Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/org.eclipse.osee.ote.ui.define/src/org/eclipse/osee/ote/ui/define/viewers/actions/OpenAssociatedOutfile.java')
-rw-r--r--plugins/org.eclipse.osee.ote.ui.define/src/org/eclipse/osee/ote/ui/define/viewers/actions/OpenAssociatedOutfile.java105
1 files changed, 53 insertions, 52 deletions
diff --git a/plugins/org.eclipse.osee.ote.ui.define/src/org/eclipse/osee/ote/ui/define/viewers/actions/OpenAssociatedOutfile.java b/plugins/org.eclipse.osee.ote.ui.define/src/org/eclipse/osee/ote/ui/define/viewers/actions/OpenAssociatedOutfile.java
index 31b15d657bd..d0aef4694cc 100644
--- a/plugins/org.eclipse.osee.ote.ui.define/src/org/eclipse/osee/ote/ui/define/viewers/actions/OpenAssociatedOutfile.java
+++ b/plugins/org.eclipse.osee.ote.ui.define/src/org/eclipse/osee/ote/ui/define/viewers/actions/OpenAssociatedOutfile.java
@@ -8,8 +8,8 @@
* Contributors:
* Boeing - initial API and implementation
*******************************************************************************/
-package org.eclipse.osee.ote.ui.define.viewers.actions;
-
+package org.eclipse.osee.ote.ui.define.viewers.actions;
+
import java.net.URI;
import java.util.logging.Level;
import org.eclipse.core.filesystem.EFS;
@@ -17,61 +17,62 @@ import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.jface.viewers.StructuredViewer;
import org.eclipse.osee.framework.logging.OseeLog;
+import org.eclipse.osee.framework.ui.swt.Displays;
import org.eclipse.osee.ote.define.artifacts.TestRunOperator;
import org.eclipse.osee.ote.ui.define.OteUiDefinePlugin;
import org.eclipse.osee.ote.ui.define.utilities.SelectionHelper;
-import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.ui.IWorkbenchPage;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.ide.IDE;
-
-/**
- * @author Roberto E. Escobar
- */
-public class OpenAssociatedOutfile extends AbstractActionHandler {
-
- public OpenAssociatedOutfile(StructuredViewer viewer, String text) throws Exception {
- super(viewer, text);
- }
-
- public OpenAssociatedOutfile(StructuredViewer viewer, String text, ImageDescriptor image) throws Exception {
- super(viewer, text, image);
- }
-
- @Override
- public void updateState() {
- TestRunOperator artifact = SelectionHelper.getInstance().getSelection(getViewer());
- setEnabled(artifact != null);
- }
-
- @Override
- public void run() {
- TestRunOperator operator = SelectionHelper.getInstance().getSelection(getViewer());
- try {
- String targetFile = operator.getOutfileUrl();
- openEditorUtility(new URI(targetFile));
- } catch (Exception ex) {
- handleException(ex);
- }
- }
-
- private void openEditorUtility(final URI resource) {
- Display.getDefault().asyncExec(new Runnable() {
- public void run() {
- try {
- IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
- IDE.openEditorOnFileStore(page, EFS.getStore(resource));
- } catch (Exception ex) {
- handleException(ex);
- }
- }
- });
- }
-
- private void handleException(Exception ex) {
- OseeLog.log(OteUiDefinePlugin.class, Level.WARNING, "Unable to open outfile.", ex);
- Shell shell = PlatformUI.getWorkbench().getDisplay().getActiveShell();
- MessageDialog.openError(shell, "Open Outfile", "Unable to open outfile.");
- }
+
+/**
+ * @author Roberto E. Escobar
+ */
+public class OpenAssociatedOutfile extends AbstractActionHandler {
+
+ public OpenAssociatedOutfile(StructuredViewer viewer, String text) throws Exception {
+ super(viewer, text);
+ }
+
+ public OpenAssociatedOutfile(StructuredViewer viewer, String text, ImageDescriptor image) throws Exception {
+ super(viewer, text, image);
+ }
+
+ @Override
+ public void updateState() {
+ TestRunOperator artifact = SelectionHelper.getInstance().getSelection(getViewer());
+ setEnabled(artifact != null);
+ }
+
+ @Override
+ public void run() {
+ TestRunOperator operator = SelectionHelper.getInstance().getSelection(getViewer());
+ try {
+ String targetFile = operator.getOutfileUrl();
+ openEditorUtility(new URI(targetFile));
+ } catch (Exception ex) {
+ handleException(ex);
+ }
+ }
+
+ private void openEditorUtility(final URI resource) {
+ Displays.ensureInDisplayThread(new Runnable() {
+ @Override
+ public void run() {
+ try {
+ IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
+ IDE.openEditorOnFileStore(page, EFS.getStore(resource));
+ } catch (Exception ex) {
+ handleException(ex);
+ }
+ }
+ });
+ }
+
+ private void handleException(Exception ex) {
+ OseeLog.log(OteUiDefinePlugin.class, Level.WARNING, "Unable to open outfile.", ex);
+ Shell shell = PlatformUI.getWorkbench().getDisplay().getActiveShell();
+ MessageDialog.openError(shell, "Open Outfile", "Unable to open outfile.");
+ }
} \ No newline at end of file

Back to the top