Java Code Examples for org.eclipse.ui.IActionBars#getToolBarManager()

The following examples show how to use org.eclipse.ui.IActionBars#getToolBarManager() . 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: RootActionProvider.java    From codewind-eclipse with Eclipse Public License 2.0 6 votes vote down vote up
@Override
public void fillActionBars(IActionBars actionBars) {
	super.fillActionBars(actionBars);
	actionBars.setGlobalActionHandler(OpenAppAction.ACTION_ID, openAppAction);
	actionBars.setGlobalActionHandler(RestartRunModeAction.ACTION_ID, restartRunAction);
	actionBars.setGlobalActionHandler(RestartDebugModeAction.ACTION_ID, restartDebugAction);
	
	IContributionManager cm = actionBars.getToolBarManager();
	IContributionItem[] items = cm.getItems();
	List<IAction> existingActions = new ArrayList<IAction>();
	for (IContributionItem item : items) {
		if (item instanceof ActionContributionItem) {
			existingActions.add(((ActionContributionItem)item).getAction());
		}
	}
	if (!existingActions.contains(openAppAction)) {
		cm.appendToGroup(ICommonMenuConstants.GROUP_OPEN, openAppAction);
	}
	if (!existingActions.contains(restartRunAction)) {
		cm.appendToGroup(ICommonMenuConstants.GROUP_OPEN, restartRunAction);
	}
	if (!existingActions.contains(restartDebugAction)) {
		cm.appendToGroup(ICommonMenuConstants.GROUP_OPEN, restartDebugAction);
	}
}
 
Example 2
Source File: JavaOutlinePage.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 6 votes vote down vote up
private void registerToolbarActions(IActionBars actionBars) {
	IToolBarManager toolBarManager= actionBars.getToolBarManager();

	fCollapseAllAction= new CollapseAllAction(fOutlineViewer);
	fCollapseAllAction.setActionDefinitionId(CollapseAllHandler.COMMAND_ID);
	toolBarManager.add(fCollapseAllAction);

	toolBarManager.add(new LexicalSortingAction());

	fMemberFilterActionGroup= new MemberFilterActionGroup(fOutlineViewer, "org.eclipse.jdt.ui.JavaOutlinePage"); //$NON-NLS-1$
	fMemberFilterActionGroup.contributeToToolBar(toolBarManager);

	fCustomFiltersActionGroup.fillActionBars(actionBars);

	IMenuManager viewMenuManager= actionBars.getMenuManager();
	viewMenuManager.add(new Separator("EndFilterGroup")); //$NON-NLS-1$

	fToggleLinkingAction= new ToggleLinkingAction();
	fToggleLinkingAction.setActionDefinitionId(IWorkbenchCommandConstants.NAVIGATE_TOGGLE_LINK_WITH_EDITOR);
	viewMenuManager.add(new ClassOnlyAction());
	viewMenuManager.add(fToggleLinkingAction);

	fCategoryFilterActionGroup= new CategoryFilterActionGroup(fOutlineViewer, "org.eclipse.jdt.ui.JavaOutlinePage", new IJavaElement[] {fInput}); //$NON-NLS-1$
	fCategoryFilterActionGroup.contributeToViewMenu(viewMenuManager);
}
 
Example 3
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 4
Source File: CurrentExceptionView.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 EditIgnoredCaughtExceptions(this));
}
 
Example 5
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 6
Source File: ConsoleRestartLaunchPageParticipant.java    From Pydev with Eclipse Public License 1.0 5 votes vote down vote up
@Override
public void init(IPageBookViewPage page, IConsole console) {
    try {
        if (!(console instanceof ProcessConsole)) {
            return;
        }
        ProcessConsole processConsole = (ProcessConsole) console;
        IProcess process = processConsole.getProcess();
        if (process == null) {
            return;
        }
        String attribute = process.getAttribute(IMiscConstants.PYDEV_ADD_RELAUNCH_IPROCESS_ATTR);
        if (!IMiscConstants.PYDEV_ADD_RELAUNCH_IPROCESS_ATTR_TRUE.equals(attribute)) {
            //Only provide relaunch if specified
            return;
        }
        this.fConsole = processConsole;
        DebugPlugin.getDefault().addDebugEventListener(this);

        IActionBars bars = page.getSite().getActionBars();

        IToolBarManager toolbarManager = bars.getToolBarManager();

        restartLaunchAction = new RestartLaunchAction(page, processConsole);
        terminateAllLaunchesAction = new TerminateAllLaunchesAction();

        toolbarManager.appendToGroup(IConsoleConstants.LAUNCH_GROUP, restartLaunchAction);
        toolbarManager.appendToGroup(IConsoleConstants.LAUNCH_GROUP, terminateAllLaunchesAction);

        bars.updateActionBars();
    } catch (Exception e) {
        Log.log(e);
    }

}
 
