1 package org.simantics.district.route.ui.handlers;
4 import java.util.concurrent.CompletableFuture;
6 import javax.inject.Named;
8 import org.eclipse.e4.core.di.annotations.Execute;
9 import org.eclipse.e4.ui.model.application.ui.basic.MPart;
10 import org.eclipse.e4.ui.services.IServiceConstants;
11 import org.eclipse.jface.viewers.ISelection;
12 import org.eclipse.swt.widgets.Shell;
13 import org.simantics.db.layer0.variable.Variable;
14 import org.simantics.district.route.Route;
15 import org.simantics.district.route.RouteJob;
16 import org.simantics.district.route.RouterConfiguration;
17 import org.simantics.utils.ui.ISelectionUtils;
20 * @author Tuukka Lehtonen
22 public class SelectRouteOnDiagram {
25 public void execute(@Named(IServiceConstants.ACTIVE_SHELL) Shell activeShell,
26 @Named(IServiceConstants.ACTIVE_PART) MPart part,
27 @Named(IServiceConstants.ACTIVE_SELECTION) ISelection selection) {
29 Route route = ISelectionUtils.filterSingleSelection(selection, Route.class);
33 CompletableFuture<List<Variable>> result = new CompletableFuture<>();
34 RouterConfiguration config = new RouterConfiguration();
35 new RouteJob(config, route, result).schedule();