List of usage examples for org.eclipse.jface.preference IPreferenceStore contains
boolean contains(String name);
From source file:org.knime.ext.textprocessing.preferences.TextprocessingPreferenceInitializer.java
License:Open Source License
/** * Returns true if dml deserialization has to be applied. * * @return the dml deserialization setting *//* w w w.j av a 2 s. c om*/ public static boolean useDmlDeserialization() { final IPreferenceStore pStore = TextprocessingCorePlugin.getDefault().getPreferenceStore(); if (!pStore.contains(PREF_DML_DESERIALIZATION)) { return DEFAULT_DML_DESERIALIZATION; } return pStore.getBoolean(PREF_DML_DESERIALIZATION); }
From source file:org.knime.ext.textprocessing.preferences.TextprocessingPreferenceInitializer.java
License:Open Source License
/** * Returns true if row preprocessing has to be applied. * * @return the preprocessing policy/*w w w .j ava2 s .c o m*/ * @deprecated setting is not used anymore. */ @Deprecated public static boolean useRowPreprocessing() { final IPreferenceStore pStore = TextprocessingCorePlugin.getDefault().getPreferenceStore(); if (!pStore.contains(PREF_ROW_PREPROCESSING)) { return DEFAULT_ROW_PREPROCESSING; } return pStore.getBoolean(PREF_ROW_PREPROCESSING); }
From source file:org.knime.ext.textprocessing.preferences.TextprocessingPreferenceInitializer.java
License:Open Source License
/** * Returns the size of the tokenizer pool. * * @return the size of the tokenizer pool. *///from ww w . j a v a 2s . c o m public static int tokenizerPoolSize() { final IPreferenceStore pStore = TextprocessingCorePlugin.getDefault().getPreferenceStore(); if (!pStore.contains(PREF_TOKENIZER_POOLSIZE)) { return DEFAULT_TOKENIZER_POOLSIZE; } return pStore.getInt(PREF_TOKENIZER_POOLSIZE); }
From source file:org.knime.ext.textprocessing.preferences.TextprocessingPreferenceInitializer.java
License:Open Source License
/** * Returns the select tokenizer name. If not tokenizer is selected, the default tokenizer will be returned. * * @return a tokenizer name// w ww.j av a 2 s . c o m */ public static String tokenizerName() { final IPreferenceStore pStore = TextprocessingCorePlugin.getDefault().getPreferenceStore(); if (!pStore.contains(PREF_TOKENIZER)) { return DEFAULT_TOKENIZER; } return pStore.getString(PREF_TOKENIZER); }
From source file:org.lh.dmlj.schema.editor.dictionary.tools.Plugin.java
License:Open Source License
private void prepareEncryptionData() { try {/*ww w. j a va 2s. c o m*/ IPreferenceStore preferenceStore = getPreferenceStore(); if (!preferenceStore.contains(PreferenceConstants.PERSONAL_ENCRYPTION_KEY) || !preferenceStore.contains(PreferenceConstants.PERSONAL_INITIALIZATION_VECTOR)) { // bundle started for the very first time: compute the personal encryption key, // encode and encrypt it and store it in the preference store as a hexadecimal // string String computerName = InetAddress.getLocalHost().getHostName(); personalEncryptionKey = generateString(computerName, 16); byte[] encodedAndEncryptedPersonalEncryptionKey = EncDec.encodeAndEncrypt(personalEncryptionKey, bootEncryptionKey, bootInitializationVector); String encodedAndEncryptedPersonalEncryptionKeyAsHex = DatatypeConverter .printHexBinary(encodedAndEncryptedPersonalEncryptionKey); preferenceStore.setValue(PreferenceConstants.PERSONAL_ENCRYPTION_KEY, encodedAndEncryptedPersonalEncryptionKeyAsHex); // next, compute the personal initialization vector, encode and encrypt it and store // it in the preference store as a hexadecimal string String ipAddress = InetAddress.getLocalHost().getHostAddress(); personalInitializationVector = generateString(ipAddress, 16); byte[] encodedAndEncryptedPersonalInitializationVector = EncDec.encodeAndEncrypt( personalInitializationVector, bootEncryptionKey, bootInitializationVector); String encodedAndEncryptedPersonalInitializationVectorAsHex = DatatypeConverter .printHexBinary(encodedAndEncryptedPersonalInitializationVector); preferenceStore.setValue(PreferenceConstants.PERSONAL_INITIALIZATION_VECTOR, encodedAndEncryptedPersonalInitializationVectorAsHex); } else { // the bundle has already been started in the past: get the personal encryption key // from the preference store String encodedAndEncryptedPersonalEncryptionKeyAsHex = preferenceStore .getString(PreferenceConstants.PERSONAL_ENCRYPTION_KEY); byte[] encodedAndEncryptedPersonalEncryptionKey = DatatypeConverter .parseHexBinary(encodedAndEncryptedPersonalEncryptionKeyAsHex); personalEncryptionKey = EncDec.decryptAndDecode(encodedAndEncryptedPersonalEncryptionKey, bootEncryptionKey, bootInitializationVector); // next, get the personal init. vector from the preference store String encodedAndEncryptedPersonalInitializationVectorAsHex = preferenceStore .getString(PreferenceConstants.PERSONAL_INITIALIZATION_VECTOR); byte[] encodedAndEncryptedPersonalInitializationVector = DatatypeConverter .parseHexBinary(encodedAndEncryptedPersonalInitializationVectorAsHex); personalInitializationVector = EncDec.decryptAndDecode( encodedAndEncryptedPersonalInitializationVector, bootEncryptionKey, bootInitializationVector); } } catch (Throwable t) { throw new RuntimeException(t); } }
From source file:org.opentravel.schemas.preferences.CompilerPreferences.java
License:Apache License
/** * Loads the compiler preferences from the workbench configuration file (or returns default * values if the workbench file is not available). * /*from w w w . ja v a 2 s . c om*/ * @return PreferenceStore */ public static IPreferenceStore loadPreferenceStore() { // this line cousing problem during loading. // if (!OtmRegistry.getMainWindow().hasDisplay()) // return null; // headless operation final IPreferenceStore preferenceStore = Activator.getDefault().getPreferenceStore(); if (!preferenceStore.contains(PREF_COMPILER_EXTENSION_ID)) { new CompilerPreferences().saveTaskOptions(preferenceStore); } return preferenceStore; }
From source file:org.rubypeople.rdt.ui.actions.CustomFiltersActionGroup.java
License:Open Source License
private void initializeWithViewDefaults() { // get default values for view IPreferenceStore store = RubyPlugin.getDefault().getPreferenceStore(); // see bug https://bugs.eclipse.org/bugs/show_bug.cgi?id=22533 if (!store.contains(getPreferenceKey("TAG_DUMMY_TO_TEST_EXISTENCE")))//$NON-NLS-1$ return;/*from w ww . j a va 2 s.c om*/ fUserDefinedPatternsEnabled = store.getBoolean(getPreferenceKey(TAG_USER_DEFINED_PATTERNS_ENABLED)); setUserDefinedPatterns(CustomFiltersDialog .convertFromString(store.getString(getPreferenceKey(TAG_USER_DEFINED_PATTERNS)), SEPARATOR)); Iterator iter = fEnabledFilterIds.keySet().iterator(); while (iter.hasNext()) { String id = (String) iter.next(); Boolean isEnabled = new Boolean(store.getBoolean(id)); fEnabledFilterIds.put(id, isEnabled); } fLRUFilterIdsStack.clear(); String lruFilterIds = store.getString(TAG_LRU_FILTERS); StringTokenizer tokenizer = new StringTokenizer(lruFilterIds, SEPARATOR); while (tokenizer.hasMoreTokens()) { String id = tokenizer.nextToken(); if (fFilterDescriptorMap.containsKey(id) && !fLRUFilterIdsStack.contains(id)) fLRUFilterIdsStack.push(id); } }
From source file:org.springframework.ide.eclipse.boot.dash.metadata.PropertyStoreFactory.java
License:Open Source License
public static IPropertyStore backedBy(final IPreferenceStore preferenceStore) { return new IPropertyStore() { @Override/*w w w . ja v a 2 s .com*/ public void put(String key, String value) throws Exception { if (value == null) { preferenceStore.setToDefault(key); } else { preferenceStore.setValue(key, value); } } @Override public String get(String key) { if (preferenceStore.contains(key)) { return preferenceStore.getString(key); } return null; } }; }
From source file:org.springsource.ide.eclipse.gradle.ui.cli.editor.TasksViewer.java
License:Open Source License
@SuppressWarnings("unchecked") public TasksViewer(Composite parent, GradleProjectIndex tasksIndex, boolean consoleMode) { super();//from w ww .j av a 2 s .c om this.tasksIndex = tasksIndex; DefaultMarkerAnnotationAccess markerAccess = new DefaultMarkerAnnotationAccess(); OverviewRuler overviewRuler = consoleMode ? null : new OverviewRuler(markerAccess, 12, colorsCache); int style = SWT.NONE; if (!consoleMode) { style = SWT.V_SCROLL | SWT.H_SCROLL | SWT.MULTI | SWT.BORDER | SWT.FULL_SELECTION; } viewer = new SourceViewer(parent, null, overviewRuler, true, style); IPreferenceStore preferences = EditorsUI.getPreferenceStore(); viewer.configure(new TasksViewerConfiguration(tasksIndex, preferences)); decorationSupport = new SourceViewerDecorationSupport(viewer, overviewRuler, markerAccess, colorsCache); for (AnnotationPreference preference : (List<AnnotationPreference>) new MarkerAnnotationPreferences() .getAnnotationPreferences()) { decorationSupport.setAnnotationPreference(preference); } decorationSupport.install(preferences); Font font = null; if (preferences != null) { // Backward compatibility if (preferences.contains(JFaceResources.TEXT_FONT) && !preferences.isDefault(JFaceResources.TEXT_FONT)) { FontData data = PreferenceConverter.getFontData(preferences, JFaceResources.TEXT_FONT); if (data != null) { font = new Font(viewer.getTextWidget().getDisplay(), data); } } } if (font == null) font = JFaceResources.getTextFont(); if (!font.equals(viewer.getTextWidget().getFont())) { viewer.getTextWidget().setFont(font); } activateHandler(); }
From source file:org.summer.sdt.internal.ui.JavaPlugin.java
License:Open Source License
/** * Installs backwards compatibility for the preference store. *//*from w ww . ja va 2 s. c o m*/ private void ensurePreferenceStoreBackwardsCompatibility() { IPreferenceStore store = getPreferenceStore(); // must add here to guarantee that it is the first in the listener list fMembersOrderPreferenceCache = new MembersOrderPreferenceCache(); fMembersOrderPreferenceCache.install(store); /* * Installs backwards compatibility: propagate the Java editor font from a * pre-2.1 plug-in to the Platform UI's preference store to preserve * the Java editor font from a pre-2.1 workspace. This is done only * once. */ String fontPropagatedKey = "fontPropagated"; //$NON-NLS-1$ if (store.contains(JFaceResources.TEXT_FONT) && !store.isDefault(JFaceResources.TEXT_FONT)) { if (!store.getBoolean(fontPropagatedKey)) PreferenceConverter.setValue(getDeprecatedWorkbenchPreferenceStore(), PreferenceConstants.EDITOR_TEXT_FONT, PreferenceConverter.getFontDataArray(store, JFaceResources.TEXT_FONT)); } store.setValue(fontPropagatedKey, true); /* * Backwards compatibility: set the Java editor font in this plug-in's * preference store to let older versions access it. Since 2.1 the * Java editor font is managed by the workbench font preference page. */ PreferenceConverter.putValue(store, JFaceResources.TEXT_FONT, JFaceResources.getFontRegistry().getFontData(PreferenceConstants.EDITOR_TEXT_FONT)); fFontPropertyChangeListener = new IPropertyChangeListener() { public void propertyChange(PropertyChangeEvent event) { if (PreferenceConstants.EDITOR_TEXT_FONT.equals(event.getProperty())) PreferenceConverter.putValue(getPreferenceStore(), JFaceResources.TEXT_FONT, JFaceResources.getFontRegistry().getFontData(PreferenceConstants.EDITOR_TEXT_FONT)); } }; JFaceResources.getFontRegistry().addListener(fFontPropertyChangeListener); /* * Backwards compatibility: propagate the Java editor tab width from a * pre-3.0 plug-in to the new preference key. This is done only once. */ final String oldTabWidthKey = DEPRECATED_EDITOR_TAB_WIDTH; final String newTabWidthKey = AbstractDecoratedTextEditorPreferenceConstants.EDITOR_TAB_WIDTH; String tabWidthPropagatedKey = "tabWidthPropagated"; //$NON-NLS-1$ if (store.contains(oldTabWidthKey) && !store.isDefault(oldTabWidthKey)) { if (!store.getBoolean(tabWidthPropagatedKey)) store.setValue(newTabWidthKey, store.getInt(oldTabWidthKey)); } store.setValue(tabWidthPropagatedKey, true); /* * Backwards compatibility: set the Java editor tab width in this plug-in's * preference store with the old key to let older versions access it. * Since 3.0 the tab width is managed by the extended text editor and * uses a new key. */ store.putValue(oldTabWidthKey, store.getString(newTabWidthKey)); fPropertyChangeListener = new IPropertyChangeListener() { public void propertyChange(PropertyChangeEvent event) { if (newTabWidthKey.equals(event.getProperty())) { IPreferenceStore prefStore = getPreferenceStore(); prefStore.putValue(oldTabWidthKey, prefStore.getString(newTabWidthKey)); } } }; store.addPropertyChangeListener(fPropertyChangeListener); /* * Backward compatibility for the refactoring preference key. */ // store.setValue( // PreferenceConstants.REFACTOR_ERROR_PAGE_SEVERITY_THRESHOLD, // RefactoringCore.getConditionCheckingFailedSeverity()); // The commented call above triggers the eager loading of the LTK core plug-in // Since the condition checking failed severity is guaranteed to be of RefactoringStatus.SEVERITY_WARNING, // we directly insert the inlined value of this constant store.setToDefault(DEPRECATED_REFACTOR_ERROR_PAGE_SEVERITY_THRESHOLD); if (!store.getBoolean(JavaDocLocations.PREF_JAVADOCLOCATIONS_MIGRATED)) { JavaDocLocations.migrateToClasspathAttributes(); } FormatterProfileStore.checkCurrentOptionsVersion(); /* * Backward compatibility: migrate "alphabetic ordering" preference to point the sorter * preference to the alphabetic sorter. */ String proposalOrderMigrated = "proposalOrderMigrated"; //$NON-NLS-1$ if (store.contains(DEPRECATED_CODEASSIST_ORDER_PROPOSALS)) { if (!store.getBoolean(proposalOrderMigrated)) { boolean alphabetic = store.getBoolean(DEPRECATED_CODEASSIST_ORDER_PROPOSALS); if (alphabetic) store.setValue(PreferenceConstants.CODEASSIST_SORTER, "org.summer.sdt.ui.AlphabeticSorter"); //$NON-NLS-1$ } } store.setValue(proposalOrderMigrated, true); }