]> gerrit.simantics Code Review - simantics/district.git/blobdiff - org.simantics.district.network.ui/src/org/simantics/district/network/ui/techtype/table/TechTypeTableView.java
Add UI for resetting component values
[simantics/district.git] / org.simantics.district.network.ui / src / org / simantics / district / network / ui / techtype / table / TechTypeTableView.java
index 6c25251c344da677ea4459de21be02db14533979..8f4b57c98b88384bbfaa9f46594406ab7976c7eb 100644 (file)
@@ -13,6 +13,7 @@ import org.eclipse.e4.ui.model.application.ui.basic.MPart;
 import org.eclipse.e4.ui.model.application.ui.menu.MHandledToolItem;
 import org.eclipse.e4.ui.model.application.ui.menu.MMenuFactory;
 import org.eclipse.e4.ui.model.application.ui.menu.MToolBar;
+import org.eclipse.e4.ui.model.application.ui.menu.MToolBarElement;
 import org.eclipse.e4.ui.workbench.modeling.ESelectionService;
 import org.eclipse.swt.widgets.Composite;
 import org.simantics.Simantics;
@@ -43,6 +44,7 @@ public class TechTypeTableView {
                toolBar.setToBeRendered(true);
                toolBar.getChildren().add(createImportCSVDataToolItem(app));
                toolBar.getChildren().add(createValidateTableToolItem(app));
+               toolBar.getChildren().add(createResetComponentsItem(app));
                part.setToolbar(toolBar);
        }
 
@@ -66,6 +68,16 @@ public class TechTypeTableView {
                return createHandledToolItem;
        }
 
+       private MToolBarElement createResetComponentsItem(MApplication app) {
+               MHandledToolItem createHandledToolItem = MMenuFactory.INSTANCE.createHandledToolItem();
+               // Command is contributed via fragment
+               MCommand command = app.getCommand("org.simantics.district.network.ui.command.resetcomponentproperties");
+               createHandledToolItem.setCommand(command); //$NON-NLS-1$
+               createHandledToolItem.setLabel("Reset Component Properties");
+               createHandledToolItem.setIconURI("platform:/plugin/com.famfamfam.silk/icons/database_go.png"); //$NON-NLS-1$
+               return createHandledToolItem;
+       }
+
        @PostConstruct
        public void postConstruct(Composite parent) {
                Resource pipe = null;