org.eclipse.ui.actions.ActionFactory Java Examples

The following examples show how to use org.eclipse.ui.actions.ActionFactory. 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: PasteAction.java    From ermaster-b with Apache License 2.0 6 votes vote down vote up
/**
 * �R���X�g���N�^
 *
 * @param part
 */
public PasteAction(IWorkbenchPart part) {
	super(part);

	this.setText(ResourceString.getResourceString("action.title.paste"));
	ISharedImages sharedImages = PlatformUI.getWorkbench()
			.getSharedImages();
	setImageDescriptor(sharedImages
			.getImageDescriptor(ISharedImages.IMG_TOOL_PASTE));
	setDisabledImageDescriptor(sharedImages
			.getImageDescriptor(ISharedImages.IMG_TOOL_PASTE_DISABLED));

	this.setId(ActionFactory.PASTE.getId());

	ERDiagramEditor editor = (ERDiagramEditor) part;

	this.editor = editor;
}
 
Example #2
Source File: TabbedPropertySheetPage.java    From bonita-studio with GNU General Public License v2.0 6 votes vote down vote up
@Override
public void setActionBars(IActionBars actionBars) {
	// Override the undo and redo global action handlers
	// to use the contributor action handlers
       IActionBars partActionBars = null;
	if (contributor instanceof IEditorPart) {
		IEditorPart editorPart = (IEditorPart) contributor;
           partActionBars = editorPart.getEditorSite().getActionBars();
	} else if (contributor instanceof IViewPart) {
           IViewPart viewPart = (IViewPart) contributor;
           partActionBars = viewPart.getViewSite().getActionBars();
       }

       if (partActionBars != null) {
           IAction action = partActionBars.getGlobalActionHandler(ActionFactory.UNDO
               .getId());
           if (action != null) {
               actionBars.setGlobalActionHandler(ActionFactory.UNDO.getId(), action);
           }
           action = partActionBars.getGlobalActionHandler(ActionFactory.REDO
               .getId());
           if (action != null) {
               actionBars.setGlobalActionHandler(ActionFactory.REDO.getId(), action);
           }
       }
}
 
Example #3
Source File: CellEditorGlobalActionHanlder.java    From tmxeditor8 with GNU General Public License v2.0 6 votes vote down vote up
public void updateGlobalActionHandler() {
	if (actionBar == null) {
		return;
	}
	preCutAction = actionBar.getGlobalActionHandler(ActionFactory.CUT.getId());
	actionBar.setGlobalActionHandler(ActionFactory.CUT.getId(), textCutAction);
	preCopyAction = actionBar.getGlobalActionHandler(ActionFactory.COPY.getId());
	actionBar.setGlobalActionHandler(ActionFactory.COPY.getId(), textCopyAction);
	prePasteAction= actionBar.getGlobalActionHandler(ActionFactory.PASTE.getId());
	actionBar.setGlobalActionHandler(ActionFactory.PASTE.getId(), textPasteAction);
	preUndoAction = actionBar.getGlobalActionHandler(ActionFactory.UNDO.getId());
	actionBar.setGlobalActionHandler(ActionFactory.UNDO.getId(), textUndoAction);
	preRedoAction = actionBar.getGlobalActionHandler(ActionFactory.REDO.getId());
	actionBar.setGlobalActionHandler(ActionFactory.REDO.getId(), textRedoAction);
	// actionBar.setGlobalActionHandler(ActionFactory.FIND.getId(), textFindReplaceAction);
	if (viewer != null && viewer.getTextWidget().isFocusControl()) {
		updateActionsEnableState();
	} else {
		actionBar.updateActionBars();
	}
}
 
