/** * return the listener for preferences changes. * @return the change listener */ private IEclipsePreferences.IPreferenceChangeListener getChangeListener() { if (changeListener==null) { changeListener = new IEclipsePreferences.IPreferenceChangeListener() { @Override public void preferenceChange(PreferenceChangeEvent pce) { if (debug==true) System.out.println("Property '" + pce.getKey() + "' changed from " + pce.getOldValue() + " to "+ pce.getNewValue()); switch(pce.getKey()) { case DEF_RUNAS: boolean changedExecutionMode = (pce.getOldValue()!=null && pce.getNewValue()!=pce.getOldValue()); if (changedExecutionMode==true) { if (debug==true) System.out.println("Changed Execution Mode: changed from " + pce.getOldValue() + " to "+ pce.getNewValue()); //TODO if the preference dialog was set to SWT! } } } }; } return changeListener; }
@Override public void preferenceChange(PreferenceChangeEvent event) { if (tracking) { String id = event.getSource().toString(); List<KeyValue> preferenceList = preferenceEntries.get(id); if (null == preferenceList) { preferenceList = new ArrayList<>(); preferenceEntries.put(id, preferenceList); } Optional<KeyValue> first = preferenceList.stream().filter(val -> val.getKey().equals(event.getKey())).findFirst(); if (first.isPresent()) { first.get().setValue(PrefUIUtil.emptyIfNull(event.getNewValue())); } else { KeyValue toAdd = new KeyValue(id, event.getKey(), PrefUIUtil.emptyIfNull(event.getNewValue())); preferenceList.add(toAdd); } firePreferencesUpdated(id); } }
private boolean isFormatPreferencesChanged(PreferenceChangeEvent event) { return TypeScriptCorePreferenceConstants.EDITOR_OPTIONS_CONVERT_TABS_TO_SPACES.equals(event.getKey()) || TypeScriptCorePreferenceConstants.EDITOR_OPTIONS_INDENT_SIZE.equals(event.getKey()) || TypeScriptCorePreferenceConstants.EDITOR_OPTIONS_TAB_SIZE.equals(event.getKey()) || TypeScriptCorePreferenceConstants.FORMAT_OPTIONS_INSERT_SPACE_AFTER_COMMA_DELIMITER .equals(event.getKey()) || TypeScriptCorePreferenceConstants.FORMAT_OPTIONS_INSERT_SPACE_AFTER_SEMICOLON_IN_FOR_STATEMENTS .equals(event.getKey()) || TypeScriptCorePreferenceConstants.FORMAT_OPTIONS_INSERT_SPACE_BEFORE_AND_AFTER_BINARY_OPERATORS .equals(event.getKey()) || TypeScriptCorePreferenceConstants.FORMAT_OPTIONS_INSERT_SPACE_AFTER_KEYWORDS_IN_CONTROL_FLOW_STATEMENTS .equals(event.getKey()) || TypeScriptCorePreferenceConstants.FORMAT_OPTIONS_INSERT_SPACE_AFTER_FUNCTION_KEYWORD_FOR_ANONYMOUS_FUNCTIONS .equals(event.getKey()) || TypeScriptCorePreferenceConstants.FORMAT_OPTIONS_INSERT_SPACE_AFTER_OPENING_AND_BEFORE_CLOSING_NONEMPTY_PARENTHESIS .equals(event.getKey()) || TypeScriptCorePreferenceConstants.FORMAT_OPTIONS_INSERT_SPACE_AFTER_OPENING_AND_BEFORE_CLOSING_NONEMPTY_BRACKETS .equals(event.getKey()) || TypeScriptCorePreferenceConstants.FORMAT_OPTIONS_PLACE_OPEN_BRACE_ON_NEW_LINE_FOR_FUNCTIONS .equals(event.getKey()) || TypeScriptCorePreferenceConstants.FORMAT_OPTIONS_PLACE_OPEN_BRACE_ON_NEW_LINE_FOR_CONTROL_BLOCKS .equals(event.getKey()); }
@Override public void start(BundleContext context) throws Exception { final IEclipsePreferences node = getPreferencesRootNode(); repoSvc = new WorkflowRepositoryServiceImpl(node.get(REPOSITORY_LOCATION_PREFNAME, REPOSITORY_LOCATION_DEFVALUE)); preferenceChangeListener = new IPreferenceChangeListener() { @Override public void preferenceChange(PreferenceChangeEvent event) { if(REPOSITORY_LOCATION_PREFNAME.equals(event.getKey()) && (repoSvc != null)) { // it seems that when you Restore Defaults for preferences, this gives a new value null i.o. the default value! String newValue = (event.getNewValue()!=null)? (String) event.getNewValue() : REPOSITORY_LOCATION_DEFVALUE; repoSvc.setRootFolder(new File(newValue)); } } }; node.addPreferenceChangeListener(preferenceChangeListener); Hashtable<String, String> svcProps = new Hashtable<>(); svcProps.put("type", "FILE"); repoSvcReg = context.registerService(WorkflowRepositoryService.class, repoSvc, svcProps); }
/** * Creates a listener that appropriately adds, updates, or removes * connections based on the values in the {@link #preferenceStore}. * * @return A new property change listener that can be registered with the * preference store. */ private IPreferenceChangeListener createPreferenceListener() { return new IPreferenceChangeListener() { @Override public void preferenceChange(PreferenceChangeEvent event) { String name = event.getKey(); Object oldValue = event.getOldValue(); Object newValue = event.getNewValue(); // Add, update, or remove depending on whether the old/new // values are null. if (oldValue != null) { if (newValue != null) { updateConnection(name, newValue.toString()); } else { removeConnection(name); } } else if (newValue != null) { addConnection(name, newValue.toString()); } return; } }; }
/** * listenForThemeChanges */ private void listenForThemeChanges() { this.fThemeChangeListener = new IPreferenceChangeListener() { public void preferenceChange(PreferenceChangeEvent event) { if (event.getKey().equals(IThemeManager.THEME_CHANGED)) { applyTheme(); } } }; EclipseUtil.instanceScope().getNode(ThemePlugin.PLUGIN_ID).addPreferenceChangeListener(this.fThemeChangeListener); }
/** * Respond to preference change events */ public void preferenceChange(PreferenceChangeEvent event) { String key = event.getKey(); if (IPreferenceConstants.COMPLETION_PROPOSAL_ACTIVATION_CHARACTERS.equals(key)) { _completionProposalChars = retrieveCAPreference(IPreferenceConstants.COMPLETION_PROPOSAL_ACTIVATION_CHARACTERS); } else if (IPreferenceConstants.CONTEXT_INFORMATION_ACTIVATION_CHARACTERS.equals(key)) { _contextInformationChars = retrieveCAPreference(IPreferenceConstants.CONTEXT_INFORMATION_ACTIVATION_CHARACTERS); } else if (IPreferenceConstants.PROPOSAL_TRIGGER_CHARACTERS.equals(key)) { _proposalTriggerChars = retrieveCAPreference(IPreferenceConstants.PROPOSAL_TRIGGER_CHARACTERS); } }
@Override public void preferenceChange(PreferenceChangeEvent event) { if( event.getKey().equals(JPFClasspathPlugin.PREF_REGISTRY_NAME) ) { manager.modelChanged(this); } }
@Override public void preferenceChange(PreferenceChangeEvent event) { if( event.getKey().equals(JPFClasspathPlugin.PREF_PARENT_REGISTRIES) ) { manager.modelChanged(this); } }
private void taggerConfigUpdated(PreferenceChangeEvent e) { if(e.getKey().equals(TermSuiteUIPreferences.TAGGERS)) { Collection<String> configNames = context.get(TaggerService.class).getTaggerConfigNames(); EPipeline pipeline = this.pipelineValue.getValue(); if(!configNames.isEmpty() && pipeline.getTaggerConfigName() == null) { pipeline.setTaggerConfigName(configNames.iterator().next()); } } }
@Override public void preferenceChange(PreferenceChangeEvent event) { IThemeManager themeManager = TMUIPlugin.getThemeManager(); if (ThemeManager.E4_THEME_ID.equals(event.getKey())) { preferenceThemeChange((String) event.getNewValue(), themeManager); } else if (PreferenceConstants.THEME_ASSOCIATIONS.equals(event.getKey())) { preferenceThemeChange(themeManager.getPreferenceE4CSSThemeId(), themeManager); } }
public void preferenceChange(PreferenceChangeEvent event) { synchronized (lock) { if (currState != State.RECORDING) { return; } changeLog.add(new PreferenceChanged(new Path(event.getNode().absolutePath()), event.getKey(), (String) event.getNewValue())); } }
/** * Refreshes all notes when a change in the plugin's preferences is detected. * * @param event */ @Override public void preferenceChange(PreferenceChangeEvent event) { for (int tabIndex = 0; tabIndex < tabFolder.getItemCount(); ++tabIndex) { getNote(tabIndex).setParametersFromPreferences(); } }
@Override public void preferenceChange(PreferenceChangeEvent event) { Object newValue = event.getNewValue(); if (PreferenceConstants.CLOUDSDK_PATH.equals(event.getKey()) && (newValue == null || newValue instanceof String)) { CloudSdkContextFunction.sdkPathChanged((String) newValue); } }
private boolean isTypeScriptRuntimePreferencesChanged(PreferenceChangeEvent event) { return TypeScriptCorePreferenceConstants.USE_EMBEDDED_TYPESCRIPT.equals(event.getKey()) || TypeScriptCorePreferenceConstants.EMBEDDED_TYPESCRIPT_ID.equals(event.getKey()) || TypeScriptCorePreferenceConstants.INSTALLED_TYPESCRIPT_PATH.equals(event.getKey()) || TypeScriptCorePreferenceConstants.TSSERVER_TRACE_ON_CONSOLE.equals(event.getKey()) || TypeScriptCorePreferenceConstants.TSSERVER_EMULATE_PLUGINS.equals(event.getKey()); }
private boolean isTslintPreferencesChanged(PreferenceChangeEvent event) { return TypeScriptCorePreferenceConstants.TSLINT_STRATEGY.equals(event.getKey()) || TypeScriptCorePreferenceConstants.TSLINT_USE_CUSTOM_TSLINTJSON_FILE.equals(event.getKey()) || TypeScriptCorePreferenceConstants.TSLINT_USE_EMBEDDED_TYPESCRIPT.equals(event.getKey()) || TypeScriptCorePreferenceConstants.TSLINT_EMBEDDED_TYPESCRIPT_ID.equals(event.getKey()) || TypeScriptCorePreferenceConstants.TSLINT_INSTALLED_TYPESCRIPT_PATH.equals(event.getKey()); }
public void preferenceChange(PreferenceChangeEvent event) { if (TypeScriptCorePreferenceConstants.USE_SALSA_AS_JS_INFERENCE.equals(event.getKey())) { try { useSalsa = UseSalsa.valueOf(event.getNewValue().toString()); } catch (Throwable e) { } } }
/** * Initialize the preferences listener. */ private void initializePreferencesListener() { if (preferencesListener == null) { preferencesListener = new IEclipsePreferences.IPreferenceChangeListener() { /* * (non-Javadoc) * * @see org.eclipse.core.runtime.preferences.IEclipsePreferences.IPreferenceChangeListener#preferenceChange(org.eclipse.core.runtime.preferences.IEclipsePreferences.PreferenceChangeEvent) */ public void preferenceChange(PreferenceChangeEvent event) { if (silentRunning) { return; } Object oldValue = event.getOldValue(); Object newValue = event.getNewValue(); String key = event.getKey(); if (newValue == null) { newValue = getDefault(key, oldValue); } else if (oldValue == null) { oldValue = getDefault(key, newValue); } firePropertyChangeEvent(event.getKey(), oldValue, newValue); } }; getStorePreferences().addPreferenceChangeListener( preferencesListener); } }
/** * Initialize the preferences listener. */ private void initializePreferencesListener() { if (preferencesListener == null) { preferencesListener = new IEclipsePreferences.IPreferenceChangeListener() { /* * (non-Javadoc) * * @see org.eclipse.core.runtime.preferences.IEclipsePreferences.IPreferenceChangeListener#preferenceChange(org.eclipse.core.runtime.preferences.IEclipsePreferences.PreferenceChangeEvent) */ @Override public void preferenceChange(PreferenceChangeEvent event) { if (silentRunning) { return; } Object oldValue = event.getOldValue(); Object newValue = event.getNewValue(); String key = event.getKey(); if (newValue == null) { newValue = getDefault(key, oldValue); } else if (oldValue == null) { oldValue = getDefault(key, newValue); } firePropertyChangeEvent(event.getKey(), oldValue, newValue); } }; getStorePreferences().addPreferenceChangeListener( preferencesListener); } }
@Override public void preferenceChange(PreferenceChangeEvent event) { // changes in the configuration for the views, so redraw the graph. if (event.getKey().startsWith(LabelPreferencesIds.LABEL_PREFIX)) { setLabelPreferences(); } if (event.getKey().startsWith(ColorPreferencesIds.COLORS_PREFIX)) { setColorsPreferences(); } if (event.getKey().startsWith(NodePreferencesIds.NODE_PREFIX)) { setNodePreferences(); } }
@Override public void preferenceChange(PreferenceChangeEvent event) { if (!isIgnorePreferenceListeners()) { buildPathMap(preferences); } else { rebuildPathMap = true; } }
void notifyListeners(IEclipsePreferences prefs) { for (int i = 0; i < prefListeners.size(); i++) { IPreferenceChangeListener listener = (IPreferenceChangeListener) prefListeners .get(i); IEclipsePreferences.PreferenceChangeEvent event = new IEclipsePreferences.PreferenceChangeEvent( prefs, KEY_PROJECT, project, project); listener.preferenceChange(event); } }
@Override public void preferenceChange(PreferenceChangeEvent event) { if (ignorePrefChange) { return; } String key = event.getKey(); if (!ProjectProperties.KEY_PROJECT.equals(key)) { return; } Job[] jobs = Job.getJobManager().find(getClass()); if (jobs.length == 0) { final Job myJob = new Job("Mapping is changed => full project sync") { @Override public boolean belongsTo(Object family) { return family == FileSyncBuilder.class; } @Override public IStatus run(IProgressMonitor monitor) { build(MAPPING_CHANGED_IN_GUI_BUILD, monitor); return Status.OK_STATUS;//new JobStatus(IStatus.INFO, 0, this, "", null); } }; myJob.setUser(false); myJob.schedule(); } }
public void preferenceChange(PreferenceChangeEvent event) { // If invasive themes are on and we changed the theme, schedule. Also schedule if we toggled invasive theming. if (event.getKey().equals(IPreferenceConstants.APPLY_TO_ALL_VIEWS) || event.getKey().equals(IPreferenceConstants.APPLY_TO_ALL_EDITORS) || (event.getKey().equals(IThemeManager.THEME_CHANGED) && applyToViews())) { cancel(); schedule(); } }
private void addThemeChangeListener() { // TODO Just use one global listener that updates all instances? fThemeChangeListener = new IPreferenceChangeListener() { public void preferenceChange(PreferenceChangeEvent event) { if (event.getKey().equals(IThemeManager.THEME_CHANGED)) { applyTheme(); } else if (event.getKey().equals(IPreferenceConstants.INVASIVE_FONT)) { // Handle the invasive font setting change if (Boolean.parseBoolean((String) event.getNewValue())) { applyControlFont(); } else { unapplyControlFont(); } } else if (event.getKey().equals(IPreferenceConstants.APPLY_TO_ALL_VIEWS)) { if (Boolean.parseBoolean((String) event.getNewValue())) { applyTheme(); } else { unapplyTheme(); } } } }; EclipseUtil.instanceScope().getNode(ThemePlugin.PLUGIN_ID).addPreferenceChangeListener(fThemeChangeListener); }
/** * Respond to a preference change event */ public void preferenceChange(PreferenceChangeEvent event) { if (ICorePreferenceConstants.PREF_DEBUG_LEVEL.equals(event.getKey())) { IdeLog.setCurrentSeverity(IdeLog.getSeverityPreference()); } }
protected synchronized IPath nodeSrcPath() { // Cache value and hook pref listener if (fNodeSrcPathListener == null) { fNodeSrcPathListener = new IEclipsePreferences.IPreferenceChangeListener() { public void preferenceChange(PreferenceChangeEvent event) { if (IPreferenceConstants.NODEJS_SOURCE_PATH.equals(event.getKey())) { String value = (String) event.getNewValue(); if (StringUtil.isEmpty(value)) { fNodeSrcPath = null; } else { fNodeSrcPath = Path.fromOSString(value); } } } }; EclipseUtil.instanceScope().getNode(JSCorePlugin.PLUGIN_ID) .addPreferenceChangeListener(fNodeSrcPathListener); String value = Platform.getPreferencesService().getString(JSCorePlugin.PLUGIN_ID, IPreferenceConstants.NODEJS_SOURCE_PATH, null, null); if (StringUtil.isEmpty(value)) { fNodeSrcPath = null; } else { fNodeSrcPath = Path.fromOSString(value); } } return fNodeSrcPath; }
@SuppressWarnings("restriction") public void preferenceChange(PreferenceChangeEvent event) { if (ResourcesPlugin.PREF_AUTO_BUILDING.equals(event.getKey())) { if ((Boolean.FALSE.toString().equals(event.getNewValue()))) { // APSTUD-4350 - We make sure that the preference change was done through the ToggleAutoBuildAction // (e.g. the menu action), or though the Workspace preference page. Any other trigger for that // preference change will not show the dialog. String buildToggleActionClassName = org.eclipse.ui.internal.ide.actions.ToggleAutoBuildAction.class .getCanonicalName(); String workspacePreferencePage = org.eclipse.ui.internal.ide.dialogs.IDEWorkspacePreferencePage.class .getCanonicalName(); StackTraceElement[] stackTrace = new Exception().getStackTrace(); for (StackTraceElement element : stackTrace) { String className = element.getClassName(); if (className.equals(buildToggleActionClassName) || className.equals(workspacePreferencePage)) { MessageDialog.openWarning(UIUtils.getActiveShell(), Messages.UIPlugin_automaticBuildsWarningTitle, Messages.UIPlugin_automaticBuildsWarningMessage); } } } } }
public void preferenceChange(PreferenceChangeEvent event) { if (IPreferenceConstants.HTML_OUTLINE_SHOW_TEXT_NODES.equals(event.getKey())) { showTextNode = HTMLPreferenceUtil.getShowTextNodesInOutline(); } }
public void preferenceChange(PreferenceChangeEvent event) { if (IPreferenceConstants.HTML_OUTLINE_TAG_ATTRIBUTES_TO_SHOW.equals(event.getKey())) { getOutlinePage().refresh(); } }
public void preferenceChange(PreferenceChangeEvent event) { if (event.getKey().equals(IThemeManager.THEME_CHANGED)) { getThemeColors(); } }
public void preferenceChange(PreferenceChangeEvent event) { if (IPreferenceConstants.CONTENT_ASSIST_DELAY.equals(event.getKey())) { setSnippetProcessorEnablement(); } }
private void installPreferenceListener() { fPreferenceChangeListener= new IPreferenceChangeListener() { public void preferenceChange(PreferenceChangeEvent event) { if (event.getKey().equals(CleanUpConstants.SHOW_CLEAN_UP_WIZARD)) { updateActionLabel(); } } }; InstanceScope.INSTANCE.getNode(JavaUI.ID_PLUGIN).addPreferenceChangeListener(fPreferenceChangeListener); }
@Override public void preferenceChange(PreferenceChangeEvent event) { String key = event.getKey(); if ("org.eclipse.debug.ui.consoleBackground".equals(key) || "org.eclipse.debug.ui.outColor".equals(key) || "org.eclipse.debug.ui.errorColor".equals(key)) { synchronized (referencesLock) { ArrayList<IOConsole> currentRefs = getCurrentRefs(); for (IOConsole console : currentRefs) { updateConsole(console); } } } }
AngularProject(IIDETernProject ternProject) throws CoreException { this.ternProject = ternProject; this.outlineProvider = new AngularOutlineProvider(ternProject); this.folders = new HashMap<ITernScriptPath, List<BaseModel>>(); this.customDirectives = new CustomAngularModulesRegistry(ternProject.getProject()); AngularModulesManager.getInstance().addRegistry(this, customDirectives); ternProject.setData(ANGULAR_PROJECT, this); ternProject.addServerListener(new TernServerAdapter() { @Override public void onStop(ITernServer server) { customDirectives.clear(); } }); // initialize symbols from project preferences initializeSymbols(); AngularCorePreferencesSupport.getInstance().getEclipsePreferences(ternProject.getProject()) .addPreferenceChangeListener(new IPreferenceChangeListener() { @Override public void preferenceChange(PreferenceChangeEvent event) { if (AngularCoreConstants.EXPRESSION_START_SYMBOL.equals(event.getKey())) { AngularProject.this.startSymbol = event.getNewValue().toString(); } else if (AngularCoreConstants.EXPRESSION_END_SYMBOL.equals(event.getKey())) { AngularProject.this.endSymbol = event.getNewValue().toString(); } } }); }
@Override protected void handlePreferenceChange(PreferenceChangeEvent event) { String changedKey = event.getKey(); String baseKey = key; if(changedKey.startsWith(baseKey)) { String suffix = changedKey.substring(baseKey.length()); if(suffix.isEmpty() || suffixes.contains(suffix)) { field.setFieldValue(get()); } } }