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


Java IHandler类代码示例

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


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

示例1: addAction

import org.eclipse.core.commands.IHandler; //导入依赖的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: dispose

import org.eclipse.core.commands.IHandler; //导入依赖的package包/类
@Override
public void dispose() {
  for (IHandler h : handlers) {
    h.dispose();
  }
  handlers.clear();
  CoverageTools.removeJavaCoverageListener(coverageListener);
  CoverageTools.getSessionManager().removeSessionListener(descriptionUpdater);
  selectiontracker.dispose();
  super.dispose();
}
 
开发者ID:eclipse,项目名称:eclemma,代码行数:12,代码来源:CoverageView.java

示例3: executeHandler

import org.eclipse.core.commands.IHandler; //导入依赖的package包/类
private void executeHandler(IHandler handler, ExecutionEvent event) {
	UIThreadRunnable.syncExec(()->{
		try {
			return handler.execute(event);
		} catch (ExecutionException e) {
			throw new RuntimeException(e);
		}
	});
}
 
开发者ID:cchabanois,项目名称:mesfavoris,代码行数:10,代码来源:CopyBookmarkUrlHandlerTest.java

示例4: testExtension

import org.eclipse.core.commands.IHandler; //导入依赖的package包/类
@Test
public void testExtension() {
  Extension extension = readCommandExtension();

  assertThat( extension.getAttribute( "name" ) ).isNotEmpty();
  assertThat( extension.getAttribute( "description" ) ).isNotEmpty();
  assertThat( extension.getAttribute( "categoryId" ) ).isEqualTo( "org.eclipse.ui.category.file" );
  IHandler handler = extension.createExecutableExtension( "defaultHandler", IHandler.class );
  assertThat( handler ).isInstanceOf( OpenWithQuickMenuHandler.class );
}
 
开发者ID:rherrmann,项目名称:eclipse-extras,代码行数:11,代码来源:OpenWithQuickMenuCommandPDETest.java

示例5: testExtension

import org.eclipse.core.commands.IHandler; //导入依赖的package包/类
@Test
public void testExtension() {
  Extension extension = readCommandExtension();

  assertThat( extension.getAttribute( "name" ) ).isNotEmpty();
  assertThat( extension.getAttribute( "description" ) ).isNotEmpty();
  assertThat( extension.getAttribute( "categoryId" ) ).isEqualTo( "org.eclipse.ui.category.file" );
  IHandler handler = extension.createExecutableExtension( "defaultHandler", IHandler.class );
  assertThat( handler ).isInstanceOf( DeleteEditorFileHandler.class );
}
 
开发者ID:rherrmann,项目名称:eclipse-extras,代码行数:11,代码来源:DeleteEditorFileCommandPDETest.java

示例6: testExtension

import org.eclipse.core.commands.IHandler; //导入依赖的package包/类
@Test
public void testExtension() {
  Extension extension = readCommandExtension();

  assertThat( extension.getAttribute( "name" ) ).isNotEmpty();
  assertThat( extension.getAttribute( "description" ) ).isNotEmpty();
  assertThat( extension.getAttribute( "categoryId" ) ).isEqualTo( "org.eclipse.ui.category.views" );
  IHandler handler = extension.createExecutableExtension( "defaultHandler", IHandler.class );
  assertThat( handler ).isInstanceOf( CloseViewHandler.class );
}
 
开发者ID:rherrmann,项目名称:eclipse-extras,代码行数:11,代码来源:CloseViewCommandPDETest.java

示例7: testExtension

import org.eclipse.core.commands.IHandler; //导入依赖的package包/类
@Test
public void testExtension() {
  Extension extension = readCommandExtension();

  assertThat( extension.getAttribute( "name" ) ).isNotEmpty();
  assertThat( extension.getAttribute( "description" ) ).isNotEmpty();
  assertThat( extension.getAttribute( "categoryId" ) ).isEqualTo( "org.eclipse.debug.ui.category.run" );
  IHandler handler = extension.createExecutableExtension( "defaultHandler", IHandler.class );
  assertThat( handler ).isInstanceOf( OpenLaunchDialogHander.class );
}
 
开发者ID:rherrmann,项目名称:eclipse-extras,代码行数:11,代码来源:LaunchCommandPDETest.java

示例8: installQuickAccessAction

