Skip to content

Commit 27dc364

Browse files
eclipse-pde-botmerks
authored andcommitted
Perform clean code of e4tools/bundles/org.eclipse.e4.tools.emf.editor3x
1 parent 2d9f7da commit 27dc364

File tree

1 file changed

+5
-8
lines changed
  • e4tools/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x

1 file changed

+5
-8
lines changed

e4tools/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/UndoAction.java

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -75,14 +75,11 @@ private void update() {
7575
*/
7676
public static String getCommandLabel(Command cmd) {
7777

78-
if (cmd instanceof SetCommand) {
79-
SetCommand sc = (SetCommand) cmd;
78+
if (cmd instanceof SetCommand sc) {
8079
return sc.getLabel() + " " + sc.getFeature().getName() + " on " + sc.getOwner().eClass().getName(); //$NON-NLS-1$ //$NON-NLS-2$
81-
} else if (cmd instanceof AddCommand) {
82-
AddCommand ac = (AddCommand) cmd;
80+
} else if (cmd instanceof AddCommand ac) {
8381
return ac.getLabel() + " " + getFirstClassName(ac.getCollection()); //$NON-NLS-1$
84-
} else if (cmd instanceof DeleteCommand) {
85-
DeleteCommand dc = (DeleteCommand) cmd;
82+
} else if (cmd instanceof DeleteCommand dc) {
8683
Collection<?> deleted = dc.getCollection();
8784
if (deleted.size() == 1) {
8885
return dc.getLabel() + " " + getFirstClassName(deleted); //$NON-NLS-1$
@@ -100,8 +97,8 @@ public static String getCommandLabel(Command cmd) {
10097
private static String getFirstClassName(Collection<?> c)
10198
{
10299
Object o = c.iterator().next();
103-
String clname = (o instanceof EObject) ? ((EObject) o).eClass().getName() : ""; //$NON-NLS-1$
104-
String dname = (o instanceof MUILabel) ? ((MUILabel) o).getLabel() : ""; //$NON-NLS-1$
100+
String clname = (o instanceof EObject e) ? e.eClass().getName() : ""; //$NON-NLS-1$
101+
String dname = (o instanceof MUILabel m) ? m.getLabel() : ""; //$NON-NLS-1$
105102
return clname + " " + (dname == null ? "" : dname); //$NON-NLS-1$ //$NON-NLS-2$
106103
}
107104

0 commit comments

Comments
 (0)