org.eclipse.jface.action.IToolBarManager Java Examples

The following examples show how to use org.eclipse.jface.action.IToolBarManager. 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: AbstractInfoView.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 6 votes vote down vote up
/**
 * Fills the actions bars.
 * <p>
 * Subclasses may extend.
 *
 * @param actionBars the action bars
 */
protected void fillActionBars(IActionBars actionBars) {
	IToolBarManager toolBar= actionBars.getToolBarManager();
	fillToolBar(toolBar);

	IAction action;

	action= getCopyToClipboardAction();
	if (action != null)
		actionBars.setGlobalActionHandler(ActionFactory.COPY.getId(), action);

	action= getSelectAllAction();
	if (action != null)
		actionBars.setGlobalActionHandler(ActionFactory.SELECT_ALL.getId(), action);

	IHandlerService handlerService= (IHandlerService) getSite().getService(IHandlerService.class);
	handlerService.activateHandler(IWorkbenchCommandConstants.NAVIGATE_TOGGLE_LINK_WITH_EDITOR, new ActionHandler(fToggleLinkAction));
}
 
Example #2
Source File: AbstractSegmentStoreDensityView.java    From tracecompass with Eclipse Public License 2.0 6 votes vote down vote up
@Override
public void createPartControl(@Nullable Composite parent) {
    super.createPartControl(parent);
    final SashForm sashForm = new SashForm(parent, SWT.NONE);

    fTableViewer = createSegmentStoreTableViewer(sashForm);
    fDensityViewer = createSegmentStoreDensityViewer(sashForm);
    fDensityViewer.addDataListener(new DataChangedListener());

    sashForm.setWeights(DEFAULT_WEIGHTS);

    Action zoomOut = new ZoomOutAction(this);
    IToolBarManager toolBar = getViewSite().getActionBars().getToolBarManager();
    toolBar.add(zoomOut);
    ITmfTrace trace = TmfTraceManager.getInstance().getActiveTrace();
    if (trace != null) {
        TmfTraceSelectedSignal signal = new TmfTraceSelectedSignal(this, trace);
        if (fDensityViewer != null) {
            fDensityViewer.traceSelected(signal);
        }
        if (fTableViewer != null) {
            fTableViewer.traceSelected(signal);
        }
    }
}
 
Example #3
Source File: AbstractFormPage.java    From typescript.java with MIT License 6 votes vote down vote up
@Override
protected void createFormContent(IManagedForm managedForm) {
	final ScrolledForm form = managedForm.getForm();
	FormToolkit toolkit = managedForm.getToolkit();
	toolkit.decorateFormHeading(form.getForm());

	IToolBarManager manager = form.getToolBarManager();
	if (contributeToToolbar(manager)) {
		form.updateToolBar();
	}
	String titleText = getFormTitleText();
	if (titleText != null) {
		form.setText(titleText);
	}
	Image titleImage = getFormTitleImage();
	if (titleImage != null) {
		form.setImage(titleImage);
	}
	toolkit.decorateFormHeading(form.getForm());
	createUI(managedForm);
}
 
Example #4
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 #5
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 #6
Source File: RecipeActionBarContributor.java    From neoscada with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * This adds Separators for editor additions to the tool bar.
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
@Override
public void contributeToToolBar ( IToolBarManager toolBarManager )
{
    toolBarManager.add ( new Separator ( "recipe-settings" ) ); //$NON-NLS-1$
    toolBarManager.add ( new Separator ( "recipe-additions" ) ); //$NON-NLS-1$
}
 
Example #7
Source File: DerivedSourceView.java    From xtext-xtend with Eclipse Public License 2.0 5 votes vote down vote up
private void createActions() {
	IActionBars actionBars = getViewSite().getActionBars();
	IToolBarManager toolBarManager = actionBars.getToolBarManager();
	openEditorAction = new OpenEditorAction(this);
	openEditorAction.setEnabled(false);
	toolBarManager.add(openEditorAction);
	toolBarManager.add(new DerivedSourceDropDownAction(this));
}
 
