--- /dev/null
+package org.simantics.district.route.ui.handlers;
+
+import javax.inject.Named;
+
+import org.eclipse.e4.core.di.annotations.CanExecute;
+import org.eclipse.e4.core.di.annotations.Execute;
+import org.eclipse.e4.ui.model.application.ui.basic.MPart;
+import org.eclipse.e4.ui.services.IServiceConstants;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.swt.widgets.Shell;
+import org.simantics.district.route.Route;
+import org.simantics.district.route.ui.RouteView;
+import org.simantics.utils.ui.ISelectionUtils;
+
+/**
+ * @author Tuukka Lehtonen
+ */
+public class RenameRoute {
+
+ @CanExecute
+ public boolean canExecute(@Named(IServiceConstants.ACTIVE_SELECTION) ISelection selection) {
+ return ISelectionUtils.filterSingleSelection(selection, Route.class) != null;
+ }
+
+ @Execute
+ public void execute(@Named(IServiceConstants.ACTIVE_SHELL) Shell activeShell,
+ @Named(IServiceConstants.ACTIVE_PART) MPart part,
+ @Named(IServiceConstants.ACTIVE_SELECTION) ISelection selection) {
+ // get selected route
+ Route route = ISelectionUtils.filterSingleSelection(selection, Route.class);
+ if (route != null) {
+ Object obj = part.getObject();
+ if (obj instanceof RouteView) {
+ ((RouteView)obj).editCurrentSelection();
+ }
+ }
+ }
+
+}
\ No newline at end of file