List of usage examples for org.eclipse.jface.preference IPreferenceStore setValue
void setValue(String name, boolean value);
From source file:com.genuitec.org.eclipse.egit.ui.internal.branch.BranchOperationUI.java
License:Open Source License
private boolean shouldCancelBecauseOfRunningLaunches() { if (mode == MODE_CHECKOUT) return false; IPreferenceStore store = Activator.getDefault().getPreferenceStore(); if (!store.getBoolean(UIPreferences.SHOW_RUNNING_LAUNCH_ON_CHECKOUT_WARNING)) return false; ILaunchConfiguration launchConfiguration = getRunningLaunchConfiguration(); if (launchConfiguration != null) { String[] buttons = new String[] { UIText.BranchOperationUI_Continue, IDialogConstants.CANCEL_LABEL }; String message = NLS.bind(UIText.BranchOperationUI_RunningLaunchMessage, launchConfiguration.getName()); MessageDialogWithToggle continueDialog = new MessageDialogWithToggle(getShell(), UIText.BranchOperationUI_RunningLaunchTitle, null, message, MessageDialog.NONE, buttons, 0, UIText.BranchOperationUI_RunningLaunchDontShowAgain, false); int result = continueDialog.open(); // cancel if (result == IDialogConstants.CANCEL_ID || result == SWT.DEFAULT) return true; boolean dontWarnAgain = continueDialog.getToggleState(); if (dontWarnAgain) store.setValue(UIPreferences.SHOW_RUNNING_LAUNCH_ON_CHECKOUT_WARNING, false); }//from w w w . j a v a2s . c o m return false; }
From source file:com.genuitec.org.eclipse.egit.ui.internal.branch.BranchProjectTracker.java
License:Open Source License
/** * Associate projects with branch. The specified memento must the one * previously returned from a call to {@link #snapshot()}. * * @see #snapshot()// w ww . j a v a2 s . c o m * @param memento * @return this tracker */ public BranchProjectTracker save(final IMemento memento) { if (!(memento instanceof XMLMemento)) throw new IllegalArgumentException("Invalid memento"); //$NON-NLS-1$ String branch = memento.getString(KEY_BRANCH); IPreferenceStore store = Activator.getDefault().getPreferenceStore(); String pref = getPreference(branch); StringWriter writer = new StringWriter(); try { ((XMLMemento) memento).save(writer); store.setValue(pref, writer.toString()); } catch (IOException e) { Activator.logError("Error writing branch-project associations", e); //$NON-NLS-1$ } return this; }
From source file:com.github.ipaas.ideploy.plugin.ui.preference.CrsPreferencePage.java
License:Apache License
/** * ?,//from w w w . jav a 2 s . co m */ public void init(IWorkbench workbench) { setPreferenceStore(Activator.getDefault().getPreferenceStore()); IPreferenceStore store = Activator.getDefault().getPreferenceStore(); String host = store.getString("host"); ConsoleHandler.info(host); if (host == null || host.trim().equals("")) { store.setValue("host", "ideploy.ipaas.com"); } // ? List<String> defaultPatterns = new ArrayList<String>(); defaultPatterns.add(JsonUtil.toJson(new FilterPattern("resinTmp", "WEB-INF/tmp", true))); defaultPatterns.add(JsonUtil.toJson(new FilterPattern("resinWork", "WEB-INF/work", true))); defaultPatterns.add(JsonUtil.toJson(new FilterPattern("resinConf", "WEB-INF/classes/config", false))); defaultPatterns.add(JsonUtil.toJson(new FilterPattern("iceConf", "resources/config", false))); defaultPatterns.add(JsonUtil.toJson(new FilterPattern("iceStart", "bin/ice.sh", false))); defaultPatterns.add(JsonUtil.toJson(new FilterPattern("iceStart", "bin/ice.sh", false))); String patternsJson = store.getString("patternsJson"); if (patternsJson == null || patternsJson.trim().equals("")) { store.setValue("patternsJson", JsonUtil.toJson(defaultPatterns)); } }
From source file:com.github.ipaas.ideploy.plugin.ui.preference.CrsPreferencePage.java
License:Apache License
@Override public boolean performOk() { String hostStr = host.getStringValue(); String userName = account.getStringValue(); String pwd = password.getStringValue(); if (hostStr == null || hostStr.trim().equals("")) { ConsoleHandler.error("Ideploy web ??"); return false; }//from w ww.j a va 2s . c om if (userName == null || userName.trim().equals("") || pwd == null || pwd.trim().equals("")) { ConsoleHandler.error("????"); return false; } IPreferenceStore store = Activator.getDefault().getPreferenceStore(); store.setValue("email", userName); store.setValue("host", hostStr); try { DESPlus plus = new DESPlus(userName);// ??? String pwdValue = plus.encrypt(pwd);// ? store.setValue("password", pwdValue); } catch (Exception e) { ConsoleHandler.error("?:" + e.getMessage()); } List<String> partternJson = new ArrayList<String>(); for (TableItem item : table.getItems()) { partternJson .add(JsonUtil.toJson(new FilterPattern(item.getText(1), item.getText(2), item.getChecked()))); } store.setValue("patternsJson", JsonUtil.toJson(partternJson)); return true; }
From source file:com.github.picologger.eclipse.syslogcat.views.TableHelper.java
License:Apache License
/** * Create a TableColumn with the specified parameters. If a * <code>PreferenceStore</code> object and a preference entry name String * object are provided then the column will listen to change in its width * and update the preference store accordingly. * * @param parent The Table parent object * @param header The header string/* w w w . ja v a2 s. c om*/ * @param style The column style * @param sample_text A sample text to figure out column width if preference * value is missing * @param pref_name The preference entry name for column width * @param prefs The preference store * @return The TableColumn object that was created */ public static TableColumn createTableColumn(Table parent, String header, int style, String sample_text, final String pref_name, final IPreferenceStore prefs) { // create the column TableColumn col = new TableColumn(parent, style); // if there is no pref store or the entry is missing, we use the sample // text and pack the column. // Otherwise we just read the width from the prefs and apply it. if (prefs == null || prefs.contains(pref_name) == false) { col.setText(sample_text); col.pack(); // init the prefs store with the current value if (prefs != null) { prefs.setValue(pref_name, col.getWidth()); } } else { col.setWidth(prefs.getInt(pref_name)); } // set the header col.setText(header); // if there is a pref store and a pref entry name, then we setup a // listener to catch column resize to put store the new width value. if (prefs != null && pref_name != null) { col.addControlListener(new ControlListener() { public void controlMoved(ControlEvent e) { } public void controlResized(ControlEvent e) { // get the new width int w = ((TableColumn) e.widget).getWidth(); // store in pref store prefs.setValue(pref_name, w); } }); } return col; }
From source file:com.github.picologger.eclipse.syslogcat.views.TableHelper.java
License:Apache License
/** * Create a TreeColumn with the specified parameters. If a * <code>PreferenceStore</code> object and a preference entry name String * object are provided then the column will listen to change in its width * and update the preference store accordingly. * * @param parent The Table parent object * @param header The header string/* ww w . j a v a 2s. c om*/ * @param style The column style * @param sample_text A sample text to figure out column width if preference * value is missing * @param pref_name The preference entry name for column width * @param prefs The preference store */ public static void createTreeColumn(Tree parent, String header, int style, String sample_text, final String pref_name, final IPreferenceStore prefs) { // create the column TreeColumn col = new TreeColumn(parent, style); // if there is no pref store or the entry is missing, we use the sample // text and pack the column. // Otherwise we just read the width from the prefs and apply it. if (prefs == null || prefs.contains(pref_name) == false) { col.setText(sample_text); col.pack(); // init the prefs store with the current value if (prefs != null) { prefs.setValue(pref_name, col.getWidth()); } } else { col.setWidth(prefs.getInt(pref_name)); } // set the header col.setText(header); // if there is a pref store and a pref entry name, then we setup a // listener to catch column resize to put store the new width value. if (prefs != null && pref_name != null) { col.addControlListener(new ControlListener() { public void controlMoved(ControlEvent e) { } public void controlResized(ControlEvent e) { // get the new width int w = ((TreeColumn) e.widget).getWidth(); // store in pref store prefs.setValue(pref_name, w); } }); } }
From source file:com.github.picologger.eclipse.syslogcat.views.TableHelper.java
License:Apache License
/** * Create a TreeColumn with the specified parameters. If a * <code>PreferenceStore</code> object and a preference entry name String * object are provided then the column will listen to change in its width * and update the preference store accordingly. * * @param parent The Table parent object * @param header The header string/*from w w w . jav a 2s.c om*/ * @param style The column style * @param width the width of the column if the preference value is missing * @param pref_name The preference entry name for column width * @param prefs The preference store */ public static void createTreeColumn(Tree parent, String header, int style, int width, final String pref_name, final IPreferenceStore prefs) { // create the column TreeColumn col = new TreeColumn(parent, style); // if there is no pref store or the entry is missing, we use the sample // text and pack the column. // Otherwise we just read the width from the prefs and apply it. if (prefs == null || prefs.contains(pref_name) == false) { col.setWidth(width); // init the prefs store with the current value if (prefs != null) { prefs.setValue(pref_name, width); } } else { col.setWidth(prefs.getInt(pref_name)); } // set the header col.setText(header); // if there is a pref store and a pref entry name, then we setup a // listener to catch column resize to put store the new width value. if (prefs != null && pref_name != null) { col.addControlListener(new ControlListener() { public void controlMoved(ControlEvent e) { } public void controlResized(ControlEvent e) { // get the new width int w = ((TreeColumn) e.widget).getWidth(); // store in pref store prefs.setValue(pref_name, w); } }); } }
From source file:com.google.dart.tools.search.internal.core.text.TextSearchEngineRegistry.java
License:Open Source License
private void setPreferredEngineID(String id) { IPreferenceStore prefs = SearchPlugin.getDefault().getPreferenceStore(); prefs.setValue(SearchPreferencePage.TEXT_SEARCH_ENGINE, id); }
From source file:com.google.dart.tools.tests.swtbot.model.FindTextBotView.java
License:Open Source License
/** * Set the preference that determines if searching is case-sensitive or not to the given * <code>value</code>. This causes re-indexing, which will update the search status. * /*from w w w . j a v a 2s . com*/ * @param value <code>true</code> if searching should be case sensitive. */ public void setCaseSensitiveSearch(final boolean value) { UIThreadRunnable.syncExec(new VoidResult() { @Override public void run() { IPreferenceStore preferences = GlancePlugin.getDefault().getPreferenceStore(); preferences.setValue(IPreferenceConstants.SEARCH_CASE_SENSITIVE, value); } }); waitMillis(WAIT_TIME); waitForAsyncDrain(); }
From source file:com.google.dart.tools.tests.swtbot.model.FindTextBotView.java
License:Open Source License
/** * Set the preference that determines if the search string should be interpreted as a regular * expression or not to the given <code>value</code>. This causes re-indexing, which will update * the search status.// w ww . j a v a2 s .c om * * @param value <code>true</code> if searching should use regular expression rules. */ public void setRegexpSearch(final boolean value) { UIThreadRunnable.syncExec(new VoidResult() { @Override public void run() { IPreferenceStore preferences = GlancePlugin.getDefault().getPreferenceStore(); preferences.setValue(IPreferenceConstants.SEARCH_REGEXP, value); } }); waitMillis(WAIT_TIME); waitForAsyncDrain(); }