Example #8
Source File: ReferrersView.java    From Pydev with Eclipse Public License 1.0 5 votes vote down vote up
@Override
protected void configureToolBar(IViewSite viewSite) {
    IActionBars actionBars = viewSite.getActionBars();
    IToolBarManager toolBar = actionBars.getToolBarManager();
    //IMenuManager menuManager = actionBars.getMenuManager(); -- not adding anything to the menu for now.

    toolBar.add(new ClearCurrentReferrers(this));

}
 
Example #9
Source File: SecurityActionBarContributor.java    From neoscada with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * This adds Separators for editor additions to the tool bar.
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
@Override
public void contributeToToolBar ( IToolBarManager toolBarManager )
{
    toolBarManager.add ( new Separator ( "security-settings" ) ); //$NON-NLS-1$
    toolBarManager.add ( new Separator ( "security-additions" ) ); //$NON-NLS-1$
}
 
Example #10
Source File: MemberFilterActionGroup.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * Adds the filter actions to the given tool bar
 *
 * @param tbm the tool bar to which the actions are added
 */
public void contributeToToolBar(IToolBarManager tbm) {
	if (fInViewMenu)
		return;
	for (int i= 0; i < fFilterActions.length; i++) {
		tbm.add(fFilterActions[i]);
	}
}
 
Example #11
Source File: GraphicalView.java    From eclipsegraphviz with Eclipse Public License 1.0 5 votes vote down vote up
private void updateAutoSyncToggleButtonState() {
    IToolBarManager toolBarManager = getViewSite().getActionBars().getToolBarManager();
    ActionContributionItem autoSyncToggleContribution = (ActionContributionItem) toolBarManager
            .find("com.abstratt.imageviewer.autoUpdate");
    if (autoSyncToggleContribution != null) {
        IAction action = autoSyncToggleContribution.getAction();
        action.setChecked(isAutoSync());
    }
}
 
Example #12
Source File: DesignerActionBarContributor.java    From birt with Eclipse Public License 1.0 5 votes vote down vote up
public void contributeToToolBar( IToolBarManager tbm )
{

	tbm.add( new Separator( ) );
	String[] zoomStrings = new String[]{
			ZoomManager.FIT_ALL,
			ZoomManager.FIT_HEIGHT,
			ZoomManager.FIT_WIDTH
	};
	ZoomComboContributionItem zoomComboContributionItem = new ZoomComboContributionItem( getPage( ),
			zoomStrings ) {

		protected Control createControl( Composite parent )
		{
			Control control = super.createControl( parent );
			control.setToolTipText( Messages.getString( "DesignerActionBarContributor.menu.zoomCombo.tooltip" ) );
			return control;
		}
	};

	if ( getPage( ) != null && getPage( ).getActivePart( ) != null )
	{
		zoomComboContributionItem.setZoomManager( (ZoomManager) getPage( ).getActivePart( )
				.getAdapter( ZoomManager.class ) );
	}

	zoomComboContributionItem.setVisible( true );
	tbm.add( zoomComboContributionItem );

	toggleBreadcrumbAction = new ToggleBreadcrumbAction( getPage( ) );
	tbm.add( toggleBreadcrumbAction );
}
 
Example #13
Source File: WorldActionBarContributor.java    From neoscada with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * This adds Separators for editor additions to the tool bar.
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
@Override
public void contributeToToolBar ( IToolBarManager toolBarManager )
{
    toolBarManager.add ( new Separator ( "world-settings" ) ); //$NON-NLS-1$
    toolBarManager.add ( new Separator ( "world-additions" ) ); //$NON-NLS-1$
}
 
Example #14
Source File: ApplicationActionBarAdvisor.java    From tmxeditor8 with GNU General Public License v2.0 5 votes vote down vote up
private IToolBarManager createToolItem(ICoolBarManager coolBar) {
		IToolBarManager toolBar = new ToolBarManager(coolBar.getStyle());
		coolBar.add(new ToolBarContributionItem(toolBar, "findreplace"));
		//没有设计 24 的图标,所以屏蔽工具栏
//		toolBar.add(cutAction);
//		toolBar.add(copyAction);
//		toolBar.add(pasteAction);
//		toolBar.add(findAction);
		return toolBar;
	}
 
