Java Code Examples for org.eclipse.ui.IWorkingSetManager#addPropertyChangeListener()

The following examples show how to use org.eclipse.ui.IWorkingSetManager#addPropertyChangeListener() . 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: WorkingSetFilterActionGroup.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 6 votes vote down vote up
public WorkingSetFilterActionGroup(IWorkbenchPartSite site, IPropertyChangeListener changeListener) {
	Assert.isNotNull(site);
	Assert.isNotNull(changeListener);

	fChangeListener= changeListener;
	fWorkbenchPage= site.getPage();
	fAllowWindowWorkingSetByDefault= true;
	fClearWorkingSetAction= new ClearWorkingSetAction(this);
	fSelectWorkingSetAction= new SelectWorkingSetAction(this, site);
	fEditWorkingSetAction= new EditWorkingSetAction(this, site);

	fWorkingSetListener= new IPropertyChangeListener() {
		public void propertyChange(PropertyChangeEvent event) {
			doPropertyChange(event);
		}
	};
	fWorkingSetFilter= new WorkingSetFilter();

	IWorkingSetManager manager= PlatformUI.getWorkbench().getWorkingSetManager();
	manager.addPropertyChangeListener(fWorkingSetListener);

	if (useWindowWorkingSetByDefault()) {
		setWorkingSet(site.getPage().getAggregateWorkingSet(), false);
	}
}
 
Example 2
Source File: WorkingSetFilterActionGroup.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 6 votes vote down vote up
public WorkingSetFilterActionGroup(Shell shell, IWorkbenchPage page, IPropertyChangeListener changeListener) {
	Assert.isNotNull(shell);
	Assert.isNotNull(changeListener);

	fWorkbenchPage= page;
	fAllowWindowWorkingSetByDefault= false;
	fChangeListener= changeListener;
	fClearWorkingSetAction= new ClearWorkingSetAction(this);
	fSelectWorkingSetAction= new SelectWorkingSetAction(this, shell);
	fEditWorkingSetAction= new EditWorkingSetAction(this, shell);

	fWorkingSetListener= new IPropertyChangeListener() {
		public void propertyChange(PropertyChangeEvent event) {
			doPropertyChange(event);
		}
	};

	fWorkingSetFilter= new WorkingSetFilter();

	IWorkingSetManager manager= PlatformUI.getWorkbench().getWorkingSetManager();
	manager.addPropertyChangeListener(fWorkingSetListener);

	setWorkingSet(null, false);
}
 
Example 3
Source File: ManualAssociationAwareWorkingSetManager.java    From n4js with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * Resets the state of all Eclipse based working sets that belong to the 'Resources' type.
 */
private void resetEclipseWorkingSetsBaseOnCurrentState() {
	try {
		if (getWorkbench() == null || getWorkbench().getWorkingSetManager() == null) {
			return; // happens during shutdown
		}

		// Removed listener otherwise due to the Eclipse based working set deletion
		// we would delete our content.
		getWorkbench().getWorkingSetManager().removePropertyChangeListener(this);

		deleteEclipseResourcesWorkingSets();
		final IWorkingSetManager manager = getWorkbench().getWorkingSetManager();
		for (final WorkingSet workingSet : getAllWorkingSets()) {
			if (!OTHERS_WORKING_SET_ID.equals(workingSet.getId())) {
				org.eclipse.ui.internal.WorkingSet eclipseWorkingSet = createEclipseWorkingSet(workingSet);
				eclipseWorkingSet.setId(WorkingSetManagerModificationStrategy.RESOURCE_WORKING_SET_ID);
				manager.addWorkingSet(eclipseWorkingSet);
			}
		}
	} finally {
		IWorkbench wb = getWorkbench();
		if (wb != null) {
			IWorkingSetManager wsm = wb.getWorkingSetManager();
			if (wsm != null) { // null-safe re-adding (can be null during shutdown)
				wsm.addPropertyChangeListener(this);
			}
		}
	}
}