本文整理匯總了Java中org.eclipse.e4.ui.model.application.commands.MHandler類的典型用法代碼示例。如果您正苦於以下問題:Java MHandler類的具體用法?Java MHandler怎麽用?Java MHandler使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
MHandler類屬於org.eclipse.e4.ui.model.application.commands包,在下文中一共展示了MHandler類的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: createCommands
import org.eclipse.e4.ui.model.application.commands.MHandler; //導入依賴的package包/類
private void createCommands() {
clearAllCommand = modelService.createModelElement(MCommand.class);
clearAllCommand.setElementId("clearAllCommand"); //$NON-NLS-1$
clearAllCommand.setCommandName("clearAllCommand"); //$NON-NLS-1$
application.getCommands().add(clearAllCommand);
showPreferencesCommand = modelService.createModelElement(MCommand.class);
showPreferencesCommand.setElementId("showPreferencesCommand"); //$NON-NLS-1$
showPreferencesCommand.setCommandName("showPreferencesCommand"); //$NON-NLS-1$
application.getCommands().add(showPreferencesCommand);
MHandler clearAllHandler = modelService.createModelElement(MHandler.class);
clearAllHandler.setCommand(clearAllCommand);
clearAllHandler.setContributionURI("bundleclass://org.eclipse.e4.ui.progress/org.eclipse.e4.ui.progress.ClearAllHandler"); //$NON-NLS-1$
part.getHandlers().add(clearAllHandler);
MHandler showPreferencesHandler = modelService.createModelElement(MHandler.class);
showPreferencesHandler.setCommand(showPreferencesCommand);
showPreferencesHandler.setContributionURI("bundleclass://org.eclipse.e4.ui.progress/org.eclipse.e4.ui.progress.OpenPreferenceDialogHandler"); //$NON-NLS-1$
part.getHandlers().add(showPreferencesHandler);
}
示例2: init
import org.eclipse.e4.ui.model.application.commands.MHandler; //導入依賴的package包/類
@Execute
void init() {
// Perspectives Category definition
MCategory perspectivesCategory = commandsFactory.createCategory();
perspectivesCategory.setContributorURI(contributorURI);
perspectivesCategory.setDescription(E4WorkbenchCommandConstants.CATEGORY_PERSPECTIVES$_DESCRIPTION);
perspectivesCategory.setElementId(E4WorkbenchCommandConstants.CATEGORY_PERSPECTIVES);
perspectivesCategory.setName(E4WorkbenchCommandConstants.CATEGORY_PERSPECTIVES$_NAME);
application.getCategories().add(perspectivesCategory);
{ // Show Perspective command & handler with properties
MCommand showPerspectiveCommand = commandsFactory.createCommand();
showPerspectiveCommand.setContributorURI(contributorURI);
showPerspectiveCommand.setElementId(E4WorkbenchCommandConstants.PERSPECTIVES_SHOW_PERSPECTIVE);
showPerspectiveCommand.setCategory(perspectivesCategory);
showPerspectiveCommand.setCommandName(E4WorkbenchCommandConstants.PERSPECTIVES_SHOW_PERSPECTIVE$_NAME);
showPerspectiveCommand.setDescription(E4WorkbenchCommandConstants.PERSPECTIVES_SHOW_PERSPECTIVE$_DESCRIPTION);
application.getCommands().add(showPerspectiveCommand);
MCommandParameter parameterPerspectiveId = commandsFactory.createCommandParameter();
parameterPerspectiveId.setContributorURI(contributorURI);
parameterPerspectiveId.setElementId(E4WorkbenchParameterConstants.COMMAND_PERSPECTIVE_ID);
parameterPerspectiveId.setName(E4WorkbenchParameterConstants.COMMAND_PERSPECTIVE_ID$_NAME);
parameterPerspectiveId.setOptional(E4WorkbenchParameterConstants.COMMAND_PERSPECTIVE_ID$_OPTION);
showPerspectiveCommand.getParameters().add(parameterPerspectiveId);
MCommandParameter parameterWindow = commandsFactory.createCommandParameter();
parameterWindow.setContributorURI(contributorURI);
parameterWindow.setElementId(E4WorkbenchParameterConstants.COMMAND_PERSPECTIVE_WINDOW);
parameterWindow.setName(E4WorkbenchParameterConstants.COMMAND_PERSPECTIVE_WINDOW$_NAME);
parameterWindow.setOptional(E4WorkbenchParameterConstants.COMMAND_PERSPECTIVE_WINDOW$_OPTION);
showPerspectiveCommand.getParameters().add(parameterWindow);
MCommandParameter parameterNewWindow = commandsFactory.createCommandParameter();
parameterNewWindow.setContributorURI(contributorURI);
parameterNewWindow.setElementId(E4WorkbenchParameterConstants.COMMAND_PERSPECTIVE_NEW_WINDOW);
parameterNewWindow.setName(E4WorkbenchParameterConstants.COMMAND_PERSPECTIVE_NEW_WINDOW$_NAME);
parameterNewWindow.setOptional(E4WorkbenchParameterConstants.COMMAND_PERSPECTIVE_NEW_WINDOW$_OPTION);
showPerspectiveCommand.getParameters().add(parameterNewWindow);
MHandler showTextHandler = commandsFactory.createHandler();
showTextHandler.setContributorURI(contributorURI);
showTextHandler.setElementId(E4WorkbenchHandlerConstants.PERSPECTIVES_SHOW_PERSPECTIVE);
showTextHandler.setCommand(showPerspectiveCommand);
showTextHandler.setContributionURI(E4PerspectiveSwitcherActivator.getDefault().getResourceURI(ShowPerspectiveHandler.class));
application.getHandlers().add(showTextHandler);
}
}
示例3: getHandlers
import org.eclipse.e4.ui.model.application.commands.MHandler; //導入依賴的package包/類
@Override
public List<MHandler> getHandlers() { return null; }