标签:
ResourcesPlugin.getPlugin().getPluginPreferences().setValue("encoding", "UTF-8");
二、默认显示行号
EditorsPlugin.getDefault().getPreferenceStore().setValue("lineNumberRuler", "true");
Combo combo = (Combo)control; combo.removeAll(); for (int i = 0; i < list.size(); i++) { DeviceInfo obj=list.get(i); combo.add(obj.getName()); //label combo.setData(i +"", obj.getSerialNumber()); //value }
String key = "" + comboDevice.getSelectionIndex();
String value= String.valueOf(comboDevice.getData(key));
PrintWriter pw = new PrintWriter(new FileWriter(filePath)); pw.print(content); pw.close();
OutputStreamWriter outputStream = new OutputStreamWriter(new FileOutputStream(filePath), "UTF-8"); outputStream.write(content); outputStream.close();
import java.io.PrintStream; import org.eclipse.ui.console.ConsolePlugin; import org.eclipse.ui.console.IConsole; import org.eclipse.ui.console.IConsoleFactory; import org.eclipse.ui.console.IConsoleManager; import org.eclipse.ui.console.MessageConsole; import org.eclipse.ui.console.MessageConsoleStream; public class ConsoleFactory implements IConsoleFactory { static MessageConsole console = new MessageConsole("console log",null); public void openConsole() { showConsole(); } public static void showConsole() { if (console != null) { IConsoleManager manager = ConsolePlugin.getDefault().getConsoleManager(); IConsole[] existing = manager.getConsoles(); boolean exists = false; for (int i = 0; i < existing.length; i++) { if (console == existing[i]) exists = true; } if (!exists) { manager.addConsoles(new IConsole[] { console }); } manager.showConsoleView(console); MessageConsoleStream stream = console.newMessageStream(); System.setOut(new PrintStream(stream)); } } public static void closeConsole() { IConsoleManager manager = ConsolePlugin.getDefault().getConsoleManager(); if (console != null) { manager.removeConsoles(new IConsole[] { console }); } } public static MessageConsole getConsole() { return console; } }
UIJob jobH = new UIJob("hide quick access") { @Override public IStatus runInUIThread(IProgressMonitor monitor) { IWorkbenchWindow window = PlatformUI.getWorkbench() .getActiveWorkbenchWindow(); if (window == null) return Status.CANCEL_STATUS; if (window instanceof WorkbenchWindow) { MTrimBar topTrim = ((WorkbenchWindow) window).getTopTrim(); for (MTrimElement element : topTrim.getChildren()) { if ("SearchField".equals(element.getElementId())) { Control contorl = (Control) element.getWidget(); contorl.setVisible(false); break; } } } return Status.OK_STATUS; } }; jobH.schedule(0L);
标签:
原文地址:http://www.cnblogs.com/lovesong/p/4694522.html