Example 7
Source File: CommonOutlinePage.java    From APICloud-Studio with GNU General Public License v3.0 5 votes vote down vote up
private void registerActions(IActionBars actionBars)
{
	IToolBarManager toolBarManager = actionBars.getToolBarManager();
	if (toolBarManager != null)
	{
		toolBarManager.add(new SortingAction());
	}

	IMenuManager menu = actionBars.getMenuManager();

	fToggleLinkingAction = new ToggleLinkingAction();
	menu.add(fToggleLinkingAction);
}
 
Example 8
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 9
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 10
Source File: AbstractViewerActionGroup.java    From gef with Eclipse Public License 2.0 5 votes vote down vote up
@Override
public void fillActionBars(IActionBars actionBars) {
	IToolBarManager tbm = actionBars.getToolBarManager();
	for (IAdaptable.Bound<IViewer> va : getContributions()) {
		if (va instanceof IAction) {
			tbm.add((IAction) va);
		} else if (va instanceof IContributionItem) {
			tbm.add((IContributionItem) va);
		}
	}
}
 
Example 11
Source File: AbstractFXView.java    From gef with Eclipse Public License 2.0 5 votes vote down vote up
/**
 * Create actions for this view and registers at the action bars of the
 * view's site.
 */
protected void createActions() {
	IViewSite site = getViewSite();
	IActionBars actionBars = site.getActionBars();
	undoRedoActionGroup = new UndoRedoActionGroup(getSite(),
			(IUndoContext) getAdapter(IUndoContext.class), true);
	undoRedoActionGroup.fillActionBars(actionBars);

	deleteAction = new DeleteAction();
	getContentViewer().setAdapter(deleteAction);
	actionBars.setGlobalActionHandler(ActionFactory.DELETE.getId(),
			deleteAction);

	selectAllAction = new SelectAllAction();
	getContentViewer().setAdapter(selectAllAction);
	actionBars.setGlobalActionHandler(ActionFactory.SELECT_ALL.getId(),
			selectAllAction);

	zoomActionGroup = new ZoomActionGroup(new FitToViewportAction());
	getContentViewer().setAdapter(zoomActionGroup);
	fitToViewportActionGroup = new FitToViewportActionGroup();
	getContentViewer().setAdapter(fitToViewportActionGroup);
	scrollActionGroup = new ScrollActionGroup();
	getContentViewer().setAdapter(scrollActionGroup);

	IToolBarManager mgr = actionBars.getToolBarManager();
	zoomActionGroup.fillActionBars(actionBars);
	mgr.add(new Separator());
	fitToViewportActionGroup.fillActionBars(actionBars);
	mgr.add(new Separator());
	scrollActionGroup.fillActionBars(actionBars);
}
 
Example 12
Source File: DotGraphView.java    From gef with Eclipse Public License 2.0 5 votes vote down vote up
@Override
protected void createActions() {
	IActionBars actionBars = getViewSite().getActionBars();
	IToolBarManager mgr = actionBars.getToolBarManager();
	linkWithDotEditorAction = new LinkWithDotEditorAction();
	linkWithSelectionAction = new LinkWithSelectionAction();
	loadFileAction = new LoadFileAction();
	mgr.add(linkWithDotEditorAction);
	mgr.add(linkWithSelectionAction);
	mgr.add(loadFileAction);
	mgr.add(new Separator());
	super.createActions();
}
 