Example #4
Source File: ApplicationActionBarAdvisor.java    From jbt with Apache License 2.0 6 votes vote down vote up
protected void makeActions(IWorkbenchWindow window) {
	this.window = window;

	this.saveBTAction = ActionFactory.SAVE.create(this.window);
	this.saveBTAsAction = ActionFactory.SAVE_AS.create(this.window);
	this.exportAsCppAction = new DialogExportAsCppAction(this.window);
	this.openBTAction = new DialogOpenBTAction(this.window);
	this.newBTAction = new NewBTAction();
	this.loadMMPMDomainAction = new DialogLoadMMPMDomainAction(this.window);
	this.viewsList = ContributionItemFactory.VIEWS_SHORTLIST.create(this.window);
	this.aboutAction = ActionFactory.ABOUT.create(this.window);

	/* For key bindings and for copy and paste actions... */
	this.register(this.saveBTAction);
	this.register(ActionFactory.COPY.create(this.window));
	this.register(ActionFactory.PASTE.create(this.window));
}
 
Example #5
Source File: CalcitePane.java    From mat-calcite-plugin with Apache License 2.0 6 votes vote down vote up
private void makeActions() {
	executeQueryAction = new ExecuteQueryAction(this, null, false);
	explainQueryAction = new ExecuteQueryAction(this, null, true);
	commentLineAction = new CommentLineAction(queryString);
	IWorkbenchWindow window = this.getEditorSite().getWorkbenchWindow();
	ActionFactory.IWorkbenchAction globalAction = ActionFactory.COPY.create(window);
	this.copyQueryStringAction = new Action() {
		public void run() {
			CalcitePane.this.queryString.copy();
		}
	};
	this.copyQueryStringAction.setAccelerator(globalAction.getAccelerator());
	this.contentAssistAction = new Action() {
		@Override
		public void run() {
			queryViewer.doOperation(ISourceViewer.CONTENTASSIST_PROPOSALS);
		}
	};
}
 
Example #6
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 #7
Source File: ERDiagramOutlinePage.java    From erflute with Apache License 2.0 6 votes vote down vote up
private void resetAction(ActionRegistry registry) {
    if (getSite() == null) {
        return;
    }
    final IActionBars bars = getSite().getActionBars();

    String id = ActionFactory.UNDO.getId();
    bars.setGlobalActionHandler(id, registry.getAction(id));

    id = ActionFactory.REDO.getId();
    bars.setGlobalActionHandler(id, registry.getAction(id));

    id = ActionFactory.DELETE.getId();
    bars.setGlobalActionHandler(id, registry.getAction(id));

    bars.updateActionBars();
}
 
Example #8
Source File: LamiChartViewerTest.java    From tracecompass with Eclipse Public License 2.0 6 votes vote down vote up
/**
 * Reset the current perspective
 */
@After
public void resetPerspective() {
    SWTBotView viewBot = fViewBot;
    if (viewBot != null) {
        viewBot.close();
    }
    /*
     * UI Thread executes the reset perspective action, which opens a shell
     * to confirm the action. The current thread will click on the 'Yes'
     * button
     */
    Runnable runnable = () -> SWTBotUtils.anyButtonOf(fBot, "Yes", "Reset Perspective").click();
    UIThreadRunnable.asyncExec(() -> {
        IWorkbenchWindow activeWorkbenchWindow = PlatformUI.getWorkbench().getWorkbenchWindows()[0];
        ActionFactory.RESET_PERSPECTIVE.create(activeWorkbenchWindow).run();
    });
    runnable.run();
}
 
Example #9
Source File: PasteResourceAction.java    From birt with Eclipse Public License 1.0 6 votes vote down vote up
/**
 * Constructs an action for pasting resource.
 * 
 * @param page
 *            the resource explorer page
 * @param clipboard
 *            the clipboard for pasting resource
 */
public PasteResourceAction( LibraryExplorerTreeViewPage page,
		Clipboard clipboard )
{
	super( Messages.getString( "PasteLibraryAction.Text" ), page ); //$NON-NLS-1$
	this.clipboard = clipboard;
	setId( ActionFactory.PASTE.getId( ) );
	setAccelerator( SWT.CTRL | 'V' );

	setImageDescriptor( PlatformUI.getWorkbench( )
			.getSharedImages( )
			.getImageDescriptor( ISharedImages.IMG_TOOL_PASTE ) );

	setDisabledImageDescriptor( PlatformUI.getWorkbench( )
			.getSharedImages( )
			.getImageDescriptor( ISharedImages.IMG_TOOL_PASTE_DISABLED ) );
}
 
