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


Java ActionHandler类代码示例

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


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

示例1: addAction

import org.eclipse.jface.commands.ActionHandler; //导入依赖的package包/类
@Override
public void addAction(final IAction action) {
    Check.notNull(action, "action"); //$NON-NLS-1$

    final String commandId = action.getActionDefinitionId();

    if (commandId == null) {
        throw new IllegalArgumentException("action does not have an action definition ID set"); //$NON-NLS-1$
    }

    final TriggerSequence[] bindings = bindingService.getActiveBindingsFor(commandId);

    if (bindings.length > 0) {
        final IHandler handler = new ActionHandler(action);
        /*
         * Call this deprecated overload for 3.1 support
         */
        final IHandlerActivation activation =
            handlerService.activateHandler(commandId, handler, expression, sourcePriorities);
        handlerActivations.add(activation);
    }
}
 
开发者ID:Microsoft,项目名称:team-explorer-everywhere,代码行数:23,代码来源:ModernActionKeyBindingSupport.java

示例2: createContentAssistActionHandler

import org.eclipse.jface.commands.ActionHandler; //导入依赖的package包/类
private ActionHandler createContentAssistActionHandler(
		final ITextOperationTarget textOperationTarget) {
	Action proposalAction = new Action() {
		@Override
		public void run() {
			if (textOperationTarget
					.canDoOperation(ISourceViewer.CONTENTASSIST_PROPOSALS)
					&& getTextWidget().isFocusControl())
				textOperationTarget
						.doOperation(ISourceViewer.CONTENTASSIST_PROPOSALS);
		}
	};
	proposalAction
			.setActionDefinitionId(ITextEditorActionDefinitionIds.CONTENT_ASSIST_PROPOSALS);
	return new ActionHandler(proposalAction);
}
 
开发者ID:cchabanois,项目名称:mesfavoris,代码行数:17,代码来源:SpellcheckableMessageArea.java

示例3: fillActionBars

import org.eclipse.jface.commands.ActionHandler; //导入依赖的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

示例4: setGlobalActionHandlers

import org.eclipse.jface.commands.ActionHandler; //导入依赖的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

示例5: fillActionBars

import org.eclipse.jface.commands.ActionHandler; //导入依赖的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

示例6: configureToolBar

import org.eclipse.jface.commands.ActionHandler; //导入依赖的package包/类
@Override
protected void configureToolBar(final IToolBarManager manager)
{
  super.configureToolBar(manager);
  final IDiagramOutputActionFactory factory = JiveUIPlugin.getDefault()
      .getDiagramOutputActionFactory();
  final ScalableRootEditPart root = (ScalableRootEditPart) viewer.getRootEditPart();
  final IAction zoomIn = new ZoomInAction(root.getZoomManager());
  final IAction zoomOut = new ZoomOutAction(root.getZoomManager());
  final IUpdatableAction saveAs = factory.createDiagramExportAction(viewer);
  final IUpdatableAction print = factory.createPrintAction(viewer);
  addUpdatableAction(saveAs);
  addUpdatableAction(print);
  // reference: http://dev.eclipse.org/newslists/news.eclipse.platform/msg60866.html
  // register action handlers for zoom in and zoom out:
  final IHandlerService handlerService = (IHandlerService) getSite().getService(
      IHandlerService.class);
  handlerService.activateHandler(zoomIn.getActionDefinitionId(), new ActionHandler(zoomIn));
  handlerService.activateHandler(zoomOut.getActionDefinitionId(), new ActionHandler(zoomOut));
  manager.insertBefore(AbstractJiveView.GROUP_STEP_CONTROLS, new Separator(
      AbstractGraphicalJiveView.ZOOM_CONTROLS_GROUP));
  manager.appendToGroup(AbstractGraphicalJiveView.ZOOM_CONTROLS_GROUP, saveAs);
  manager.appendToGroup(AbstractGraphicalJiveView.ZOOM_CONTROLS_GROUP, print);
  manager.appendToGroup(AbstractGraphicalJiveView.ZOOM_CONTROLS_GROUP, zoomIn);
  manager.appendToGroup(AbstractGraphicalJiveView.ZOOM_CONTROLS_GROUP, zoomOut);
}
 
开发者ID:UBPL,项目名称:jive,代码行数:27,代码来源:AbstractGraphicalJiveView.java

示例7: execute

import org.eclipse.jface.commands.ActionHandler; //导入依赖的package包/类
@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
  try {
    InputStream in = null;
    String resource = "plugin.properties"; //$NON-NLS-1$
    ClassLoader loader = this.getClass().getClassLoader();
    if (loader != null) {
      in = loader.getResourceAsStream(resource);
    }
    else {
      in = ClassLoader.getSystemResourceAsStream(resource);
    }

    IWorkbenchPart part = HandlerUtil.getActivePart(event);
    FindReplaceAction findReplaceAction = new FindReplaceAction(new PropertyResourceBundle(in), null, part);
    ActionHandler actionHandler = new ActionHandler(findReplaceAction);

    return actionHandler.execute(event);
  } catch (Exception e) {
    throw new ExecutionException("Could not execute command!", e); //$NON-NLS-1$
  }
}
 
开发者ID:agusevas,项目名称:logan,代码行数:23,代码来源:FindReplaceHandler.java

示例8: viewerFocusGained