Example 13
Source File: SDView.java    From tracecompass with Eclipse Public License 2.0 4 votes vote down vote up
/**
 * Updates the view coolbar buttons state according to the value return by: -
 * ISDExtendedActionBarProvider.hasNextPage()<br>
 * - ISDExtendedActionBarProvider.hasPrevPage()<br>
 *
 */
public void updateCoolBar() {
    if (fSdPagingProvider != null) {
        IActionBars bar = getViewSite().getActionBars();
        if (bar == null) {
            return;
        }
        IToolBarManager barManager = bar.getToolBarManager();
        if (barManager == null) {
            return;
        }
        IContributionItem nextPage = barManager.find(NextPage.ID);
        if (nextPage instanceof ActionContributionItem) {
            IAction nextPageAction = ((ActionContributionItem) nextPage).getAction();
            if (nextPageAction instanceof NextPage) {
                ((NextPage) nextPageAction).setEnabled(fSdPagingProvider.hasNextPage());
            }
        }

        IContributionItem prevPage = barManager.find(PrevPage.ID);
        if (prevPage instanceof ActionContributionItem) {
            IAction prevPageAction = ((ActionContributionItem) prevPage).getAction();
            if (prevPageAction instanceof PrevPage) {
                ((PrevPage) prevPageAction).setEnabled(fSdPagingProvider.hasPrevPage());
            }
        }

        IContributionItem firstPage = barManager.find(FirstPage.ID);
        if (firstPage instanceof ActionContributionItem) {
            IAction firstPageAction = ((ActionContributionItem) firstPage).getAction();
            if (firstPageAction instanceof FirstPage) {
                ((FirstPage) firstPageAction).setEnabled(fSdPagingProvider.hasPrevPage());
            }
        }

        IContributionItem lastPage = barManager.find(LastPage.ID);
        if (lastPage instanceof ActionContributionItem) {
            IAction lastPageAction = ((ActionContributionItem) lastPage).getAction();
            if (lastPageAction instanceof LastPage) {
                ((LastPage) lastPageAction).setEnabled(fSdPagingProvider.hasNextPage());
            }
        }

        updatePagesMenuItem(bar);
    }
}
 
Example 14
Source File: AnnotationOutline.java    From uima-uimaj with Apache License 2.0 4 votes vote down vote up
/**
 * Adds the these actions to the global action handler: {@link DeleteFeatureStructureAction}
 * SelectAllAction.
 *
 * @param actionBars the new action bars
 */
