]> gerrit.simantics Code Review - simantics/platform.git/blobdiff - bundles/org.simantics.ui/src/org/simantics/ui/workbench/action/PerformDefaultAction.java
Remove usage of deprecated SimanticsUI-methods
[simantics/platform.git] / bundles / org.simantics.ui / src / org / simantics / ui / workbench / action / PerformDefaultAction.java
index 22164e5042dd714aa3f42d3a35a89d7e6d853637..46facb59ea4896dc5a2093959c2c5812000b8006 100644 (file)
@@ -1,6 +1,6 @@
 /*******************************************************************************
- * Copyright (c) 2012 Association for Decentralized Information Management in
- * Industry THTH ry.
+ * Copyright (c) 2012, 2017 Association for Decentralized Information Management
+ * in Industry THTH ry.
  * All rights reserved. This program and the accompanying materials
  * are made available under the terms of the Eclipse Public License v1.0
  * which accompanies this distribution, and is available at
  *******************************************************************************/
 package org.simantics.ui.workbench.action;
 
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
 import org.eclipse.jface.action.Action;
 import org.eclipse.swt.widgets.Control;
 import org.eclipse.swt.widgets.Shell;
 import org.eclipse.ui.IWorkbench;
 import org.eclipse.ui.IWorkbenchWindow;
 import org.eclipse.ui.PlatformUI;
-import org.simantics.db.Resource;
-import org.simantics.ui.SimanticsUI;
+import org.simantics.Simantics;
+import org.simantics.db.common.procedure.adapter.ProcedureAdapter;
+import org.simantics.ui.internal.Activator;
 import org.simantics.utils.ui.workbench.WorkbenchUtils;
 
 /**
@@ -27,12 +30,12 @@ import org.simantics.utils.ui.workbench.WorkbenchUtils;
 public class PerformDefaultAction extends Action {
 
     private Control  control;
-    private Resource component;
+    private Object   input;
 
-    public PerformDefaultAction(String name, Control control, Resource component) {
+    public PerformDefaultAction(String name, Control control, Object input) {
         super(name);
         this.control = control;
-        this.component = component;
+        this.input = input;
     }
 
     @Override
@@ -47,7 +50,16 @@ public class PerformDefaultAction extends Action {
             if (window != null)
                 shell = window.getShell();
         }
-        SimanticsUI.getSession().asyncRequest(new ChooseActionRequest(shell, control, component, perspectiveId));
+        Simantics.getSession().asyncRequest(
+                new ChooseActionRequest(shell, control, input, perspectiveId),
+                new ProcedureAdapter<Object>() {
+                    @Override
+                    public void exception(Throwable t) {
+                        Activator.getDefault().getLog().log(
+                                new Status(IStatus.ERROR, Activator.PLUGIN_ID,
+                                        "Failed to choose action for input " + input + ", see exception for details.", t));
+                    }
+                });
     }
 
 }
\ No newline at end of file