Skip to content

Commit 59fae8d

Browse files
eclipse-pde-botlaeubi
authored andcommitted
Perform clean code of ui/org.eclipse.pde.ui
1 parent 8d5c857 commit 59fae8d

File tree

8 files changed

+13
-26
lines changed

8 files changed

+13
-26
lines changed

ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/dialogs/FeatureSelectionDialog.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -134,8 +134,7 @@ private int getId(Object element) {
134134
}
135135

136136
private int compareSimilarObjects(Object o1, Object o2) {
137-
if (o1 instanceof IFeatureModel ipmb1 && o2 instanceof IFeatureModel) {
138-
IFeatureModel ipmb2 = (IFeatureModel) o2;
137+
if (o1 instanceof IFeatureModel ipmb1 && o2 instanceof IFeatureModel ipmb2) {
139138
return compareFeatures(ipmb1.getFeature(), ipmb2.getFeature());
140139
}
141140
return 0;

ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/dialogs/PluginSelectionDialog.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -105,8 +105,7 @@ private int getId(Object element) {
105105
}
106106

107107
private int compareSimilarObjects(Object o1, Object o2) {
108-
if (o1 instanceof IPluginModelBase ipmb1 && o2 instanceof IPluginModelBase) {
109-
IPluginModelBase ipmb2 = (IPluginModelBase) o2;
108+
if (o1 instanceof IPluginModelBase ipmb1 && o2 instanceof IPluginModelBase ipmb2) {
110109
return comparePlugins(ipmb1.getPluginBase(), ipmb2.getPluginBase());
111110
}
112111
return 0;

ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/editor/KeyValueSourcePage.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,7 @@ public ViewerComparator createDefaultOutlineComparator() {
3131
return new ViewerComparator() {
3232
@Override
3333
public int compare(Viewer viewer, Object e1, Object e2) {
34-
if ((e1 instanceof IDocumentKey key1) && (e2 instanceof IDocumentKey)) {
35-
IDocumentKey key2 = (IDocumentKey) e2;
34+
if ((e1 instanceof IDocumentKey key1) && (e2 instanceof IDocumentKey key2)) {
3635
return Integer.compare(key1.getOffset(), key2.getOffset());
3736
}
3837
// Bundle manifest header elements

ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/editor/contentassist/TypePackageCompletionProcessor.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -246,8 +246,7 @@ private Comparator<Object> getComparator() {
246246
fComparator = new Comparator<>() {
247247
@Override
248248
public int compare(Object arg0, Object arg1) {
249-
if (arg0 instanceof ICompletionProposal p1 && arg1 instanceof ICompletionProposal) {
250-
ICompletionProposal p2 = (ICompletionProposal) arg1;
249+
if (arg0 instanceof ICompletionProposal p1 && arg1 instanceof ICompletionProposal p2) {
251250
return getSortKey(p1).compareToIgnoreCase(getSortKey(p2));
252251
}
253252
return 0;

ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/editor/plugin/PluginInputContextManager.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -136,8 +136,7 @@ private void bundleRemoved(InputContext bundleContext) {
136136
}
137137

138138
private void transferListeners(IModel source, IModel target) {
139-
if (source instanceof IModelChangeProviderExtension smodel && target instanceof IModelChangeProviderExtension) {
140-
IModelChangeProviderExtension tmodel = (IModelChangeProviderExtension) target;
139+
if (source instanceof IModelChangeProviderExtension smodel && target instanceof IModelChangeProviderExtension tmodel) {
141140
// first fire one last event to all the listeners to
142141
// refresh
143142
smodel.fireModelChanged(new ModelChangedEvent(smodel, IModelChangedEvent.WORLD_CHANGED, null, null));

ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/preferences/PDECompilersConfigurationBlock.java

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -345,8 +345,7 @@ public static Key[] getAllKeys() {
345345
* Default selection listener for combo and check controls
346346
*/
347347
private final SelectionListener selectionlistener = widgetSelectedAdapter(e -> {
348-
if (e.widget instanceof Combo) {
349-
Combo combo = (Combo) e.widget;
348+
if (e.widget instanceof Combo combo) {
350349
ControlData data = (ControlData) combo.getData();
351350
int selectionIndex = combo.getSelectionIndex();
352351
selectionIndex = adjustIndex(selectionIndex);
@@ -366,8 +365,7 @@ public static Key[] getAllKeys() {
366365
* Default modify listener for text controls
367366
*/
368367
private final ModifyListener modifylistener = e -> {
369-
if (e.widget instanceof Text) {
370-
Text text = (Text) e.widget;
368+
if (e.widget instanceof Text text) {
371369
ControlData data = (ControlData) text.getData();
372370
data.key.setStoredValue(fLookupOrder[0], text.getText().trim(), fManager);
373371
fDirty = true;

ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/search/dialogs/FilteredPluginArtifactsSelectionDialog.java

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -764,30 +764,25 @@ private int getId(Object element) {
764764
}
765765

766766
private int compareSimilarObjects(Object o1, Object o2) {
767-
if (o1 instanceof IPluginModelBase ipmb1 && o2 instanceof IPluginModelBase) {
768-
IPluginModelBase ipmb2 = (IPluginModelBase) o2;
767+
if (o1 instanceof IPluginModelBase ipmb1 && o2 instanceof IPluginModelBase ipmb2) {
769768
return comparePlugins(ipmb1.getPluginBase(), ipmb2.getPluginBase());
770-
} else if (o1 instanceof IPluginExtensionPoint ipep1 && o2 instanceof IPluginExtensionPoint) {
771-
IPluginExtensionPoint ipep2 = (IPluginExtensionPoint) o2;
769+
} else if (o1 instanceof IPluginExtensionPoint ipep1 && o2 instanceof IPluginExtensionPoint ipep2) {
772770
return compareExtensionPoints(ipep1, ipep2);
773-
} else if (o1 instanceof IPluginExtension ipe1 && o2 instanceof IPluginExtension) {
774-
IPluginExtension ipe2 = (IPluginExtension) o2;
771+
} else if (o1 instanceof IPluginExtension ipe1 && o2 instanceof IPluginExtension ipe2) {
775772
int comparePointsResult = ipe1.getPoint().compareTo(ipe2.getPoint());
776773
if (comparePointsResult == 0) {
777774
return comparePlugins(ipe1.getPluginBase(), ipe2.getPluginBase());
778775
}
779776
// else
780777
return comparePointsResult;
781-
} else if (o1 instanceof ExportPackageDescription epd1 && o2 instanceof ExportPackageDescription) {
782-
ExportPackageDescription epd2 = (ExportPackageDescription) o2;
778+
} else if (o1 instanceof ExportPackageDescription epd1 && o2 instanceof ExportPackageDescription epd2) {
783779
int compareNamesResult = epd1.getName().compareTo(epd2.getName());
784780
if (compareNamesResult == 0) {
785781
return compareBundleDescriptions(epd1.getSupplier(), epd2.getSupplier());
786782
}
787783
// else
788784
return compareNamesResult;
789-
} else if (o1 instanceof IFeatureModel ifm1 && o2 instanceof IFeatureModel) {
790-
IFeatureModel ifm2 = (IFeatureModel) o2;
785+
} else if (o1 instanceof IFeatureModel ifm1 && o2 instanceof IFeatureModel ifm2) {
791786
return compareFeatures(ifm1, ifm2);
792787
}
793788
return 0;

ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/views/features/viewer/FeatureChildViewerFilter.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,7 @@ public class FeatureChildViewerFilter extends ViewerFilter {
2121

2222
@Override
2323
public boolean select(Viewer viewer, Object parentElement, Object element) {
24-
if (parentElement instanceof DeferredFeaturesViewInput input && element instanceof IFeatureModel) {
25-
IFeatureModel featureModel = (IFeatureModel) element;
24+
if (parentElement instanceof DeferredFeaturesViewInput input && element instanceof IFeatureModel featureModel) {
2625
boolean showProducts = input.getFeaturesViewInput().isIncludeProducts();
2726

2827
String featureId = featureModel.getFeature().getId();

0 commit comments

Comments
 (0)