@Override
public void setActionBars(IActionBars actionBars) {
  DeleteFeatureStructureAction deleteAction = new DeleteFeatureStructureAction(editor);

  actionBars.setGlobalActionHandler(ActionFactory.DELETE.getId(), deleteAction);

  getSite().getSelectionProvider().addSelectionChangedListener(deleteAction);

  actionBars.setGlobalActionHandler(ActionFactory.SELECT_ALL.getId(), new SelectAllAction());
  
  Action action = new SwitchStyleAction(this);
  
  IMenuManager dropDownMenu = actionBars.getMenuManager();
  dropDownMenu.add(action);
  
  IToolBarManager toolBarManager = actionBars.getToolBarManager();
  
  // wide left annotation side action
  WideLeftAnnotationSideAction wideLeftAnnotationSideAction = new WideLeftAnnotationSideAction(
          editor);
  wideLeftAnnotationSideAction.setActionDefinitionId(WideLeftAnnotationSideAction.ID);
  wideLeftAnnotationSideAction.setText("Wides the left annotation side");
  wideLeftAnnotationSideAction.setImageDescriptor(CasEditorPlugin
          .getTaeImageDescriptor(Images.WIDE_LEFT_SIDE));

  getSite().getSelectionProvider().addSelectionChangedListener(wideLeftAnnotationSideAction);
  actionBars.setGlobalActionHandler(WideLeftAnnotationSideAction.ID, wideLeftAnnotationSideAction);
  toolBarManager.add(wideLeftAnnotationSideAction);

  // lower left annotation side action
  LowerLeftAnnotationSideAction lowerLeftAnnotationSideAction = new LowerLeftAnnotationSideAction(
          editor);
  lowerLeftAnnotationSideAction.setActionDefinitionId(LowerLeftAnnotationSideAction.ID);
  lowerLeftAnnotationSideAction.setText("Lowers the left annotation side");
  lowerLeftAnnotationSideAction.setImageDescriptor(CasEditorPlugin
          .getTaeImageDescriptor(Images.LOWER_LEFT_SIDE));

  getSite().getSelectionProvider().addSelectionChangedListener(lowerLeftAnnotationSideAction);
  actionBars.setGlobalActionHandler(LowerLeftAnnotationSideAction.ID, lowerLeftAnnotationSideAction);
  toolBarManager.add(lowerLeftAnnotationSideAction);

  // lower right annotation side action
  LowerRightAnnotationSideAction lowerRightAnnotationSideAction =
    new LowerRightAnnotationSideAction(editor);
  lowerRightAnnotationSideAction.setActionDefinitionId(LowerRightAnnotationSideAction.ID);
  lowerRightAnnotationSideAction.setText("Lowers the right annotation side");
  lowerRightAnnotationSideAction.setImageDescriptor(CasEditorPlugin
          .getTaeImageDescriptor(Images.LOWER_RIGHT_SIDE));

  getSite().getSelectionProvider().addSelectionChangedListener(lowerRightAnnotationSideAction);
  actionBars.setGlobalActionHandler(LowerRightAnnotationSideAction.ID, lowerRightAnnotationSideAction);
  toolBarManager.add(lowerRightAnnotationSideAction);

  // wide right annotation side action
  WideRightAnnotationSideAction wideRightAnnotationSideAction = new WideRightAnnotationSideAction(
          editor);
  wideRightAnnotationSideAction.setActionDefinitionId(WideRightAnnotationSideAction.ID);
  wideRightAnnotationSideAction.setText("Wides the right annotation side");
  wideRightAnnotationSideAction.setImageDescriptor(CasEditorPlugin
          .getTaeImageDescriptor(Images.WIDE_RIGHT_SIDE));

  getSite().getSelectionProvider().addSelectionChangedListener(wideRightAnnotationSideAction);
  actionBars.setGlobalActionHandler(WideRightAnnotationSideAction.ID, wideRightAnnotationSideAction);
  toolBarManager.add(wideRightAnnotationSideAction);

  // merge action
  MergeAnnotationAction mergeAction = new MergeAnnotationAction(editor);
  getSite().getSelectionProvider().addSelectionChangedListener(mergeAction);
  mergeAction.setImageDescriptor(CasEditorPlugin.getTaeImageDescriptor(Images.MERGE));

  toolBarManager.add(mergeAction);

  // delete action
  toolBarManager.add(ActionFactory.DELETE.create(getSite().getWorkbenchWindow()));
  
  super.setActionBars(actionBars);
}
 
Example 15
Source File: JavaBrowsingPart.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 4 votes vote down vote up
protected void fillActionBars(IActionBars actionBars) {
	IToolBarManager toolBar= actionBars.getToolBarManager();
	fillToolBar(toolBar);


	if (fHasWorkingSetFilter)
		fWorkingSetFilterActionGroup.fillActionBars(getViewSite().getActionBars());

	actionBars.updateActionBars();

	fActionGroups.fillActionBars(actionBars);

	if (fHasCustomFilter)
		fCustomFiltersActionGroup.fillActionBars(actionBars);

	IMenuManager menu= actionBars.getMenuManager();
	menu.add(fToggleLinkingAction);
}
 