Example #15
Source File: FeatureStructureBrowserViewPage.java    From uima-uimaj with Apache License 2.0 5 votes vote down vote up
/**
 * Adds the following actions to the toolbar: {@link FeatureStructureBrowserViewPage.CreateAction}
 * DeleteAction
 *
 * @param menuManager the menu manager
 * @param toolBarManager the tool bar manager
 * @param statusLineManager the status line manager
 */
@Override
public void makeContributions(IMenuManager menuManager, IToolBarManager toolBarManager,
        IStatusLineManager statusLineManager) {
  // create
  Action createAction = new CreateAction();
  createAction.setText("Create");
  createAction.setImageDescriptor(CasEditorPlugin.getTaeImageDescriptor(Images.ADD));
  toolBarManager.add(createAction);

  // delete
  toolBarManager.add(ActionFactory.DELETE.create(getSite().getWorkbenchWindow()));
}
 
Example #16
Source File: CustomMessageConsole.java    From gwt-eclipse-plugin with Eclipse Public License 1.0 5 votes vote down vote up
private synchronized void setActiveToolbarManager(
    IToolBarManager toolBarManager) {
  this.activeToolBarManager = toolBarManager;

  // Ensure the terminate action exists on this toolbar
  setTerminateAction(terminateAction);
}
 
Example #17
Source File: MarkerStatsView.java    From eclipse-cs with GNU Lesser General Public License v2.1 5 votes vote down vote up
/**
 * {@inheritDoc}
 */
@Override
protected void initToolBar(IToolBarManager tbm) {
  tbm.add(mChartAction);
  tbm.add(new Separator());
  tbm.add(mDrillBackAction);
  tbm.add(mDrillDownAction);
  tbm.add(new FiltersAction(this));
}
 
Example #18
Source File: SinkView.java    From lapse-plus with GNU General Public License v3.0 5 votes vote down vote up
private void fillLocalToolBar(IToolBarManager manager) {
    manager.add(runAction);
    manager.add(setSafeAction);
    manager.add(copyToClipboardAction);
    manager.add(new Separator());
    manager.add(statAction);
    // manager.add(hideSafeAction);
    // manager.add(hideNoSourceAction);
}
 
Example #19
Source File: ReportExamplesView.java    From birt with Eclipse Public License 1.0 5 votes vote down vote up
private void registerActions( )
{
	final IActionBars actionBars = getViewSite( ).getActionBars( );
	IToolBarManager toolbarManager = actionBars.getToolBarManager( );
	exportAction = new ExportSampleReportAction( instance );
	toolbarManager.add( exportAction );
	toolbarManager.add( new Separator( ) );

	Object adapter = null;
	int status = Platform.getAdapterManager( ).queryAdapter( this,
			IAction.class.getName( ) );

	if ( status == IAdapterManager.LOADED )
	{
		adapter = Platform.getAdapterManager( ).getAdapter( this,
				IAction.class );
	}
	else if ( status == IAdapterManager.NOT_LOADED )
	{
		// Cause the plug-in loading first
		adapter = Platform.getAdapterManager( ).loadAdapter( this,
				IAction.class.getName( ) );
	}
	if ( adapter != null )
	{
		importAction = ( (IOpenSampleReportAction) adapter );
		importAction.setMainComposite( instance );
		toolbarManager.add( (Action) importAction );
	}

	actionBars.updateActionBars( );
}
 
Example #20
Source File: DeployConsolePageParticipant.java    From google-cloud-eclipse with Apache License 2.0 5 votes vote down vote up
private void configureToolBar(IToolBarManager toolbarManager) {
  terminateAction = createTerminateAction();
  toolbarManager.appendToGroup(IConsoleConstants.LAUNCH_GROUP, terminateAction);

  closeAction = createCloseAction();
  toolbarManager.appendToGroup(IConsoleConstants.LAUNCH_GROUP, closeAction);
}
 