import org.eclipse.core.commands.IHandler; //导入依赖的package包/类
private void installQuickAccessAction() {
	fHandlerService= (IHandlerService)fSite.getService(IHandlerService.class);
	if (fHandlerService != null) {
		IHandler handler= new JDTQuickMenuCreator(fEditor) {
			@Override
			protected void fillMenu(IMenuManager menu) {
				fillQuickMenu(menu);
			}
		}.createHandler();
		fQuickAccessHandlerActivation= fHandlerService.activateHandler(QUICK_MENU_ID, handler);
	}
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:13,代码来源:GenerateActionGroup.java

示例9: createHandler

import org.eclipse.core.commands.IHandler; //导入依赖的package包/类
/**
 * Returns a handler that can create and open the quick menu.
 * 
 * @return a handler that can create and open the quick menu
 */
public IHandler createHandler() {
	return new AbstractHandler() {
		public Object execute(ExecutionEvent event) throws ExecutionException {
			createMenu();
			return null;
		}
	};
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:14,代码来源:JDTQuickMenuCreator.java

示例10: preExecute

import org.eclipse.core.commands.IHandler; //导入依赖的package包/类
public void preExecute(String commandId, ExecutionEvent event) {
	IHandler handler = event.getCommand().getHandler();
	// The handler class is not visible
	if (handler != null && handler.getClass().getName().startsWith(ASSIST_HANDLER)) {
		Beeper.setBeepon(false); // disable beep if in content assist
	}
}
 
开发者ID:MulgaSoft,项目名称:e4macs,代码行数:8,代码来源:EmacsOverrunHandler.java

示例11: widgetSelected

import org.eclipse.core.commands.IHandler; //导入依赖的package包/类
/**
 * {@inheritDoc}
 */
@Override
public void widgetSelected(SelectionEvent event) {
	IHandler handler;
	if (isShow) {
		handler = new NodeChildrenShowHandler();
	} else {
		handler = new NodeChildrenHideHandler();
	}
	try {
		handler.execute(null);
	} catch (Exception e) {
		e.printStackTrace();
	}
}
 
开发者ID:d-case,项目名称:d-case_editor,代码行数:18,代码来源:NodeChildrenContributionItem.java

示例12: activateHandler

import org.eclipse.core.commands.IHandler; //导入依赖的package包/类
private void activateHandler(String id, IHandler handler) {
  final IHandlerService hs = (IHandlerService) getSite().getService(
      IHandlerService.class);
  hs.activateHandler(id, handler);
  handlers.add(handler);
}
 
开发者ID:eclipse,项目名称:eclemma,代码行数:7,代码来源:CoverageView.java

示例13: registerActionHandler

import org.eclipse.core.commands.IHandler; //导入依赖的package包/类
/**
 * Creates an ActionHandler for the given IAction and registers it to the Site's HandlerService,
 * i. e. binds the action to the command so that key bindings get activated. You need to set the
 * action's actionDefinitionId to the command id.
 * 
 * @param action
 *            the action to activate. The action's actionDefinitionId must have been set to the
 *            command's id (using <code>setActionDefinitionId()</code>)
 * @param part
 *            the view this action should be registered for
 */
public static void registerActionHandler(final ViewPart part, final IAction action){
	String commandId = action.getActionDefinitionId();
	if (!StringTool.isNothing(commandId)) {
		IHandlerService handlerService = part.getSite().getService(IHandlerService.class);
		IHandler handler = new ActionHandler(action);
		handlerService.activateHandler(commandId, handler);
	}
}
 
开发者ID:elexis,项目名称:elexis-3-core,代码行数:20,代码来源:GlobalActions.java

示例14: getHandler

import org.eclipse.core.commands.IHandler; //导入依赖的package包/类
/**
 * Returns the handler for the given command identifier.
 *
 * <p>The same handler instance will be returned when called a more than once with the same
 * command identifier.
 *
 * @param commandId the command identifier
 * @return the handler for the given command identifier
 * @throws IllegalArgumentException if the command is not supported by this content assistant
 * @throws IllegalStateException if called when this content assistant is uninstalled
 */
IHandler getHandler(String commandId);
 
开发者ID:eclipse,项目名称:che,代码行数:13,代码来源:IQuickAssistAssistantExtension.java

示例15: setHelpContextId

import org.eclipse.core.commands.IHandler; //导入依赖的package包/类
/**
 * Sets the help context identifier to associate with a particular handler.
 * 
 * @param handler
 *            The handler with which to register a help context identifier;
 *            must not be <code>null</code>.
 * @param helpContextId
 *            The help context identifier to register; may be
 *            <code>null</code> if the help context identifier should be
 *            removed.
 * @since 3.2
 */
public void setHelpContextId(IHandler handler, String helpContextId);
 
开发者ID:ghillairet,项目名称:gef-gwt,代码行数:14,代码来源:ICommandService.java


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