Example 16
Source File: LamiReportView.java    From tracecompass with Eclipse Public License 2.0 4 votes vote down vote up
@Override
public void createPartControl(@Nullable Composite parent) {
    LamiAnalysisReport report = fReport;
    if (report == null || parent == null) {
        return;
    }

    setPartName(report.getName());

    fTabFolder = new CTabFolder(parent, SWT.NONE);
    fTabFolder.setSimple(false);

    for (LamiResultTable table : report.getTables()) {
        String name = table.getTableClass().getTableTitle();

        CTabItem tabItem = new CTabItem(fTabFolder, SWT.NULL);
        tabItem.setText(name);

        SashForm sf = new SashForm(fTabFolder, SWT.NONE);
        fTabPages.add(new LamiReportViewTabPage(sf, table));
        tabItem.setControl(sf);
    }

    /* Add toolbar buttons */
    Action toggleTableAction = new ToggleTableAction();
    toggleTableAction.setText(Messages.LamiReportView_ActivateTableAction_ButtonName);
    toggleTableAction.setToolTipText(Messages.LamiReportView_ActivateTableAction_ButtonTooltip);
    toggleTableAction.setImageDescriptor(Activator.getDefault().getImageDescripterFromPath("icons/table.gif")); //$NON-NLS-1$

    IActionBars actionBars = getViewSite().getActionBars();
    IToolBarManager toolbarMgr = actionBars.getToolBarManager();
    toolbarMgr.add(toggleTableAction);

    fNewChartAction.setText(Messages.LamiReportView_NewCustomChart);

    fClearCustomViewsAction.setText(Messages.LamiReportView_ClearAllCustomViews);
    IMenuManager menuMgr = actionBars.getMenuManager();
    menuMgr.setRemoveAllWhenShown(true);
    menuMgr.addMenuListener((@Nullable IMenuManager manager) -> {
        if (manager != null) {
            populateMenu(manager);
        }
    });
    populateMenu(menuMgr);

    /* Select the first tab initially */
    CTabFolder tf = checkNotNull(fTabFolder);
    if (tf.getItemCount() > 0) {
        tf.setSelection(0);
    }

}
 
Example 17
Source File: SvnRevPropertiesView.java    From APICloud-Studio with GNU General Public License v3.0 4 votes vote down vote up
/**
 * Adds the action contributions for this view.
 */    
public void contributeActions() {
    // Contribute actions to popup menu for the table
//    MenuManager menuMgr = new MenuManager();
//    Menu menu = menuMgr.createContextMenu(tableViewer.getTable());
//    menuMgr.addMenuListener(new IMenuListener() {
//        public void menuAboutToShow(IMenuManager menuMgr) {
//            fillTableMenu(menuMgr);
//        }
//    });
//    menuMgr.setRemoveAllWhenShown(true);
//    tableViewer.getTable().setMenu(menu);
//    getSite().registerContextMenu(menuMgr, tableViewer); 

    // Create the local tool bar
    IActionBars actionBars = getViewSite().getActionBars();
    IToolBarManager tbm = actionBars.getToolBarManager();
    tbm.add(getRefreshAction());
    tbm.update(false);
    
    // set F1 help
    PlatformUI.getWorkbench().getHelpSystem().setHelp(tableViewer.getControl(), IHelpContextIds.REV_PROPERTIES_VIEW);

    // set the selectionchanged listener for the table
    // updates property value when selection changes
    tableViewer.addSelectionChangedListener(new ISelectionChangedListener() {
        public void selectionChanged(SelectionChangedEvent event) {
            ISelection selection = event.getSelection();
            if (selection == null || !(selection instanceof IStructuredSelection)) {
                textViewer.setDocument(new Document("")); //$NON-NLS-1$
                return;
            }
            IStructuredSelection ss = (IStructuredSelection)selection;
            if (ss.size() != 1) {
                textViewer.setDocument(new Document("")); //$NON-NLS-1$
                return;
            }
            ISVNProperty property = (ISVNProperty)ss.getFirstElement();
            textViewer.setDocument(new Document(property.getValue()));
        }
    });
}
 
Example 18
Source File: CommandTerminalDebugView.java    From typescript.java with MIT License 4 votes vote down vote up
private void addActions() {
	Action action = new ClearAction();
	IActionBars actionBars = getViewSite().getActionBars();
	IToolBarManager toolBar = actionBars.getToolBarManager();
	toolBar.add(action);
}
 
