File tree Expand file tree Collapse file tree 6 files changed +40
-26
lines changed
com.archimatetool.editor/src/com/archimatetool/editor Expand file tree Collapse file tree 6 files changed +40
-26
lines changed Original file line number Diff line number Diff line change @@ -270,16 +270,8 @@ protected int getLineWidth() {
270
270
}
271
271
272
272
protected int getLineStyle () {
273
- int value = fDiagramModelObject .getLineStyle ();
274
-
275
- if (value == IDiagramModelObject .LINE_STYLE_DEFAULT ) {
276
- IObjectUIProvider provider = ObjectUIFactory .INSTANCE .getProvider (getDiagramModelObject ());
277
- if (provider != null && provider .getDefaultFeatureValue (IDiagramModelObject .FEATURE_LINE_STYLE ) instanceof Integer val ) {
278
- value = val ;
279
- }
280
- }
281
-
282
- return value ;
273
+ IObjectUIProvider provider = ObjectUIFactory .INSTANCE .getProvider (getDiagramModelObject ());
274
+ return provider != null && provider .getFeatureValue (IDiagramModelObject .FEATURE_LINE_STYLE ) instanceof Integer val ? val : IDiagramModelObject .LINE_STYLE_SOLID ;
283
275
}
284
276
285
277
@ Override
Original file line number Diff line number Diff line change @@ -111,16 +111,8 @@ private boolean isValidObject(EObject eObject) {
111
111
}
112
112
113
113
private int getLineStyle (IDiagramModelObject dmo ) {
114
- int value = dmo .getLineStyle ();
115
-
116
- if (value == IDiagramModelObject .LINE_STYLE_DEFAULT ) {
117
- IObjectUIProvider provider = ObjectUIFactory .INSTANCE .getProvider (dmo );
118
- if (provider != null && provider .getDefaultFeatureValue (IDiagramModelObject .FEATURE_LINE_STYLE ) instanceof Integer val ) {
119
- value = val ;
120
- }
121
- }
122
-
123
- return value ;
114
+ IObjectUIProvider provider = ObjectUIFactory .INSTANCE .getProvider (dmo );
115
+ return provider != null && provider .getFeatureValue (IDiagramModelObject .FEATURE_LINE_STYLE ) instanceof Integer val ? val : IDiagramModelObject .LINE_STYLE_SOLID ;
124
116
}
125
117
126
118
void updateControl () {
Original file line number Diff line number Diff line change 8
8
import org .eclipse .draw2d .geometry .Dimension ;
9
9
import org .eclipse .swt .graphics .Color ;
10
10
11
+ import com .archimatetool .model .IDiagramModelObject ;
11
12
import com .archimatetool .model .ITextAlignment ;
12
13
import com .archimatetool .model .ITextPosition ;
13
14
@@ -62,4 +63,26 @@ public int getDefaultTextPosition() {
62
63
public boolean hasIcon () {
63
64
return false ;
64
65
}
66
+
67
+ @ Override
68
+ public Object getDefaultFeatureValue (String featureName ) {
69
+ if (IDiagramModelObject .FEATURE_LINE_STYLE .equals (featureName )) {
70
+ return IDiagramModelObject .LINE_STYLE_SOLID ;
71
+ }
72
+
73
+ return super .getDefaultFeatureValue (featureName );
74
+ }
75
+
76
+ @ Override
77
+ public Object getFeatureValue (String featureName ) {
78
+ if (IDiagramModelObject .FEATURE_LINE_STYLE .equals (featureName ) && instance instanceof IDiagramModelObject dmo ) {
79
+ int value = dmo .getLineStyle ();
80
+ if (value == IDiagramModelObject .LINE_STYLE_DEFAULT ) {
81
+ return getDefaultFeatureValue (featureName );
82
+ }
83
+ return value ;
84
+ }
85
+
86
+ return super .getFeatureValue (featureName );
87
+ }
65
88
}
Original file line number Diff line number Diff line change @@ -66,9 +66,4 @@ public boolean shouldExposeFeature(EAttribute feature) {
66
66
public boolean shouldExposeFeature (String featureName ) {
67
67
return true ;
68
68
}
69
-
70
- @ Override
71
- public Object getDefaultFeatureValue (String featureName ) {
72
- return null ;
73
- }
74
69
}
Original file line number Diff line number Diff line change @@ -63,5 +63,15 @@ public interface IObjectUIProvider {
63
63
* @param featureName The feature in question
64
64
* @return a default value for a given feature. Default is null
65
65
*/
66
- Object getDefaultFeatureValue (String featureName );
66
+ default Object getDefaultFeatureValue (String featureName ) {
67
+ return null ;
68
+ }
69
+
70
+ /**
71
+ * @param featureName The feature in question
72
+ * @return a value for a given feature. Default is null
73
+ */
74
+ default Object getFeatureValue (String featureName ) {
75
+ return null ;
76
+ }
67
77
}
Original file line number Diff line number Diff line change @@ -76,11 +76,13 @@ public int getDefaultTextPosition() {
76
76
return ITextPosition .TEXT_POSITION_TOP ;
77
77
}
78
78
79
+
79
80
@ Override
80
81
public Object getDefaultFeatureValue (String featureName ) {
81
82
if (IDiagramModelObject .FEATURE_LINE_STYLE .equals (featureName )) {
82
83
return IDiagramModelObject .LINE_STYLE_DASHED ;
83
84
}
85
+
84
86
return super .getDefaultFeatureValue (featureName );
85
87
}
86
88
}
You can’t perform that action at this time.
0 commit comments