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

The following examples show how to use org.eclipse.ui.IActionBars#setGlobalActionHandler() . 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: ActionProvider.java    From hadoop-gpu with Apache License 2.0 6 votes vote down vote up
@Override
public void fillActionBars(IActionBars actionBars) {
  actionBars.setGlobalActionHandler(ActionFactory.DELETE.getId(),
      new DFSAction(DFSActions.DELETE));
  actionBars.setGlobalActionHandler(ActionFactory.REFRESH.getId(),
      new DFSAction(DFSActions.REFRESH));

  if (site == null)
    return;

  if ((site.getStructuredViewer().getSelection() instanceof IStructuredSelection)
      && (((IStructuredSelection) site.getStructuredViewer()
          .getSelection()).size() == 1)
      && (((IStructuredSelection) site.getStructuredViewer()
          .getSelection()).getFirstElement() instanceof DFSFile)) {

    actionBars.setGlobalActionHandler(ICommonActionConstants.OPEN,
        new DFSAction(DFSActions.OPEN));
  }

  actionBars.updateActionBars();
}
 
Example 2
Source File: EditViewPage.java    From uima-uimaj with Apache License 2.0 6 votes vote down vote up
@Override
public void setActionBars(IActionBars actionBars) {
  // pin action
  pinAction = new PinAction();

  pinAction.setText("Pin");
  pinAction.setImageDescriptor(CasEditorPlugin.getTaeImageDescriptor(Images.PIN));
  actionBars.getToolBarManager().add(pinAction);

  CreateFeatureStructrueValue createAction = new CreateFeatureStructrueValue();
  createAction.setImageDescriptor(CasEditorPlugin.getTaeImageDescriptor(Images.ADD));
  actionBars.getToolBarManager().add(createAction);

  // TODO: setActionBars is depreciated, but registration of change listener
  // does not work in init method
  getSite().getSelectionProvider().addSelectionChangedListener(createAction);

  // delete action
  DeleteFeatureStructureValue deleteAction = new DeleteFeatureStructureValue();
  actionBars.setGlobalActionHandler(ActionFactory.DELETE.getId(), deleteAction);

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

  actionBars.getToolBarManager().add(
          ActionFactory.DELETE.create(getSite().getWorkbenchWindow()));
}
 
Example 3
Source File: CallHierarchyViewPart.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 6 votes vote down vote up
private void fillActionBars() {
      IActionBars actionBars = getActionBars();
actionBars.setGlobalActionHandler(ActionFactory.REFRESH.getId(), fRefreshSingleElementAction);
actionBars.setGlobalActionHandler(ActionFactory.DELETE.getId(), fRemoveFromViewAction);

      IToolBarManager toolBar = actionBars.getToolBarManager();

      fActionGroups.fillActionBars(actionBars);

      toolBar.add(fRefreshViewAction);
      toolBar.add(fCancelSearchAction);
      for (int i = 0; i < fToggleCallModeActions.length; i++) {
          toolBar.add(fToggleCallModeActions[i]);
      }
      toolBar.add(fHistoryDropDownAction);
      toolBar.add(fPinViewAction);
  }
 
Example 4
Source File: JavaSearchResultPage.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
@Override
protected void fillToolbar(IToolBarManager tbm) {
	super.fillToolbar(tbm);

	IActionBars actionBars = getSite().getActionBars();
	if (actionBars != null) {
		actionBars.setGlobalActionHandler(CopyQualifiedNameAction.ACTION_HANDLER_ID, getCopyQualifiedNameAction());
	}

	if (getLayout() != FLAG_LAYOUT_FLAT)
		addGroupActions(tbm);
}
 
Example 5
Source File: StyledTextActionHandler.java    From statecharts with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * Creates a <code>StyledText</code> widget action handler for the global Copy,
 * Cut, Paste and Select All of the action bar.
 *
 * @param actionBars
 *            the actionbars to register global action handlers for Copy, Cut
 *            Paste and Select All actions
 */
public StyledTextActionHandler(IActionBars actionBars) {
	super();
	actionBars.setGlobalActionHandler(ActionFactory.COPY.getId(), styledTextCopyActionHandler);
	actionBars.setGlobalActionHandler(ActionFactory.CUT.getId(), styledTextCutActionHandler);
	actionBars.setGlobalActionHandler(ActionFactory.PASTE.getId(), styledTextPasteActionHandler);
	actionBars.setGlobalActionHandler(ActionFactory.SELECT_ALL.getId(), styledTextSelectAllActionHandler);
	actionBars.setGlobalActionHandler(ActionFactory.PRINT.getId(), styledTextPrintActionHandler);
}
 
