Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJonathan E. Jensen2013-09-06 19:20:26 +0000
committerGerrit Code Review @ Eclipse.org2013-09-19 18:45:12 +0000
commit58684e9a972496a9ceec69908820194d826a807e (patch)
tree4c84b327f357cbc2a2a358c142763050e80e0682 /plugins
parentf6d2cf5ccb577af94ceb36b222ee914ff70e54b3 (diff)
downloadorg.eclipse.osee-58684e9a972496a9ceec69908820194d826a807e.tar.gz
org.eclipse.osee-58684e9a972496a9ceec69908820194d826a807e.tar.xz
org.eclipse.osee-58684e9a972496a9ceec69908820194d826a807e.zip
feature[ats_5KHM8]: Add human readable pre/post process
Change-Id: Id43143fc8cc6b389ff3822d02c43c6c8bb0e659a Signed-off-by: Jonathan E. Jensen <jonathan.e.jensen2@boeing.com>
Diffstat (limited to 'plugins')
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/compare/AttributeCompareItem.java13
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/DefaultArtifactRenderer.java22
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/IRenderer.java2
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/PresentationType.java1
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/xmerge/MergeXViewer.java37
5 files changed, 61 insertions, 14 deletions
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/compare/AttributeCompareItem.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/compare/AttributeCompareItem.java
index 8a9ccf1fd8..7b868ec27d 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/compare/AttributeCompareItem.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/compare/AttributeCompareItem.java
@@ -14,6 +14,9 @@ import java.util.logging.Level;
import org.eclipse.osee.framework.core.exception.OseeCoreException;
import org.eclipse.osee.framework.logging.OseeLog;
import org.eclipse.osee.framework.skynet.core.conflict.AttributeConflict;
+import org.eclipse.osee.framework.ui.skynet.DslGrammar;
+import org.eclipse.osee.framework.ui.skynet.DslGrammarStorageAdapter;
+import org.eclipse.osee.framework.ui.skynet.internal.DslGrammarManager;
import org.eclipse.swt.graphics.Image;
/**
@@ -31,7 +34,15 @@ public class AttributeCompareItem extends CompareItem {
@Override
public void persistContent() {
try {
- attributeConflict.setAttributeValue(getStringContent());
+ String stringContent = getStringContent();
+ DslGrammar dslGrammar = DslGrammarManager.getGrammar(attributeConflict.getAttributeType());
+ if (dslGrammar != null) {
+ DslGrammarStorageAdapter dslGrammarStorageAdapter = dslGrammar.getStorageAdapter();
+ if (dslGrammarStorageAdapter != null) {
+ stringContent = dslGrammarStorageAdapter.postProcess(attributeConflict.getArtifact(), stringContent);
+ }
+ }
+ attributeConflict.setAttributeValue(stringContent);
} catch (OseeCoreException ex) {
OseeLog.log(AttributeCompareItem.class, Level.SEVERE, ex);
}
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/DefaultArtifactRenderer.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/DefaultArtifactRenderer.java
index 544d8ead94..fd851fed42 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/DefaultArtifactRenderer.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/DefaultArtifactRenderer.java
@@ -15,6 +15,7 @@ import static org.eclipse.osee.framework.ui.skynet.render.PresentationType.GENER
import static org.eclipse.osee.framework.ui.skynet.render.PresentationType.GENERAL_REQUESTED;
import static org.eclipse.osee.framework.ui.skynet.render.PresentationType.PREVIEW;
import static org.eclipse.osee.framework.ui.skynet.render.PresentationType.PRODUCE_ATTRIBUTE;
+import static org.eclipse.osee.framework.ui.skynet.render.PresentationType.RENDER_AS_HUMAN_READABLE_TEXT;
import static org.eclipse.osee.framework.ui.skynet.render.PresentationType.SPECIALIZED_EDIT;
import java.util.ArrayList;
import java.util.Collection;
@@ -32,6 +33,7 @@ import org.eclipse.osee.framework.jdk.core.util.xml.Xml;
import org.eclipse.osee.framework.logging.OseeLevel;
import org.eclipse.osee.framework.logging.OseeLog;
import org.eclipse.osee.framework.skynet.core.artifact.Artifact;
+import org.eclipse.osee.framework.skynet.core.artifact.Attribute;
import org.eclipse.osee.framework.skynet.core.linking.OseeLinkBuilder;
import org.eclipse.osee.framework.skynet.core.relation.RelationManager;
import org.eclipse.osee.framework.skynet.core.relation.order.RelationOrderData;
@@ -113,7 +115,7 @@ public class DefaultArtifactRenderer implements IRenderer {
if (presentationType.matches(SPECIALIZED_EDIT, DEFAULT_OPEN)) {
return GENERAL_MATCH;
}
- if (presentationType.matches(PREVIEW)) {
+ if (presentationType.matches(PREVIEW, RENDER_AS_HUMAN_READABLE_TEXT)) {
return BASE_MATCH;
}
return NO_MATCH;
@@ -159,6 +161,24 @@ public class DefaultArtifactRenderer implements IRenderer {
}
}
+ @Override
+ public String renderAttributeAsString(IAttributeType attributeType, Artifact artifact, PresentationType presentationType, final String defaultValue) throws OseeCoreException {
+ String returnValue = defaultValue;
+ if (presentationType.matches(RENDER_AS_HUMAN_READABLE_TEXT)) {
+ if (artifact == null) {
+ returnValue = "DELETED";
+ } else {
+ Attribute<Object> soleAttribute = artifact.getSoleAttribute(attributeType);
+ if (soleAttribute == null) {
+ returnValue = "DELETED";
+ } else {
+ returnValue = soleAttribute.getDisplayableString();
+ }
+ }
+ }
+ return returnValue;
+ }
+
private String renderRelationOrder(Artifact artifact) throws OseeCoreException {
StringBuilder builder = new StringBuilder();
ArtifactGuidToWordML guidResolver = new ArtifactGuidToWordML(new OseeLinkBuilder());
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/IRenderer.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/IRenderer.java
index 349ae09c86..d929910633 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/IRenderer.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/IRenderer.java
@@ -85,6 +85,8 @@ public interface IRenderer {
public void renderAttribute(IAttributeType attributeType, Artifact artifact, PresentationType presentationType, Producer producer, AttributeElement attributeElement) throws OseeCoreException;
+ public String renderAttributeAsString(IAttributeType attributeType, Artifact artifact, PresentationType presentationType, String defaultValue) throws OseeCoreException;
+
public int minimumRanking() throws OseeCoreException;
public void open(List<Artifact> artifacts, PresentationType presentationType) throws OseeCoreException;
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/PresentationType.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/PresentationType.java
index 7d6de4dc3e..60fe2cd191 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/PresentationType.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/PresentationType.java
@@ -23,6 +23,7 @@ public enum PresentationType {
F5_DIFF,
PREVIEW, // open read-only using application specific editor
MERGE,
+ RENDER_AS_HUMAN_READABLE_TEXT, // Used to pre and post process text based attributes.
DEFAULT_OPEN, // up to the renderer to determine what is used for default
GENERAL_REQUESTED, // this is the case where default open is selected and the preference "Default Presentation opens in Artifact Editor if applicable" is true
PRODUCE_ATTRIBUTE; // used in conjunction with renderAttribute()
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/xmerge/MergeXViewer.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/xmerge/MergeXViewer.java
index 8091417141..d85dc49328 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/xmerge/MergeXViewer.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/xmerge/MergeXViewer.java
@@ -10,6 +10,7 @@
*******************************************************************************/
package org.eclipse.osee.framework.ui.skynet.widgets.xmerge;
+import static org.eclipse.osee.framework.ui.skynet.render.PresentationType.RENDER_AS_HUMAN_READABLE_TEXT;
import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.jface.wizard.WizardDialog;
import org.eclipse.nebula.widgets.xviewer.XViewer;
@@ -18,8 +19,10 @@ import org.eclipse.osee.framework.core.enums.ConflictType;
import org.eclipse.osee.framework.core.exception.ArtifactDoesNotExist;
import org.eclipse.osee.framework.core.exception.MultipleArtifactsExist;
import org.eclipse.osee.framework.core.exception.OseeCoreException;
+import org.eclipse.osee.framework.jdk.core.util.Strings;
import org.eclipse.osee.framework.logging.OseeLevel;
import org.eclipse.osee.framework.logging.OseeLog;
+import org.eclipse.osee.framework.skynet.core.artifact.Artifact;
import org.eclipse.osee.framework.skynet.core.conflict.AttributeConflict;
import org.eclipse.osee.framework.skynet.core.conflict.Conflict;
import org.eclipse.osee.framework.skynet.core.event.OseeEventManager;
@@ -31,8 +34,10 @@ import org.eclipse.osee.framework.ui.skynet.compare.AttributeCompareItem;
import org.eclipse.osee.framework.ui.skynet.compare.CompareHandler;
import org.eclipse.osee.framework.ui.skynet.internal.Activator;
import org.eclipse.osee.framework.ui.skynet.mergeWizard.ConflictResolutionWizard;
+import org.eclipse.osee.framework.ui.skynet.render.RendererManager;
import org.eclipse.osee.framework.ui.swt.Displays;
import org.eclipse.osee.framework.ui.swt.Widgets;
+import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.TreeColumn;
@@ -164,18 +169,26 @@ public class MergeXViewer extends XViewer {
}
private CompareHandler getCompareHandler(AttributeConflict attributeConflict) throws OseeCoreException {
- AttributeCompareItem leftContributionItem =
- new AttributeCompareItem(attributeConflict,
- attributeConflict.getArtifactName() + " on Branch: " + attributeConflict.getSourceBranch().getName(),
- attributeConflict.getAttribute().getDisplayableString(), true,
- ArtifactImageManager.getImage(attributeConflict.getArtifact()));
- AttributeCompareItem rightContributionItem =
- new AttributeCompareItem(attributeConflict,
- attributeConflict.getArtifactName() + " on Branch: " + attributeConflict.getDestBranch().getName(),
- attributeConflict.getDestDisplayData(), false,
- ArtifactImageManager.getImage(attributeConflict.getArtifact()));
-
- return new CompareHandler(null, leftContributionItem, rightContributionItem, null);
+
+ Artifact sourceArtifact = attributeConflict.getArtifact();
+ String leftName = sourceArtifact.getName() + " on Branch: " + attributeConflict.getSourceBranch().getName();
+ String leftContents =
+ RendererManager.getBestRenderer(RENDER_AS_HUMAN_READABLE_TEXT, sourceArtifact).renderAttributeAsString(
+ attributeConflict.getAttributeType(), sourceArtifact, RENDER_AS_HUMAN_READABLE_TEXT, Strings.EMPTY_STRING);
+
+ Artifact destArtifact = attributeConflict.getDestArtifact();
+ String rightName = destArtifact.getName() + " on Branch: " + attributeConflict.getDestBranch().getName();
+ String rightContents =
+ RendererManager.getBestRenderer(RENDER_AS_HUMAN_READABLE_TEXT, destArtifact).renderAttributeAsString(
+ attributeConflict.getAttributeType(), destArtifact, RENDER_AS_HUMAN_READABLE_TEXT, Strings.EMPTY_STRING);
+
+ Image image = ArtifactImageManager.getImage(sourceArtifact);
+ AttributeCompareItem leftCompareItem =
+ new AttributeCompareItem(attributeConflict, leftName, leftContents, true, image);
+ AttributeCompareItem rightCompareItem =
+ new AttributeCompareItem(attributeConflict, rightName, rightContents, false, image);
+
+ return new CompareHandler(null, leftCompareItem, rightCompareItem, null);
}
private static void nativeContentAlert(Shell shell) {

Back to the top