iter = model.eAllContents(); iter.hasNext();) {
- EObject eObject = iter.next();
- if(eObject instanceof IDiagramModelArchimateObject dmo && dmo.getArchimateConcept() instanceof IGrouping) {
- dmo.setLineStyle(IDiagramModelObject.LINE_STYLE_DASHED);
- }
- }
- }
-}
diff --git a/com.archimatetool.editor/src/com/archimatetool/editor/propertysections/LineStyleComposite.java b/com.archimatetool.editor/src/com/archimatetool/editor/propertysections/LineStyleComposite.java
index 24b38c09b..08fb47e58 100644
--- a/com.archimatetool.editor/src/com/archimatetool/editor/propertysections/LineStyleComposite.java
+++ b/com.archimatetool.editor/src/com/archimatetool/editor/propertysections/LineStyleComposite.java
@@ -24,6 +24,8 @@
import com.archimatetool.editor.diagram.commands.DiagramModelObjectLineStyleCommand;
import com.archimatetool.editor.ui.IArchiImages;
+import com.archimatetool.editor.ui.factory.IObjectUIProvider;
+import com.archimatetool.editor.ui.factory.ObjectUIFactory;
import com.archimatetool.model.IDiagramModelObject;
@@ -78,7 +80,8 @@ public void run() {
for(EObject object : section.getEObjects()) {
if(isValidObject(object)) {
- Command cmd = new DiagramModelObjectLineStyleCommand((IDiagramModelObject)object, value);
+ IDiagramModelObject dmo = (IDiagramModelObject)object;
+ Command cmd = new DiagramModelObjectLineStyleCommand(dmo, value, getDefaultLineStyle(dmo));
if(cmd.canExecute()) {
result.add(cmd);
}
@@ -94,7 +97,8 @@ public ImageDescriptor getImageDescriptor() {
}
};
- action.setChecked(((IDiagramModelObject)section.getFirstSelectedObject()).getLineStyle() == value);
+ int lineStyle = getActualLineStyle((IDiagramModelObject)section.getFirstSelectedObject());
+ action.setChecked(lineStyle == value);
return action;
}
@@ -107,9 +111,19 @@ private boolean isValidObject(EObject eObject) {
section.getFilter().shouldExposeFeature(eObject, IDiagramModelObject.FEATURE_LINE_STYLE);
}
+ private int getActualLineStyle(IDiagramModelObject dmo) {
+ IObjectUIProvider provider = ObjectUIFactory.INSTANCE.getProvider(dmo);
+ return provider != null && provider.getFeatureValue(IDiagramModelObject.FEATURE_LINE_STYLE) instanceof Integer val ? val : IDiagramModelObject.LINE_STYLE_SOLID;
+ }
+
+ private int getDefaultLineStyle(IDiagramModelObject dmo) {
+ IObjectUIProvider provider = ObjectUIFactory.INSTANCE.getProvider(dmo);
+ return provider != null && provider.getDefaultFeatureValue(IDiagramModelObject.FEATURE_LINE_STYLE) instanceof Integer val ? val : IDiagramModelObject.LINE_STYLE_SOLID;
+ }
+
void updateControl() {
IDiagramModelObject dmo = (IDiagramModelObject)section.getFirstSelectedObject();
- int lineStyle = dmo.getLineStyle();
+ int lineStyle = getActualLineStyle(dmo);
switch(lineStyle) {
case IDiagramModelObject.LINE_STYLE_SOLID:
diff --git a/com.archimatetool.editor/src/com/archimatetool/editor/ui/factory/AbstractGraphicalObjectUIProvider.java b/com.archimatetool.editor/src/com/archimatetool/editor/ui/factory/AbstractGraphicalObjectUIProvider.java
index 046222988..857b44210 100644
--- a/com.archimatetool.editor/src/com/archimatetool/editor/ui/factory/AbstractGraphicalObjectUIProvider.java
+++ b/com.archimatetool.editor/src/com/archimatetool/editor/ui/factory/AbstractGraphicalObjectUIProvider.java
@@ -8,6 +8,7 @@
import org.eclipse.draw2d.geometry.Dimension;
import org.eclipse.swt.graphics.Color;
+import com.archimatetool.model.IDiagramModelObject;
import com.archimatetool.model.ITextAlignment;
import com.archimatetool.model.ITextPosition;
@@ -62,4 +63,23 @@ public int getDefaultTextPosition() {
public boolean hasIcon() {
return false;
}
+
+ @Override
+ public Object getDefaultFeatureValue(String featureName) {
+ if(IDiagramModelObject.FEATURE_LINE_STYLE.equals(featureName)) {
+ return IDiagramModelObject.LINE_STYLE_SOLID;
+ }
+
+ return super.getDefaultFeatureValue(featureName);
+ }
+
+ @Override
+ public Object getFeatureValue(String featureName) {
+ if(IDiagramModelObject.FEATURE_LINE_STYLE.equals(featureName) && instance instanceof IDiagramModelObject dmo) {
+ int value = dmo.getLineStyle();
+ return (value == IDiagramModelObject.LINE_STYLE_DEFAULT) ? getDefaultFeatureValue(featureName) : value;
+ }
+
+ return super.getFeatureValue(featureName);
+ }
}
diff --git a/com.archimatetool.editor/src/com/archimatetool/editor/ui/factory/IObjectUIProvider.java b/com.archimatetool.editor/src/com/archimatetool/editor/ui/factory/IObjectUIProvider.java
index db665d178..f9da03f88 100644
--- a/com.archimatetool.editor/src/com/archimatetool/editor/ui/factory/IObjectUIProvider.java
+++ b/com.archimatetool.editor/src/com/archimatetool/editor/ui/factory/IObjectUIProvider.java
@@ -54,8 +54,24 @@ public interface IObjectUIProvider {
boolean shouldExposeFeature(EAttribute feature);
/**
- * @param feature The feature in question
+ * @param featureName The feature in question
* @return True if this object should expose a feature in the UI
*/
boolean shouldExposeFeature(String featureName);
+
+ /**
+ * @param featureName The feature in question
+ * @return a default value for a given feature. Default is null
+ */
+ default Object getDefaultFeatureValue(String featureName) {
+ return null;
+ }
+
+ /**
+ * @param featureName The feature in question
+ * @return a value for a given feature. Default is null
+ */
+ default Object getFeatureValue(String featureName) {
+ return null;
+ }
}
diff --git a/com.archimatetool.editor/src/com/archimatetool/editor/ui/factory/elements/GroupingUIProvider.java b/com.archimatetool.editor/src/com/archimatetool/editor/ui/factory/elements/GroupingUIProvider.java
index bd9805568..4840779f0 100644
--- a/com.archimatetool.editor/src/com/archimatetool/editor/ui/factory/elements/GroupingUIProvider.java
+++ b/com.archimatetool.editor/src/com/archimatetool/editor/ui/factory/elements/GroupingUIProvider.java
@@ -16,6 +16,7 @@
import com.archimatetool.editor.diagram.figures.elements.GroupingFigure;
import com.archimatetool.editor.ui.IArchiImages;
import com.archimatetool.model.IArchimatePackage;
+import com.archimatetool.model.IDiagramModelObject;
import com.archimatetool.model.ITextAlignment;
import com.archimatetool.model.ITextPosition;
@@ -74,4 +75,13 @@ public int getDefaultTextAlignment() {
public int getDefaultTextPosition() {
return ITextPosition.TEXT_POSITION_TOP;
}
+
+ @Override
+ public Object getDefaultFeatureValue(String featureName) {
+ if(IDiagramModelObject.FEATURE_LINE_STYLE.equals(featureName)) {
+ return IDiagramModelObject.LINE_STYLE_DASHED;
+ }
+
+ return super.getDefaultFeatureValue(featureName);
+ }
}
diff --git a/com.archimatetool.model/src/com/archimatetool/model/IDiagramModelObject.java b/com.archimatetool.model/src/com/archimatetool/model/IDiagramModelObject.java
index 4cbdaebdc..7fe8b5dc4 100644
--- a/com.archimatetool.model/src/com/archimatetool/model/IDiagramModelObject.java
+++ b/com.archimatetool.model/src/com/archimatetool/model/IDiagramModelObject.java
@@ -46,10 +46,11 @@ public interface IDiagramModelObject extends IConnectable, IFontAttribute, ILine
boolean FEATURE_DERIVE_ELEMENT_LINE_COLOR_DEFAULT = true;
String FEATURE_LINE_STYLE = "lineStyle";
- int FEATURE_LINE_STYLE_DEFAULT = 0;
+ int LINE_STYLE_DEFAULT = -1;
int LINE_STYLE_SOLID = 0;
int LINE_STYLE_DASHED = 1;
int LINE_STYLE_DOTTED = 2;
+ int FEATURE_LINE_STYLE_DEFAULT = LINE_STYLE_DEFAULT;
/**
* @return the value of FEATURE_LINE_ALPHA
diff --git a/com.archimatetool.model/src/com/archimatetool/model/ModelVersion.java b/com.archimatetool.model/src/com/archimatetool/model/ModelVersion.java
index 1995762c1..47333fb07 100644
--- a/com.archimatetool.model/src/com/archimatetool/model/ModelVersion.java
+++ b/com.archimatetool.model/src/com/archimatetool/model/ModelVersion.java
@@ -11,12 +11,13 @@
* Use this to determine when loading a different version model if it will bring the whole
* show down. Example, folders were introduced in version 1.3 of Archi but won't open in Archi 1.2.
*
- * PLEASE NOTE - THIS IS THE VERSION OF THE INTERNAL MODEL, NOT ARCHI.
+ * PLEASE NOTE - THIS IS THE VERSION OF THE MODEL, NOT ARCHI.
+ * As from Archi version 2.6.0 I will try to keep the model version number the same as Archi's version number when the model version is incremented.
* Only need to change the model version number if there are changes that affect backwards compatibility.
- *
- * History:
*
- * 1.0.0 - Archi versions 0.7 - 1.2.0 the version number was not saved to the XMI file
+ * History:
+ *
+ * 1.0.0 - Archi versions 0.7 - 1.2.0 the version number was not saved to the XMI file
* 1.1.0 - Archi version 1.3.0 introduced sub-folders which are not backwards-compatible
* 1.1.1 - Archi version 1.4.0 added sub-folders in the Views folder which are not backwards-compatible
* 1.2.0 - Archi version 1.5.0 added the Sketch View which is not backwards-compatible, and text alignment attribute
@@ -50,11 +51,9 @@
* - Add images to IDiagramModelArchimateObject
* - Refactor IDiagramModelImageProvider, IIconic and more...
* 5.0.0 - ArchiMate 3.2
- * 5.0.1 - Line styles on diagram objects. Grouping figure has to be set to dashed lines.
*
- *
* @author Phillip Beauvoir
*/
public interface ModelVersion {
- String VERSION = "5.0.1"; //$NON-NLS-1$
+ String VERSION = "5.0.0"; //$NON-NLS-1$
}
diff --git a/tests/com.archimatetool.model.tests/src/com/archimatetool/model/impl/DiagramModelObjectTests.java b/tests/com.archimatetool.model.tests/src/com/archimatetool/model/impl/DiagramModelObjectTests.java
index 3aed579c7..8791c845b 100644
--- a/tests/com.archimatetool.model.tests/src/com/archimatetool/model/impl/DiagramModelObjectTests.java
+++ b/tests/com.archimatetool.model.tests/src/com/archimatetool/model/impl/DiagramModelObjectTests.java
@@ -161,9 +161,9 @@ public void testGetLineColor() {
@Test
public void testGetLineStyle() {
- assertEquals(0, object.getLineStyle());
- object.setLineStyle(1);
- assertEquals(1, object.getLineStyle());
+ assertEquals(IDiagramModelObject.LINE_STYLE_DEFAULT, object.getLineStyle());
+ object.setLineStyle(IDiagramModelObject.LINE_STYLE_SOLID);
+ assertEquals(IDiagramModelObject.LINE_STYLE_SOLID, object.getLineStyle());
}
@Test