Example 19
Source File: SVNHistoryPage.java    From APICloud-Studio with GNU General Public License v3.0 4 votes vote down vote up
private void contributeActions() {
  toggleShowComments = new Action(Policy.bind("HistoryView.showComments"), //$NON-NLS-1$
      SVNUIPlugin.getPlugin().getImageDescriptor(ISVNUIConstants.IMG_COMMENTS)) {
    public void run() {
      showComments = isChecked();
      setViewerVisibility();
      store.setValue(ISVNUIConstants.PREF_SHOW_COMMENTS, showComments);
    }
  };
  toggleShowComments.setChecked(showComments);
  // PlatformUI.getWorkbench().getHelpSystem().setHelp(toggleTextAction,
  // IHelpContextIds.SHOW_COMMENT_IN_HISTORY_ACTION);

  // Toggle wrap comments action
  toggleWrapCommentsAction = new Action(Policy.bind("HistoryView.wrapComments")) { //$NON-NLS-1$
    public void run() {
      wrapCommentsText = isChecked();
      setViewerVisibility();
      store.setValue(ISVNUIConstants.PREF_WRAP_COMMENTS, wrapCommentsText);
    }
  };
  toggleWrapCommentsAction.setChecked(wrapCommentsText);
  // PlatformUI.getWorkbench().getHelpSystem().setHelp(toggleTextWrapAction,
  // IHelpContextIds.SHOW_TAGS_IN_HISTORY_ACTION);

  // Toggle path visible action
  toggleShowAffectedPathsAction = new Action(Policy.bind("HistoryView.showAffectedPaths"), //$NON-NLS-1$
      SVNUIPlugin.getPlugin().getImageDescriptor(ISVNUIConstants.IMG_AFFECTED_PATHS_FLAT_MODE)) {
    public void run() {
      showAffectedPaths = isChecked();
      setViewerVisibility();
      store.setValue(ISVNUIConstants.PREF_SHOW_PATHS, showAffectedPaths);
    }
  };
  toggleShowAffectedPathsAction.setChecked(showAffectedPaths);
  // PlatformUI.getWorkbench().getHelpSystem().setHelp(toggleListAction,
  // IHelpContextIds.SHOW_TAGS_IN_HISTORY_ACTION);

  // Toggle stop on copy action
  toggleStopOnCopyAction = new Action(Policy.bind("HistoryView.stopOnCopy")) { //$NON-NLS-1$
    public void run() {
      refresh();
      SVNUIPlugin.getPlugin().getPreferenceStore().setValue(ISVNUIConstants.PREF_STOP_ON_COPY,
          toggleStopOnCopyAction.isChecked());
    }
  };
  toggleStopOnCopyAction.setChecked(store.getBoolean(ISVNUIConstants.PREF_STOP_ON_COPY));
  
  // Toggle include merged revisions action
  toggleIncludeMergedRevisionsAction = new Action(Policy.bind("HistoryView.includeMergedRevisions")) { //$NON-NLS-1$
    public void run() {
      store.setValue(ISVNUIConstants.PREF_INCLUDE_MERGED_REVISIONS, toggleIncludeMergedRevisionsAction.isChecked());
  	refreshTable();
  	refresh();
    }
  };
  toggleIncludeMergedRevisionsAction.setChecked(store.getBoolean(ISVNUIConstants.PREF_INCLUDE_MERGED_REVISIONS));    
  
  IHistoryPageSite parentSite = getHistoryPageSite();
  IPageSite pageSite = parentSite.getWorkbenchPageSite();
  IActionBars actionBars = pageSite.getActionBars();

  // Contribute toggle text visible to the toolbar drop-down
  IMenuManager actionBarsMenu = actionBars.getMenuManager();
  actionBarsMenu.add(getGetNextAction());
  actionBarsMenu.add(getGetAllAction());
  actionBarsMenu.add(toggleStopOnCopyAction);
  actionBarsMenu.add(toggleIncludeMergedRevisionsAction);
  actionBarsMenu.add(new Separator());
  actionBarsMenu.add(toggleWrapCommentsAction);
  actionBarsMenu.add(new Separator());
  actionBarsMenu.add(toggleShowComments);
  actionBarsMenu.add(toggleShowAffectedPathsAction);
  actionBarsMenu.add(new Separator());
  for (int i = 0; i < toggleAffectedPathsModeActions.length; i++) {
    actionBarsMenu.add(toggleAffectedPathsModeActions[i]);
  }
  actionBarsMenu.add(new Separator());
  for (int i = 0; i < toggleAffectedPathsLayoutActions.length; i++) {
    actionBarsMenu.add(toggleAffectedPathsLayoutActions[i]);
  }
  
  // Create the local tool bar
  IToolBarManager tbm = actionBars.getToolBarManager();
  // tbm.add(getRefreshAction());
  tbm.add(new Separator());
  tbm.add(getSearchAction());
  tbm.add(getClearSearchAction());
  tbm.add(new Separator());
  tbm.add(toggleShowComments);
  tbm.add(toggleShowAffectedPathsAction);
  tbm.add(new Separator());
  tbm.add(getGetNextAction());
  tbm.add(getGetAllAction());
  // tbm.add(getLinkWithEditorAction());
  tbm.update(false);
  
  actionBars.updateActionBars();  
}
 
