+
+ /**
+ * See
+ * http://www.vogella.com/tutorials/EclipsePlugin/article.html#adding-eclipse-4-x-parts-to-eclipse-3-x-applications-via-the-code-org-eclipse-ui-views-code-extension-point
+ *
+ * Cannot contribute toolbar items via fragment at this point
+ */
+ MToolBar toolBar = MMenuFactory.INSTANCE.createToolBar();
+ toolBar.setToBeRendered(true);
+ toolBar.getChildren().add(createActivateRouteToolItem(app));
+ toolBar.getChildren().add(createDeactivateRouteToolItem(app));
+ part.setToolbar(toolBar);
+ }
+
+
+ private static MHandledToolItem createActivateRouteToolItem(MApplication app) {
+ MHandledToolItem createHandledToolItem = MMenuFactory.INSTANCE.createHandledToolItem();
+ createHandledToolItem.setCommand(app.getCommand("org.simantics.district.route.ui.command.activatecreateroute")); // Command is contributed via fragment //$NON-NLS-1$
+ createHandledToolItem.setLabel("Activate create route");
+ createHandledToolItem.setIconURI("platform:/plugin/com.famfamfam.silk/icons/table_add.png"); //$NON-NLS-1$
+ createHandledToolItem.setEnabled(true);
+ return createHandledToolItem;
+ }
+
+ private static MHandledToolItem createDeactivateRouteToolItem(MApplication app) {
+ MHandledToolItem createHandledToolItem = MMenuFactory.INSTANCE.createHandledToolItem();
+ createHandledToolItem.setCommand(app.getCommand("org.simantics.district.route.ui.command.deactivatecreateroute")); // Command is contributed via fragment //$NON-NLS-1$
+ createHandledToolItem.setLabel("Deactivate create route");
+ createHandledToolItem.setIconURI("platform:/plugin/com.famfamfam.silk/icons/table_edit.png"); //$NON-NLS-1$
+ createHandledToolItem.setEnabled(true);
+ return createHandledToolItem;