Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorrescobar2011-01-18 20:15:03 +0000
committerRyan D. Brooks2011-01-18 20:15:03 +0000
commit76bdf9aa498d63962fb9db7d2752149b28a1f2a3 (patch)
tree74d75f8555c1e127e258e7984342074fad8b819f
parent2844ddb1c08e8764895733bd422b742b633c59b1 (diff)
downloadorg.eclipse.osee-76bdf9aa498d63962fb9db7d2752149b28a1f2a3.tar.gz
org.eclipse.osee-76bdf9aa498d63962fb9db7d2752149b28a1f2a3.tar.xz
org.eclipse.osee-76bdf9aa498d63962fb9db7d2752149b28a1f2a3.zip
refactor: Remove redundant code use Handlers class
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/ArtifactDoubleClick.java21
1 files changed, 6 insertions, 15 deletions
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/ArtifactDoubleClick.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/ArtifactDoubleClick.java
index 47d16afc263..25a14f263b0 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/ArtifactDoubleClick.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/ArtifactDoubleClick.java
@@ -11,6 +11,7 @@
package org.eclipse.osee.framework.ui.skynet;
+import java.util.List;
import java.util.logging.Level;
import org.eclipse.jface.viewers.DoubleClickEvent;
import org.eclipse.jface.viewers.IDoubleClickListener;
@@ -23,9 +24,9 @@ import org.eclipse.osee.framework.logging.OseeLevel;
import org.eclipse.osee.framework.logging.OseeLog;
import org.eclipse.osee.framework.skynet.core.UserManager;
import org.eclipse.osee.framework.skynet.core.artifact.Artifact;
+import org.eclipse.osee.framework.ui.skynet.commandHandlers.Handlers;
import org.eclipse.osee.framework.ui.skynet.render.PresentationType;
import org.eclipse.osee.framework.ui.skynet.render.RendererManager;
-import org.eclipse.search.ui.text.Match;
/**
* @author Ryan D. Brooks
@@ -37,22 +38,12 @@ public class ArtifactDoubleClick implements IDoubleClickListener {
}
public static void openArtifact(ISelection selection) {
- IStructuredSelection structSel = (IStructuredSelection) selection;
- Object object = structSel.getFirstElement();
- Artifact artifact = null;
- if (object instanceof Artifact) {
- artifact = (Artifact) structSel.getFirstElement();
- } else if (object instanceof Match) {
- Match match = (Match) object;
-
- if (match.getElement() instanceof Artifact) {
- artifact = (Artifact) match.getElement();
- }
- }
-
- if (artifact == null) {
+ IStructuredSelection structuredSelection = (IStructuredSelection) selection;
+ List<Artifact> artifacts = Handlers.getArtifactsFromStructuredSelection(structuredSelection);
+ if (artifacts.isEmpty()) {
OseeLog.log(SkynetGuiPlugin.class, Level.SEVERE, "The artifact associated with the double-click was null");
} else {
+ Artifact artifact = artifacts.iterator().next();
try {
if (AccessControlManager.hasPermission(artifact, PermissionEnum.READ)) {
RendererManager.openInJob(artifact, PresentationType.DEFAULT_OPEN);

Back to the top