Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorrescobar2010-10-20 16:22:30 +0000
committerRyan D. Brooks2010-10-20 16:22:30 +0000
commitaba6344a0dbe9fbc617e4afcb86a5fd976610b05 (patch)
treee7680ce72f0361f2f6f28b5674483a67140ecd1f
parent822fe73f9977a2ba69ede1727743411c0b56714b (diff)
downloadorg.eclipse.osee-0.9.7.v201010200939_RC.tar.gz
org.eclipse.osee-0.9.7.v201010200939_RC.tar.xz
org.eclipse.osee-0.9.7.v201010200939_RC.zip
refinement: Provide messages for error cases in show document order0.9.7.v201010200939_RC
Handle artifact deleted Handle when the artifact is not connected to the root artifact tree Handle when the artifact is null Conflicts: plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/xviewer/skynet/column/XViewerHierarchyIndex.java
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/xviewer/skynet/column/XViewerHierarchyIndex.java21
1 files changed, 18 insertions, 3 deletions
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/xviewer/skynet/column/XViewerHierarchyIndex.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/xviewer/skynet/column/XViewerHierarchyIndex.java
index 357556cd52f..272c78b1ca7 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/xviewer/skynet/column/XViewerHierarchyIndex.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/xviewer/skynet/column/XViewerHierarchyIndex.java
@@ -16,11 +16,16 @@ import java.util.Set;
import org.eclipse.nebula.widgets.xviewer.XViewerColumn;
import org.eclipse.nebula.widgets.xviewer.XViewerValueColumn;
import org.eclipse.osee.framework.core.exception.OseeCoreException;
+import org.eclipse.osee.framework.core.exception.OseeStateException;
import org.eclipse.osee.framework.skynet.core.OseeSystemArtifacts;
import org.eclipse.osee.framework.skynet.core.artifact.Artifact;
import org.eclipse.osee.framework.skynet.core.change.Change;
import org.eclipse.swt.SWT;
+/**
+ * @author Roberto E. Escobar
+ * @author Ryan D. Brooks
+ */
public class XViewerHierarchyIndex extends XViewerValueColumn {
private final Set<Artifact> strongArtifactRefs = new HashSet<Artifact>();
@@ -50,12 +55,17 @@ public class XViewerHierarchyIndex extends XViewerValueColumn {
artifact = (Artifact) element;
} else if (element instanceof Change) {
artifact = ((Change) element).getChangeArtifact();
+ } else {
+ return "unexpected type: " + element;
}
try {
+ if (artifact.isDeleted()) {
+ return "deleted";
+ }
return computeHierarchyIndex(artifact);
} catch (OseeCoreException ex) {
- return "-1";
+ return ex.toString();
}
}
@@ -65,8 +75,12 @@ public class XViewerHierarchyIndex extends XViewerValueColumn {
Artifact root = OseeSystemArtifacts.getDefaultHierarchyRootArtifact(artifact.getBranch());
while (!artifactCursor.equals(root)) {
+ Artifact parent = artifactCursor.getParent();
+ if (parent == null) {
+ return "not connected to root";
+ }
builder.insert(0, getPosition(artifactCursor) + ".");
- artifactCursor = artifactCursor.getParent();
+ artifactCursor = parent;
}
return builder.substring(0, builder.length() - 1);
}
@@ -75,12 +89,13 @@ public class XViewerHierarchyIndex extends XViewerValueColumn {
Artifact parent = artifact.getParent();
List<Artifact> children = parent.getChildren();
strongArtifactRefs.addAll(children);
+
for (int index = 0; index < children.size(); index++) {
Artifact child = children.get(index);
if (artifact.equals(child)) {
return index + 1;
}
}
- return 0;
+ throw new OseeStateException("[%s] is expected to be a child of [%s]", artifact, parent);
}
} \ No newline at end of file

Back to the top