当前位置: 首页>>代码示例>>Java>>正文


Java IWorkbenchCommandConstants类代码示例

本文整理汇总了Java中org.eclipse.ui.IWorkbenchCommandConstants的典型用法代码示例。如果您正苦于以下问题:Java IWorkbenchCommandConstants类的具体用法?Java IWorkbenchCommandConstants怎么用?Java IWorkbenchCommandConstants使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


IWorkbenchCommandConstants类属于org.eclipse.ui包,在下文中一共展示了IWorkbenchCommandConstants类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: hookToCommands

import org.eclipse.ui.IWorkbenchCommandConstants; //导入依赖的package包/类
private void hookToCommands(final ToolItem lastEdit, final ToolItem nextEdit) {
	final UIJob job = new UIJob("Hooking to commands") {

		@Override
		public IStatus runInUIThread(final IProgressMonitor monitor) {
			final ICommandService service = WorkbenchHelper.getService(ICommandService.class);
			final Command nextCommand = service.getCommand(IWorkbenchCommandConstants.NAVIGATE_FORWARD_HISTORY);
			nextEdit.setEnabled(nextCommand.isEnabled());
			final ICommandListener nextListener = e -> nextEdit.setEnabled(nextCommand.isEnabled());

			nextCommand.addCommandListener(nextListener);
			final Command lastCommand = service.getCommand(IWorkbenchCommandConstants.NAVIGATE_BACKWARD_HISTORY);
			final ICommandListener lastListener = e -> lastEdit.setEnabled(lastCommand.isEnabled());
			lastEdit.setEnabled(lastCommand.isEnabled());
			lastCommand.addCommandListener(lastListener);
			// Attaching dispose listeners to the toolItems so that they remove the
			// command listeners properly
			lastEdit.addDisposeListener(e -> lastCommand.removeCommandListener(lastListener));
			nextEdit.addDisposeListener(e -> nextCommand.removeCommandListener(nextListener));
			return Status.OK_STATUS;
		}
	};
	job.schedule();

}
 
开发者ID:gama-platform,项目名称:gama,代码行数:26,代码来源:EditorToolbar.java

示例2: ClipboardOperationAction

import org.eclipse.ui.IWorkbenchCommandConstants; //导入依赖的package包/类
/**
 * Creates the action.
 * @param bundle the resource bundle
 * @param prefix a prefix to be prepended to the various resource keys
 *   (described in <code>ResourceAction</code> constructor), or
 *   <code>null</code> if none
 * @param editor the text editor
 * @param operationCode the operation code
 */