Example #10
Source File: FXEditorActionBarContributor.java    From gef with Eclipse Public License 2.0 6 votes vote down vote up
@Override
public void setActiveEditor(final IEditorPart activeEditor) {
	// XXX: We need to perform instance-of check here, even if
	// FXEditorActionBarContributor is bound to AbstractFXEditor alone.
	// This is because activeEditor may for instance also be of type
	// org.eclipse.ui.internal.ErrorEditorPart when the opened resource is
	// out of sync with the file system.
	if (activeEditor instanceof AbstractFXEditor) {
		registerUndoRedoActions(activeEditor);

		DeleteAction deleteAction = (DeleteAction) activeEditor
				.getAdapter(DeleteAction.class);
		if (deleteAction != null) {
			getActionBars().setGlobalActionHandler(
					ActionFactory.DELETE.getId(), deleteAction);
		}

		IAction selectAllAction = (IAction) activeEditor
				.getAdapter(SelectAllAction.class);
		if (selectAllAction != null) {
			getActionBars().setGlobalActionHandler(
					ActionFactory.SELECT_ALL.getId(), selectAllAction);
		}
	}
}
 
Example #11
Source File: CCPActionGroup.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
@Override
public void fillActionBars(IActionBars actionBars) {
	super.fillActionBars(actionBars);
	if (fDeleteAction != null)
		actionBars.setGlobalActionHandler(ActionFactory.DELETE.getId(), fDeleteAction);
	actionBars.setGlobalActionHandler(ActionFactory.COPY.getId(), fCopyAction);
	actionBars.setGlobalActionHandler(CopyQualifiedNameAction.ACTION_HANDLER_ID, fCopyQualifiedNameAction);
	if (fCopyAction != null)
		actionBars.setGlobalActionHandler(ActionFactory.CUT.getId(), fCutAction);
	if (fPasteAction != null)
		actionBars.setGlobalActionHandler(ActionFactory.PASTE.getId(), fPasteAction);
}
 
Example #12
Source File: AbstractTreeNodePanel.java    From XPagesExtensionLibrary with Apache License 2.0 5 votes vote down vote up
@Override
public void dispose() {
    IWorkbenchPart part = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActivePart();
    IActionBars bars = null;
    if(part instanceof IViewPart){
        bars = ((IViewPart)part).getViewSite().getActionBars();
        if(bars != null){
            bars.setGlobalActionHandler(ActionFactory.UNDO.getId(), null);
            bars.setGlobalActionHandler(ActionFactory.REDO.getId(), null);
        }
    }
    if(!isDisposed()){
        super.dispose();
    }
}
 
Example #13
Source File: NewActionProvider.java    From tmxeditor8 with GNU General Public License v2.0 5 votes vote down vote up
public void init(ICommonActionExtensionSite anExtensionSite) {

		if (anExtensionSite.getViewSite() instanceof ICommonViewerWorkbenchSite) {
			IWorkbenchWindow window = ((ICommonViewerWorkbenchSite) anExtensionSite.getViewSite()).getWorkbenchWindow();
			showDlgAction = ActionFactory.NEW_WIZARD_DROP_DOWN.create(window);
			showDlgAction.setText(WorkbenchNavigatorMessages.actions_NewActionProvider_NewMenu_label);
			contribute = true;
		}
	}
 
Example #14
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 #15
Source File: RefactorActionGroup.java    From tmxeditor8 with GNU General Public License v2.0 5 votes vote down vote up
public void fillActionBars(IActionBars actionBars) {

		// renameAction.setTextActionHandler(textActionHandler);
		updateActionBars();

		actionBars.setGlobalActionHandler(ActionFactory.MOVE.getId(), moveAction);
		actionBars.setGlobalActionHandler(ActionFactory.RENAME.getId(), renameAction);
	}
 