Example #21
Source File: FilterView.java    From tracecompass with Eclipse Public License 2.0 5 votes vote down vote up
/**
 * Build the popup menu
 *
 * @param manager
 *            The manager to build
 */
private void fillLocalToolBar(IToolBarManager manager) {

    fSaveAction = new SaveAction();
    fSaveAction.setImageDescriptor(ImageDescriptor.createFromImage(SAVE_IMAGE));
    fSaveAction.setToolTipText(Messages.FilterView_SaveActionToolTipText);

    fAddAction = new AddAction();
    fAddAction.setImageDescriptor(ImageDescriptor.createFromImage(ADD_IMAGE));
    fAddAction.setToolTipText(Messages.FilterView_AddActionToolTipText);

    fExportAction = new ExportAction();
    fExportAction.setImageDescriptor(ImageDescriptor.createFromImage(EXPORT_IMAGE));
    fExportAction.setToolTipText(Messages.FilterView_ExportActionToolTipText);

    fImportAction = new ImportAction();
    fImportAction.setImageDescriptor(ImageDescriptor.createFromImage(IMPORT_IMAGE));
    fImportAction.setToolTipText(Messages.FilterView_ImportActionToolTipText);

    manager.add(fSaveAction);
    manager.add(new Separator("add_delete")); //$NON-NLS-1$
    manager.add(fAddAction);
    manager.add(new Separator("edit")); //$NON-NLS-1$
    manager.add(new Separator());
    manager.add(fExportAction);
    manager.add(fImportAction);
}
 
Example #22
Source File: PyUnitView.java    From Pydev with Eclipse Public License 1.0 5 votes vote down vote up
private void configureToolBar() {
    IActionBars actionBars = getViewSite().getActionBars();
    IToolBarManager toolBar = actionBars.getToolBarManager();
    IMenuManager menuManager = actionBars.getMenuManager();

    ShowViewOnTestRunAction showViewOnTestRunAction = new ShowViewOnTestRunAction(this);
    menuManager.add(showViewOnTestRunAction);
    IAction showTestRunnerPreferencesAction = new ShowTestRunnerPreferencesAction(this);
    menuManager.add(showTestRunnerPreferencesAction);

    ShowOnlyFailuresAction action = new ShowOnlyFailuresAction(this);
    toolBar.add(action);
    action.setChecked(this.showOnlyErrors);

    toolBar.add(new Separator());
    toolBar.add(new RelaunchAction(this));
    toolBar.add(new RelaunchErrorsAction(this));
    toolBar.add(new StopAction(this));

    toolBar.add(new Separator());
    toolBar.add(new RelaunchInBackgroundAction(this));

    toolBar.add(new Separator());
    toolBar.add(new HistoryAction(this));
    toolBar.add(fPinHistory);
    toolBar.add(new RestorePinHistoryAction(this));

    addOrientationPreferences(menuManager);
}
 
Example #23
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 #24
Source File: ProjectEditorActions.java    From olca-app with Mozilla Public License 2.0 5 votes vote down vote up
@Override
public void contributeToToolBar(IToolBarManager toolBar) {
	toolBar.add(Actions.onCalculate(() -> {
		log.trace("action -> calculate project");
		ProjectEditor e = getEditor();
		if (e == null)
			return;
		calculate(e.getModel(), e.getReport());
	}));
}
 
Example #25
Source File: SVNSynchronizeParticipant.java    From APICloud-Studio with GNU General Public License v3.0 5 votes vote down vote up
public void fillActionBars(IActionBars actionBars) {
	IToolBarManager manager = actionBars.getToolBarManager();
	
	appendToGroup(manager, ISynchronizePageConfiguration.NAVIGATE_GROUP, expandAllAction);
	appendToGroup(
			manager,
			TOOLBAR_CONTRIBUTION_GROUP,
			updateToolbar);	
	appendToGroup(
			manager,
			TOOLBAR_CONTRIBUTION_GROUP,
			commitToolbar);						
}
 
