1 package org.simantics.district.network.ui.techtype.table;
4 import javax.annotation.PostConstruct;
5 import javax.annotation.PreDestroy;
6 import javax.inject.Inject;
8 import org.eclipse.e4.ui.model.application.MApplication;
9 import org.eclipse.e4.ui.model.application.commands.MCommand;
10 import org.eclipse.e4.ui.model.application.ui.basic.MPart;
11 import org.eclipse.e4.ui.model.application.ui.menu.MHandledToolItem;
12 import org.eclipse.e4.ui.model.application.ui.menu.MMenuFactory;
13 import org.eclipse.e4.ui.model.application.ui.menu.MToolBar;
14 import org.eclipse.e4.ui.workbench.modeling.ESelectionService;
15 import org.eclipse.swt.widgets.Composite;
17 public class TechTypeTableView {
19 @Inject ESelectionService selectionService;
21 public static TechTypeTable table;
24 public void init(MPart part, MApplication app) {
25 MToolBar toolBar = MMenuFactory.INSTANCE.createToolBar();
26 toolBar.setToBeRendered(true);
27 toolBar.getChildren().add(createImportCSVDataToolItem(app));
28 part.setToolbar(toolBar);
31 private MHandledToolItem createImportCSVDataToolItem(MApplication app) {
32 MHandledToolItem createHandledToolItem = MMenuFactory.INSTANCE.createHandledToolItem();
33 // Command is contributed via fragment
34 MCommand command = app.getCommand("org.simantics.district.network.ui.command.importtechtypecsv");
35 createHandledToolItem.setCommand(command); //$NON-NLS-1$
36 createHandledToolItem.setLabel("Import Tech Type");
37 createHandledToolItem.setIconURI("platform:/plugin/com.famfamfam.silk/icons/table_edit.png"); //$NON-NLS-1$
38 return createHandledToolItem;
42 public void postConstruct(Composite parent) {
43 table = new TechTypeTable(parent, 0);
48 public void dispose() {