import org.eclipse.jface.commands.ActionHandler; //导入依赖的package包/类
public void viewerFocusGained(FocusEvent event) {
	final IHandlerService handlerService = getHandlerService();
       copyHandlerActivation = handlerService
       		.activateHandler(IWorkbenchCommandConstants.EDIT_COPY,
       		new ActionHandler(copyAction));
       
       refreshHandlerActivation = handlerService
       		.activateHandler(IWorkbenchCommandConstants.FILE_REFRESH,
       		new ActionHandler(reloadAction));
       
       removeHandlerActivation = handlerService
       		.activateHandler(IWorkbenchCommandConstants.EDIT_DELETE,
       		new ActionHandler(removeAction));

}
 
开发者ID:32kda,项目名称:com.onpositive.prefeditor,代码行数:16,代码来源:PreferenceView.java

示例9: prepareZoomContributions

import org.eclipse.jface.commands.ActionHandler; //导入依赖的package包/类
private void prepareZoomContributions(GraphicalViewer viewer) {

		ScalableFreeformRootEditPart root = new ScalableFreeformRootEditPart();

		// set clipping strategy for connection layer
		ConnectionLayer connectionLayer = (ConnectionLayer) root
				.getLayer(LayerConstants.CONNECTION_LAYER);
		connectionLayer
		.setClippingStrategy(new ViewportAwareConnectionLayerClippingStrategy(
				connectionLayer));

		List<String> zoomLevels = new ArrayList<String>(3);
		zoomLevels.add(ZoomManager.FIT_ALL);
		zoomLevels.add(ZoomManager.FIT_WIDTH);
		zoomLevels.add(ZoomManager.FIT_HEIGHT);
		root.getZoomManager().setZoomLevelContributions(zoomLevels);

		IAction zoomIn = new ZoomInAction(root.getZoomManager());
		IAction zoomOut = new ZoomOutAction(root.getZoomManager());
		viewer.setRootEditPart(root);
		getActionRegistry().registerAction(zoomIn);
		getActionRegistry().registerAction(zoomOut);

		//zoom on key strokes: ctrl++ and ctrl--
		IHandlerService service = 
				(IHandlerService)getEditorSite().getService(IHandlerService. class);

		service.activateHandler(zoomIn.getActionDefinitionId(),
				new ActionHandler(zoomIn));

		service.activateHandler(zoomOut.getActionDefinitionId(),
				new ActionHandler(zoomOut));

		// Scroll-wheel Zoom
		getGraphicalViewer().setProperty(
				MouseWheelHandler.KeyGenerator.getKey(SWT.MOD1),
				MouseWheelZoomHandler.SINGLETON);
	}
 
开发者ID:capitalone,项目名称:Hydrograph,代码行数:39,代码来源:ELTGraphicalEditor.java

示例10: createQuickFixActionHandler

import org.eclipse.jface.commands.ActionHandler; //导入依赖的package包/类
private ActionHandler createQuickFixActionHandler(
		final ITextOperationTarget textOperationTarget) {
	Action quickFixAction = new Action() {

		@Override
		public void run() {
			textOperationTarget.doOperation(ISourceViewer.QUICK_ASSIST);
		}
	};
	quickFixAction
	.setActionDefinitionId(ITextEditorActionDefinitionIds.QUICK_ASSIST);
	return new ActionHandler(quickFixAction);
}
 
开发者ID:cchabanois,项目名称:mesfavoris,代码行数:14,代码来源:SpellcheckableMessageArea.java

示例11: createControl

import org.eclipse.jface.commands.ActionHandler; //导入依赖的package包/类
@Override
public void createControl(Composite parent) {
	super.createControl(parent);

	IActionBars bars= getSite().getActionBars();
	IMenuManager menu= bars.getMenuManager();
	menu.add(fToggleLinkingAction);

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

示例12: addAction

import org.eclipse.jface.commands.ActionHandler; //导入依赖的package包/类
public void addAction(Action action){
	if(action == null){
		throw new IllegalArgumentException("Missing argument action.");
	}
	if(action instanceof ViewActionBase){
		((ViewActionBase)action).setPrefModel(this.prefModel);
	}

	actionList.add(action);
	handlerService.activateHandler(action.getActionDefinitionId(), new ActionHandler(action));
}
 
开发者ID:baloise,项目名称:egitblit,代码行数:12,代码来源:ActionFactory.java

示例13: addKeyHandler

import org.eclipse.jface.commands.ActionHandler; //导入依赖的package包/类
private void addKeyHandler(IAction action) {
	IHandlerService service = (IHandlerService) getSite().getService(IHandlerService.class);
	service.activateHandler(action.getActionDefinitionId(), new ActionHandler(action));

}
 
开发者ID:bsteker,项目名称:bdf2,代码行数:6,代码来源:DbToolGefEditor.java

示例14: addKeyHandler

import org.eclipse.jface.commands.ActionHandler; //导入依赖的package包/类
private void addKeyHandler(final IAction action) {
    final IHandlerService service = getSite().getService(IHandlerService.class);
    service.activateHandler(action.getActionDefinitionId(), new ActionHandler(action));
}
 
开发者ID:roundrop,项目名称:ermasterr,代码行数:5,代码来源:ERDiagramEditor.java

示例15: addKeyHandler

import org.eclipse.jface.commands.ActionHandler; //导入依赖的package包/类
private void addKeyHandler(IAction action) {
	IHandlerService service = (IHandlerService) this.getSite().getService(
			IHandlerService.class);
	service.activateHandler(action.getActionDefinitionId(),
			new ActionHandler(action));
}
 
开发者ID:kozake,项目名称:ermaster-k,代码行数:7,代码来源:ERDiagramEditor.java


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