List of usage examples for org.eclipse.jface.preference IPreferenceStore getInt
int getInt(String name);
From source file:com.generalrobotix.ui.util.GrxServerManager.java
License:Open Source License
private void getNameServerInfoFromPerferenceStore() { IPreferenceStore store = Activator.getDefault().getPreferenceStore(); nameServerInfo.id = PreferenceConstants.NAMESERVER; String _dir = store.getString(PreferenceConstants.PROCESS + "." + PreferenceConstants.NAMESERVER + "." + PreferenceConstants.LOGGIR); NAME_SERVER_LOG_DIR_ = GrxXmlUtil.expandEnvVal(_dir).trim(); if (!NAME_SERVER_LOG_DIR_.isEmpty()) { String localStr = NAME_SERVER_LOG_DIR_.replaceFirst("^\"", ""); File logDir = new File(localStr.replaceFirst("\"$", "")); if (!logDir.exists()) { logDir.mkdirs();// w w w .ja v a2 s. co m } } NAME_SERVER_PORT_ = store.getInt(PreferenceConstants.PROCESS + "." + PreferenceConstants.NAMESERVER + "." + PreferenceConstants.PORT); if (NAME_SERVER_PORT_ == 0) NAME_SERVER_PORT_ = store.getDefaultInt(PreferenceConstants.PROCESS + "." + PreferenceConstants.NAMESERVER + "." + PreferenceConstants.PORT); NAME_SERVER_HOST_ = store.getString(PreferenceConstants.PROCESS + "." + PreferenceConstants.NAMESERVER + "." + PreferenceConstants.HOST); if (NAME_SERVER_HOST_.equals("")) NAME_SERVER_HOST_ = store.getDefaultString(PreferenceConstants.PROCESS + "." + PreferenceConstants.NAMESERVER + "." + PreferenceConstants.HOST); nameServerInfo.args = generateNameServerArgs(); String s = store.getString( PreferenceConstants.PROCESS + "." + PreferenceConstants.NAMESERVER + "." + PreferenceConstants.COM); // SERVER_DIR?, Path???????, AbsolutePath// String ss = comToAbsolutePath(s); if (ss != null) nameServerInfo.com.add(ss); nameServerInfo.com.add(s); s = store.getString(PreferenceConstants.PROCESS + "." + PreferenceConstants.NAMESERVER + "." + PreferenceConstants.COM + 0); if (!s.equals("")) nameServerInfo.com.add(s); nameServerInfo.autoStart = true; nameServerInfo.waitCount = store.getInt(PreferenceConstants.PROCESS + "." + PreferenceConstants.NAMESERVER + "." + PreferenceConstants.WAITCOUNT); nameServerInfo.dir = store.getString( PreferenceConstants.PROCESS + "." + PreferenceConstants.NAMESERVER + "." + PreferenceConstants.DIR) .trim(); nameServerInfo.isCorbaServer = false; nameServerInfo.hasShutdown = store.getBoolean(PreferenceConstants.PROCESS + "." + PreferenceConstants.NAMESERVER + "." + PreferenceConstants.HASSHUTDOWN); nameServerInfo.doKillall = false; nameServerInfo.autoStop = true; }
From source file:com.ggasoftware.indigo.knime.plugin.IndigoPlugin.java
License:Open Source License
@Override public void start(final BundleContext context) throws Exception { super.start(context); final IPreferenceStore pStore = getDefault().getPreferenceStore(); pStore.addPropertyChangeListener(new IPropertyChangeListener() { public void propertyChange(final PropertyChangeEvent event) { if (event.getProperty().equals(PREF_BOND_LENGTH)) _bondLength = pStore.getInt(PREF_BOND_LENGTH); else if (event.getProperty().equals(PREF_SHOW_IMPLICIT_HYDROGENS)) _showImplicitHydrogens = pStore.getBoolean(PREF_SHOW_IMPLICIT_HYDROGENS); else if (event.getProperty().equals(PREF_COLORING)) _coloring = pStore.getBoolean(PREF_COLORING); else if (event.getProperty().equals(PREF_MOL_IMAGE_WIDTH)) _molImageWidth = pStore.getInt(PREF_MOL_IMAGE_WIDTH); else if (event.getProperty().equals(PREF_MOL_IMAGE_HEIGHT)) _molImageHeight = pStore.getInt(PREF_MOL_IMAGE_HEIGHT); else if (event.getProperty().equals(PREF_ENABLE_RENDERER)) _enableRendering = pStore.getBoolean(PREF_ENABLE_RENDERER); }/*from ww w . j a v a 2 s. c om*/ }); _enableRendering = pStore.getBoolean(PREF_ENABLE_RENDERER); _bondLength = pStore.getInt(PREF_BOND_LENGTH); _showImplicitHydrogens = pStore.getBoolean(PREF_SHOW_IMPLICIT_HYDROGENS); _coloring = pStore.getBoolean(PREF_COLORING); _molImageWidth = pStore.getInt(PREF_MOL_IMAGE_WIDTH); _molImageHeight = pStore.getInt(PREF_MOL_IMAGE_HEIGHT); MolValue.UTILITY.addRenderer(new IndigoDataValueRenderer(), false); SdfValue.UTILITY.addRenderer(new IndigoDataValueRenderer(), false); SmilesValue.UTILITY.addRenderer(new IndigoDataValueRenderer(), false); SmartsValue.UTILITY.addRenderer(new IndigoDataValueRenderer(), false); RxnValue.UTILITY.addRenderer(new IndigoDataValueRenderer(), false); CMLValue.UTILITY.addRenderer(new IndigoDataValueRenderer(), false); }
From source file:com.github.picologger.eclipse.syslogcat.preference.PreferenceInitializer.java
License:Apache License
/** * Initializes the preferences of ddmlib and ddmuilib with values from the eclipse store. *///from w w w. java 2s.c om public synchronized static void setupPreferences() { IPreferenceStore store = DdmsPlugin.getDefault().getPreferenceStore(); DdmPreferences.setDebugPortBase(store.getInt(ATTR_DEBUG_PORT_BASE)); DdmPreferences.setSelectedDebugPort(store.getInt(ATTR_SELECTED_DEBUG_PORT)); DdmPreferences.setLogLevel(store.getString(ATTR_LOG_LEVEL)); DdmPreferences.setInitialThreadUpdate(store.getBoolean(ATTR_DEFAULT_THREAD_UPDATE)); DdmPreferences.setInitialHeapUpdate(store.getBoolean(ATTR_DEFAULT_HEAP_UPDATE)); DdmUiPreferences.setThreadRefreshInterval(store.getInt(ATTR_THREAD_INTERVAL)); DdmPreferences.setTimeOut(store.getInt(ATTR_TIME_OUT)); }
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/*from w w w .j a v a 2 s. com*/ * @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//w w w . j a va2s . co m * @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. j a v a2s . co m * @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.ui.SearchPreferencePage.java
License:Open Source License
public static int getHistoryLimit() { IPreferenceStore store = SearchPlugin.getDefault().getPreferenceStore(); int limit = store.getInt(LIMIT_HISTORY); if (limit < 1) { limit = 1;// w ww . j ava 2 s . com } else if (limit >= 100) { limit = 99; } return limit; }
From source file:com.google.dart.tools.ui.callhierarchy.CallHierarchyUI.java
License:Open Source License
/** * Returns the maximum tree level allowed *//*from w w w . ja v a 2 s. c o m*/ public int getMaxCallDepth() { IPreferenceStore settings = DartToolsPlugin.getDefault().getPreferenceStore(); int maxCallDepth = settings.getInt(PREF_MAX_CALL_DEPTH); if (maxCallDepth < 1 || maxCallDepth > 99) { maxCallDepth = DEFAULT_MAX_CALL_DEPTH; } return maxCallDepth; }
From source file:com.google.dart.tools.ui.internal.presentation.DartEditorPresentationFactory.java
License:Open Source License
@Override public StackPresentation createViewPresentation(Composite parent, IStackPresentationSite site) { DefaultTabFolder folder = new DefaultTabFolder(parent, SWT.TOP | SWT.BORDER, site.supportsState(IStackPresentationSite.STATE_MINIMIZED), site.supportsState(IStackPresentationSite.STATE_MAXIMIZED)); final IPreferenceStore store = PlatformUI.getPreferenceStore(); final int minimumCharacters = store.getInt(IWorkbenchPreferenceConstants.VIEW_MINIMUM_CHARACTERS); if (minimumCharacters >= 0) { folder.setMinimumCharacters(minimumCharacters); }//from www.j a va2 s. c om folder.setUnselectedCloseVisible(false); folder.setUnselectedImageVisible(true); folder.setSimpleTabs(false); PresentablePartFolder partFolder = new PresentablePartFolder(folder); TabbedStackPresentation result = new TabbedStackPresentation(site, partFolder, new ViewSystemMenu(site)); DefaultThemeListener themeListener = new DefaultThemeListener(folder, result.getTheme()); result.getTheme().addListener(themeListener); return result; }
From source file:com.google.dart.tools.ui.internal.text.functions.ContentAssistPreference.java
License:Open Source License
/** * Changes the configuration of the given content assistant according to the given property change * event and the given preference store. *//*from w ww . j a v a 2 s .co m*/ public static void changeConfiguration(ContentAssistant assistant, IPreferenceStore store, PropertyChangeEvent event) { String p = event.getProperty(); if (AUTOACTIVATION.equals(p)) { boolean enabled = store.getBoolean(AUTOACTIVATION); assistant.enableAutoActivation(enabled); } else if (AUTOACTIVATION_DELAY.equals(p)) { int delay = store.getInt(AUTOACTIVATION_DELAY); assistant.setAutoActivationDelay(delay); } else if (PROPOSALS_FOREGROUND.equals(p)) { Color c = getColor(store, PROPOSALS_FOREGROUND); assistant.setProposalSelectorForeground(c); } else if (PROPOSALS_BACKGROUND.equals(p)) { Color c = getColor(store, PROPOSALS_BACKGROUND); assistant.setProposalSelectorBackground(c); } else if (PARAMETERS_FOREGROUND.equals(p)) { Color c = getColor(store, PARAMETERS_FOREGROUND); assistant.setContextInformationPopupForeground(c); assistant.setContextSelectorForeground(c); } else if (PARAMETERS_BACKGROUND.equals(p)) { Color c = getColor(store, PARAMETERS_BACKGROUND); assistant.setContextInformationPopupBackground(c); assistant.setContextSelectorBackground(c); } else if (AUTOINSERT.equals(p)) { boolean enabled = store.getBoolean(AUTOINSERT); assistant.enableAutoInsert(enabled); } else if (PREFIX_COMPLETION.equals(p)) { boolean enabled = store.getBoolean(PREFIX_COMPLETION); assistant.enablePrefixCompletion(enabled); } changeJavaProcessor(assistant, store, p); changeJavaDocProcessor(assistant, store, p); }