I'm having a problem regarding the HandledToolItem in my MToolbar. When pressing a button the application should create a new Part with a Toolbar and one HandledToolItem. The problem is that the HandledToolItem is always greyed out and I don't know why yet.
final MPart mPart = modelService.createModelElement(MPart.class);
mPart.setLabel("Test");
mPart.setElementId("newid");
mPart.setContributionURI("bundleclass://something");
mPart.setCloseable(true);
// create Toolbar
final MToolBar mBar = modelService.createModelElement(MToolBar.class);
mPart.setToolbar(mBar);
// create HanledToolItem
final MHandledToolItem mItem = modelService.createModelElement(MHandledToolItem.class);
mBar.getChildren().add(mItem);
// create Handle and Command
final MHandler toolHandler = modelService.createModelElement(MHandler.class);
final MCommand toolCommand = modelService.createModelElement(MCommand.class);
toolCommand.setElementId("dsadsadsa");
toolHandler.setCommand(toolCommand);
toolHandler.setContributionURI("bundleclass://something");
mItem.setIconURI("platform:/plugin/RCPCAN/icons/icon_con_scroll_lock.png");
mItem.setTooltip("Lock Table Scrollbar");
mItem.setCommand(toolCommand);
mItem.setEnabled(true);
// show part
partService.showPart(mPart, PartState.ACTIVATE);