Example #16
Source File: PackagesView.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
private void createSelectAllAction() {
	IActionBars actionBars= getViewSite().getActionBars();
	if (isInListState()) {
		fSelectAllAction= new SelectAllAction((TableViewer)fWrappedViewer.getViewer());
		actionBars.setGlobalActionHandler(ActionFactory.SELECT_ALL.getId(), fSelectAllAction);
	} else {
		actionBars.setGlobalActionHandler(ActionFactory.SELECT_ALL.getId(), null);
		fSelectAllAction= null;
	}
	actionBars.updateActionBars();
}
 
Example #17
Source File: ReferenceSearchViewPage.java    From xtext-eclipse with Eclipse Public License 2.0 5 votes vote down vote up
protected void fillToolbar(IToolBarManager tbm) {
	tbm.appendToGroup(IContextMenuConstants.GROUP_SHOW, showNextAction);
	tbm.appendToGroup(IContextMenuConstants.GROUP_SHOW, showPreviousAction);
	IActionBars actionBars = getSite().getActionBars();
	if (actionBars != null) {
		actionBars.setGlobalActionHandler(ActionFactory.NEXT.getId(), showNextAction);
		actionBars.setGlobalActionHandler(ActionFactory.PREVIOUS.getId(), showPreviousAction);
	}
	tbm.appendToGroup(IContextMenuConstants.GROUP_VIEWER_SETUP, expandAllAction);
	tbm.appendToGroup(IContextMenuConstants.GROUP_VIEWER_SETUP, collapseAllAction);
}
 
Example #18
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 #19
Source File: XtextDirectEditManager.java    From statecharts with Eclipse Public License 1.0 5 votes vote down vote up
private void restoreSavedActions(IActionBars _actionBars) {
	_actionBars.setGlobalActionHandler(ActionFactory.COPY.getId(), copy);
	_actionBars.setGlobalActionHandler(ActionFactory.PASTE.getId(), paste);
	_actionBars.setGlobalActionHandler(ActionFactory.DELETE.getId(), delete);
	_actionBars.setGlobalActionHandler(ActionFactory.SELECT_ALL.getId(), selectAll);
	_actionBars.setGlobalActionHandler(ActionFactory.CUT.getId(), cut);
	_actionBars.setGlobalActionHandler(ActionFactory.FIND.getId(), find);
	_actionBars.setGlobalActionHandler(ActionFactory.UNDO.getId(), undo);
	_actionBars.setGlobalActionHandler(ActionFactory.REDO.getId(), redo);
}
 
Example #20
Source File: CopyAction.java    From erflute with Apache License 2.0 5 votes vote down vote up
public CopyAction(IWorkbenchPart part) {
    super(part);
    setText(DisplayMessages.getMessage("action.title.copy"));
    final ISharedImages sharedImages = PlatformUI.getWorkbench().getSharedImages();
    setImageDescriptor(sharedImages.getImageDescriptor(ISharedImages.IMG_TOOL_COPY));
    setDisabledImageDescriptor(sharedImages.getImageDescriptor(ISharedImages.IMG_TOOL_COPY_DISABLED));
    setId(ActionFactory.COPY.getId());
}
 
Example #21
Source File: PasteAction.java    From erflute with Apache License 2.0 5 votes vote down vote up
public PasteAction(IWorkbenchPart part) {
    super(part);
    this.setText(DisplayMessages.getMessage("action.title.paste"));
    final ISharedImages sharedImages = PlatformUI.getWorkbench().getSharedImages();
    setImageDescriptor(sharedImages.getImageDescriptor(ISharedImages.IMG_TOOL_PASTE));
    setDisabledImageDescriptor(sharedImages.getImageDescriptor(ISharedImages.IMG_TOOL_PASTE_DISABLED));
    this.setId(ActionFactory.PASTE.getId());
    final MainDiagramEditor editor = (MainDiagramEditor) part;
    this.editor = editor;
}
 
