Skip to content

Commit

Permalink
Simplify canExecute() by using Objects.equals()
Browse files Browse the repository at this point in the history
  • Loading branch information
Phillipus committed Jul 30, 2024
1 parent 7d11e7a commit b42cd4c
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
*/
package com.archimatetool.editor.model.commands;

import java.util.Objects;

import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.EStructuralFeature;
import org.eclipse.gef.commands.Command;
Expand Down Expand Up @@ -42,9 +44,7 @@ public void undo() {

@Override
public boolean canExecute() {
return (fNewValue != null) ? !fNewValue.equals(fOldValue)
: (fOldValue != null) ? !fOldValue.equals(fNewValue)
: false;
return !Objects.equals(fNewValue, fOldValue);
}

@Override
Expand Down

0 comments on commit b42cd4c

Please sign in to comment.