Java Code Examples for org.eclipse.core.resources.IWorkspace#removeResourceChangeListener()
The following examples show how to use
org.eclipse.core.resources.IWorkspace#removeResourceChangeListener() .
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: ModelRefreshTests.java From google-cloud-eclipse with Apache License 2.0 | 6 votes |
/** Record and return the set of files altered when running the provided block. */ private static Set<IFile> recordChangedFilesDuring(IWorkspace workspace, ICoreRunnable block) throws CoreException { Set<IFile> changed = new LinkedHashSet<>(); IResourceChangeListener listener = event -> { try { changed.addAll(ResourceUtils.getAffectedFiles(event.getDelta()).values()); } catch (CoreException ex) { throw new RuntimeException(ex); } }; workspace.addResourceChangeListener(listener); try { block.run(new NullProgressMonitor()); } finally { workspace.removeResourceChangeListener(listener); } return changed; }
Example 2
Source File: DotGraphView.java From gef with Eclipse Public License 2.0 | 6 votes |
private void toggleResourceListener() { IWorkspace workspace = ResourcesPlugin.getWorkspace(); ISelectionService service = getSite().getWorkbenchWindow() .getSelectionService(); if (listenToDotContent) { IWorkbenchPart activeEditor = PlatformUI.getWorkbench() .getActiveWorkbenchWindow().getActivePage() .getActiveEditor(); checkActiveEditorAndUpdateGraph(activeEditor); workspace.addResourceChangeListener(resourceChangeListener, IResourceChangeEvent.POST_BUILD | IResourceChangeEvent.POST_CHANGE); service.addSelectionListener(selectionChangeListener); } else { workspace.removeResourceChangeListener(resourceChangeListener); service.removeSelectionListener(selectionChangeListener); } }
Example 3
Source File: WorkspaceSpecManager.java From tlaplus with MIT License | 6 votes |
/** * Destructor */ public void terminate() { IWorkspace ws = ResourcesPlugin.getWorkspace(); ws.removeResourceChangeListener(this); if (this.loadedSpec != null && PreferenceStoreHelper.getInstancePreferenceStore().getBoolean( IPreferenceConstants.I_RESTORE_LAST_SPEC)) { PreferenceStoreHelper.getInstancePreferenceStore().setValue(IPreferenceConstants.I_SPEC_LOADED, this.loadedSpec.getName()); } else { PreferenceStoreHelper.getInstancePreferenceStore().setValue(IPreferenceConstants.I_SPEC_LOADED, ""); } }
Example 4
Source File: JavaReconciler.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 6 votes |
@Override public void uninstall() { IWorkbenchPartSite site= fTextEditor.getSite(); IWorkbenchWindow window= site.getWorkbenchWindow(); window.getPartService().removePartListener(fPartListener); fPartListener= null; Shell shell= window.getShell(); if (shell != null && !shell.isDisposed()) shell.removeShellListener(fActivationListener); fActivationListener= null; JavaCore.removeElementChangedListener(fJavaElementChangedListener); fJavaElementChangedListener= null; IWorkspace workspace= JavaPlugin.getWorkspace(); workspace.removeResourceChangeListener(fResourceChangeListener); fResourceChangeListener= null; JavaPlugin.getDefault().getCombinedPreferenceStore().removePropertyChangeListener(fPropertyChangeListener); fPropertyChangeListener= null; super.uninstall(); }
Example 5
Source File: N4JSProjectActionGroup.java From n4js with Eclipse Public License 1.0 | 5 votes |
@Override public void dispose() { selectionProvider.removeSelectionChangedListener(selectionChangedListener); selectionProvider = null; final IWorkspace workspace = ResourcesPlugin.getWorkspace(); workspace.removeResourceChangeListener(openAction); workspace.removeResourceChangeListener(closeAction); workspace.removeResourceChangeListener(closeUnrelatedAction); super.dispose(); }
Example 6
Source File: XdsResourceChangeListener.java From xds-ide with Eclipse Public License 1.0 | 5 votes |
/** * Uninstalls the {@link IWorkspace#removeResourceChangeListener(IResourceChangeListener)} */ public void stop(){ try { IWorkspace workspace = ResourcesPlugin.getWorkspace(); if (workspace != null) { workspace.removeResourceChangeListener(this); } } catch (java.lang.IllegalStateException e) { } }
Example 7
Source File: SVNProviderPlugin.java From APICloud-Studio with GNU General Public License v3.0 | 5 votes |
/** * @see Plugin#stop(BundleContext ctxt) */ public void stop(BundleContext ctxt) throws Exception { super.stop(ctxt); // remove listeners IWorkspace workspace = ResourcesPlugin.getWorkspace(); workspace.removeResourceChangeListener(statusCacheManager); workspace.removeResourceChangeListener(metaFileSyncListener); workspace.removeResourceChangeListener(fileModificationManager); workspace.removeResourceChangeListener(teamPrivateListener); workspace.removeResourceChangeListener(revertManager); // save the state which includes the known repositories if (repositories != null) { repositories.shutdown(); } adapterFactories.shutdown(null); getPluginPreferences().removePropertyChangeListener(statusCacheManager); // save the plugin preferences savePluginPreferences(); // remove all of this plugin's save participants. This is easier than // having // each class that added itself as a participant to have to listen to // shutdown. workspace.removeSaveParticipant(this); if (svnClientManager != null) svnClientManager.shutdown(null); getChangeSetManager().dispose(); }
Example 8
Source File: BibtexEntryView.java From slr-toolkit with Eclipse Public License 1.0 | 5 votes |
@Override public void dispose() { IWorkspace workspace = ResourcesPlugin.getWorkspace(); workspace.removeResourceChangeListener(markerChangeListener); workspace.removeResourceChangeListener(projectChangeListener); super.dispose(); }
Example 9
Source File: ProjectActionGroup.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 5 votes |
@Override public void dispose() { fSelectionProvider.removeSelectionChangedListener(fSelectionChangedListener); fSelectionProvider= null; IWorkspace workspace = ResourcesPlugin.getWorkspace(); workspace.removeResourceChangeListener(fOpenAction); workspace.removeResourceChangeListener(fCloseAction); workspace.removeResourceChangeListener(fCloseUnrelatedAction); super.dispose(); }
Example 10
Source File: SarosSessionTest.java From saros with GNU General Public License v2.0 | 5 votes |
private static IWorkspace createWorkspaceMock(final List<Object> workspaceListeners) { final IWorkspace workspace = createMock(IWorkspace.class); workspace.addResourceChangeListener(isA(IResourceChangeListener.class), anyInt()); expectLastCall() .andStubAnswer( new IAnswer<Object>() { @Override public Object answer() throws Throwable { workspaceListeners.add(getCurrentArguments()[0]); return null; } }); workspace.removeResourceChangeListener(isA(IResourceChangeListener.class)); expectLastCall() .andStubAnswer( new IAnswer<Object>() { @Override public Object answer() throws Throwable { workspaceListeners.remove(getCurrentArguments()[0]); return null; } }); replay(workspace); PowerMock.mockStaticPartial(ResourcesPlugin.class, "getWorkspace"); ResourcesPlugin.getWorkspace(); expectLastCall().andReturn(workspace).anyTimes(); PowerMock.replay(ResourcesPlugin.class); return workspace; }
Example 11
Source File: ResourceCache.java From depan with Apache License 2.0 | 4 votes |
protected void releaseWorkspace(IWorkspace workspace) { workspace.removeResourceChangeListener(this); }