Skip to content

Commit

Permalink
[Property Sections] Don't check if the notifier is the first selected…
Browse files Browse the repository at this point in the history
… object

- We don't need to check if(msg.getNotifier() == getFirstSelectedObject()) because it will be if the object is selected

- This fixes Feature notifications not updating controls because the notifier might not be the first selected object it might be the feature itself
  • Loading branch information
Phillipus committed Oct 7, 2024
1 parent 434787c commit ebb11dd
Show file tree
Hide file tree
Showing 33 changed files with 185 additions and 260 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -122,14 +122,12 @@ protected void textChanged(String oldText, String newText) {

@Override
protected void notifyChanged(Notification msg) {
if(msg.getNotifier() == getFirstSelectedObject()) {
Object feature = msg.getFeature();

if(feature == ICanvasPackage.Literals.HINT_PROVIDER__HINT_TITLE ||
feature == ICanvasPackage.Literals.HINT_PROVIDER__HINT_CONTENT ||
feature == IArchimatePackage.Literals.LOCKABLE__LOCKED) {
update();
}
Object feature = msg.getFeature();

if(feature == ICanvasPackage.Literals.HINT_PROVIDER__HINT_TITLE ||
feature == ICanvasPackage.Literals.HINT_PROVIDER__HINT_CONTENT ||
feature == IArchimatePackage.Literals.LOCKABLE__LOCKED) {
update();
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,13 +86,11 @@ protected void textChanged(String oldText, String newText) {

@Override
protected void notifyChanged(Notification msg) {
if(msg.getNotifier() == getFirstSelectedObject()) {
Object feature = msg.getFeature();
// Model event
if(feature == ICanvasPackage.Literals.NOTES_CONTENT__NOTES
|| feature == IArchimatePackage.Literals.LOCKABLE__LOCKED) {
update();
}
Object feature = msg.getFeature();

if(feature == ICanvasPackage.Literals.NOTES_CONTENT__NOTES
|| feature == IArchimatePackage.Literals.LOCKABLE__LOCKED) {
update();
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,11 @@ protected void createControls(Composite parent) {

@Override
protected void notifyChanged(Notification msg) {
if(msg.getNotifier() == getFirstSelectedObject()) {
Object feature = msg.getFeature();

if(feature == IArchimatePackage.Literals.DOCUMENTABLE__DOCUMENTATION ||
feature == IArchimatePackage.Literals.LOCKABLE__LOCKED) {
update();
}
Object feature = msg.getFeature();

if(feature == IArchimatePackage.Literals.DOCUMENTABLE__DOCUMENTATION ||
feature == IArchimatePackage.Literals.LOCKABLE__LOCKED) {
update();
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,22 +36,20 @@ protected void createControls(Composite parent) {

@Override
protected void notifyChanged(Notification msg) {
if(msg.getNotifier() == getFirstSelectedObject()) {
Object feature = msg.getFeature();

// Name event
if(feature == IArchimatePackage.Literals.NAMEABLE__NAME) {
refreshNameField();
updatePropertiesLabel();
}
// Documentation event
else if(feature == IArchimatePackage.Literals.DOCUMENTABLE__DOCUMENTATION) {
refreshDocumentationField();
}
// Locked
else if(feature == IArchimatePackage.Literals.LOCKABLE__LOCKED) {
update();
}
Object feature = msg.getFeature();

// Name event
if(feature == IArchimatePackage.Literals.NAMEABLE__NAME) {
refreshNameField();
updatePropertiesLabel();
}
// Documentation event
else if(feature == IArchimatePackage.Literals.DOCUMENTABLE__DOCUMENTATION) {
refreshDocumentationField();
}
// Locked
else if(feature == IArchimatePackage.Literals.LOCKABLE__LOCKED) {
update();
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,14 +34,12 @@ protected void createControls(Composite parent) {

@Override
protected void notifyChanged(Notification msg) {
if(msg.getNotifier() == getFirstSelectedObject()) {
Object feature = msg.getFeature();

if(feature == IArchimatePackage.Literals.NAMEABLE__NAME ||
feature == IArchimatePackage.Literals.LOCKABLE__LOCKED) {
update();
updatePropertiesLabel();
}
Object feature = msg.getFeature();

if(feature == IArchimatePackage.Literals.NAMEABLE__NAME ||
feature == IArchimatePackage.Literals.LOCKABLE__LOCKED) {
update();
updatePropertiesLabel();
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,11 +98,9 @@ public void widgetSelected(SelectionEvent e) {

@Override
protected void notifyChanged(Notification msg) {
if(msg.getNotifier() == getFirstSelectedObject()) {
Object feature = msg.getFeature();
if(feature == IArchimatePackage.Literals.ACCESS_RELATIONSHIP__ACCESS_TYPE) {
update();
}
Object feature = msg.getFeature();
if(feature == IArchimatePackage.Literals.ACCESS_RELATIONSHIP__ACCESS_TYPE) {
update();
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,22 +94,20 @@ protected void textChanged(String oldText, String newText) {

@Override
protected void notifyChanged(Notification msg) {
if(msg.getNotifier() == getFirstSelectedObject()) {
Object feature = msg.getFeature();

// Model Name
if(feature == IArchimatePackage.Literals.NAMEABLE__NAME) {
refreshNameField();
updatePropertiesLabel(); // Update Main label
}
// Model File
else if(feature == IArchimatePackage.Literals.ARCHIMATE_MODEL__FILE) {
refreshFileField();
}
// Model Purpose
else if(feature == IArchimatePackage.Literals.ARCHIMATE_MODEL__PURPOSE) {
refreshPurposeField();
}
Object feature = msg.getFeature();

// Model Name
if(feature == IArchimatePackage.Literals.NAMEABLE__NAME) {
refreshNameField();
updatePropertiesLabel(); // Update Main label
}
// Model File
else if(feature == IArchimatePackage.Literals.ARCHIMATE_MODEL__FILE) {
refreshFileField();
}
// Model Purpose
else if(feature == IArchimatePackage.Literals.ARCHIMATE_MODEL__PURPOSE) {
refreshPurposeField();
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,12 +50,10 @@ public Class<?> getAdaptableType() {

@Override
protected void notifyChanged(Notification msg) {
if(msg.getNotifier() == getFirstSelectedObject()) {
Object feature = msg.getFeature();

if(feature == IArchimatePackage.Literals.ASSOCIATION_RELATIONSHIP__DIRECTED) {
update();
}
Object feature = msg.getFeature();

if(feature == IArchimatePackage.Literals.ASSOCIATION_RELATIONSHIP__DIRECTED) {
update();
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,12 +119,10 @@ public void run() {

@Override
protected void notifyChanged(Notification msg) {
if(msg.getNotifier() == getFirstSelectedObject()) {
Object feature = msg.getFeature();

if(feature == IArchimatePackage.Literals.BORDER_OBJECT__BORDER_COLOR || feature == IArchimatePackage.Literals.LOCKABLE__LOCKED) {
update();
}
Object feature = msg.getFeature();

if(feature == IArchimatePackage.Literals.BORDER_OBJECT__BORDER_COLOR || feature == IArchimatePackage.Literals.LOCKABLE__LOCKED) {
update();
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,13 +67,11 @@ public void widgetSelected(SelectionEvent e) {

@Override
protected void notifyChanged(Notification msg) {
if(msg.getNotifier() == getFirstSelectedObject()) {
Object feature = msg.getFeature();

if(feature == IArchimatePackage.Literals.BORDER_TYPE__BORDER_TYPE ||
feature == IArchimatePackage.Literals.LOCKABLE__LOCKED) {
update();
}
Object feature = msg.getFeature();

if(feature == IArchimatePackage.Literals.BORDER_TYPE__BORDER_TYPE ||
feature == IArchimatePackage.Literals.LOCKABLE__LOCKED) {
update();
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,13 +84,11 @@ protected int getLineTypeValue() {

@Override
protected void notifyChanged(Notification msg) {
if(msg.getNotifier() == getFirstSelectedObject()) {
Object feature = msg.getFeature();

if(feature == IArchimatePackage.Literals.DIAGRAM_MODEL_CONNECTION__TYPE ||
feature == IArchimatePackage.Literals.LOCKABLE__LOCKED) {
update();
}
Object feature = msg.getFeature();

if(feature == IArchimatePackage.Literals.DIAGRAM_MODEL_CONNECTION__TYPE ||
feature == IArchimatePackage.Literals.LOCKABLE__LOCKED) {
update();
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -124,19 +124,15 @@ public void widgetSelected(SelectionEvent e) {

@Override
protected void notifyChanged(Notification msg) {
if(msg.getNotifier() == getFirstSelectedObject()) {
Object feature = msg.getFeature();

if(feature == IArchimatePackage.Literals.DIAGRAM_MODEL_CONNECTION__TEXT_POSITION) {
refreshTextPositionCombo();
}
else if(feature == IArchimatePackage.Literals.LOCKABLE__LOCKED) {
update();
}
Object feature = msg.getFeature();

if(feature == IArchimatePackage.Literals.DIAGRAM_MODEL_CONNECTION__TEXT_POSITION) {
refreshTextPositionCombo();
}

// Notifier is the Feature
if(isFeatureNotification(msg, IDiagramModelConnection.FEATURE_NAME_VISIBLE)) {
else if(feature == IArchimatePackage.Literals.LOCKABLE__LOCKED) {
update();
}
else if(isFeatureNotification(msg, IDiagramModelConnection.FEATURE_NAME_VISIBLE)) {
refreshNameVisibleButton();
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,12 +112,10 @@ protected IObjectFilter getFilter() {

@Override
protected void notifyChanged(Notification msg) {
if(msg.getNotifier() == getFirstSelectedObject()) {
Object feature = msg.getFeature();

if(feature == IArchimatePackage.Literals.DIAGRAM_MODEL_ARCHIMATE_OBJECT__TYPE) {
update();
}
Object feature = msg.getFeature();

if(feature == IArchimatePackage.Literals.DIAGRAM_MODEL_ARCHIMATE_OBJECT__TYPE) {
update();
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,12 +112,10 @@ public void widgetSelected(SelectionEvent e) {

@Override
protected void notifyChanged(Notification msg) {
if(msg.getNotifier() == getFirstSelectedObject()) {
Object feature = msg.getFeature();
Object feature = msg.getFeature();

if(feature == IArchimatePackage.Literals.DIAGRAM_MODEL__CONNECTION_ROUTER_TYPE) {
update();
}
if(feature == IArchimatePackage.Literals.DIAGRAM_MODEL__CONNECTION_ROUTER_TYPE) {
update();
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,13 +71,11 @@ protected void refreshDocumentationField() {
protected void notifyChanged(Notification msg) {
super.notifyChanged(msg);

if(msg.getNotifier() == getFirstSelectedObject()) {
Object feature = msg.getFeature();

if(feature == IArchimatePackage.Literals.DOCUMENTABLE__DOCUMENTATION ||
feature == IArchimatePackage.Literals.LOCKABLE__LOCKED) {
refreshDocumentationField();
}
Object feature = msg.getFeature();

if(feature == IArchimatePackage.Literals.DOCUMENTABLE__DOCUMENTATION ||
feature == IArchimatePackage.Literals.LOCKABLE__LOCKED) {
refreshDocumentationField();
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,21 +58,19 @@ protected void createControls(Composite parent) {

@Override
protected void notifyChanged(Notification msg) {
if(msg.getNotifier() == getFirstSelectedObject()) {
Object feature = msg.getFeature();

if(feature == IArchimatePackage.Literals.DIAGRAM_MODEL_OBJECT__FILL_COLOR) {
updateColorControl(); // update also when executing command in case "default" is chosen
}
else if(isFeatureNotification(msg, IDiagramModelObject.FEATURE_GRADIENT)) {
if(!fIsExecutingCommand) {
updateGradientControl();
}
}
else if(feature == IArchimatePackage.Literals.LOCKABLE__LOCKED) {
update();
Object feature = msg.getFeature();

if(feature == IArchimatePackage.Literals.DIAGRAM_MODEL_OBJECT__FILL_COLOR) {
updateColorControl(); // update also when executing command in case "default" is chosen
}
else if(isFeatureNotification(msg, IDiagramModelObject.FEATURE_GRADIENT)) {
if(!fIsExecutingCommand) {
updateGradientControl();
}
}
else if(feature == IArchimatePackage.Literals.LOCKABLE__LOCKED) {
update();
}
}

@Override
Expand All @@ -99,7 +97,6 @@ private void updateColorControl() {
else if(fillColorComposite != null) {
fillColorComposite.dispose();
fillColorComposite = null;
return;
}
}

Expand All @@ -115,7 +112,6 @@ private void updateGradientControl() {
else if(gradientComposite != null) {
gradientComposite.dispose();
gradientComposite = null;
return;
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,18 +63,16 @@ int getValue() {

@Override
protected void notifyChanged(Notification msg) {
if(msg.getNotifier() == getFirstSelectedObject()) {
Object feature = msg.getFeature();

if(feature == IArchimatePackage.Literals.DIAGRAM_MODEL_OBJECT__ALPHA) {
if(!fIsExecutingCommand) {
update();
}
}
else if(feature == IArchimatePackage.Literals.LOCKABLE__LOCKED) {
Object feature = msg.getFeature();

if(feature == IArchimatePackage.Literals.DIAGRAM_MODEL_OBJECT__ALPHA) {
if(!fIsExecutingCommand) {
update();
}
}
else if(feature == IArchimatePackage.Literals.LOCKABLE__LOCKED) {
update();
}
}

@Override
Expand Down
Loading

0 comments on commit ebb11dd

Please sign in to comment.