Example 6
Source File: MultiPageEditorContributor.java    From hybris-commerce-eclipse-plugin with Apache License 2.0 5 votes vote down vote up
public void setActivePage(IEditorPart part) {
	if (activeEditorPart == part)
		return;

	activeEditorPart = part;

	IActionBars actionBars = getActionBars();
	if (actionBars != null) {
		ITextEditor editor = (part instanceof ITextEditor) ? (ITextEditor) part : null;

		actionBars.setGlobalActionHandler(ActionFactory.DELETE.getId(),
		                getAction(editor, ITextEditorActionConstants.DELETE));
		actionBars.setGlobalActionHandler(ActionFactory.UNDO.getId(),
		                getAction(editor, ITextEditorActionConstants.UNDO));
		actionBars.setGlobalActionHandler(ActionFactory.REDO.getId(),
		                getAction(editor, ITextEditorActionConstants.REDO));
		actionBars.setGlobalActionHandler(ActionFactory.CUT.getId(),
		                getAction(editor, ITextEditorActionConstants.CUT));
		actionBars.setGlobalActionHandler(ActionFactory.COPY.getId(),
		                getAction(editor, ITextEditorActionConstants.COPY));
		actionBars.setGlobalActionHandler(ActionFactory.PASTE.getId(),
		                getAction(editor, ITextEditorActionConstants.PASTE));
		actionBars.setGlobalActionHandler(ActionFactory.SELECT_ALL.getId(),
		                getAction(editor, ITextEditorActionConstants.SELECT_ALL));
		actionBars.setGlobalActionHandler(ActionFactory.FIND.getId(),
		                getAction(editor, ITextEditorActionConstants.FIND));
		actionBars.setGlobalActionHandler(IDEActionFactory.BOOKMARK.getId(),
		                getAction(editor, IDEActionFactory.BOOKMARK.getId()));
		actionBars.updateActionBars();

	}
}
 
Example 7
Source File: MultiPageEditorContributor.java    From uima-uimaj with Apache License 2.0 5 votes vote down vote up
@Override
public void setActiveEditor(IEditorPart part) {
  if (activeEditorPart == part)
    return;

  if (null == part)
    return;
  activeEditorPart = part;

  IActionBars actionBars = getActionBars();
  if (actionBars != null) {

    MultiPageEditorPart editor = (MultiPageEditorPart) part;

    actionBars.setGlobalActionHandler(ActionFactory.DELETE.getId(), getAction(editor,
            ITextEditorActionConstants.DELETE));
    actionBars.setGlobalActionHandler(ActionFactory.UNDO.getId(), getAction(editor,
            ITextEditorActionConstants.UNDO));
    actionBars.setGlobalActionHandler(ActionFactory.REDO.getId(), getAction(editor,
            ITextEditorActionConstants.REDO));
    actionBars.setGlobalActionHandler(ActionFactory.CUT.getId(), getAction(editor,
            ITextEditorActionConstants.CUT));
    actionBars.setGlobalActionHandler(ActionFactory.COPY.getId(), getAction(editor,
            ITextEditorActionConstants.COPY));
    actionBars.setGlobalActionHandler(ActionFactory.PASTE.getId(), getAction(editor,
            ITextEditorActionConstants.PASTE));
    actionBars.setGlobalActionHandler(ActionFactory.SELECT_ALL.getId(), getAction(editor,
            ITextEditorActionConstants.SELECT_ALL));
    actionBars.setGlobalActionHandler(ActionFactory.FIND.getId(), getAction(editor,
            ITextEditorActionConstants.FIND));
    actionBars.setGlobalActionHandler(IDEActionFactory.BOOKMARK.getId(), getAction(editor,
            IDEActionFactory.BOOKMARK.getId()));
    actionBars.updateActionBars();
  }
}
 
Example 8
Source File: GoNavigatorActionProvider.java    From goclipse with Eclipse Public License 1.0 5 votes vote down vote up
@Override
public void fillActionBars(IActionBars actionBars) {
	super.fillActionBars(actionBars);
	
	if(navigatorOpenAction.isEnabled()) {
		actionBars.setGlobalActionHandler(ICommonActionConstants.OPEN, navigatorOpenAction);
	}
}
 
Example 9
Source File: OpenViewActionGroup.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
private void setGlobalActionHandlers(IActionBars actionBars) {
	actionBars.setGlobalActionHandler(JdtActionConstants.OPEN_IMPLEMENTATION, fOpenImplementation);
	actionBars.setGlobalActionHandler(JdtActionConstants.OPEN_SUPER_IMPLEMENTATION, fOpenSuperImplementation);
	actionBars.setGlobalActionHandler(JdtActionConstants.OPEN_ATTACHED_JAVA_DOC, fOpenAttachedJavadoc);
	actionBars.setGlobalActionHandler(JdtActionConstants.OPEN_TYPE_HIERARCHY, fOpenTypeHierarchy);
	actionBars.setGlobalActionHandler(JdtActionConstants.OPEN_CALL_HIERARCHY, fOpenCallHierarchy);

	if (!fEditorIsOwner && fShowOpenPropertiesAction)
		actionBars.setGlobalActionHandler(ActionFactory.PROPERTIES.getId(), fOpenPropertiesDialog);
}
 