public ClipboardOperationAction(ResourceBundle bundle, String prefix, ITextEditor editor, int operationCode) {
	super(bundle, prefix, editor);
	fOperationCode= operationCode;

	if (operationCode == ITextOperationTarget.CUT) {
		setHelpContextId(IAbstractTextEditorHelpContextIds.CUT_ACTION);
		setActionDefinitionId(IWorkbenchCommandConstants.EDIT_CUT);
	} else if (operationCode == ITextOperationTarget.COPY) {
		setHelpContextId(IAbstractTextEditorHelpContextIds.COPY_ACTION);
		setActionDefinitionId(IWorkbenchCommandConstants.EDIT_COPY);
	} else if (operationCode == ITextOperationTarget.PASTE) {
		setHelpContextId(IAbstractTextEditorHelpContextIds.PASTE_ACTION);
		setActionDefinitionId(IWorkbenchCommandConstants.EDIT_PASTE);
	} else {
		Assert.isTrue(false, "Invalid operation code"); //$NON-NLS-1$
	}
	update();
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:28,代码来源:ClipboardOperationAction.java

示例3: createTextMenu

import org.eclipse.ui.IWorkbenchCommandConstants; //导入依赖的package包/类
/**
 * Create the context menu for the text widget.
 * 
 * @since 3.4
 */
private void createTextMenu() {
	final MenuManager textManager = new MenuManager();
	textManager.add(new CommandContributionItem(new CommandContributionItemParameter(PlatformUI.getWorkbench(),
			null, IWorkbenchCommandConstants.EDIT_COPY, CommandContributionItem.STYLE_PUSH)));
	textManager.add(new CommandContributionItem(new CommandContributionItemParameter(PlatformUI.getWorkbench(),
			null, IWorkbenchCommandConstants.EDIT_SELECT_ALL, CommandContributionItem.STYLE_PUSH)));
	text.setMenu(textManager.createContextMenu(text));
	text.addDisposeListener(new DisposeListener() {

		public void widgetDisposed(DisposeEvent e) {
			textManager.dispose();
		}
	});

}
 
开发者ID:capitalone,项目名称:Hydrograph,代码行数:21,代码来源:CustomAboutDialog.java

示例4: execute

import org.eclipse.ui.IWorkbenchCommandConstants; //导入依赖的package包/类
public Object execute(ExecutionEvent event) throws ExecutionException {

    final IWorkbenchSite site = HandlerUtil.getActiveSite(event);
    final ICommandService cs = (ICommandService) site
        .getService(ICommandService.class);
    final IHandlerService hs = (IHandlerService) site
        .getService(IHandlerService.class);
    final Command command = cs
        .getCommand(IWorkbenchCommandConstants.FILE_IMPORT);

    try {
      hs.executeCommand(ParameterizedCommand.generateCommand(command,
          Collections.singletonMap(
              IWorkbenchCommandConstants.FILE_IMPORT_PARM_WIZARDID,
              SessionImportWizard.ID)),
          null);
    } catch (CommandException e) {
      EclEmmaUIPlugin.log(e);
    }

    return null;
  }
 
开发者ID:eclipse,项目名称:eclemma,代码行数:23,代码来源:ImportSessionHandler.java

示例5: execute

import org.eclipse.ui.IWorkbenchCommandConstants; //导入依赖的package包/类
public Object execute(ExecutionEvent event) throws ExecutionException {

    final IWorkbenchSite site = HandlerUtil.getActiveSite(event);
    final ICommandService cs = (ICommandService) site
        .getService(ICommandService.class);
    final IHandlerService hs = (IHandlerService) site
        .getService(IHandlerService.class);
    final Command command = cs
        .getCommand(IWorkbenchCommandConstants.FILE_EXPORT);

    try {
      hs.executeCommand(ParameterizedCommand.generateCommand(command,
          Collections.singletonMap(
              IWorkbenchCommandConstants.FILE_EXPORT_PARM_WIZARDID,
              SessionExportWizard.ID)),
          null);
    } catch (CommandException e) {
      EclEmmaUIPlugin.log(e);
    }

    return null;
  }
 
开发者ID:eclipse,项目名称:eclemma,代码行数:23,代码来源:ExportSessionHandler.java

示例6: createHandlers

import org.eclipse.ui.IWorkbenchCommandConstants; //导入依赖的package包/类
/**
 * Create local handlers.
 */
private void createHandlers() {
  activateHandler(SelectRootElementsHandler.ID,
      new SelectRootElementsHandler(settings, this));
  activateHandler(SelectCountersHandler.ID, new SelectCountersHandler(
      settings, this));
  activateHandler(HideUnusedElementsHandler.ID,
      new HideUnusedElementsHandler(settings, this));
  activateHandler(IWorkbenchCommandConstants.EDIT_COPY, new CopyHandler(
      settings, getSite().getShell().getDisplay(), viewer));
  activateHandler(IWorkbenchCommandConstants.FILE_REFRESH,
      new RefreshSessionHandler(CoverageTools.getSessionManager()));
  activateHandler(IWorkbenchCommandConstants.NAVIGATE_COLLAPSE_ALL,
      new CollapseAllHandler(viewer));
  activateHandler(LinkWithSelectionHandler.ID, new LinkWithSelectionHandler(
      settings, selectiontracker));
}
 
开发者ID:eclipse,项目名称:eclemma,代码行数:20,代码来源:CoverageView.java

示例7: createActions

import org.eclipse.ui.IWorkbenchCommandConstants; //导入依赖的package包/类
private void createActions() {
  // For the following commands we use actions, as they are already available

  final IActionBars ab = getViewSite().getActionBars();

  openAction = new OpenAction(getSite());
  openAction
      .setActionDefinitionId(IJavaEditorActionDefinitionIds.OPEN_EDITOR);
  ab.setGlobalActionHandler(JdtActionConstants.OPEN, openAction);
  openAction.setEnabled(false);
  viewer.addSelectionChangedListener(openAction);

  PropertyDialogAction propertiesAction = new PropertyDialogAction(getSite(),
      viewer);
  propertiesAction
      .setActionDefinitionId(IWorkbenchCommandConstants.FILE_PROPERTIES);
  ab.setGlobalActionHandler(ActionFactory.PROPERTIES.getId(),
      propertiesAction);
  propertiesAction.setEnabled(false);
  viewer.addSelectionChangedListener(propertiesAction);
}
 
开发者ID:eclipse,项目名称:eclemma,代码行数:22,代码来源:CoverageView.java

示例8: makeActions

import org.eclipse.ui.IWorkbenchCommandConstants; //导入依赖的package包/类
protected void makeActions() {
	clipboard = new Clipboard(shell.getDisplay());

	pasteAction = new PasteAction(shell, clipboard);
	pasteAction.setImageDescriptor(GamaIcons.create("menu.paste2").descriptor());
	pasteAction.setActionDefinitionId(IWorkbenchCommandConstants.EDIT_PASTE);

	copyAction = new CopyAction(shell, clipboard, pasteAction);
	copyAction.setImageDescriptor(GamaIcons.create("menu.copy2").descriptor());
	copyAction.setActionDefinitionId(IWorkbenchCommandConstants.EDIT_COPY);

	final IShellProvider sp = () -> shell;

	deleteAction = new DeleteResourceAction(sp);
	deleteAction.setImageDescriptor(GamaIcons.create("menu.delete2").descriptor());
	deleteAction.setActionDefinitionId(IWorkbenchCommandConstants.EDIT_DELETE);

}
 
开发者ID:gama-platform,项目名称:gama,代码行数:19,代码来源:EditActionProvider.java

示例9: execute

import org.eclipse.ui.IWorkbenchCommandConstants; //导入依赖的package包/类
public final Object execute(final ExecutionEvent event)
{
	final String preferencePageId = event.getParameter(IWorkbenchCommandConstants.WINDOW_PREFERENCES_PARM_PAGEID);
	final IWorkbenchWindow activeWorkbenchWindow = HandlerUtil.getActiveWorkbenchWindow(event);

	final Shell shell;
	if (activeWorkbenchWindow == null)
	{
		shell = null;
	}
	else
	{
		shell = activeWorkbenchWindow.getShell();
	}

	final PreferenceDialog dialog = PreferencesUtil.createPreferenceDialogOn(shell, preferencePageId,
			new String[] { preferencePageId }, null);
	dialog.open();

	return null;
}
 
开发者ID:apicloudcom,项目名称:APICloud-Studio,代码行数:22,代码来源:ShowFilteredPreferencePageHandler.java

示例10: BuildActionGroup

import org.eclipse.ui.IWorkbenchCommandConstants; //导入依赖的package包/类
private BuildActionGroup(IWorkbenchSite site, ISelectionProvider specialSelectionProvider, RefreshAction refreshAction) {
	fSelectionProvider= specialSelectionProvider != null ? specialSelectionProvider : site.getSelectionProvider();

	fBuildAction= new BuildAction(new ShellProviderAdapter(site.getShell()), IncrementalProjectBuilder.INCREMENTAL_BUILD);
	fBuildAction.setText(ActionMessages.BuildAction_label);
	fBuildAction.setActionDefinitionId(IWorkbenchCommandConstants.PROJECT_BUILD_PROJECT);

	fRefreshAction= refreshAction;
	fRefreshAction.setActionDefinitionId(IWorkbenchCommandConstants.FILE_REFRESH);

	if (specialSelectionProvider != null) {
		fRefreshAction.setSpecialSelectionProvider(specialSelectionProvider);
	}

	fSelectionProvider.addSelectionChangedListener(fBuildAction);
	fSelectionProvider.addSelectionChangedListener(fRefreshAction);
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:18,代码来源:BuildActionGroup.java

示例11: fillActionBars

import org.eclipse.ui.IWorkbenchCommandConstants; //导入依赖的package包/类
/**
 * 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));
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:25,代码来源:AbstractInfoView.java

示例12: setGlobalActionHandlers

import org.eclipse.ui.IWorkbenchCommandConstants; //导入依赖的package包/类
private void setGlobalActionHandlers(IActionBars actionBars) {
	// Navigate Go Into and Go To actions.
	actionBars.setGlobalActionHandler(IWorkbenchActionConstants.GO_INTO, fZoomInAction);
	actionBars.setGlobalActionHandler(ActionFactory.BACK.getId(), fBackAction);
	actionBars.setGlobalActionHandler(ActionFactory.FORWARD.getId(), fForwardAction);
	actionBars.setGlobalActionHandler(IWorkbenchActionConstants.UP, fUpAction);
	actionBars.setGlobalActionHandler(IWorkbenchActionConstants.GO_TO_RESOURCE, fGotoResourceAction);
	actionBars.setGlobalActionHandler(JdtActionConstants.GOTO_TYPE, fGotoTypeAction);
	actionBars.setGlobalActionHandler(JdtActionConstants.GOTO_PACKAGE, fGotoPackageAction);
	actionBars.setGlobalActionHandler(ActionFactory.SELECT_ALL.getId(), fSelectAllAction);

	fRefactorActionGroup.retargetFileMenuActions(actionBars);

	IHandlerService handlerService= (IHandlerService) fPart.getViewSite().getService(IHandlerService.class);
	handlerService.activateHandler(IWorkbenchCommandConstants.NAVIGATE_TOGGLE_LINK_WITH_EDITOR, new ActionHandler(fToggleLinkingAction));
	handlerService.activateHandler(CollapseAllHandler.COMMAND_ID, new ActionHandler(fCollapseAllAction));
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:18,代码来源:PackageExplorerActionGroup.java

示例13: registerToolbarActions

import org.eclipse.ui.IWorkbenchCommandConstants; //导入依赖的package包/类
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);
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:26,代码来源:JavaOutlinePage.java

示例14: createTitleMenuArea

import org.eclipse.ui.IWorkbenchCommandConstants; //导入依赖的package包/类
@Override
protected Control createTitleMenuArea(Composite parent) {
	fViewMenuButtonComposite= (Composite) super.createTitleMenuArea(parent);

	// If there is a header, then the filter text must be created
	// underneath the title and menu area.

	if (hasHeader()) {
		fFilterText= createFilterText(parent);
	}

	// Create show view menu action
	fShowViewMenuAction= new Action("showViewMenu") { //$NON-NLS-1$
		/*
		 * @see org.eclipse.jface.action.Action#run()
		 */
		@Override
		public void run() {
			showDialogMenu();
		}
	};
	fShowViewMenuAction.setEnabled(true);
	fShowViewMenuAction.setActionDefinitionId(IWorkbenchCommandConstants.WINDOW_SHOW_VIEW_MENU);

	return fViewMenuButtonComposite;
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:27,代码来源:AbstractInformationControl.java

示例15: fillActionBars

import org.eclipse.ui.IWorkbenchCommandConstants; //导入依赖的package包/类
@Override
protected void fillActionBars(final IActionBars actionBars) {
	super.fillActionBars(actionBars);

	actionBars.setGlobalActionHandler(ActionFactory.BACK.getId(), fBackAction);
	actionBars.setGlobalActionHandler(ActionFactory.FORWARD.getId(), fForthAction);

	fInputSelectionProvider.addSelectionChangedListener(new ISelectionChangedListener() {
		public void selectionChanged(SelectionChangedEvent event) {
			actionBars.setGlobalActionHandler(JdtActionConstants.OPEN_ATTACHED_JAVA_DOC, fOpenBrowserAction);
		}
	});

	IHandlerService handlerService= (IHandlerService) getSite().getService(IHandlerService.class);
	handlerService.activateHandler(IWorkbenchCommandConstants.NAVIGATE_TOGGLE_LINK_WITH_EDITOR, new ActionHandler(fToggleLinkAction));
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion-Juno38,代码行数:17,代码来源:JavadocView.java


注:本文中的org.eclipse.ui.IWorkbenchCommandConstants类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。