package org.simantics.district.route.ui;
import java.util.List;
-import java.util.concurrent.CompletableFuture;
import org.eclipse.e4.ui.workbench.modeling.ESelectionService;
import org.eclipse.jface.layout.GridDataFactory;
import org.eclipse.jface.resource.LocalResourceManager;
import org.eclipse.jface.viewers.ColumnLabelProvider;
import org.eclipse.jface.viewers.DoubleClickEvent;
-import org.eclipse.jface.viewers.IDoubleClickListener;
-import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.viewers.ITreeContentProvider;
import org.eclipse.jface.viewers.SelectionChangedEvent;
-import org.eclipse.jface.viewers.StructuredSelection;
import org.eclipse.jface.viewers.TreePath;
import org.eclipse.jface.viewers.TreeViewer;
import org.eclipse.jface.viewers.Viewer;
import org.eclipse.osgi.util.NLS;
import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.Composite;
-import org.simantics.db.Resource;
+import org.eclipse.swt.widgets.Tree;
import org.simantics.district.route.Route;
import org.simantics.district.route.RouteEvent;
-import org.simantics.district.route.RouteJob;
import org.simantics.district.route.RouteService;
import org.simantics.district.route.RouteServiceListener;
import org.simantics.district.route.Waypoint;
}
}
+ public Tree getTree() {
+ return tree.getTree();
+ }
+
}
import org.eclipse.e4.ui.model.application.ui.menu.MMenuContribution;
import org.eclipse.e4.ui.model.application.ui.menu.MMenuFactory;
import org.eclipse.e4.ui.model.application.ui.menu.MPopupMenu;
+import org.eclipse.e4.ui.services.EMenuService;
import org.eclipse.e4.ui.workbench.modeling.ESelectionService;
import org.eclipse.swt.widgets.Composite;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
/**
* @author Tuukka Lehtonen
*/
public class RouteView {
+ private static final Logger LOGGER = LoggerFactory.getLogger(RouteView.class);
+
private static final String POPUP_CONTRIBUTION_ID = "org.simantics.district.route.ui.contextMenu";
public static final String POPUP_ELEMENT_ID = "org.simantics.district.route.ui.popup";
}
@PostConstruct
- public void postConstruct(Composite parent) {
+ public void postConstruct(Composite parent, EMenuService menuService) {
this.ui = new RouteTree(parent, 0, selectionService);
+ if (!(menuService.registerContextMenu(this.ui.getTree(), POPUP_ELEMENT_ID)))
+ LOGGER.warn("Could not register context menu {}", POPUP_ELEMENT_ID);
}
@PreDestroy