Example #22
Source File: XLIFFEditorActionHandler.java    From tmxeditor8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Add a <code>Text</code> control to the handler so that the Cut, Copy, Paste, Delete, Undo, Redo and Select All
 * actions are redirected to it when active.
 * @param viewer
 *            the inline <code>Text</code> control
 */
public void addTextViewer(SegmentViewer viewer) {
	if (viewer == null) {
		return;
	}
	this.viewer = viewer;
	StyledText textControl = viewer.getTextWidget();

	// 移除 StyledText 默认绑定的 Delete 键。解决“按下 Delete 键后会删除两次”的 Bug。
	textControl.setKeyBinding(SWT.DEL, SWT.NULL);

	viewer.addSelectionChangedListener(new ISelectionChangedListener() {
		public void selectionChanged(SelectionChangedEvent event) {
			updateActionsEnableState();
		}
	});

	textControl.addModifyListener(new ModifyListener() {
		public void modifyText(ModifyEvent e) {
			updateActionsEnableState();
		}
	});

	actionBar.setGlobalActionHandler(ActionFactory.CUT.getId(), textCutAction);
	actionBar.setGlobalActionHandler(ActionFactory.COPY.getId(), textCopyAction);
	actionBar.setGlobalActionHandler(ActionFactory.PASTE.getId(), textPasteAction);
	actionBar.setGlobalActionHandler(ActionFactory.SELECT_ALL.getId(), textSelectAllAction);
	actionBar.setGlobalActionHandler(ActionFactory.DELETE.getId(), textDeleteAction);
	actionBar.setGlobalActionHandler(ActionFactory.UNDO.getId(), textUndoAction);
	actionBar.setGlobalActionHandler(ActionFactory.REDO.getId(), textRedoAction);

	if (textControl.isFocusControl()) {
		updateActionsEnableState();
	} else {
		actionBar.updateActionBars();
	}
}
 
Example #23
Source File: RcpActionBarAdvisor.java    From olca-app with Mozilla Public License 2.0 5 votes vote down vote up
@Override
protected void makeActions(IWorkbenchWindow window) {
	// save
	saveAction = ActionFactory.SAVE.create(window);
	saveAction.setText(M.Save);
	saveAction.setImageDescriptor(Icon.SAVE.descriptor());
	saveAction.setDisabledImageDescriptor(Icon.SAVE_DISABLED.descriptor());

	// save as
	saveAsAction = ActionFactory.SAVE_AS.create(window);
	saveAsAction.setText(M.SaveAs);
	saveAsAction.setImageDescriptor(Icon.SAVE_AS.descriptor());
	saveAsAction.setDisabledImageDescriptor(Icon.SAVE_AS_DISABLED.descriptor());

	// save all
	saveAllAction = ActionFactory.SAVE_ALL.create(window);
	saveAllAction.setText(M.SaveAll);
	saveAllAction.setImageDescriptor(Icon.SAVE_ALL.descriptor());
	saveAllAction.setDisabledImageDescriptor(Icon.SAVE_ALL_DISABLED.descriptor());

	// close & close all
	closeAction = ActionFactory.CLOSE.create(window);
	closeAction.setText(M.Close);
	closeAllAction = ActionFactory.CLOSE_ALL.create(window);
	closeAllAction.setText(M.CloseAll);

	// preferences
	preferencesAction = ActionFactory.PREFERENCES.create(window);
	preferencesAction.setImageDescriptor(Icon.PREFERENCES.descriptor());
	preferencesAction.setText(M.Settings);

	// other
	exitAction = ActionFactory.QUIT.create(window);
	exitAction.setText(M.Exit);
	showViews = ContributionItemFactory.VIEWS_SHORTLIST.create(window);
	aboutAction = ActionFactory.ABOUT.create(window);
	aboutAction.setText(M.AboutOpenLCA);
}
 
