本文整理汇总了Java中org.eclipse.e4.ui.model.application.ui.menu.MHandledMenuItem类的典型用法代码示例。如果您正苦于以下问题:Java MHandledMenuItem类的具体用法?Java MHandledMenuItem怎么用?Java MHandledMenuItem使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
MHandledMenuItem类属于org.eclipse.e4.ui.model.application.ui.menu包,在下文中一共展示了MHandledMenuItem类的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createViewMenu
import org.eclipse.e4.ui.model.application.ui.menu.MHandledMenuItem; //导入依赖的package包/类
private void createViewMenu() {
MHandledToolItem clearAllButton = modelService.createModelElement(MHandledToolItem.class);
clearAllButton.setIconURI(CLEAR_ALL_ICON_URI);
clearAllButton.setCommand(clearAllCommand);
MToolBar toolBar = modelService.createModelElement(MToolBar.class);
toolBar.getChildren().add(clearAllButton);
part.setToolbar(toolBar);
MHandledMenuItem clearAllMenuItem = modelService.createModelElement(MHandledMenuItem.class);
clearAllMenuItem.setLabel("Clear All"); //$NON-NLS-1$
clearAllMenuItem.setIconURI(CLEAR_ALL_ICON_URI);
clearAllMenuItem.setCommand(clearAllCommand);
MHandledMenuItem preferencesMenuItem = modelService.createModelElement(MHandledMenuItem.class);
preferencesMenuItem.setLabel("Preferences"); //$NON-NLS-1$
preferencesMenuItem.setCommand(showPreferencesCommand);
MMenu menu = modelService.createModelElement(MMenu.class);
menu.getTags().add("ViewMenu"); // required //$NON-NLS-1$
menu.getChildren().add(clearAllMenuItem);
menu.getChildren().add(preferencesMenuItem);
part.getMenus().add(menu);
}
示例2: newFilterMenuItem
import org.eclipse.e4.ui.model.application.ui.menu.MHandledMenuItem; //导入依赖的package包/类
private MHandledMenuItem newFilterMenuItem(String key) {
MHandledMenuItem menuItem = MMenuFactory.INSTANCE.createHandledMenuItem();
menuItem.setElementId("org.bbaw.bts.ui.corpus.part.annotations.viewmenu.showType.annotation.type." + key);
menuItem.setSelected(true);
menuItem.setType(ItemType.CHECK);
MParameter menuFilterParam = MCommandsFactory.INSTANCE.createParameter();
menuFilterParam.setName("annotationsPartFilterParam");
menuFilterParam.setValue(key);
menuItem.getParameters().add(menuFilterParam);
return menuItem;
}
示例3: testStartLaunchConfigMenuContribution
import org.eclipse.e4.ui.model.application.ui.menu.MHandledMenuItem; //导入依赖的package包/类
@Test
public void testStartLaunchConfigMenuContribution() {
List<MMenuContribution> menuContributions = application.getMenuContributions();
MHandledMenuItem element = menuContributions.stream()
.flatMap( menuContribution -> menuContribution.getChildren().stream() )
.filter( menuElement -> MENU_ITEM_ID.equals( menuElement.getElementId() ) )
.findFirst()
.map( MHandledMenuItem.class::cast )
.orElse( null );
assertThat( element.getIconURI() ).endsWith( Images.START_LAUNCH_CONFIGURATION );
assertThat( element.getLabel() ).isNotEmpty();
assertThat( element.getCommand().getElementId() ).isEqualTo( OpenLaunchDialogHander.COMMAND_ID );
}
示例4: canExecute
import org.eclipse.e4.ui.model.application.ui.menu.MHandledMenuItem; //导入依赖的package包/类
@CanExecute
public boolean canExecute(MHandledMenuItem item) {
CommandActivator activator = activated.get(getClass());
if (activator == null)
return false;
if ((activator.getStyle() & (SWT.CHECK | SWT.RADIO)) != 0)
item.setSelected(activator.getSelection());
return activator.getEnabled();
}
示例5: getMenuItem
import org.eclipse.e4.ui.model.application.ui.menu.MHandledMenuItem; //导入依赖的package包/类
private MHandledMenuItem getMenuItem(final String inItemID,
final MApplication inApplication, final EModelService inModel) {
if (menuItem == null) {
menuItem = findMenuItem(inItemID, inApplication, inModel);
}
return menuItem;
}
示例6: findMenuItem
import org.eclipse.e4.ui.model.application.ui.menu.MHandledMenuItem; //导入依赖的package包/类
private MHandledMenuItem findMenuItem(final String inItemID,
final MMenu inMenu) {
inMenu.getChildren();
for (final MMenuElement lItem : inMenu.getChildren()) {
if (inItemID.equals(lItem.getElementId())) {
return (MHandledMenuItem) lItem;
}
}
return null;
}
示例7: canExecute
import org.eclipse.e4.ui.model.application.ui.menu.MHandledMenuItem; //导入依赖的package包/类
public boolean canExecute(MHandledMenuItem item) {
if (super.canExecute(item))
return true;
return isWebSite();
}
示例8: canExecute
import org.eclipse.e4.ui.model.application.ui.menu.MHandledMenuItem; //导入依赖的package包/类
public boolean canExecute(MHandledMenuItem item) {
return super.canExecute(item) && isThereSomethingToPaste();
}
示例9: canExecute
import org.eclipse.e4.ui.model.application.ui.menu.MHandledMenuItem; //导入依赖的package包/类
@CanExecute
public boolean canExecute(MHandledMenuItem item) {
if (super.canExecute(item))
return true;
return (getMethod("selectAll") != null && getMethod("cut") != null);
}
示例10: canExecute
import org.eclipse.e4.ui.model.application.ui.menu.MHandledMenuItem; //导入依赖的package包/类
@CanExecute
public boolean canExecute(MHandledMenuItem item) {
if (super.canExecute(item))
return true;
return getDefaultMethod() != null;
}
示例11: setSelected
import org.eclipse.e4.ui.model.application.ui.menu.MHandledMenuItem; //导入依赖的package包/类
/**
* Sets the item with the specified ID' toggle state.
*
* @param inItemID
* String
* @param inState
* boolean
* @param inApplication
* {@link MApplication}
* @param inModel
* {@link EModelService}
*/
public void setSelected(final String inItemID, final boolean inState,
final MApplication inApplication, final EModelService inModel) {
final MHandledMenuItem lItem = getMenuItem(inItemID, inApplication,
inModel);
if (lItem != null) {
lItem.setSelected(inState);
}
}