Java Code Examples for org.eclipse.core.runtime.preferences.IEclipsePreferences#removePreferenceChangeListener()
The following examples show how to use
org.eclipse.core.runtime.preferences.IEclipsePreferences#removePreferenceChangeListener() .
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: FixedScopedPreferenceStore.java From xtext-eclipse with Eclipse Public License 2.0 | 6 votes |
/** * Dispose the preference store listener. */ private void disposePreferenceStoreListener() { IEclipsePreferences root = (IEclipsePreferences) Platform .getPreferencesService().getRootNode().node( Plugin.PLUGIN_PREFERENCE_SCOPE); try { if (!(root.nodeExists(nodeQualifier))) { return; } } catch (BackingStoreException e) { return;// No need to report here as the node won't have the // listener } IEclipsePreferences preferences = getStorePreferences(); if (preferences == null) { return; } if (preferencesListener != null) { preferences.removePreferenceChangeListener(preferencesListener); preferencesListener = null; } }
Example 2
Source File: ScopedPreferenceStore.java From e4Preferences with Eclipse Public License 1.0 | 6 votes |
/** * Dispose the receiver. */ private void disposePreferenceStoreListener() { IEclipsePreferences root = (IEclipsePreferences) Platform .getPreferencesService().getRootNode().node( Plugin.PLUGIN_PREFERENCE_SCOPE); try { if (!(root.nodeExists(nodeQualifier))) { return; } } catch (BackingStoreException e) { return;// No need to report here as the node won't have the // listener } IEclipsePreferences preferences = getStorePreferences(); if (preferences == null) { return; } if (preferencesListener != null) { preferences.removePreferenceChangeListener(preferencesListener); preferencesListener = null; } }
Example 3
Source File: ThemeManager.java From tm4e with Eclipse Public License 1.0 | 5 votes |
/** * Remove preference change listener to observe changed of Eclipse E4 Theme and * TextMate theme association with grammar. * * @param themeChangeListener */ public void removePreferenceChangeListener(IPreferenceChangeListener themeChangeListener) { // Observe change of Eclipse E4 Theme IEclipsePreferences preferences = PreferenceUtils.getE4PreferenceStore(); if (preferences != null) { preferences.removePreferenceChangeListener(themeChangeListener); } // Observe change of TextMate Theme association preferences = InstanceScope.INSTANCE.getNode(TMUIPlugin.PLUGIN_ID); if (preferences != null) { preferences.removePreferenceChangeListener(themeChangeListener); } }
Example 4
Source File: PreferenceRecorder.java From workspacemechanic with Eclipse Public License 1.0 | 5 votes |
/** * Ends the recording process. No other changes to the preference tree are * recorded after this method is called. * * @throws IllegalStateException if {@code startRecording()} had not been * previously called, or if recording has already completed on this * object. */ public void endRecording() { synchronized (lock) { Preconditions.checkState(currState == State.RECORDING, "Recorder object is not currently recording"); currState = State.COMPLETE; for (IEclipsePreferences node : recordedNodes) { node.removeNodeChangeListener(listener); node.removePreferenceChangeListener(listener); } recordedNodes.clear(); } }
Example 5
Source File: PreferenceKey.java From xds-ide with Eclipse Public License 1.0 | 5 votes |
public static void removeChangeListener(IScopeContext context, IWorkingCopyManager manager, String qualifier, IPreferenceChangeListener listener) { IEclipsePreferences node= context.getNode(qualifier); if (manager != null) { node = manager.getWorkingCopy(node); } node.removePreferenceChangeListener(listener); }
Example 6
Source File: UIPlugin.java From APICloud-Studio with GNU General Public License v3.0 | 5 votes |
/** * Remove the auto-build action listener. */ private void removeAutoBuildListener() { if (autoBuildListener != null) { IEclipsePreferences node = EclipseUtil.instanceScope().getNode(ResourcesPlugin.PI_RESOURCES); node.removePreferenceChangeListener(autoBuildListener); autoBuildListener = null; } }
Example 7
Source File: RendererPreferences.java From depan with Apache License 2.0 | 4 votes |
public void dispose() { // TODO(leeca): What does this do? // listen the changes in the configuration IEclipsePreferences prefs = PreferencesIds.getInstanceNode(); prefs.removePreferenceChangeListener(this); }
Example 8
Source File: InvasiveThemeHijacker.java From APICloud-Studio with GNU General Public License v3.0 | 4 votes |
public void dispose() { IEclipsePreferences prefs = EclipseUtil.instanceScope().getNode(ThemePlugin.PLUGIN_ID); prefs.removePreferenceChangeListener(this); pageListener = null; }
Example 9
Source File: JavaProject.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 4 votes |
/** * Returns the project custom preference pool. * Project preferences may include custom encoding. * @return IEclipsePreferences or <code>null</code> if the project * does not have a java nature. */ public IEclipsePreferences getEclipsePreferences() { if (!JavaProject.hasJavaNature(this.project)) return null; // Get cached preferences if exist JavaModelManager.PerProjectInfo perProjectInfo = JavaModelManager.getJavaModelManager().getPerProjectInfo(this.project, true); if (perProjectInfo.preferences != null) return perProjectInfo.preferences; // Init project preferences IScopeContext context = new ProjectScope(getProject()); final IEclipsePreferences eclipsePreferences = context.getNode(JavaCore.PLUGIN_ID); updatePreferences(eclipsePreferences); perProjectInfo.preferences = eclipsePreferences; // Listen to new preferences node final IEclipsePreferences eclipseParentPreferences = (IEclipsePreferences) eclipsePreferences.parent(); if (eclipseParentPreferences != null) { if (this.preferencesNodeListener != null) { eclipseParentPreferences.removeNodeChangeListener(this.preferencesNodeListener); } this.preferencesNodeListener = new IEclipsePreferences.INodeChangeListener() { public void added(IEclipsePreferences.NodeChangeEvent event) { // do nothing } public void removed(IEclipsePreferences.NodeChangeEvent event) { if (event.getChild() == eclipsePreferences) { JavaModelManager.getJavaModelManager().resetProjectPreferences(JavaProject.this); } } }; eclipseParentPreferences.addNodeChangeListener(this.preferencesNodeListener); } // Listen to preferences changes if (this.preferencesChangeListener != null) { eclipsePreferences.removePreferenceChangeListener(this.preferencesChangeListener); } this.preferencesChangeListener = new IEclipsePreferences.IPreferenceChangeListener() { public void preferenceChange(IEclipsePreferences.PreferenceChangeEvent event) { String propertyName = event.getKey(); JavaModelManager manager = JavaModelManager.getJavaModelManager(); if (propertyName.startsWith(JavaCore.PLUGIN_ID)) { if (propertyName.equals(JavaCore.CORE_JAVA_BUILD_CLEAN_OUTPUT_FOLDER) || propertyName.equals(JavaCore.CORE_JAVA_BUILD_RESOURCE_COPY_FILTER) || propertyName.equals(JavaCore.CORE_JAVA_BUILD_DUPLICATE_RESOURCE) || propertyName.equals(JavaCore.CORE_JAVA_BUILD_RECREATE_MODIFIED_CLASS_FILES_IN_OUTPUT_FOLDER) || propertyName.equals(JavaCore.CORE_JAVA_BUILD_INVALID_CLASSPATH) || propertyName.equals(JavaCore.CORE_ENABLE_CLASSPATH_EXCLUSION_PATTERNS) || propertyName.equals(JavaCore.CORE_ENABLE_CLASSPATH_MULTIPLE_OUTPUT_LOCATIONS) || propertyName.equals(JavaCore.CORE_INCOMPLETE_CLASSPATH) || propertyName.equals(JavaCore.CORE_CIRCULAR_CLASSPATH) || propertyName.equals(JavaCore.CORE_OUTPUT_LOCATION_OVERLAPPING_ANOTHER_SOURCE) || propertyName.equals(JavaCore.CORE_INCOMPATIBLE_JDK_LEVEL) || propertyName.equals(JavaCore.COMPILER_CODEGEN_TARGET_PLATFORM)) { manager.deltaState.addClasspathValidation(JavaProject.this); } manager.resetProjectOptions(JavaProject.this); JavaProject.this.resetCaches(); // see https://bugs.eclipse.org/bugs/show_bug.cgi?id=233568 } } }; eclipsePreferences.addPreferenceChangeListener(this.preferencesChangeListener); return eclipsePreferences; }