Skip to content

Commit a8e0f7d

Browse files
eclipse-equinox-botakurtakov
authored andcommitted
Perform clean code of bundles/org.eclipse.equinox.p2.ui.sdk.scheduler
1 parent 0d9ea46 commit a8e0f7d

File tree

3 files changed

+5
-10
lines changed

3 files changed

+5
-10
lines changed

bundles/org.eclipse.equinox.p2.ui.sdk.scheduler/src/org/eclipse/equinox/internal/p2/ui/sdk/scheduler/AutomaticUpdater.java

+1-2
Original file line numberDiff line numberDiff line change
@@ -70,8 +70,7 @@ public AutomaticUpdater() {
7070

7171
private void createProfileListener() {
7272
profileListener = o -> {
73-
if (o instanceof IProfileEvent) {
74-
IProfileEvent event = (IProfileEvent) o;
73+
if (o instanceof IProfileEvent event) {
7574
if (event.getReason() == IProfileEvent.CHANGED && sameProfile(event.getProfileId())) {
7675
triggerNewUpdateNotification();
7776
}

bundles/org.eclipse.equinox.p2.ui.sdk.scheduler/src/org/eclipse/equinox/internal/p2/ui/sdk/scheduler/PreviousConfigurationFinder.java

+1-2
Original file line numberDiff line numberDiff line change
@@ -91,10 +91,9 @@ boolean isGreaterEqualTo(Identifier minimum) {
9191

9292
@Override
9393
public boolean equals(Object other) {
94-
if (!(other instanceof Identifier)) {
94+
if (!(other instanceof Identifier o)) {
9595
return false;
9696
}
97-
Identifier o = (Identifier) other;
9897
if (major == o.major && minor == o.minor && service == o.service) {
9998
return true;
10099
}

bundles/org.eclipse.equinox.p2.ui.sdk.scheduler/src/org/eclipse/equinox/internal/p2/ui/sdk/scheduler/migration/MigrationPage.java

+3-6
Original file line numberDiff line numberDiff line change
@@ -164,11 +164,9 @@ public int compare(Viewer viewer1, Object e1, Object e2) {
164164
IInstallableUnit iu1 = ProvUI.getAdapter(e1, IInstallableUnit.class);
165165
IInstallableUnit iu2 = ProvUI.getAdapter(e2, IInstallableUnit.class);
166166
if (iu1 != null && iu2 != null) {
167-
if (viewer1 instanceof TreeViewer) {
168-
TreeViewer treeViewer = (TreeViewer) viewer1;
167+
if (viewer1 instanceof TreeViewer treeViewer) {
169168
IBaseLabelProvider baseLabel = treeViewer.getLabelProvider();
170-
if (baseLabel instanceof ITableLabelProvider) {
171-
ITableLabelProvider tableProvider = (ITableLabelProvider) baseLabel;
169+
if (baseLabel instanceof ITableLabelProvider tableProvider) {
172170
String e1p = tableProvider.getColumnText(e1, getSortColumn());
173171
String e2p = tableProvider.getColumnText(e2, getSortColumn());
174172
// don't suppress this warning as it will cause build-time warning
@@ -466,8 +464,7 @@ public void controlResized(ControlEvent e) {
466464
viewer.setInput(getInput());
467465

468466
viewer.getTree().addListener(SWT.Selection, event -> {
469-
if (event.item instanceof TreeItem && event.detail == SWT.CHECK) {
470-
TreeItem treeItem = (TreeItem) event.item;
467+
if (event.item instanceof TreeItem treeItem && event.detail == SWT.CHECK) {
471468
IInstallableUnit iu = ProvUI.getAdapter(event.item.getData(), IInstallableUnit.class);
472469
if (treeItem.getChecked()) {
473470
selectedUnitsToMigrate.add(iu);

0 commit comments

Comments
 (0)