-/*******************************************************************************\r
- * Copyright (c) 2012 Association for Decentralized Information Management in\r
- * Industry THTH ry.\r
- * All rights reserved. This program and the accompanying materials\r
- * are made available under the terms of the Eclipse Public License v1.0\r
- * which accompanies this distribution, and is available at\r
- * http://www.eclipse.org/legal/epl-v10.html\r
- *\r
- * Contributors:\r
- * VTT Technical Research Centre of Finland - initial API and implementation\r
- *******************************************************************************/\r
-package org.simantics.ui.workbench.action;\r
-\r
-import org.eclipse.jface.action.Action;\r
-import org.eclipse.swt.widgets.Control;\r
-import org.eclipse.swt.widgets.Shell;\r
-import org.eclipse.ui.IWorkbench;\r
-import org.eclipse.ui.IWorkbenchWindow;\r
-import org.eclipse.ui.PlatformUI;\r
-import org.simantics.db.Resource;\r
-import org.simantics.ui.SimanticsUI;\r
-import org.simantics.utils.ui.workbench.WorkbenchUtils;\r
-\r
-/**\r
- * @author Tuukka Lehtonen\r
- */\r
-public class PerformDefaultAction extends Action {\r
-\r
- private Control control;\r
- private Resource component;\r
-\r
- public PerformDefaultAction(String name, Control control, Resource component) {\r
- super(name);\r
- this.control = control;\r
- this.component = component;\r
- }\r
-\r
- @Override\r
- public void run() {\r
- final String perspectiveId = WorkbenchUtils.getCurrentPerspectiveId();\r
- Shell shell = null;\r
- if (control != null) {\r
- shell = control.getShell();\r
- } else {\r
- IWorkbench wb = PlatformUI.getWorkbench();\r
- IWorkbenchWindow window = wb.getActiveWorkbenchWindow();\r
- if (window != null)\r
- shell = window.getShell();\r
- }\r
- SimanticsUI.getSession().asyncRequest(new ChooseActionRequest(shell, control, component, perspectiveId));\r
- }\r
-\r
+/*******************************************************************************
+ * Copyright (c) 2012 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
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * VTT Technical Research Centre of Finland - initial API and implementation
+ *******************************************************************************/
+package org.simantics.ui.workbench.action;
+
+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.utils.ui.workbench.WorkbenchUtils;
+
+/**
+ * @author Tuukka Lehtonen
+ */
+public class PerformDefaultAction extends Action {
+
+ private Control control;
+ private Resource component;
+
+ public PerformDefaultAction(String name, Control control, Resource component) {
+ super(name);
+ this.control = control;
+ this.component = component;
+ }
+
+ @Override
+ public void run() {
+ final String perspectiveId = WorkbenchUtils.getCurrentPerspectiveId();
+ Shell shell = null;
+ if (control != null) {
+ shell = control.getShell();
+ } else {
+ IWorkbench wb = PlatformUI.getWorkbench();
+ IWorkbenchWindow window = wb.getActiveWorkbenchWindow();
+ if (window != null)
+ shell = window.getShell();
+ }
+ SimanticsUI.getSession().asyncRequest(new ChooseActionRequest(shell, control, component, perspectiveId));
+ }
+
}
\ No newline at end of file