Example 20
Source File: LaborView.java    From elexis-3-core with Eclipse Public License 1.0 4 votes vote down vote up
@Override
public void createPartControl(final Composite parent){
	setTitleImage(Images.IMG_VIEW_LABORATORY.getImage());
	
	tabFolder = new CTabFolder(parent, SWT.TOP);
	tabFolder.setLayout(new FillLayout());
	
	final CTabItem resultsTabItem = new CTabItem(tabFolder, SWT.NULL);
	resultsTabItem.setText("Resultate");
	resultsComposite = new LaborResultsComposite(tabFolder, SWT.NONE);
	resultsTabItem.setControl(resultsComposite);
	
	final CTabItem ordersTabItem = new CTabItem(tabFolder, SWT.NULL);
	ordersTabItem.setText("Verordnungen");
	ordersComposite = new LaborOrdersComposite(tabFolder, SWT.NONE);
	ordersTabItem.setControl(ordersComposite);
	
	tabFolder.setSelection(0);
	tabFolder.addSelectionListener(new SelectionAdapter() {
		@Override
		public void widgetSelected(SelectionEvent e){
			resultsComposite.reload();
			ordersComposite.reload();
		}
	});
	makeActions();
	menu = new ViewMenus(getViewSite());
	menu.createMenu(newAction, backAction, fwdAction, printAction, importAction, xmlAction);
	// Orders
	final LaborOrderPulldownMenuCreator menuCreator =
		new LaborOrderPulldownMenuCreator(parent.getShell());
	if (menuCreator.getSelected() != null) {
		IAction dropDownAction = menuCreator.getAction();
		
		IActionBars actionBars = getViewSite().getActionBars();
		IToolBarManager toolbar = actionBars.getToolBarManager();
		
		toolbar.add(dropDownAction);
		
		// Set data
		dropDownAction.setText(menuCreator.getSelected().getText());
		dropDownAction.setToolTipText(menuCreator.getSelected().getToolTipText());
		dropDownAction.setImageDescriptor(menuCreator.getSelected().getImageDescriptor());
	}
	// Importers
	IToolBarManager tm = getViewSite().getActionBars().getToolBarManager();
	List<IAction> importers =
		Extensions.getClasses(
			Extensions.getExtensions(ExtensionPointConstantsUi.LABORDATENIMPORT),
			"ToolbarAction", //$NON-NLS-1$ //$NON-NLS-2$
			false);
	for (IAction ac : importers) {
		tm.add(ac);
	}
	if (importers.size() > 0) {
		tm.add(new Separator());
	}
	tm.add(refreshAction);
	tm.add(newColumnAction);
	tm.add(newAction);
	tm.add(backAction);
	tm.add(fwdAction);
	tm.add(expandAllAction);
	tm.add(collapseAllAction);
	tm.add(printAction);
	
	// register event listeners
	ElexisEventDispatcher.getInstance().addListeners(eeli_labitem, eeli_laborder,
		eeli_labresult, eeli_pat);
	Patient act = (Patient) ElexisEventDispatcher.getSelected(Patient.class);
	if ((act != null && act != resultsComposite.getPatient())) {
		resultsComposite.selectPatient(act);
	}
	getSite().getPage().addPartListener(udpateOnVisible);
}