Skip to content

Commit d6d38e7

Browse files
eclipse-pde-botlaeubi
authored andcommitted
Perform clean code of ui/org.eclipse.pde.spy.css
1 parent 24a924e commit d6d38e7

File tree

2 files changed

+5
-10
lines changed

2 files changed

+5
-10
lines changed

ui/org.eclipse.pde.spy.css/src/org/eclipse/pde/spy/css/CssSpyPart.java

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -116,8 +116,7 @@ public static CSSStylableElement getCSSElement(Object o) {
116116
/** @return the CSS engine governing the argument, or null if none */
117117
public static CSSEngine getCSSEngine(Object o) {
118118
CSSEngine engine = null;
119-
if (o instanceof CSSStylableElement) {
120-
CSSStylableElement element = (CSSStylableElement) o;
119+
if (o instanceof CSSStylableElement element) {
121120
engine = WidgetElement.getEngine((Widget) element.getNativeWidget());
122121
}
123122
if (engine == null && o instanceof Widget) {
@@ -391,16 +390,13 @@ private Rectangle getBounds(Widget widget) {
391390
if (widget instanceof Shell) {
392391
// Shell bounds are already in display coordinates
393392
return ((Shell) widget).getBounds();
394-
} else if (widget instanceof Control) {
395-
Control control = (Control) widget;
393+
} else if (widget instanceof Control control) {
396394
Rectangle bounds = control.getBounds();
397395
return control.getDisplay().map(control.getParent(), null, bounds);
398-
} else if (widget instanceof ToolItem) {
399-
ToolItem item = (ToolItem) widget;
396+
} else if (widget instanceof ToolItem item) {
400397
Rectangle bounds = item.getBounds();
401398
return item.getDisplay().map(item.getParent(), null, bounds);
402-
} else if (widget instanceof CTabItem) {
403-
CTabItem item = (CTabItem) widget;
399+
} else if (widget instanceof CTabItem item) {
404400
Rectangle bounds = item.getBounds();
405401
return item.getDisplay().map(item.getParent(), null, bounds);
406402
}

ui/org.eclipse.pde.spy.css/src/org/eclipse/pde/spy/css/WidgetTreeProvider.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,8 +67,7 @@ public Object[] getChildren(Object parentElement) {
6767

6868
@Override
6969
public Object getParent(Object element) {
70-
if (element instanceof Control) {
71-
Control control = (Control) element;
70+
if (element instanceof Control control) {
7271
return control.isDisposed() ? null : control.getParent();
7372
} else if (element instanceof CTabItem) {
7473
return ((CTabItem) element).getParent();

0 commit comments

Comments
 (0)