org.eclipse.ui.actions.WorkingSetFilterActionGroup Java Examples

The following examples show how to use org.eclipse.ui.actions.WorkingSetFilterActionGroup. 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: WorkingSetActionProvider.java    From translationstudio8 with GNU General Public License v2.0 6 votes vote down vote up
public void init(ICommonActionExtensionSite aSite) {
	viewer = (CommonViewer) aSite.getStructuredViewer();
	contentService = aSite.getContentService();
	filterService = (NavigatorFilterService) contentService.getFilterService();

	extensionStateModel = contentService.findStateModel(WorkingSetsContentProvider.EXTENSION_ID);

	workingSetActionGroup = new WorkingSetFilterActionGroup(aSite.getViewSite().getShell(), filterChangeListener);
	workingSetRootModeActionGroup = new WorkingSetRootModeActionGroup(viewer, extensionStateModel);

	topLevelModeListener = new IPropertyChangeListener() {
		public void propertyChange(PropertyChangeEvent event) {
			setWorkingSet(workingSet);
			viewer.getFrameList().reset();
		}
	};

	if (contentService.isActive(WorkingSetsContentProvider.EXTENSION_ID)) {
		managerChangeListener.listen();
		extensionStateModel.addPropertyChangeListener(topLevelModeListener);
	}

	contentService.getActivationService().addExtensionActivationListener(activationListener);
}
 
Example #2
Source File: WorkingSetActionProvider.java    From tmxeditor8 with GNU General Public License v2.0 6 votes vote down vote up
public void init(ICommonActionExtensionSite aSite) {
	viewer = (CommonViewer) aSite.getStructuredViewer();
	contentService = aSite.getContentService();
	filterService = (NavigatorFilterService) contentService.getFilterService();

	extensionStateModel = contentService.findStateModel(WorkingSetsContentProvider.EXTENSION_ID);

	workingSetActionGroup = new WorkingSetFilterActionGroup(aSite.getViewSite().getShell(), filterChangeListener);
	workingSetRootModeActionGroup = new WorkingSetRootModeActionGroup(viewer, extensionStateModel);

	topLevelModeListener = new IPropertyChangeListener() {
		public void propertyChange(PropertyChangeEvent event) {
			setWorkingSet(workingSet);
			viewer.getFrameList().reset();
		}
	};

	if (contentService.isActive(WorkingSetsContentProvider.EXTENSION_ID)) {
		managerChangeListener.listen();
		extensionStateModel.addPropertyChangeListener(topLevelModeListener);
	}

	contentService.getActivationService().addExtensionActivationListener(activationListener);
}
 
Example #3
Source File: BugActionProvider.java    From spotbugs with GNU Lesser General Public License v2.1 4 votes vote down vote up
@Override
public void init(ICommonActionExtensionSite aSite) {
    site = aSite;
    super.init(aSite);
    final StructuredViewer viewer = aSite.getStructuredViewer();
    final BugContentProvider provider = BugContentProvider.getProvider(site.getContentService());

    filterChangeListener = new IPropertyChangeListener() {

        @Override
        public void propertyChange(PropertyChangeEvent event) {
            if (!initDone) {
                return;
            }
            IWorkingSet oldWorkingSet = provider.getCurrentWorkingSet();
            IWorkingSet oldWorkingSet1 = (IWorkingSet) event.getOldValue();
            IWorkingSet newWorkingSet = (IWorkingSet) event.getNewValue();
            if (newWorkingSet != null && (oldWorkingSet == newWorkingSet || oldWorkingSet1 == newWorkingSet)) {
                return;
            }
            if (viewer != null) {
                provider.setCurrentWorkingSet(newWorkingSet);
                if (newWorkingSet == null) {
                    viewer.setInput(ResourcesPlugin.getWorkspace().getRoot());
                } else if (oldWorkingSet != newWorkingSet) {
                    viewer.setInput(newWorkingSet);
                }
            }
        }
    };


    workingSetActionGroup = new WorkingSetFilterActionGroup(aSite.getViewSite().getShell(), filterChangeListener);
    if (provider == null)
        throw new NullPointerException("no provider");
    workingSetActionGroup.setWorkingSet(provider.getCurrentWorkingSet());
    doubleClickAction = new MyAction();
    // only if doubleClickAction must know tree selection:
    viewer.addSelectionChangedListener(doubleClickAction);
    initDone = true;
}
 
Example #4
Source File: GlobalsTwoPanelElementSelector2.java    From Pydev with Eclipse Public License 1.0 4 votes vote down vote up
/**
 * We need to add the action for the working set.
 */
@Override
protected void fillViewMenu(IMenuManager menuManager) {
    super.fillViewMenu(menuManager);

    workingSetFilterActionGroup = new WorkingSetFilterActionGroup(getShell(), new IPropertyChangeListener() {
        @Override
        public void propertyChange(PropertyChangeEvent event) {
            String property = event.getProperty();

            if (WorkingSetFilterActionGroup.CHANGE_WORKING_SET.equals(property)) {

                IWorkingSet workingSet = (IWorkingSet) event.getNewValue();

                if (workingSet != null && !(workingSet.isAggregateWorkingSet() && workingSet.isEmpty())) {
                    workingSetFilter.setWorkingSet(workingSet);
                    setSubtitle(workingSet.getLabel());
                } else {
                    IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();

                    if (window != null) {
                        IWorkbenchPage page = window.getActivePage();
                        workingSet = page.getAggregateWorkingSet();

                        if (workingSet.isAggregateWorkingSet() && workingSet.isEmpty()) {
                            workingSet = null;
                        }
                    }

                    workingSetFilter.setWorkingSet(workingSet);
                    setSubtitle(null);
                }

                scheduleRefresh();
            }
        }
    });

    menuManager.add(new Separator());
    workingSetFilterActionGroup.fillContextMenu(menuManager);
}