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

The following examples show how to use org.eclipse.jface.action.IToolBarManager#getItems() . 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: HdViewPart.java    From http4e with Apache License 2.0 6 votes vote down vote up
public void fireAuthEnable( boolean enabled){
   IToolBarManager toolbar = this.getViewSite().getActionBars().getToolBarManager();
   IContributionItem[] items = toolbar.getItems();

   for (IContributionItem it : items) {
      if (it instanceof ActionContributionItem) {
         ActionContributionItem aci = (ActionContributionItem) it;
         if (aci.getAction() instanceof AuthenticationAction) {
            AuthenticationAction aa = (AuthenticationAction) aci.getAction();
            String img = null;
            if (enabled) {
               img = CoreImages.AUTH_ENABLED;
            } else {
               img = CoreImages.AUTH;
            }
            aa.setImageDescriptor(ImageDescriptor.createFromImage(ResourceUtils.getImage(CoreConstants.PLUGIN_UI, img)));
         }
      }
   }
}
 
Example 2
Source File: HdViewPart.java    From http4e with Apache License 2.0 6 votes vote down vote up
public void fireProxyEnable( boolean enabled){
   IToolBarManager toolbar = this.getViewSite().getActionBars().getToolBarManager();
   IContributionItem[] items = toolbar.getItems();
   for (IContributionItem it : items) {
      if (it instanceof ActionContributionItem) {
         ActionContributionItem aci = (ActionContributionItem) it;
         if (aci.getAction() instanceof ProxyAction) {
            ProxyAction aa = (ProxyAction) aci.getAction();
            String img = null;
            if (enabled) {
               img = CoreImages.PROXY_ENABLED;
            } else {
               img = CoreImages.PROXY;
            }
            aa.setImageDescriptor(ImageDescriptor.createFromImage(ResourceUtils.getImage(CoreConstants.PLUGIN_UI, img)));
         }
      }
   }
}
 
Example 3
Source File: KonsDetailView.java    From elexis-3-core with Eclipse Public License 1.0 6 votes vote down vote up
@Override
public void setUnlocked(boolean unlocked){
	boolean hlMandantEnabled =
		actEncounter != null && BillingServiceHolder.get().isEditable(actEncounter).isOK()
			&& CoreHub.acl.request(AccessControlDefaults.KONS_REASSIGN) && unlocked;
	hlMandant.setEnabled(hlMandantEnabled);
	boolean cbFallEnabled = actEncounter != null
		&& BillingServiceHolder.get().isEditable(actEncounter).isOK() && unlocked;
	comboViewerFall.getCombo().setEnabled(cbFallEnabled);
	text.setEditable(unlocked);
	
	// update the UI
	IToolBarManager mgr = ((IViewSite) getSite()).getActionBars().getToolBarManager();
	IContributionItem[] items = mgr.getItems();
	for (IContributionItem iContributionItem : items) {
		iContributionItem.update();
	}
}
 
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: DotGraphView.java    From gef with Eclipse Public License 2.0 5 votes vote down vote up
private boolean toggle(Action action, boolean input) {
	action.setChecked(!action.isChecked());
	IToolBarManager mgr = getViewSite().getActionBars().getToolBarManager();
	for (IContributionItem item : mgr.getItems()) {
		if (item instanceof ActionContributionItem
				&& ((ActionContributionItem) item).getAction() == action) {
			action.setChecked(!action.isChecked());
			return !input;
		}
	}
	return input;
}
 
Example 6
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();

}
 
Example 7
Source File: ConsoleAutoScrollPageParticipant.java    From APICloud-Studio with GNU General Public License v3.0 4 votes vote down vote up
public void init(IPageBookViewPage page, IConsole console)
{
	if (console.getType() != IDebugUIConstants.ID_PROCESS_CONSOLE_TYPE || !(page instanceof TextConsolePage))
	{
		return;
	}
	TextConsolePage consolePage = (TextConsolePage) page;
	TextConsoleViewer textViewer = consolePage.getViewer();
	if (!(textViewer instanceof IOConsoleViewer))
	{
		return;
	}
	final IOConsoleViewer viewer = (IOConsoleViewer) textViewer;
	scrollActionEnabled = viewer.isAutoScroll();
	final IToolBarManager toolBarManager = consolePage.getSite().getActionBars().getToolBarManager();
	IAction slAction = null;
	// Look for the ScrollLockAction
	for (IContributionItem item : toolBarManager.getItems())
	{
		if (item instanceof ActionContributionItem)
		{
			IAction action = ((ActionContributionItem) item).getAction();
			if (action instanceof ScrollLockAction)
			{
				slAction = action;
				break;
			}
		}
	}
	textWidget = viewer.getTextWidget();
	listener = new ConsoleListener(viewer, toolBarManager, slAction);

	// Based on Eclipse Snippet191 - Detects scrolling that were initiated by the user.
	textWidget.addListener(SWT.MouseDown, listener);
	textWidget.addListener(SWT.MouseMove, listener);
	textWidget.addListener(SWT.MouseUp, listener);
	textWidget.addListener(SWT.KeyDown, listener);
	textWidget.addListener(SWT.KeyUp, listener);
	ScrollBar vBar = textWidget.getVerticalBar();
	if (vBar != null)
	{
		vBar.addListener(SWT.Selection, listener);
	}
}