Skip to content

Commit afb5571

Browse files
eclipse-pde-botakurtakov
authored andcommitted
Perform clean code of ui/org.eclipse.ui.trace
1 parent 83a3ef3 commit afb5571

File tree

6 files changed

+7
-14
lines changed

6 files changed

+7
-14
lines changed

ui/org.eclipse.ui.trace/src/org/eclipse/ui/trace/internal/TracingComponentColumnEditingSupport.java

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -74,8 +74,7 @@ protected boolean canEdit(final Object element) {
7474
@Override
7575
protected CellEditor getCellEditor(final Object element) {
7676

77-
if (element instanceof TracingComponentDebugOption) {
78-
TracingComponentDebugOption option = (TracingComponentDebugOption) element;
77+
if (element instanceof TracingComponentDebugOption option) {
7978
if (TracingUtils.isValueBoolean(option.getOptionPathValue())) {
8079
return this.comboEditor;
8180
}
@@ -112,8 +111,7 @@ protected void setValue(final Object element, final Object value) {
112111

113112
switch (this.columnIndex) {
114113
case 1 :
115-
if (element instanceof TracingComponentDebugOption) {
116-
TracingComponentDebugOption option = (TracingComponentDebugOption) element;
114+
if (element instanceof TracingComponentDebugOption option) {
117115
String updatedValue = String.valueOf(value);
118116
if (value instanceof Integer) {
119117
updatedValue = String.valueOf((Integer) value == 0);

ui/org.eclipse.ui.trace/src/org/eclipse/ui/trace/internal/TracingComponentComparator.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,7 @@ public int compare(final Viewer viewer, final Object object1, final Object objec
6464
} else {
6565
result = name1.compareTo(name2);
6666
}
67-
} else if (object1 instanceof String && object2 instanceof String) {
68-
String label1 = (String) object1;
67+
} else if (object1 instanceof String label1 && object2 instanceof String) {
6968
String label2 = (String) object2;
7069
result = label1.compareTo(label2);
7170
}

ui/org.eclipse.ui.trace/src/org/eclipse/ui/trace/internal/TracingComponentViewerFilter.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,7 @@ private void forceVisibleDebugOptions(final TracingComponentDebugOption[] option
6464
public boolean isElementVisible(final Viewer viewer, final Object element) {
6565

6666
boolean isVisible = false;
67-
if (element instanceof TracingComponent) {
68-
TracingComponent component = (TracingComponent) element;
67+
if (element instanceof TracingComponent component) {
6968
boolean textMatches = super.isLeafMatch(viewer, component);
7069
if (textMatches) {
7170
// the text matches - make sure all children of this component are visible

ui/org.eclipse.ui.trace/src/org/eclipse/ui/trace/internal/datamodel/TracingComponent.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,10 +66,9 @@ public boolean equals(final Object obj) {
6666
if (obj == null) {
6767
return false;
6868
}
69-
if (!(obj instanceof TracingComponent)) {
69+
if (!(obj instanceof TracingComponent other)) {
7070
return false;
7171
}
72-
TracingComponent other = (TracingComponent) obj;
7372
if (getId() == null) {
7473
if (other.getId() != null) {
7574
return false;

ui/org.eclipse.ui.trace/src/org/eclipse/ui/trace/internal/datamodel/TracingComponentDebugOption.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,10 +90,9 @@ public boolean equals(final Object obj) {
9090
if (obj == null) {
9191
return false;
9292
}
93-
if (!(obj instanceof TracingComponentDebugOption)) {
93+
if (!(obj instanceof TracingComponentDebugOption other)) {
9494
return false;
9595
}
96-
TracingComponentDebugOption other = (TracingComponentDebugOption) obj;
9796
if (fOptionPath == null) {
9897
if (other.fOptionPath != null) {
9998
return false;

ui/org.eclipse.ui.trace/src/org/eclipse/ui/trace/internal/providers/TracingComponentContentProvider.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,7 @@ public class TracingComponentContentProvider implements ITreeContentProvider {
2727
public TracingNode[] getChildren(final Object parentElement) {
2828

2929
TracingNode[] children = null;
30-
if (parentElement instanceof TracingNode) {
31-
final TracingNode node = (TracingNode) parentElement;
30+
if (parentElement instanceof final TracingNode node) {
3231
children = node.getChildren();
3332
}
3433
return children;

0 commit comments

Comments
 (0)