Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorrescobar2010-09-28 13:48:29 -0400
committerRyan D. Brooks2010-09-28 13:48:29 -0400
commit9845d7cc6a61cf3679cc024e89448396c3c4ade4 (patch)
treed04a15f9938ccdfaea271b17914fb5e63e5c8ac7 /plugins
parentcb846ab0223e0f8700e2015b742e9764c55e451f (diff)
downloadorg.eclipse.osee-9845d7cc6a61cf3679cc024e89448396c3c4ade4.tar.gz
org.eclipse.osee-9845d7cc6a61cf3679cc024e89448396c3c4ade4.tar.xz
org.eclipse.osee-9845d7cc6a61cf3679cc024e89448396c3c4ade4.zip
feature[ats_VC64S]: Redesign show change report in document order
Diffstat (limited to 'plugins')
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/xchange/ChangeXViewerFactory.java2
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/xviewer/skynet/column/XViewerHierarchyIndex.java96
2 files changed, 98 insertions, 0 deletions
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/xchange/ChangeXViewerFactory.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/xchange/ChangeXViewerFactory.java
index bdf810a22bd..e893431c7bb 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/xchange/ChangeXViewerFactory.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/xchange/ChangeXViewerFactory.java
@@ -18,6 +18,7 @@ import org.eclipse.osee.framework.core.enums.CoreAttributeTypes;
import org.eclipse.osee.framework.ui.skynet.widgets.xviewer.skynet.SkynetXViewerFactory;
import org.eclipse.osee.framework.ui.skynet.widgets.xviewer.skynet.column.XViewerArtifactTypeColumn;
import org.eclipse.osee.framework.ui.skynet.widgets.xviewer.skynet.column.XViewerGuidColumn;
+import org.eclipse.osee.framework.ui.skynet.widgets.xviewer.skynet.column.XViewerHierarchyIndex;
import org.eclipse.osee.framework.ui.skynet.widgets.xviewer.skynet.column.XViewerHridColumn;
import org.eclipse.osee.framework.ui.skynet.widgets.xviewer.skynet.column.XViewerLastModifiedByColumn;
import org.eclipse.osee.framework.ui.skynet.widgets.xviewer.skynet.column.XViewerLastModifiedDateColumn;
@@ -48,6 +49,7 @@ public class ChangeXViewerFactory extends SkynetXViewerFactory {
public ChangeXViewerFactory() {
super(NAMESPACE);
registerColumns(Name, Item_Type, Item_Kind, Change_Type, Is_Value, Was_Value, paraNumber);
+ registerColumns(new XViewerHierarchyIndex(false));
registerColumns(new XViewerHridColumn());
registerColumns(new XViewerGuidColumn(false));
registerColumns(new XViewerArtifactTypeColumn("framework.change.artifactType", "Artifact Type", true));
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
new file mode 100644
index 00000000000..0bc694721c1
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/xviewer/skynet/column/XViewerHierarchyIndex.java
@@ -0,0 +1,96 @@
+/*
+ * Created on Sep 27, 2010
+ *
+ * PLACE_YOUR_DISTRIBUTION_STATEMENT_RIGHT_HERE
+ */
+package org.eclipse.osee.framework.ui.skynet.widgets.xviewer.skynet.column;
+
+import java.util.List;
+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.skynet.core.artifact.Artifact;
+import org.eclipse.osee.framework.skynet.core.change.Change;
+import org.eclipse.swt.SWT;
+
+public class XViewerHierarchyIndex extends XViewerValueColumn {
+
+ public XViewerHierarchyIndex(boolean show) {
+ this("framework.hierarchy.index", "Hierarchy Index", 50, SWT.LEFT, show, SortDataType.Paragraph_Number, false,
+ "Hierarchy Index");
+ }
+
+ public XViewerHierarchyIndex(String id, String name, int width, int align, boolean show, SortDataType sortDataType, boolean multiColumnEditable, String description) {
+ super(id, name, width, align, show, sortDataType, multiColumnEditable, description);
+ }
+
+ /**
+ * XViewer uses copies of column definitions so originals that are registered are not corrupted. Classes extending
+ * XViewerValueColumn MUST extend this constructor so the correct sub-class is created
+ */
+ @Override
+ public XViewerHierarchyIndex copy() {
+ return new XViewerHierarchyIndex(getId(), getName(), getWidth(), getAlign(), isShow(), getSortDataType(),
+ isMultiColumnEditable(), getDescription());
+ }
+
+ @Override
+ public String getColumnText(Object element, XViewerColumn column, int columnIndex) {
+ Artifact artifact = null;
+ if (element instanceof Artifact) {
+ artifact = (Artifact) element;
+ } else if (element instanceof Change) {
+ artifact = ((Change) element).getChangeArtifact();
+ }
+ String toReturn;
+ try {
+ toReturn = computeHierarchyIndex(artifact);
+ } catch (OseeCoreException ex) {
+ toReturn = "-1";
+ }
+ return toReturn;
+ }
+
+ private String computeHierarchyIndex(Artifact artifact) throws OseeCoreException {
+ int position = 0;
+ StringBuilder builder = new StringBuilder();
+ int depth = getHierarchyDepth(artifact);
+ if (depth != -1) {
+ position = getPosition(artifact);
+ }
+ builder.append(depth);
+ if (position > 0) {
+ builder.append(".");
+ builder.append(position);
+ }
+ return builder.toString();
+ }
+
+ private int getHierarchyDepth(Artifact artifact) throws OseeCoreException {
+ int depth = -1;
+ if (artifact != null) {
+ Artifact artifactPtr = artifact;
+ while (artifactPtr != null) {
+ artifactPtr = artifactPtr.getParent();
+ depth++;
+ }
+ }
+ return depth;
+ }
+
+ private int getPosition(Artifact artifact) throws OseeCoreException {
+ if (artifact != null) {
+ Artifact parent = artifact.getParent();
+ if (parent != null) {
+ List<Artifact> artifacts = parent.getChildren();
+ for (int index = 0; index < artifacts.size(); index++) {
+ Artifact child = artifacts.get(index);
+ if (artifact.equals(child)) {
+ return index + 1;
+ }
+ }
+ }
+ }
+ return 0;
+ }
+} \ No newline at end of file

Back to the top