Java Code Examples for org.eclipse.jface.action.IToolBarManager#remove()

The following examples show how to use org.eclipse.jface.action.IToolBarManager#remove() . 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: N4JSActionBarContributionProvider.java    From n4js with Eclipse Public License 1.0 6 votes vote down vote up
@Override
public void topLevelElementChanged(final boolean workingSetTopLevel) {
	if (actionBars != null) {
		final IToolBarManager toolBarManager = actionBars.getToolBarManager();
		toolBarManager.remove(selectWorkingSetDelegate);
		toolBarManager.remove(showHiddenWorkingSetsDelegate);
		if (workingSetManagerBroker.isWorkingSetTopLevel()) {
			toolBarManager.add(selectWorkingSetDelegate);
			final WorkingSetManager manager = workingSetManagerBroker.getActiveManager();
			if (manager != null) {
				WorkingSet[] allItems = manager.getAllWorkingSets();
				WorkingSet[] items = manager.getWorkingSets();
				updateShowHiddenAction(allItems, items);
			}
		}
		selectTopLevelElementAction.fillActionBars(actionBars);
		actionBars.updateActionBars();
	}
}
 
Example 2
Source File: PackageExplorerActionGroup.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 6 votes vote down vote up
public void updateToolBar(IToolBarManager toolBar) {

		boolean hasBeenFrameActionsShown= fFrameActionsShown;
		fFrameActionsShown= fBackAction.isEnabled() || fUpAction.isEnabled() || fForwardAction.isEnabled();
		if (fFrameActionsShown != hasBeenFrameActionsShown) {
			if (hasBeenFrameActionsShown) {
				toolBar.remove(fBackAction.getId());
				toolBar.remove(fForwardAction.getId());
				toolBar.remove(fUpAction.getId());
				toolBar.remove(FRAME_ACTION_SEPARATOR_ID);
			} else {
				toolBar.prependToGroup(FRAME_ACTION_GROUP_ID, new Separator(FRAME_ACTION_SEPARATOR_ID));
				toolBar.prependToGroup(FRAME_ACTION_GROUP_ID, fUpAction);
				toolBar.prependToGroup(FRAME_ACTION_GROUP_ID, fForwardAction);
				toolBar.prependToGroup(FRAME_ACTION_GROUP_ID, fBackAction);
			}
			toolBar.update(true);
		}
	}
 
Example 3
Source File: N4JSActionBarContributionProvider.java    From n4js with Eclipse Public License 1.0 5 votes vote down vote up
private void updateShowHiddenAction(final WorkingSet[] allItems, final WorkingSet[] items) {
	final IToolBarManager toolBarManager = actionBars.getToolBarManager();
	toolBarManager.remove(showHiddenWorkingSetsDelegate);
	if (allItems.length > items.length) {
		toolBarManager.add(showHiddenWorkingSetsDelegate);
	}
}
 
Example 4
Source File: OrionConsoleView.java    From orion.server with Eclipse Public License 1.0 5 votes vote down vote up
protected void configureToolBar(IToolBarManager mgr) {
	super.configureToolBar(mgr);

	mgr.remove(IConsoleConstants.LAUNCH_GROUP);
	IContributionItem[] items = mgr.getItems();
	if (items.length >= 3) {
		mgr.remove(items[items.length - 1]);
		mgr.remove(items[items.length - 2]);
		mgr.remove(items[items.length - 3]);
	}
}
 
Example 5
Source File: ShowWhitespaceCharactersActionContributor.java    From xtext-xtend with Eclipse Public License 2.0 5 votes vote down vote up
@Override
public void editorDisposed(XtextEditor editor) {
	IToolBarManager toolBarManager = editor.getEditorSite().getActionBars().getToolBarManager();
	IContributionItem i = toolBarManager.remove(ITextEditorActionConstants.SHOW_WHITESPACE_CHARACTERS);
	if (i instanceof ActionContributionItem) {
		IAction action = ((ActionContributionItem) i).getAction();
		if (action instanceof ShowWhitespaceCharactersAction) {
			((ShowWhitespaceCharactersAction)action).setEditor(null);
		}
	}
}
 
Example 6
Source File: GamlMarkOccurrenceActionContributor.java    From gama with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void contributeActions(final XtextEditor editor) {
	super.contributeActions(editor);
	final IToolBarManager toolBarManager = editor.getEditorSite().getActionBars().getToolBarManager();
	final IContributionItem item = toolBarManager.find(getAction().getId());
	if (item != null) {
		toolBarManager.remove(item);
	}

}
 
Example 7
Source File: GamaNavigator.java    From gama with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void createPartControl(final Composite compo) {
	this.parent = GamaToolbarFactory.createToolbars(this, compo);

	super.createPartControl(parent);
	restoreState();
	final IToolBarManager tb = getViewSite().getActionBars().getToolBarManager();
	for (final IContributionItem item : tb.getItems()) {
		if (item instanceof ActionContributionItem) {
			final ActionContributionItem aci = (ActionContributionItem) item;
			final IAction action = aci.getAction();
			if (action instanceof LinkEditorAction) {
				link = action;
				tb.remove(aci);
			} else if (action instanceof org.eclipse.ui.internal.navigator.actions.CollapseAllAction) {
				tb.remove(aci);
			}

		}
	}
	linkItem.setSelection(link.isChecked());
	tb.update(true);
	tb.insertBefore("toolbar.toggle", byDate.toCheckAction());
	tb.insertBefore("toolbar.toggle", expandAll.toAction());
	tb.insertBefore(expandAll.getId(), collapseAll.toAction());

	try {
		final IDecoratorManager mgr = PlatformUI.getWorkbench().getDecoratorManager();
		mgr.setEnabled("msi.gama.application.date.decorator", false);
	} catch (final CoreException e) {
		e.printStackTrace();
	}
	properties =
			new PropertyDialogAction(new SameShellProvider(getSite().getShell()), getSite().getSelectionProvider());
	findControl.initialize();

}