bug[TW19471]: Prevent rendering non editable attributes
Change-Id: Ib887a3f9004b48bfacf3425977cd38d02ea9ad76
diff --git a/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/data/AttributeTypeToken.java b/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/data/AttributeTypeToken.java
index cc0bddb..5655d35 100644
--- a/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/data/AttributeTypeToken.java
+++ b/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/data/AttributeTypeToken.java
@@ -168,4 +168,12 @@
default boolean isMultiLine() {
return getDisplayHints().contains(DisplayHint.MultiLine);
}
+
+ default boolean notEditable() {
+ return getDisplayHints().contains(DisplayHint.NoGeneralEdit);
+ }
+
+ default boolean notRenderable() {
+ return getDisplayHints().contains(DisplayHint.NoGeneralRender);
+ }
}
\ No newline at end of file
diff --git a/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/data/DisplayHint.java b/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/data/DisplayHint.java
index b695892..202431a 100644
--- a/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/data/DisplayHint.java
+++ b/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/data/DisplayHint.java
@@ -22,6 +22,7 @@
public static DisplayHint SingleLine = new DisplayHint(1L, "Single Line");
public static DisplayHint MultiLine = new DisplayHint(2L, "Multiline");
public static DisplayHint NoGeneralEdit = new DisplayHint(3L, "No General Edit");
+ public static DisplayHint NoGeneralRender = new DisplayHint(4L, "No General Render");
private DisplayHint(Long id, String name) {
super(id, name);
diff --git a/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/enums/CoreAttributeTypes.java b/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/enums/CoreAttributeTypes.java
index 1555706..153ce23 100644
--- a/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/enums/CoreAttributeTypes.java
+++ b/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/enums/CoreAttributeTypes.java
@@ -208,7 +208,7 @@
VerificationLevelAttributeType VerificationLevel = osee.createEnum(new VerificationLevelAttributeType());
AttributeTypeString WebPreferences = osee.createString(1152921504606847386L, "Web Preferences", MediaType.TEXT_PLAIN, "", "xml");
AttributeTypeString Website = osee.createString(1152921504606847084L, "Website", AttributeTypeToken.TEXT_URI_LIST, "");
- AttributeTypeString WholeWordContent = osee.createString(1152921504606847099L, "Whole Word Content", AttributeTypeToken.APPLICATION_MSWORD, "value must comply with WordML xml schema", DisplayHint.MultiLine);
+ AttributeTypeString WholeWordContent = osee.createString(1152921504606847099L, "Whole Word Content", AttributeTypeToken.APPLICATION_MSWORD, "value must comply with WordML xml schema", DisplayHint.NoGeneralRender);
AttributeTypeString WordOleData = osee.createStringNoTag(1152921504606847092L, "Word Ole Data", AttributeTypeToken.APPLICATION_MSWORD, "Word Ole Data");
AttributeTypeString WordTemplateContent = osee.createString(1152921504606847098L, "Word Template Content", AttributeTypeToken.APPLICATION_MSWORD, "value must comply with WordML xml schema", DisplayHint.MultiLine);
AttributeTypeString WorkData = osee.createStringNoTag(1152921504606847126L, "osee.wi.Work Data", MediaType.TEXT_XML, "");
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/artifact/ArtifactPrompt.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/artifact/ArtifactPrompt.java
index ab12cf7..cbe137c 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/artifact/ArtifactPrompt.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/artifact/ArtifactPrompt.java
@@ -14,6 +14,7 @@
package org.eclipse.osee.framework.ui.skynet.artifact;
import java.util.Collection;
+import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.osee.framework.core.data.AttributeTypeToken;
import org.eclipse.osee.framework.core.enums.PermissionEnum;
import org.eclipse.osee.framework.jdk.core.result.XResultData;
@@ -23,6 +24,7 @@
import org.eclipse.osee.framework.ui.skynet.artifact.prompt.IHandlePromptChange;
import org.eclipse.osee.framework.ui.skynet.artifact.prompt.IPromptFactory;
import org.eclipse.osee.framework.ui.skynet.widgets.dialog.XResultDataDialog;
+import org.eclipse.osee.framework.ui.swt.Displays;
/**
* @author Jeff C. Phillips
@@ -38,16 +40,25 @@
public boolean promptChangeAttribute(AttributeTypeToken attributeType, final Collection<Artifact> artifacts, boolean persist, boolean multiLine) {
boolean toReturn = false;
- XResultData rd =
- OseeApiService.get().getAccessControlService().hasAttributeTypePermission(artifacts, attributeType,
- PermissionEnum.WRITE, AccessControlArtifactUtil.getXResultAccessHeader("Change Attribute", artifacts, attributeType));
+ XResultData rd = OseeApiService.get().getAccessControlService().hasAttributeTypePermission(artifacts,
+ attributeType, PermissionEnum.WRITE,
+ AccessControlArtifactUtil.getXResultAccessHeader("Change Attribute", artifacts, attributeType));
if (rd.isErrors()) {
XResultDataDialog.open(rd, "Change Attribute", "Permission Denied Changing Attribute %s",
attributeType.toStringWithId());
+
return false;
}
+ if (attributeType.notRenderable()) {
+ if (!MessageDialog.openConfirm(Displays.getActiveShell(), attributeType.getUnqualifiedName(), String.format(
+ "Attribute %s is set as non-renderable: it may render very slowly or incorrectly. Continue with editing anyway?",
+ attributeType.getUnqualifiedName()))) {
+ return false;
+ }
+ }
+
IHandlePromptChange promptChange =
promptFactory.createPrompt(attributeType, attributeType.getUnqualifiedName(), artifacts, persist, multiLine);
if (promptChange.promptOk()) {
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/XTextDam.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/XTextDam.java
index e5d15a4..c7106ef 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/XTextDam.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/XTextDam.java
@@ -86,11 +86,19 @@
@Override
public void refresh() {
- super.set(getArtifact().getSoleAttributeValue(getAttributeType(), ""));
+ if (this.attributeType.notRenderable()) {
+ super.set("Attribute not displayable");
+ super.setEditable(false);
+ } else {
+ super.set(getArtifact().getSoleAttributeValue(getAttributeType(), ""));
+ }
}
@Override
public void saveToArtifact() {
+ if (!this.isEditable()) {
+ return;
+ }
String value = get();
if (!Strings.isValid(value)) {
getArtifact().deleteSoleAttribute(getAttributeType());