Example #24
Source File: DesignerActionBarAdvisor.java    From birt with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * Creates and returns the File menu.
 */
private MenuManager createFileMenu( )
{
	MenuManager menu = new MenuManager( DesignerWorkbenchMessages.Workbench_file,
			IWorkbenchActionConstants.M_FILE );
	
	MenuManager newMenu = new MenuManager(DesignerWorkbenchMessages.Workbench_new, ActionFactory.NEW.getId());
	newMenu.add(newReportAction);
	newMenu.add(newLibraryAction);
	newMenu.add(newReportTemplateAction);
	for (int i=0; i<newActions.length; i++)
	{
		newMenu.add(newActions[i]);
	}
	menu.add(newMenu);
	
	menu.add(openFileAction);
	menu.add( new Separator( ) );

	menu.add( closeAction );
	menu.add( closeAllAction );
	menu.add( new GroupMarker( IWorkbenchActionConstants.CLOSE_EXT ) );
	menu.add( new Separator( ) );
	menu.add( saveAction );
	menu.add( saveAsAction );
	menu.add( saveAllAction );
	menu.add( new GroupMarker( IWorkbenchActionConstants.SAVE_EXT ) );

	menu.add( new GroupMarker( IWorkbenchActionConstants.MB_ADDITIONS ) );

	menu.add( ContributionItemFactory.REOPEN_EDITORS.create( getWindow( ) ) );
	menu.add( new GroupMarker( IWorkbenchActionConstants.MRU ) );
	menu.add( new Separator( ) );
	menu.add( quitAction );
	menu.add( new GroupMarker( IWorkbenchActionConstants.FILE_END ) );
	return menu;
}
 
Example #25
Source File: SavePerspectiveHandler.java    From tmxeditor8 with GNU General Public License v2.0 5 votes vote down vote up
public Object execute(ExecutionEvent event) throws ExecutionException {
	IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
	IWorkbenchAction savePerspectiveAction = ActionFactory.SAVE_PERSPECTIVE.create(window);
	savePerspectiveAction.run();
	
	return null;
}
 
Example #26
Source File: BodyMenuConfiguration.java    From tmxeditor8 with GNU General Public License v2.0 5 votes vote down vote up
private void createBodyMenu() {
	MenuManager menuMgr = new MenuManager();
	bodyMenu = menuMgr.createContextMenu(table.getShell());
	menuMgr.add(new CommandContributionItem(new CommandContributionItemParameter(PlatformUI.getWorkbench(), null,
			ActionFactory.CUT.getCommandId(), Collections.EMPTY_MAP, null, null, null, Messages
					.getString("tmxedtior.bodyMenuConfiguration.cut"), null, null,
			CommandContributionItem.STYLE_PUSH, null, false)));
	menuMgr.add(new CommandContributionItem(new CommandContributionItemParameter(PlatformUI.getWorkbench(), null,
			ActionFactory.COPY.getCommandId(), Collections.EMPTY_MAP, null, null, null, Messages
					.getString("tmxedtior.bodyMenuConfiguration.copy"), null, null,
			CommandContributionItem.STYLE_PUSH, null, false)));
	menuMgr.add(new CommandContributionItem(new CommandContributionItemParameter(PlatformUI.getWorkbench(), null,
			ActionFactory.PASTE.getCommandId(), Collections.EMPTY_MAP, null, null, null, Messages
					.getString("tmxedtior.bodyMenuConfiguration.paste"), null, null,
			CommandContributionItem.STYLE_PUSH, null, false)));
	menuMgr.add(new Separator());

	menuMgr.add(new CommandContributionItem(new CommandContributionItemParameter(PlatformUI.getWorkbench(), null,
			"net.heartsome.cat.te.tmxeditor.command.addtu", Collections.EMPTY_MAP, null, null, null, null, null,
			null, CommandContributionItem.STYLE_PUSH, null, false)));
	menuMgr.add(new CommandContributionItem(new CommandContributionItemParameter(PlatformUI.getWorkbench(), null,
			"net.heartsome.cat.te.tmxeditor.command.deletetu", Collections.EMPTY_MAP, null, null, null, null, null,
			null, CommandContributionItem.STYLE_PUSH, null, false)));
	
	menuMgr.add(new Separator());
	menuMgr.add(new CommandContributionItem(new CommandContributionItemParameter(PlatformUI.getWorkbench(), null,
			"net.heartsome.cat.te.ui.command.cleanSelectInnerTag", Collections.EMPTY_MAP, null, null, null, null, null,
			null, CommandContributionItem.STYLE_PUSH, null, false)));
}
 
