private M2RepositoryBrowser() { super(Children.create(new RootNodes(), true)); setName(NAME); setDisplayName(CTL_M2RepositoryBrowserTopComponent2(RepositoryPreferences.isIndexRepositories() ? "" : CTL_M2RepositoriesDisabled())); setShortDescription(HINT_M2RepositoryBrowserTopComponent()); setIconBaseWithExtension(ICON_PATH); NbPreferences.root().node("org/netbeans/modules/maven/nexus/indexing").addPreferenceChangeListener(new PreferenceChangeListener() { @Override public void preferenceChange(PreferenceChangeEvent evt) { if (RepositoryPreferences.PROP_INDEX.equals(evt.getKey())) { setDisplayName(CTL_M2RepositoryBrowserTopComponent2(RepositoryPreferences.isIndexRepositories() ? "" : CTL_M2RepositoriesDisabled())); } } }); }
@Override public void preferenceChange(PreferenceChangeEvent evt) { String k = evt.getKey(); if (FoldUtilitiesImpl.PREF_CONTENT_PREVIEW.equals(k) || FoldUtilitiesImpl.PREF_CONTENT_SUMMARY.equals(k)) { initViewFlags(); final Document d = document(); if (d != null) { d.render(new Runnable() { @Override public void run() { int end = d.getLength(); fireEvent(EditorViewFactoryChange.createList(0, end, EditorViewFactoryChange.Type.CHARACTER_CHANGE)); } }); } } }
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; }
public @Override void preferenceChange(PreferenceChangeEvent evt) { EditorUI eui = editorUI; JTextComponent c = eui == null ? null : eui.getComponent(); Rectangle rect = c == null ? null : c.getVisibleRect(); if (rect != null && rect.width == 0) { if (SwingUtilities.isEventDispatchThread()) { resize(); } else { SwingUtilities.invokeLater( new Runnable() { public @Override void run() { resize(); } } ); } } }
@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); } } }
protected void initialize () { loadAll (); getNode ().addPreferenceChangeListener ( this.listener = new PreferenceChangeListener () { @Override public void preferenceChange ( final PreferenceChangeEvent evt ) { if ( PREF_NAME.equals ( evt.getKey () ) ) { refresh (); } } } ); }
@Override public void preferenceChange(PreferenceChangeEvent evt) { if (evt.getKey().startsWith(SvnModuleConfig.PROP_COMMIT_EXCLUSIONS)) { Runnable inAWT = new Runnable() { @Override public void run() { commitTable.dataChanged(); listenerSupport.fireVersioningEvent(EVENT_SETTINGS_CHANGED); } }; // this can be called from a background thread - e.g. change of exclusion status in Versioning view if (EventQueue.isDispatchThread()) { inAWT.run(); } else { EventQueue.invokeLater(inAWT); } } }
@Override public void preferenceChange(PreferenceChangeEvent e) { if(!e.getKey().startsWith(CHANNEL_PREFS_HEADER)) { return; } // parse our the channel from the prefs key and then set properties of that channel String[] s=e.getKey().split("\\."); int chanNum=Integer.parseInt(s[4]); EqualizerChannel c=channels[chanNum]; if (s[5].equals("qsos")) { c.setQSOS(Integer.parseInt(e.getNewValue())); } else if (e.getKey().equals("qbpf")) { c.setQBPF(Integer.parseInt(e.getNewValue())); } else if (e.getKey().equals("bpfkilled")) { c.setBpfKilled(Boolean.parseBoolean(e.getNewValue())); } else if (e.getKey().equals("lpfkilled")) { c.setLpfKilled(Boolean.parseBoolean(e.getNewValue())); } }
@Override public void preferenceChange(PreferenceChangeEvent evt) { if (corePref.equals(evt.getNode()) && USAGE_STATISTICS_ENABLED.equals(evt.getKey())) { boolean newVal = Boolean.parseBoolean(evt.getNewValue()); if (newVal != logMetricsEnabled) { corePref.putBoolean(USAGE_STATISTICS_SET_BY_IDE, true); logMetricsEnabled = newVal; Logger log = Logger.getLogger(METRICS_LOGGER_NAME); if (logMetricsEnabled) { log.setUseParentHandlers(true); log.setLevel(Level.FINEST); log.addHandler(metrics); MetricsHandler.setFlushOnRecord(false); } else { MetricsHandler.flushImmediatelly(); closeLogStreamMetrics(); log.removeHandler(metrics); } } } }
@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); } }
private void firePrefEvents(List<EventBag<PreferenceChangeListener, PreferenceChangeEvent>> events) { if (noEvents) { return; } for(EventBag<PreferenceChangeListener, PreferenceChangeEvent> bag : events) { for(PreferenceChangeEvent event : bag.getEvents()) { for(PreferenceChangeListener l : bag.getListeners()) { try { l.preferenceChange(event); } catch (Throwable t) { LOG.log(Level.WARNING, null, t); } } } } }
@Override public void preferenceChange(PreferenceChangeEvent evt) { if (evt.getKey().startsWith(HgModuleConfig.PROP_COMMIT_EXCLUSIONS)) { Runnable inAWT = new Runnable() { @Override public void run() { commitTable.dataChanged(); listenerSupport.fireVersioningEvent(EVENT_SETTINGS_CHANGED); } }; // this can be called from a background thread - e.g. change of exclusion status in Versioning view if (EventQueue.isDispatchThread()) { inAWT.run(); } else { EventQueue.invokeLater(inAWT); } } }
@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); } } }
InstanceNodeChildren(HudsonInstance instance) { this.instance = instance; instance.addHudsonChangeListener(this); instance.prefs().addPreferenceChangeListener(new PreferenceChangeListener() { @Override public void preferenceChange(PreferenceChangeEvent evt) { refreshKeys(); } }); }
@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); } } }
@Override public void preferenceChange(PreferenceChangeEvent evt) { if (suppressPrefChanges == Boolean.TRUE) { return; } boolean ch = detectIsChanged(); MemoryPreferences defMime; synchronized (preferences) { defMime = preferences.get(""); // NOI18N } if (defMime != null && defMime.getPreferences() == evt.getNode()) { if (FoldUtilitiesImpl.PREF_CODE_FOLDING_ENABLED.equals(evt.getKey())) { // propagate to all preferences, suppress events suppressPrefChanges = true; Collection<MemoryPreferences> col; synchronized (preferences) { col = new ArrayList<>(preferences.values()); } try { for (MemoryPreferences p : col) { if (p != defMime) { if (((OverridePreferences)p.getPreferences()).isOverriden(FoldUtilitiesImpl.PREF_CODE_FOLDING_ENABLED)) { p.getPreferences().remove(FoldUtilitiesImpl.PREF_CODE_FOLDING_ENABLED); } } } } finally { suppressPrefChanges = false; } } } if (ch != changed) { propSupport.firePropertyChange(PROP_CHANGED, !ch, ch); changed = true; } }
@Override public void preferenceChange(final PreferenceChangeEvent evt) { // the inherited legacy 'method' fold setting in "" mime type is changed in the same Swing event // as the real 'member' setting, so updating in the next event should read the already changed value. // similar for javadoc and inner classes. SwingUtilities.invokeLater(new Runnable() { public void run() { fireChanged(updateCheckers(evt)); } }); }
public void preferenceChange(PreferenceChangeEvent evt) { if (evt != null) { // real change event staticWordsDocs.clear(); } maxSearchLen = prefs.getInt(EditorPreferencesKeys.WORD_MATCH_SEARCH_LEN, EditorPreferencesDefaults.defaultWordMatchSearchLen); wrapSearch = prefs.getBoolean(EditorPreferencesKeys.WORD_MATCH_WRAP_SEARCH, EditorPreferencesDefaults.defaultWordMatchWrapSearch); matchOneChar = prefs.getBoolean(EditorPreferencesKeys.WORD_MATCH_MATCH_ONE_CHAR, EditorPreferencesDefaults.defaultWordMatchMatchOneChar); matchCase = prefs.getBoolean(EditorPreferencesKeys.WORD_MATCH_MATCH_CASE, EditorPreferencesDefaults.defaultWordMatchMatchCase); smartCase = prefs.getBoolean(EditorPreferencesKeys.WORD_MATCH_SMART_CASE, EditorPreferencesDefaults.defaultWordMatchSmartCase); }
public void preferenceChange(PreferenceChangeEvent evt) { // #50073 SwingUtilities.invokeLater(new Runnable(){ public void run(){ refreshPanel(); } }); if (evt == null || SimpleValueNames.STATUS_BAR_CARET_DELAY.equals(evt.getKey())) { caretDelay = prefs.getInt(SimpleValueNames.STATUS_BAR_CARET_DELAY, EditorPreferencesDefaults.defaultStatusBarCaretDelay); if (caretL != null) { caretL.setDelay(caretDelay); } } }
@Override public void preferenceChange(PreferenceChangeEvent evt) { String key = evt.getKey(); if (DebuggingNodeModel.SHOW_PACKAGE_NAMES.equals(key)) { synchronized (frameDescriptionsByFrame) { frameDescriptionsByFrame.clear(); } } }
@Override public void preferenceChange(PreferenceChangeEvent evt) { String key = evt.getKey(); if (VariablesViewButtons.SHOW_VALUE_PROPERTY_EDITORS.equals(key)) { refresh(); } }
public void preferenceChange(PreferenceChangeEvent evt) { if (KEY_DEPENDENCY_TRACKING.equals(evt.getKey())) { final DependencyTracking dt = getDependencyTracking(); if (curr != dt) { if (dt.ordinal() > curr.ordinal()) { IndexingManager.getDefault().refreshAllIndices(JavaIndex.NAME); } curr = dt; } } }
@Override public void preferenceChange(PreferenceChangeEvent e) { if (e.getKey().equals(key)) { // log.info(this+" preferenceChange(): event="+e+" key="+e.getKey()+" newValue="+e.getNewValue()); boolean newv = Boolean.parseBoolean(e.getNewValue()); set(newv); } }
@Override public void preferenceChange(PreferenceChangeEvent e) { int curPort = Integer.parseInt(Settings.get().get(binary ? Settings.PORT_BINARY : Settings.PORT, binary ? Settings.PORT_BINARY_DEFAULT : Settings.PORT_DEFAULT)); if (curPort != port) { initializeNetwork(); } }
@Override public void preferenceChange(final PreferenceChangeEvent e) { if (e.getKey().equals(getPreferencesKey())) { final int newVal = Integer.parseInt(e.getNewValue()); setFullValue(newVal); } }
@Override public void preferenceChange(final PreferenceChangeEvent e) { if (e.getKey().equals(getPreferencesKey())) { final int newVal = Integer.parseInt(e.getNewValue()); set(newVal); } }
@Override public void preferenceChange(final PreferenceChangeEvent e) { // TODO we get pref change events here but by this time the new values have already been set and there is no // change in value so the GUI elements are not updated try { final String base = prefsKey() + TowerOnChip6BitVDAC.SEP; final String key = e.getKey(); if (!key.startsWith(base)) { return; } final String val = e.getNewValue(); // log.info("key="+key+" value="+val); if (key.equals(base + TowerOnChip6BitVDAC.KEY_VDAC_VALUE)) { if (getVdacBitValue() != Integer.parseInt(val)) { Pot.log.info("reference voltage bit value change from preferences"); } setVdacBitValue(Integer.parseInt(val)); } else if (key.equals(base + TowerOnChip6BitVDAC.KEY_BUFFER_VALUE)) { if (getBufferBitValue() != Integer.parseInt(val)) { Pot.log.info("regulator bit value changed from preferences"); } setBufferBitValue(Integer.parseInt(val)); } } catch (final Exception ex) { Pot.log.warning("while responding to preference change event " + e + ", caught " + ex.toString()); } }
@Override public void preferenceChange(PreferenceChangeEvent e) { // TODO we get pref change events here but by this time the new values have already been set and there is no change in value so the GUI elements are not updated try { String base = prefsKey() + SEP; String key = e.getKey(); if(!key.startsWith(base)) { return; } String val = e.getNewValue(); // log.info("key="+key+" value="+val); if (key.equals(base + KEY_BITVALUE_FINE)) { if(getFineBitValue()!=Integer.parseInt(val)){ log.info(base+" fine bit value change from "+getFineBitValue()+" to "+ Integer.parseInt(val)+" from preferences"); } setFineBitValue(Integer.parseInt(val)); } else if (key.equals(base + KEY_BITVALUE_COARSE)) { if(getCoarseBitValue()!=Integer.parseInt(val)){ log.info("coarse bit value change from preferences"); } setCoarseBitValue(Integer.parseInt(val)); } else if (key.equals(base + KEY_ENABLED)) { setEnabled(Boolean.parseBoolean(val)); } else if (key.equals(base + KEY_LOWCURRENT_ENABLED)) { setLowCurrentModeEnabled(Boolean.parseBoolean(val)); } else if (key.equals(base + KEY_SEX)) { setSex(Pot.Sex.valueOf(val)); } else if (key.equals(base + KEY_TYPE)) { setType(Pot.Type.valueOf(val)); } } catch (Exception ex) { log.warning("while responding to preference change event " + e + ", caught " + ex.toString()); } }
public static void addBreadCrumbsEnabledListener(@NonNull final ChangeListener l) { Preferences prefs = MimeLookup.getLookup(MimePath.EMPTY).lookup(Preferences.class); prefs.addPreferenceChangeListener(new PreferenceChangeListener() { @Override public void preferenceChange(PreferenceChangeEvent evt) { if (evt == null || SideBarFactoryImpl.KEY_BREADCRUMBS.equals(evt.getKey())) { l.stateChanged(new ChangeEvent(evt)); } } }); }
@Override public void preferenceChange(PreferenceChangeEvent e) { if (e.getKey().equals(prefsKey + "qsos")) { setQSOS(Integer.parseInt(e.getNewValue())); } else if (e.getKey().equals(prefsKey + "qbpf")) { setQBPF(Integer.parseInt(e.getNewValue())); } else if (e.getKey().equals(prefsKey + "bpfkilled")) { setBpfKilled(Boolean.parseBoolean(e.getNewValue())); } else if (e.getKey().equals(prefsKey + "lpfkilled")) { setLpfKilled(Boolean.parseBoolean(e.getNewValue())); } }
@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)); } } }
@Override public void preferenceChange(PreferenceChangeEvent evt) { if(HistorySettings.PROP_INCREMENTS.equals(evt.getKey()) || HistorySettings.PROP_LOAD_ALL.equals(evt.getKey())) { HistoryRootNode rootNode = getRootNode(); if(rootNode != null) { loadNextAction.refreshName(); } // XXX invoke either for all or increment value } }
@Override protected void setUp () throws Exception { super.setUp (); System.setProperty ("netbeans.system_http_proxy", SYSTEM_PROXY_HOST + ":" + SYSTEM_PROXY_PORT); System.setProperty ("netbeans.system_socks_proxy", SYSTEM_PROXY_HOST + ":" + SYSTEM_PROXY_PORT); System.setProperty ("netbeans.system_http_non_proxy_hosts", "*.other.org"); System.setProperty ("http.nonProxyHosts", "*.netbeans.org"); selector = ProxySelector.getDefault (); proxyPreferences = NbPreferences.root ().node ("/org/netbeans/core"); proxyPreferences.addPreferenceChangeListener (new PreferenceChangeListener () { public void preferenceChange (PreferenceChangeEvent arg0) { isWaiting = false; } }); proxyPreferences.put ("proxyHttpHost", USER_PROXY_HOST); proxyPreferences.put ("proxyHttpPort", USER_PROXY_PORT); proxyPreferences.put ("proxySocksHost", USER_PROXY_HOST); proxyPreferences.put ("proxySocksPort", USER_PROXY_PORT); while (isWaiting); isWaiting = true; TO_LOCALHOST = new URI ("http://localhost"); TO_LOCAL_DOMAIN_1 = new URI ("http://core.netbeans.org"); TO_LOCAL_DOMAIN_2 = new URI ("http://core.other.org"); TO_EXTERNAL = new URI ("http://worldwide.net"); SOCKS_TO_LOCALHOST = new URI ("socket://localhost:8041"); SOCKS_TO_LOCAL_DOMAIN_1 = new URI ("socket://core.netbeans.org"); SOCKS_TO_LOCAL_DOMAIN_2 = new URI ("socket://core.other.org"); SOCKS_TO_EXTERNAL = new URI ("socket://worldwide.net"); }
public void preferenceChange(PreferenceChangeEvent evt) { synchronized (lock) { if (local != null && local.containsKey(evt.getKey())) { // ignore return; } } firePreferenceChange(evt.getKey(), evt.getNewValue()); }
@Override public void sync() throws BackingStoreException { ArrayList<EventBag<PreferenceChangeListener, PreferenceChangeEvent>> prefEvents = new ArrayList<EventBag<PreferenceChangeListener, PreferenceChangeEvent>>(); ArrayList<EventBag<NodeChangeListener, NodeChangeEvent>> nodeEvents = new ArrayList<EventBag<NodeChangeListener, NodeChangeEvent>>(); synchronized (tree.treeLock()) { _sync(prefEvents, nodeEvents); } fireNodeEvents(nodeEvents); firePrefEvents(prefEvents); }
private void _put(String key, String value, String javaType) { EventBag<PreferenceChangeListener, PreferenceChangeEvent> bag = null; synchronized (tree.treeLock()) { checkNotNull(key, "key"); //NOI18N checkNotNull(value, "value"); //NOI18N checkRemoved(); String orig = get(key, null); if (orig == null || !orig.equals(value)) { if (LOG.isLoggable(Level.FINE)) { LOG.fine("Overwriting '" + key + "' = '" + value + "'"); //NOI18N } data.put(key, new TypedValue(value, javaType)); removedKeys.remove(key); bag = new EventBag<PreferenceChangeListener, PreferenceChangeEvent>(); bag.addListeners(prefListeners); bag.addEvent(new PreferenceChangeEvent(this, key, value)); } } if (bag != null) { firePrefEvents(Collections.singletonList(bag)); } }
@Override public void preferenceChange(PreferenceChangeEvent evt) { // potential NPE fix; key ought not be null, but guard against it. if (evt.getKey() == null) { return; } ignorePut.set(true); String k = evt.getKey(); String v = evt.getNewValue(); try { if (evt.getSource() == stored) { // not important, obnly local storage should refire, except clearing of the local value if (!isOverriden(k) && v != null) { return; } // try to recover the inherited value if (v == null) { v = inherited.get(k, null); } } else if (isOverriden(k)) { return; } // potential NPE, null values should be reported as removals. if (v == null) { remove(k); } else { put(k, v); } } finally { ignorePut.set(false); } }
@Override public void preferenceChange(PreferenceChangeEvent e) { if (e.getKey().equals(key())) { log.info(this + " preferenceChange(): event=" + e + " key=" + e.getKey() + " newValue=" + e.getNewValue()); setGain(OffChipPreampGain.valueOf(e.getNewValue())); } }