本文整理汇总了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);
}
}
示例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();
}
示例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);
}
});
}
示例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 );
}
示例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 );
}
示例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 );
}
示例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 );
}
示例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);
}
}
示例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;
}
};
}
示例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
}
}
示例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();
}
}
示例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);
}
示例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);
}
}
示例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);
示例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);