Example 10
Source File: CalcitePane.java    From mat-calcite-plugin with Apache License 2.0 5 votes vote down vote up
private void installUndoRedoSupport() {
	IUndoContext undoContext = ((IUndoManagerExtension) queryViewer.getUndoManager()).getUndoContext();

	UndoActionHandler undoAction = new UndoActionHandler(getSite(), undoContext);
	RedoActionHandler redoAction = new RedoActionHandler(getSite(), undoContext);

	undoAction.setActionDefinitionId(IWorkbenchCommandConstants.EDIT_UNDO);
	redoAction.setActionDefinitionId(IWorkbenchCommandConstants.EDIT_REDO);

	IActionBars actionBars = getEditor().getEditorSite().getActionBars();
	actionBars.setGlobalActionHandler(ActionFactory.UNDO.getId(), undoAction);
	actionBars.setGlobalActionHandler(ActionFactory.REDO.getId(), redoAction);

	actionBars.updateActionBars();
}
 
Example 11
Source File: TypesView.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
@Override
protected void fillActionBars(IActionBars actionBars) {
	super.fillActionBars(actionBars);

	// Add selectAll action handlers.
	actionBars.setGlobalActionHandler(ActionFactory.SELECT_ALL.getId(), fSelectAllAction);
}
 
Example 12
Source File: TmfActionProvider.java    From tracecompass with Eclipse Public License 2.0 4 votes vote down vote up
@Override
public void fillActionBars(IActionBars actionBars) {
    if (openAction.isEnabled()) {
        actionBars.setGlobalActionHandler(ICommonActionConstants.OPEN, openAction);
    }
}
 
Example 13
Source File: SurroundWithActionGroup.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 4 votes vote down vote up
@Override
public void fillActionBars(IActionBars actionBar) {
	actionBar.setGlobalActionHandler(JdtActionConstants.SURROUND_WITH_TRY_CATCH, fSurroundWithTryCatchAction);
	actionBar.setGlobalActionHandler(JdtActionConstants.SURROUND_WITH_TRY_MULTI_CATCH, fSurroundWithTryMultiCatchAction);
}
 
Example 14
Source File: JavaEditorBreadcrumbActionGroup.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 4 votes vote down vote up
@Override
public void fillActionBars(IActionBars actionBars) {
	super.fillActionBars(actionBars);
	actionBars.setGlobalActionHandler(IJavaEditorActionDefinitionIds.SHOW_IN_BREADCRUMB, fGoToEditor);
}
 
Example 15
Source File: GoIntoActionProvider.java    From translationstudio8 with GNU General Public License v2.0 4 votes vote down vote up
public void fillActionBars(IActionBars actionBars) {
	actionBars.setGlobalActionHandler(IWorkbenchActionConstants.GO_INTO, goIntoAction);
}
 
Example 16
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 17
Source File: SourceView.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 4 votes vote down vote up
@Override
protected void fillActionBars(IActionBars actionBars) {
	super.fillActionBars(actionBars);
	actionBars.setGlobalActionHandler(JdtActionConstants.OPEN, fOpen);
	fOpen.setActionDefinitionId(IJavaEditorActionDefinitionIds.OPEN_EDITOR);
}
 
Example 18
Source File: PropertiesActionProvider.java    From translationstudio8 with GNU General Public License v2.0 4 votes vote down vote up
public void fillActionBars(IActionBars actionBars) {
	super.fillActionBars(actionBars);

	actionBars.setGlobalActionHandler(ActionFactory.PROPERTIES.getId(),
			propertiesAction);
}
 
Example 19
Source File: ShowActionGroup.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 4 votes vote down vote up
private void setGlobalActionHandlers(IActionBars actionBar) {
	if (!fIsPackageExplorer)
		actionBar.setGlobalActionHandler(JdtActionConstants.SHOW_IN_PACKAGE_VIEW, fShowInPackagesViewAction);
}
 
Example 20
Source File: RefactorActionGroup.java    From typescript.java with MIT License 4 votes vote down vote up
@Override
public void fillActionBars(IActionBars actionBars) {
	super.fillActionBars(actionBars);
	actionBars.setGlobalActionHandler(TypeScriptActionConstants.RENAME, fRenameAction);
}