summary |
shortlog |
log |
commit | commitdiff |
review |
tree
raw |
patch |
inline | side by side (from parent 1:
7e64b34)
gitlab #25
Change-Id: I80f6bdb349ca44997d63882ef433813cf45c8504
package org.simantics.district.route.ui.handlers;
package org.simantics.district.route.ui.handlers;
+import java.util.Collections;
import java.util.List;
import java.util.concurrent.CompletableFuture;
import java.util.List;
import java.util.concurrent.CompletableFuture;
Display display = activeShell.getDisplay();
CompletableFuture<List<Resource>> result = new CompletableFuture<>();
Display display = activeShell.getDisplay();
CompletableFuture<List<Resource>> result = new CompletableFuture<>();
- result.thenAccept(dnElements -> {
- try {
- openDiagram(display, dnElements);
- } catch (DatabaseException e) {
- LOGGER.error("Failed to open district network diagram with selection {}", dnElements);
+ result
+ .exceptionally(e -> Collections.emptyList())
+ .thenAccept(dnElements -> {
+ if (!dnElements.isEmpty()) {
+ try {
+ openDiagram(display, dnElements);
+ } catch (DatabaseException e) {
+ LOGGER.error("Failed to open district network diagram with selection {}", dnElements); //$NON-NLS-1$
+ }
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
import org.eclipse.core.runtime.jobs.Job;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
import org.eclipse.core.runtime.jobs.Job;
+import org.eclipse.osgi.util.NLS;
import org.simantics.ObjectIdentitySchedulingRule;
import org.simantics.db.Resource;
import org.simantics.district.route.internal.Activator;
import org.simantics.ObjectIdentitySchedulingRule;
import org.simantics.db.Resource;
import org.simantics.district.route.internal.Activator;
return Status.OK_STATUS;
}
} catch (RoutingException e) {
return Status.OK_STATUS;
}
} catch (RoutingException e) {
- LOGGER.error("Routing failed for waypoints {} and router {}", waypoints, router, e);
+ LOGGER.error("Routing failed for waypoints {} and router '{}'", waypoints, router, e);
callback.completeExceptionally(e);
callback.completeExceptionally(e);
+ // This results in UI feedback of the error.
+ // Perhaps later we get rid of this and let the UI code handle the notifications.
+ return new Status(IStatus.ERROR, Activator.PLUGIN_ID, e.getMessage());
}
}
LOGGER.info("No router could calculate route between waypoints {}. Available routers: {}", waypoints, routers);
}
}
LOGGER.info("No router could calculate route between waypoints {}. Available routers: {}", waypoints, routers);
- return Status.OK_STATUS;
+ return new Status(IStatus.ERROR, Activator.PLUGIN_ID, NLS.bind("No router could calculate route between waypoints {0}. Available routers: {1}", waypoints, routers));
*/
public class Activator implements BundleActivator, ServiceListener {
*/
public class Activator implements BundleActivator, ServiceListener {
+ // The plug-in ID
+ public static final String PLUGIN_ID = "org.simantics.district.route"; //$NON-NLS-1$
+
private static BundleContext context;
private static Activator instance;
private static BundleContext context;
private static Activator instance;