Example #27
Source File: ShowFindBarAction.java    From APICloud-Studio with GNU General Public License v3.0 5 votes vote down vote up
public ShowFindBarAction(ITextEditor textEditor)
{
	super(ResourceBundle.getBundle(ShowFindBarAction.class.getName()), ShowFindBarAction.class.getSimpleName()
			+ ".", textEditor); //$NON-NLS-1$
	this.textEditor = textEditor;
	setActionDefinitionId(ActionFactory.FIND.create(textEditor.getSite().getWorkbenchWindow())
			.getActionDefinitionId());
}
 
Example #28
Source File: MultiPageEditorContributor.java    From uima-uimaj with Apache License 2.0 5 votes vote down vote up
@Override
public void setActivePage(IEditorPart part) {

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

    ITextEditor textEditor = (part instanceof XMLEditor) ? (ITextEditor) part : null;

    actionBars.setGlobalActionHandler(ActionFactory.DELETE.getId(), getAction1(textEditor,
            ITextEditorActionConstants.DELETE));
    actionBars.setGlobalActionHandler(ActionFactory.UNDO.getId(), getAction1(textEditor,
            ITextEditorActionConstants.UNDO));
    actionBars.setGlobalActionHandler(ActionFactory.REDO.getId(), getAction1(textEditor,
            ITextEditorActionConstants.REDO));
    actionBars.setGlobalActionHandler(ActionFactory.CUT.getId(), getAction1(textEditor,
            ITextEditorActionConstants.CUT));
    actionBars.setGlobalActionHandler(ActionFactory.COPY.getId(), getAction1(textEditor,
            ITextEditorActionConstants.COPY));
    actionBars.setGlobalActionHandler(ActionFactory.PASTE.getId(), getAction1(textEditor,
            ITextEditorActionConstants.PASTE));
    actionBars.setGlobalActionHandler(ActionFactory.SELECT_ALL.getId(), getAction1(textEditor,
            ITextEditorActionConstants.SELECT_ALL));
    actionBars.setGlobalActionHandler(ActionFactory.FIND.getId(), getAction1(textEditor,
            ITextEditorActionConstants.FIND));
    actionBars.setGlobalActionHandler(IDEActionFactory.BOOKMARK.getId(), getAction1(textEditor,
            IDEActionFactory.BOOKMARK.getId()));
    actionBars.updateActionBars();
  }
}
 
Example #29
Source File: PropertiesView.java    From tmxeditor8 with GNU General Public License v2.0 5 votes vote down vote up
protected CopyActionHandler() {
	super(WorkbenchMessages.Workbench_copy);
	setId("ProperCopyAttribute");//$NON-NLS-1$
	setEnabled(true);
	setImageDescriptor(Activator.getImageDescriptor("images/menu/edit/copy.png"));
	setActionDefinitionId(ActionFactory.COPY.getCommandId());
}
 
Example #30
Source File: ApplicationActionBarAdvisor.java    From translationstudio8 with GNU General Public License v2.0 5 votes vote down vote up
@Override
protected void makeActions(IWorkbenchWindow window) {
	exitAction = ActionFactory.QUIT.create(window);
	register(exitAction);

	preferenceAction = ActionFactory.PREFERENCES.create(window);
	register(preferenceAction);
}