Example #26
Source File: PropertiesView.java    From tmxeditor8 with GNU General Public License v2.0 5 votes vote down vote up
private void addToolBarAction() {
	// 工具栏上添加按钮
	IToolBarManager toolBarManager = getViewSite().getActionBars().getToolBarManager();
	toolBarManager.add(addAction);
	toolBarManager.add(editAction);
	toolBarManager.add(deleteAction);
}
 
Example #27
Source File: TexOutlinePage.java    From texlipse with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * Create the toolbar.
 *
 */
private void createToolbar() {
    
    // add actions to the toolbar
    IToolBarManager toolbarManager = getSite().getActionBars().getToolBarManager();
    toolbarManager.add(outlineActions.get(ACTION_UPDATE));
    toolbarManager.add(outlineActions.get(ACTION_COLLAPSE));
    toolbarManager.add(outlineActions.get(ACTION_EXPAND));
    toolbarManager.add(outlineActions.get(ACTION_HIDE_SEC));
    toolbarManager.add(outlineActions.get(ACTION_HIDE_SUBSEC));
    toolbarManager.add(outlineActions.get(ACTION_HIDE_SUBSUBSEC));
    toolbarManager.add(outlineActions.get(ACTION_HIDE_PARAGRAPH));
    toolbarManager.add(outlineActions.get(ACTION_HIDE_FLOAT));
    toolbarManager.add(outlineActions.get(ACTION_HIDE_LABEL));
}
 
Example #28
Source File: BibOutlinePage.java    From texlipse with Eclipse Public License 1.0 5 votes vote down vote up
private void createToolbar() {
    // add actions to the toolbar
    IToolBarManager toolbarManager = getSite().getActionBars().getToolBarManager();
    toolbarManager.add((IAction)outlineActions.get(ACTION_BYINDEX));
    toolbarManager.add((IAction)outlineActions.get(ACTION_BYAUTHOR));    	
    toolbarManager.add((IAction)outlineActions.get(ACTION_BYJOURNAL));
    toolbarManager.add((IAction)outlineActions.get(ACTION_BYYEAR));      
    //adds the additional actions from the "BibEditorOutlineExtension"-Extension point
    if (this.extensionActions != null) {
    	for (Action a : this.extensionActions) {
    		toolbarManager.add(a);
    	}
    }
}
 
Example #29
Source File: SarosView.java    From saros with GNU General Public License v2.0 5 votes vote down vote up
protected void addToolBarItems(IToolBarManager toolBar) {
  toolBar.add(getAction(ChangeXMPPAccountAction.ACTION_ID));
  toolBar.add(getAction(NewContactAction.ACTION_ID));
  toolBar.add(getAction(OpenPreferencesAction.ACTION_ID));
  toolBar.add(new Separator());
  toolBar.add(getAction(FollowModeAction.ACTION_ID));
  toolBar.add(getAction(ConsistencyAction.ACTION_ID));
  toolBar.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS));
  toolBar.add(getAction(LeaveSessionAction.ACTION_ID));
}
 
Example #30
Source File: TmfView.java    From tracecompass with Eclipse Public License 2.0 5 votes vote down vote up
/**
 * Method adds a pin action to the TmfView. For example, this action can be used
 * to ignore time synchronization signals from other TmfViews. <br>
 *
 * Uses {@link ITmfPinnable#setPinned(ITmfTrace)} to propagate the state of the
 * action button.
 */
protected void contributePinActionToToolBar() {
    if (fPinAction == null && this instanceof ITmfPinnable) {
        fPinAction = new PinTmfViewAction((ITmfPinnable) this);

        IToolBarManager toolBarManager = getViewSite().getActionBars().getToolBarManager();
        toolBarManager.add(new Separator(IWorkbenchActionConstants.PIN_GROUP));
        toolBarManager.add(fPinAction);
    }
}