From 5c0d30aaec009be2c1de215a13be2eee4a785dd2 Mon Sep 17 00:00:00 2001
From: Phillipus
Date: Mon, 16 Dec 2024 13:46:03 +0000
Subject: [PATCH] Make the "None" border colour a check menu option
- Before this to remove the "None" border colour you had to open the color chooser and choose a different color than black for it to take effect
- This was because the color chooser returns null if the colour is the same
- This gives the user an easier way to remove the "None" option and set the border colour to the default of black
---
.../propertysections/BorderColorSection.java | 28 +++++++++----------
1 file changed, 14 insertions(+), 14 deletions(-)
diff --git a/com.archimatetool.editor/src/com/archimatetool/editor/propertysections/BorderColorSection.java b/com.archimatetool.editor/src/com/archimatetool/editor/propertysections/BorderColorSection.java
index b3bbd7d9a..b7ecbe2c3 100644
--- a/com.archimatetool.editor/src/com/archimatetool/editor/propertysections/BorderColorSection.java
+++ b/com.archimatetool.editor/src/com/archimatetool/editor/propertysections/BorderColorSection.java
@@ -56,17 +56,16 @@ public Class> getAdaptableType() {
private IPropertyChangeListener colorListener = new IPropertyChangeListener() {
@Override
public void propertyChange(PropertyChangeEvent event) {
+ RGB rgb = fColorChooser.getColorValue();
+ String newColor = ColorFactory.convertRGBToString(rgb);
+
CompoundCommand result = new CompoundCommand();
- for(EObject bo : getEObjects()) {
- if(isAlive(bo)) {
- RGB rgb = fColorChooser.getColorValue();
- String newColor = ColorFactory.convertRGBToString(rgb);
- if(!newColor.equals(((IBorderObject)bo).getBorderColor())) {
- Command cmd = new BorderColorCommand((IBorderObject)bo, newColor);
- if(cmd.canExecute()) {
- result.add(cmd);
- }
+ for(EObject eObject : getEObjects()) {
+ if(isAlive(eObject) && eObject instanceof IBorderObject bo) {
+ Command cmd = new BorderColorCommand(bo, newColor);
+ if(cmd.canExecute()) {
+ result.add(cmd);
}
}
}
@@ -95,14 +94,15 @@ private void createColorControl(Composite parent) {
fColorChooser.setDoShowPreferencesMenuItem(false);
// No border action
- fNoBorderAction = new Action(Messages.BorderColorSection_1) {
+ fNoBorderAction = new Action(Messages.BorderColorSection_1, SWT.CHECK) {
@Override
public void run() {
CompoundCommand result = new CompoundCommand();
- for(EObject bo : getEObjects()) {
- if(isAlive(bo)) {
- Command cmd = new BorderColorCommand((IBorderObject)bo, null);
+ for(EObject eObject : getEObjects()) {
+ if(isAlive(eObject) && eObject instanceof IBorderObject bo) {
+ String color = isChecked() ? null : "#000000"; //$NON-NLS-1$
+ Command cmd = new BorderColorCommand(bo, color);
if(cmd.canExecute()) {
result.add(cmd);
}
@@ -140,7 +140,7 @@ protected void update() {
fColorChooser.setEnabled(!isLocked(bo));
- fNoBorderAction.setEnabled(colorValue != null);
+ fNoBorderAction.setChecked(colorValue == null);
fColorChooser.setDoShowColorImage(colorValue != null);
}