Java Code Examples for java.util.prefs.PreferenceChangeEvent#getKey()
The following examples show how to use
java.util.prefs.PreferenceChangeEvent#getKey() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: Utilities.java From netbeans with Apache License 2.0 | 6 votes |
@Override public void preferenceChange(PreferenceChangeEvent evt) { String settingName = evt == null ? null : evt.getKey(); if (settingName == null || COMPLETION_CASE_SENSITIVE.equals(settingName)) { caseSensitive = preferences.getBoolean(COMPLETION_CASE_SENSITIVE, COMPLETION_CASE_SENSITIVE_DEFAULT); } if (settingName == null || SHOW_DEPRECATED_MEMBERS.equals(settingName)) { showDeprecatedMembers = preferences.getBoolean(SHOW_DEPRECATED_MEMBERS, SHOW_DEPRECATED_MEMBERS_DEFAULT); } if (settingName == null || JAVA_COMPLETION_BLACKLIST.equals(settingName)) { String blacklist = preferences.get(JAVA_COMPLETION_BLACKLIST, EMPTY); updateExcluder(excludeRef, blacklist); } if (settingName == null || JAVA_COMPLETION_WHITELIST.equals(settingName)) { String whitelist = preferences.get(JAVA_COMPLETION_WHITELIST, EMPTY); updateExcluder(includeRef, whitelist); } if (settingName == null || JAVA_COMPLETION_EXCLUDER_METHODS.equals(settingName)) { javaCompletionExcluderMethods = preferences.getBoolean(JAVA_COMPLETION_EXCLUDER_METHODS, JAVA_COMPLETION_EXCLUDER_METHODS_DEFAULT); } if (settingName == null || JAVA_COMPLETION_SUBWORDS.equals(settingName)) { javaCompletionSubwords = preferences.getBoolean(JAVA_COMPLETION_SUBWORDS, JAVA_COMPLETION_SUBWORDS_DEFAULT); } }
Example 2
Source File: DefaultFoldingOptions.java From netbeans with Apache License 2.0 | 6 votes |
private String updateCheckers(PreferenceChangeEvent evt) { String pk = evt.getKey(); if (pk != null) { if (pk.equals(SimpleValueNames.CODE_FOLDING_ENABLE)) { updateEnabledState(); return pk; } if (pk.equals(PREF_OVERRIDE_DEFAULTS)) { updateOverrideChanged(); } else if (!pk.startsWith(COLLAPSE_PREFIX)) { return pk; } } else { updateEnabledState(); } String c = pk == null ? null : pk.substring(COLLAPSE_PREFIX.length()); for (JCheckBox cb : controls) { FoldType ft = (FoldType)cb.getClientProperty("type"); // NOI18N FoldType ftp = ft.parent(); if (c == null || ft.code().equals(c) || (ftp != null && ftp.code().equals(c))) { updateChecker(pk, cb, ft); return pk; } } return pk; }
Example 3
Source File: RecentProjects.java From Logisim with GNU General Public License v3.0 | 6 votes |
@Override public void preferenceChange(PreferenceChangeEvent event) { Preferences prefs = event.getNode(); String prop = event.getKey(); if (prop.startsWith(BASE_PROPERTY)) { String rest = prop.substring(BASE_PROPERTY.length()); int index = -1; try { index = Integer.parseInt(rest); if (index < 0 || index >= NUM_RECENT) index = -1; } catch (NumberFormatException e) { } if (index >= 0) { File oldValue = recentFiles[index]; long oldTime = recentTimes[index]; getAndDecode(prefs, index); File newValue = recentFiles[index]; long newTime = recentTimes[index]; if (!isSame(oldValue, newValue) || oldTime != newTime) { AppPreferences.firePropertyChange(AppPreferences.RECENT_PROJECTS, new FileTime(oldValue, oldTime), new FileTime(newValue, newTime)); } } } }
Example 4
Source File: PrefMonitorStringOpts.java From Logisim with GNU General Public License v3.0 | 6 votes |
@Override public void preferenceChange(PreferenceChangeEvent event) { Preferences prefs = event.getNode(); String prop = event.getKey(); String name = getIdentifier(); if (prop.equals(name)) { String oldValue = value; String newValue = prefs.get(name, dflt); if (!isSame(oldValue, newValue)) { String[] o = opts; String chosen = null; for (int i = 0; i < o.length; i++) { if (isSame(o[i], newValue)) { chosen = o[i]; break; } } if (chosen == null) chosen = dflt; value = chosen; AppPreferences.firePropertyChange(name, oldValue, chosen); } } }
Example 5
Source File: PrefMonitorDouble.java From Logisim with GNU General Public License v3.0 | 5 votes |
@Override public void preferenceChange(PreferenceChangeEvent event) { Preferences prefs = event.getNode(); String prop = event.getKey(); String name = getIdentifier(); if (prop.equals(name)) { double oldValue = value; double newValue = prefs.getDouble(name, dflt); if (newValue != oldValue) { value = newValue; AppPreferences.firePropertyChange(name, Double.valueOf(oldValue), Double.valueOf(newValue)); } } }
Example 6
Source File: ExtFormatter.java From netbeans with Apache License 2.0 | 5 votes |
public void preferenceChange(PreferenceChangeEvent evt) { String key = evt == null ? null : evt.getKey(); if (key == null || EditorPreferencesKeys.INDENT_HOT_CHARS_ACCEPTOR.equals(key)) { indentHotCharsAcceptor = (Acceptor) SettingsConversions.callFactory( prefs, MimePath.parse(mimeType), EditorPreferencesKeys.INDENT_HOT_CHARS_ACCEPTOR, AcceptorFactory.FALSE); } if (key == null || EditorPreferencesKeys.REINDENT_WITH_TEXT_BEFORE.equals(key)) { reindentWithTextBefore = prefs.getBoolean(EditorPreferencesKeys.REINDENT_WITH_TEXT_BEFORE, false); } }
Example 7
Source File: CodeFoldingSideBar.java From netbeans with Apache License 2.0 | 5 votes |
public void preferenceChange(PreferenceChangeEvent evt) { String key = evt == null ? null : evt.getKey(); if (key == null || SimpleValueNames.CODE_FOLDING_ENABLE.equals(key)) { updateColors(); boolean newEnabled = prefs.getBoolean(SimpleValueNames.CODE_FOLDING_ENABLE, EditorPreferencesDefaults.defaultCodeFoldingEnable); if (enabled != newEnabled) { enabled = newEnabled; updatePreferredSize(); } } SettingsConversions.callSettingsChange(CodeFoldingSideBar.this); }
Example 8
Source File: InheritedPreferences.java From netbeans with Apache License 2.0 | 5 votes |
@Override public void preferenceChange(PreferenceChangeEvent evt) { if (evt.getKey() != null && !isOverriden(evt.getKey())) { // jusr refires an event ignorePut.set(true); try { put(evt.getKey(), evt.getNewValue()); } finally { ignorePut.set(false); } } }
Example 9
Source File: PrefMonitorBoolean.java From Logisim with GNU General Public License v3.0 | 5 votes |
@Override public void preferenceChange(PreferenceChangeEvent event) { Preferences prefs = event.getNode(); String prop = event.getKey(); String name = getIdentifier(); if (prop.equals(name)) { boolean oldValue = value; boolean newValue = prefs.getBoolean(name, dflt); if (newValue != oldValue) { value = newValue; AppPreferences.firePropertyChange(name, oldValue, newValue); } } }
Example 10
Source File: Formatter.java From netbeans with Apache License 2.0 | 5 votes |
public void preferenceChange(PreferenceChangeEvent evt) { String key = evt == null ? null : evt.getKey(); if (!inited || key == null || SimpleValueNames.TAB_SIZE.equals(key)) { if (!customTabSize) { tabSize = prefs.getInt(SimpleValueNames.TAB_SIZE, EditorPreferencesDefaults.defaultTabSize); } } // Shift-width often depends on the rest of parameters if (!customShiftWidth) { int shw = prefs.getInt(SimpleValueNames.INDENT_SHIFT_WIDTH, -1); if (shw >= 0) { shiftWidth = shw; } } if (!inited || key == null || SimpleValueNames.EXPAND_TABS.equals(key)) { if (!customExpandTabs) { expandTabs = prefs.getBoolean(SimpleValueNames.EXPAND_TABS, EditorPreferencesDefaults.defaultExpandTabs); } } if (!inited || key == null || SimpleValueNames.SPACES_PER_TAB.equals(key)) { if (!customSpacesPerTab) { spacesPerTab = prefs.getInt(SimpleValueNames.SPACES_PER_TAB, EditorPreferencesDefaults.defaultSpacesPerTab); } } inited = true; SettingsConversions.callSettingsChange(Formatter.this); }
Example 11
Source File: PrefMonitorString.java From Logisim with GNU General Public License v3.0 | 5 votes |
@Override public void preferenceChange(PreferenceChangeEvent event) { Preferences prefs = event.getNode(); String prop = event.getKey(); String name = getIdentifier(); if (prop.equals(name)) { String oldValue = value; String newValue = prefs.get(name, dflt); if (!isSame(oldValue, newValue)) { value = newValue; AppPreferences.firePropertyChange(name, oldValue, newValue); } } }
Example 12
Source File: HtmlPreferences.java From netbeans with Apache License 2.0 | 5 votes |
@Override public void preferenceChange(PreferenceChangeEvent evt) { String settingName = evt == null ? null : evt.getKey(); if (settingName == null || HtmlCompletionOptionsPanel.HTML_AUTOCOMPLETE_QUOTES_AFTER_EQS.equals(settingName)) { autocompleQuotesAfterEQS = preferences.getBoolean(HtmlCompletionOptionsPanel.HTML_AUTOCOMPLETE_QUOTES_AFTER_EQS, HtmlCompletionOptionsPanel.HTML_AUTOCOMPLETE_QUOTES_AFTER_EQS_DEFAULT); } if (settingName == null || HtmlCompletionOptionsPanel.HTML_AUTOCOMPLETE_QUOTES.equals(settingName)) { autocompleQuotes = preferences.getBoolean(HtmlCompletionOptionsPanel.HTML_AUTOCOMPLETE_QUOTES, HtmlCompletionOptionsPanel.HTML_AUTOCOMPLETE_QUOTES_DEFAULT); } if (settingName == null || HtmlCompletionOptionsPanel.HTML_COMPLETION_END_TAG_ADTER_LT.equals(settingName)) { completionOffersEndTagAfterLt = preferences.getBoolean(HtmlCompletionOptionsPanel.HTML_COMPLETION_END_TAG_ADTER_LT, HtmlCompletionOptionsPanel.HTML_COMPLETION_END_TAG_ADTER_LT_DEFAULT); } if (settingName == null || HtmlCompletionOptionsPanel.HTML_COMPLETION_AUTOPOPUP_WINDOW.equals(settingName)) { autoPopupCompletionWindow = preferences.getBoolean(HtmlCompletionOptionsPanel.HTML_COMPLETION_AUTOPOPUP_WINDOW, HtmlCompletionOptionsPanel.HTML_COMPLETION_AUTOPOPUP_WINDOW_DEFAULT); } if (settingName == null || HtmlCompletionOptionsPanel.HTML_END_TAG_AUTOCOMPLETION_AUTOPOPUP.equals(settingName)) { autoPopupEndTagAutoCompletion = preferences.getBoolean(HtmlCompletionOptionsPanel.HTML_END_TAG_AUTOCOMPLETION_AUTOPOPUP, HtmlCompletionOptionsPanel.HTML_END_TAG_AUTOCOMPLETION_AUTOPOPUP_DEFAULT); } if (settingName == null || SELECTOR_TYPE_PROPERTY_NAME.equals(settingName)) { selectorType = SelectorType.valueOf(preferences.get(SELECTOR_TYPE_PROPERTY_NAME, SELECTOR_TYPE_DEFAULT.name())); } if (settingName == null || SECTION_MODE_PROPERTY_NAME.equals(settingName)) { sectionMode = Mode.valueOf(preferences.get(SECTION_MODE_PROPERTY_NAME, SECTION_MODE_DEFAULT.name())); } if (settingName == null || mimetypesWithEnabledHtmlErrorChecking_key.equals(settingName)) { mimetypesWithEnabledHtmlErrorChecking = preferences.get(mimetypesWithEnabledHtmlErrorChecking_key, mimetypesWithEnabledHtmlErrorChecking_default); } }
Example 13
Source File: LegacySettingsSync.java From netbeans with Apache License 2.0 | 5 votes |
@Override public void preferenceChange(PreferenceChangeEvent evt) { if (evt.getKey() == null || !evt.getKey().startsWith(FoldUtilitiesImpl.PREF_COLLAPSE_PREFIX)) { return; } String k = evt.getKey().substring(FoldUtilitiesImpl.PREF_COLLAPSE_PREFIX.length()); syncKey(k, evt.getNode()); }
Example 14
Source File: NodeJsSupport.java From netbeans with Apache License 2.0 | 5 votes |
@Override public void preferenceChange(PreferenceChangeEvent evt) { String projectName = project.getProjectDirectory().getNameExt(); if (!preferences.isEnabled()) { LOGGER.log(Level.FINE, "Change event in node.js options ignored, node.js not enabled in project {0}", projectName); return; } String key = evt.getKey(); LOGGER.log(Level.FINE, "Processing change event {0} in node.js options in project {1}", new Object[] {key, projectName}); if (preferences.isDefaultNode() && (NodeJsOptions.NODE_PATH.equals(key) || NodeJsOptions.NODE_SOURCES_PATH.equals(key))) { fireSourceRootsChanged(); } }
Example 15
Source File: PrefMonitorInt.java From Logisim with GNU General Public License v3.0 | 5 votes |
@Override public void preferenceChange(PreferenceChangeEvent event) { Preferences prefs = event.getNode(); String prop = event.getKey(); String name = getIdentifier(); if (prop.equals(name)) { int oldValue = value; int newValue = prefs.getInt(name, dflt); if (newValue != oldValue) { value = newValue; AppPreferences.firePropertyChange(name, Integer.valueOf(oldValue), Integer.valueOf(newValue)); } } }
Example 16
Source File: DebuggingViewComponent.java From netbeans with Apache License 2.0 | 5 votes |
@Override public void preferenceChange(PreferenceChangeEvent evt) { String key = evt.getKey(); if (FiltersDescriptor.SHOW_SUSPEND_TABLE.equals(key)) { setSuspendTableVisible(evt.getNewValue().equals("true")); } }
Example 17
Source File: VariablesTreeModelFilter.java From netbeans with Apache License 2.0 | 5 votes |
@Override public void preferenceChange(PreferenceChangeEvent evt) { String key = evt.getKey(); if (VariablesViewButtons.SHOW_VALUE_PROPERTY_EDITORS.equals(key)) { refresh(); } }
Example 18
Source File: OptionsUtils.java From netbeans with Apache License 2.0 | 4 votes |
@Override public void preferenceChange(PreferenceChangeEvent evt) { String settingName = evt == null ? null : evt.getKey(); if (settingName == null || CodeCompletionPanel.PHP_AUTO_COMPLETION_FULL.equals(settingName)) { autoCompletionFull = preferences.getBoolean( CodeCompletionPanel.PHP_AUTO_COMPLETION_FULL, CodeCompletionPanel.PHP_AUTO_COMPLETION_FULL_DEFAULT); } if (settingName == null || CodeCompletionPanel.PHP_AUTO_COMPLETION_VARIABLES.equals(settingName)) { autoCompletionVariables = preferences.getBoolean( CodeCompletionPanel.PHP_AUTO_COMPLETION_VARIABLES, CodeCompletionPanel.PHP_AUTO_COMPLETION_VARIABLES_DEFAULT); } if (settingName == null || CodeCompletionPanel.PHP_AUTO_COMPLETION_TYPES.equals(settingName)) { autoCompletionTypes = preferences.getBoolean( CodeCompletionPanel.PHP_AUTO_COMPLETION_TYPES, CodeCompletionPanel.PHP_AUTO_COMPLETION_TYPES_DEFAULT); } if (settingName == null || CodeCompletionPanel.PHP_AUTO_COMPLETION_NAMESPACES.equals(settingName)) { autoCompletionNamespaces = preferences.getBoolean( CodeCompletionPanel.PHP_AUTO_COMPLETION_NAMESPACES, CodeCompletionPanel.PHP_AUTO_COMPLETION_NAMESPACES_DEFAULT); } if (settingName == null || CodeCompletionPanel.PHP_AUTO_COMPLETION_SMART_QUOTES.equals(settingName)) { autoCompletionSmartQuotes = preferences.getBoolean( CodeCompletionPanel.PHP_AUTO_COMPLETION_SMART_QUOTES, CodeCompletionPanel.PHP_AUTO_COMPLETION_SMART_QUOTES_DEFAULT); } if (settingName == null || CodeCompletionPanel.PHP_AUTO_STRING_CONCATINATION.equals(settingName)) { autoStringConcatination = preferences.getBoolean( CodeCompletionPanel.PHP_AUTO_STRING_CONCATINATION, CodeCompletionPanel.PHP_AUTO_STRING_CONCATINATION_DEFAULT); } if (settingName == null || CodeCompletionPanel.PHP_AUTO_COMPLETION_USE_LOWERCASE_TRUE_FALSE_NULL.equals(settingName)) { autoCompletionUseLowercaseTrueFalseNull = preferences.getBoolean( CodeCompletionPanel.PHP_AUTO_COMPLETION_USE_LOWERCASE_TRUE_FALSE_NULL, CodeCompletionPanel.PHP_AUTO_COMPLETION_USE_LOWERCASE_TRUE_FALSE_NULL_DEFAULT); } if (settingName == null || CodeCompletionPanel.PHP_AUTO_COMPLETION_COMMENT_ASTERISK.equals(settingName)) { autoCompletionCommentAsterisk = preferences.getBoolean( CodeCompletionPanel.PHP_AUTO_COMPLETION_COMMENT_ASTERISK, CodeCompletionPanel.PHP_AUTO_COMPLETION_COMMENT_ASTERISK_DEFAULT); } if (settingName == null || CodeCompletionPanel.PHP_CODE_COMPLETION_STATIC_METHODS.equals(settingName)) { codeCompletionStaticMethods = preferences.getBoolean( CodeCompletionPanel.PHP_CODE_COMPLETION_STATIC_METHODS, CodeCompletionPanel.PHP_CODE_COMPLETION_STATIC_METHODS_DEFAULT); } if (settingName == null || CodeCompletionPanel.PHP_CODE_COMPLETION_NON_STATIC_METHODS.equals(settingName)) { codeCompletionNonStaticMethods = preferences.getBoolean( CodeCompletionPanel.PHP_CODE_COMPLETION_NON_STATIC_METHODS, CodeCompletionPanel.PHP_CODE_COMPLETION_NON_STATIC_METHODS_DEFAULT); } if (settingName == null || CodeCompletionPanel.PHP_CODE_COMPLETION_SMART_PARAMETERS_PRE_FILLING.equals(settingName)) { codeCompletionSmartParametersPreFilling = preferences.getBoolean( CodeCompletionPanel.PHP_CODE_COMPLETION_SMART_PARAMETERS_PRE_FILLING, CodeCompletionPanel.PHP_CODE_COMPLETION_SMART_PARAMETERS_PRE_FILLING_DEFAULT); } if (settingName == null || CodeCompletionPanel.PHP_CODE_COMPLETION_VARIABLES_SCOPE.equals(settingName)) { codeCompletionVariablesScope = CodeCompletionPanel.VariablesScope.resolve(preferences.get(CodeCompletionPanel.PHP_CODE_COMPLETION_VARIABLES_SCOPE, null)); } if (settingName == null || CodeCompletionPanel.PHP_CODE_COMPLETION_TYPE.equals(settingName)) { codeCompletionType = CodeCompletionPanel.CodeCompletionType.resolve(preferences.get(CodeCompletionPanel.PHP_CODE_COMPLETION_TYPE, null)); } }
Example 19
Source File: NbEditorToolBar.java From netbeans with Apache License 2.0 | 4 votes |
public void preferenceChange(PreferenceChangeEvent evt) { String settingName = evt == null ? null : evt.getKey(); if (settingName == null || SimpleValueNames.TOOLBAR_VISIBLE_PROP.equals(settingName)) { refreshToolbarButtons(); } }
Example 20
Source File: FoldOptionsPanel.java From netbeans with Apache License 2.0 | 4 votes |
@Override public void preferenceChange(PreferenceChangeEvent evt) { String k = evt == null ? null : evt.getKey(); ignoreEnableTrigger = true; try { if (k == null || k.equals(FoldUtilitiesImpl.PREF_OVERRIDE_DEFAULTS)) { useDefaults.setSelected(currentPreferences.getBoolean(FoldUtilitiesImpl.PREF_OVERRIDE_DEFAULTS, true)); } if (k == null || k.equals(SimpleValueNames.CODE_FOLDING_ENABLE)) { boolean enabled = currentPreferences.getBoolean(SimpleValueNames.CODE_FOLDING_ENABLE, true); enableFolds.setSelected(enabled); contentPreview.setEnabled(enabled); foldedSummary.setEnabled(enabled); useDefaults.setEnabled(enabled); } if (k == null || FoldUtilitiesImpl.PREF_CONTENT_PREVIEW.equals(FoldUtilitiesImpl.PREF_CONTENT_PREVIEW)) { contentPreview.setSelected(currentPreferences.getBoolean(FoldUtilitiesImpl.PREF_CONTENT_PREVIEW, true)); } if (k == null || FoldUtilitiesImpl.PREF_CONTENT_SUMMARY.equals(FoldUtilitiesImpl.PREF_CONTENT_SUMMARY)) { foldedSummary.setSelected(currentPreferences.getBoolean(FoldUtilitiesImpl.PREF_CONTENT_SUMMARY, true)); } // must not replicate defaults over current settings if unspecified key arrives. if (k != null && FoldUtilitiesImpl.PREF_OVERRIDE_DEFAULTS.equals(k)) { boolean b = parentPrefs == null || !currentPreferences.getBoolean(FoldUtilitiesImpl.PREF_OVERRIDE_DEFAULTS, true); if (parentPrefs != null) { if (b) { currentPreferences.putBoolean(FoldUtilitiesImpl.PREF_CONTENT_PREVIEW, parentPrefs.getBoolean(FoldUtilitiesImpl.PREF_CONTENT_PREVIEW, true)); currentPreferences.putBoolean(FoldUtilitiesImpl.PREF_CONTENT_SUMMARY, parentPrefs.getBoolean(FoldUtilitiesImpl.PREF_CONTENT_SUMMARY, true)); } else { currentPreferences.remove(FoldUtilitiesImpl.PREF_CONTENT_PREVIEW); currentPreferences.remove(FoldUtilitiesImpl.PREF_CONTENT_SUMMARY); } } contentPreview.setEnabled(b); foldedSummary.setEnabled(b); contentPreview.setSelected(currentPreferences.getBoolean(FoldUtilitiesImpl.PREF_CONTENT_PREVIEW, true)); foldedSummary.setSelected(currentPreferences.getBoolean(FoldUtilitiesImpl.PREF_CONTENT_SUMMARY, true)); } } finally { ignoreEnableTrigger = false; } }