Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/attribute/AttributeTypeManager.java18
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/artifact/EnumSelectionDialog.java2
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/artifact/EnumSingletonSelectionDialog.java3
3 files changed, 21 insertions, 2 deletions
diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/attribute/AttributeTypeManager.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/attribute/AttributeTypeManager.java
index 5e68ab8fe0f..9c4b2b69445 100644
--- a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/attribute/AttributeTypeManager.java
+++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/attribute/AttributeTypeManager.java
@@ -28,6 +28,7 @@ import org.eclipse.osee.framework.core.model.type.AttributeType;
import org.eclipse.osee.framework.core.services.IOseeCachingService;
import org.eclipse.osee.framework.jdk.core.type.OseeArgumentException;
import org.eclipse.osee.framework.jdk.core.type.OseeCoreException;
+import org.eclipse.osee.framework.skynet.core.artifact.Artifact;
import org.eclipse.osee.framework.skynet.core.artifact.ArtifactTypeManager;
import org.eclipse.osee.framework.skynet.core.artifact.Attribute;
import org.eclipse.osee.framework.skynet.core.attribute.providers.IAttributeDataProvider;
@@ -155,4 +156,21 @@ public class AttributeTypeManager {
public static Class<? extends IAttributeDataProvider> getAttributeProviderClass(AttributeType attributeType) throws OseeCoreException {
return AttributeExtensionManager.getAttributeProviderClassFor(attributeType.getAttributeProviderId());
}
+
+ public static boolean checkIfRemovalAllowed(IAttributeType attributeType, Collection<? extends Artifact> artifacts) {
+ boolean removalAllowed = false;
+ if (getType(attributeType).getMinOccurrences() == 0) {
+ removalAllowed = true;
+ }
+ // if there is any artifact that allows the type, then removal is not allowed
+ boolean notAllowed = false;
+ for (Artifact art : artifacts) {
+ notAllowed = art.isAttributeTypeValid(attributeType);
+ if (notAllowed) {
+ break;
+ }
+ }
+
+ return removalAllowed || !notAllowed;
+ }
} \ No newline at end of file
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/artifact/EnumSelectionDialog.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/artifact/EnumSelectionDialog.java
index d615d2f15d5..29d1b56907c 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/artifact/EnumSelectionDialog.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/artifact/EnumSelectionDialog.java
@@ -58,7 +58,7 @@ public class EnumSelectionDialog extends CheckedTreeSelectionDialog {
try {
options = AttributeTypeManager.getEnumerationValues(attributeType);
isSingletonAttribute = AttributeTypeManager.getMaxOccurrences(attributeType) == 1;
- isRemoveAllAllowed = AttributeTypeManager.getMinOccurrences(attributeType) == 0;
+ isRemoveAllAllowed = AttributeTypeManager.checkIfRemovalAllowed(attributeType, artifacts);
if (isSingletonAttribute) {
selected = Selection.ReplaceAll;
}
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/artifact/EnumSingletonSelectionDialog.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/artifact/EnumSingletonSelectionDialog.java
index 8ae31611260..8ffda3bcaef 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/artifact/EnumSingletonSelectionDialog.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/artifact/EnumSingletonSelectionDialog.java
@@ -43,7 +43,8 @@ public class EnumSingletonSelectionDialog extends ListDialog {
Set<String> options;
try {
options = AttributeTypeManager.getEnumerationValues(attributeType);
- isRemoveAllAllowed = AttributeTypeManager.getType(attributeType).getMinOccurrences() == 0;
+ isRemoveAllAllowed = AttributeTypeManager.checkIfRemovalAllowed(attributeType, artifacts);
+
} catch (OseeCoreException ex) {
options = new HashSet<String>();
options.add(ex.getLocalizedMessage());

Back to the top