From 56e617dc6f29901dafbc4facce8ca60c7c1c88a6 Mon Sep 17 00:00:00 2001 From: Stephan Herrmann Date: Thu, 20 Jun 2024 20:49:29 +0200 Subject: [PATCH] Remove unnecessary casts (#1311) Remove unnecessary casts and version bumps where needed. --- ds/org.eclipse.pde.ds.ui/META-INF/MANIFEST.MF | 2 +- .../contentassist/DSContentAssistProcessor.java | 4 ++-- .../eclipse/pde/internal/ds/ui/parts/ComboPart.java | 2 +- ua/org.eclipse.pde.ua.ui/META-INF/MANIFEST.MF | 2 +- .../cheatsheet/comp/CompCSMasterTreeSection.java | 2 +- .../simple/details/SimpleCSCommandComboPart.java | 5 ++--- ui/org.eclipse.pde.core/META-INF/MANIFEST.MF | 2 +- .../core/builders/ManifestErrorReporter.java | 2 +- .../pde/internal/core/schema/SchemaAttribute.java | 2 +- .../pde/ui/tests/launcher/ValidationDialogTest.java | 2 +- .../ui/compare/ManifestContentMergeViewer.java | 2 +- .../ui/compare/PluginContentMergeViewer.java | 2 +- .../ui/editor/build/BuildContentsSection.java | 2 +- .../editor/contentassist/XMLCompletionProposal.java | 8 ++++---- .../contentassist/XMLContentAssistProcessor.java | 4 ++-- .../internal/ui/editor/product/LauncherSection.java | 4 ++-- .../ui/editor/schema/NewClassCreationWizard.java | 12 ++++++------ .../internal/ui/editor/text/PluginXMLTextHover.java | 2 +- .../eclipse/pde/internal/ui/editor/text/XMLUtil.java | 4 ++-- .../org/eclipse/pde/internal/ui/parts/ComboPart.java | 2 +- .../ui/refactoring/PluginManifestChange.java | 2 +- .../pde/internal/ui/views/target/StateViewPage.java | 2 +- .../ui/wizards/imports/PluginImportOperation.java | 2 +- .../plugin/NewLibraryPluginCreationOperation.java | 2 +- .../ui/wizards/plugin/PluginContentPage.java | 2 +- 25 files changed, 38 insertions(+), 39 deletions(-) diff --git a/ds/org.eclipse.pde.ds.ui/META-INF/MANIFEST.MF b/ds/org.eclipse.pde.ds.ui/META-INF/MANIFEST.MF index 241241a983..90b7ccc3d9 100644 --- a/ds/org.eclipse.pde.ds.ui/META-INF/MANIFEST.MF +++ b/ds/org.eclipse.pde.ds.ui/META-INF/MANIFEST.MF @@ -2,7 +2,7 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: %pluginName Bundle-SymbolicName: org.eclipse.pde.ds.ui;singleton:=true -Bundle-Version: 1.3.400.qualifier +Bundle-Version: 1.3.500.qualifier Bundle-Activator: org.eclipse.pde.internal.ds.ui.Activator Require-Bundle: org.eclipse.core.runtime;bundle-version="[3.30.0,4.0.0)", org.eclipse.core.resources;bundle-version="[3.20.0,4.0.0)", diff --git a/ds/org.eclipse.pde.ds.ui/src/org/eclipse/pde/internal/ds/ui/editor/contentassist/DSContentAssistProcessor.java b/ds/org.eclipse.pde.ds.ui/src/org/eclipse/pde/internal/ds/ui/editor/contentassist/DSContentAssistProcessor.java index 04aeeb1e0f..1e36594203 100644 --- a/ds/org.eclipse.pde.ds.ui/src/org/eclipse/pde/internal/ds/ui/editor/contentassist/DSContentAssistProcessor.java +++ b/ds/org.eclipse.pde.ds.ui/src/org/eclipse/pde/internal/ds/ui/editor/contentassist/DSContentAssistProcessor.java @@ -567,10 +567,10 @@ private void assignRange(int offset) { fRange = ((IDocumentAttributeNode) fRange) .getEnclosingElement(); } else if (fRange instanceof IDocumentElementNode) { - if (((IDocumentElementNode) fRange).getOffset() == offset) + if (fRange.getOffset() == offset) fRange = ((IDocumentElementNode) fRange).getParentNode(); } else if (fRange instanceof IDocumentTextNode) { - if (((IDocumentTextNode) fRange).getOffset() == offset) + if (fRange.getOffset() == offset) fRange = ((IDocumentTextNode) fRange).getEnclosingElement(); } } diff --git a/ds/org.eclipse.pde.ds.ui/src/org/eclipse/pde/internal/ds/ui/parts/ComboPart.java b/ds/org.eclipse.pde.ds.ui/src/org/eclipse/pde/internal/ds/ui/parts/ComboPart.java index 02ab8e3396..3979cdfe2c 100644 --- a/ds/org.eclipse.pde.ds.ui/src/org/eclipse/pde/internal/ds/ui/parts/ComboPart.java +++ b/ds/org.eclipse.pde.ds.ui/src/org/eclipse/pde/internal/ds/ui/parts/ComboPart.java @@ -126,7 +126,7 @@ public void setItems(String[] items) { public void setEnabled(boolean enabled) { if (combo instanceof Combo) - ((Combo) combo).setEnabled(enabled); + combo.setEnabled(enabled); else ((CCombo) combo).setEnabled(enabled); } diff --git a/ua/org.eclipse.pde.ua.ui/META-INF/MANIFEST.MF b/ua/org.eclipse.pde.ua.ui/META-INF/MANIFEST.MF index aa9d561080..3547535f42 100644 --- a/ua/org.eclipse.pde.ua.ui/META-INF/MANIFEST.MF +++ b/ua/org.eclipse.pde.ua.ui/META-INF/MANIFEST.MF @@ -2,7 +2,7 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: %pluginName Bundle-SymbolicName: org.eclipse.pde.ua.ui;singleton:=true -Bundle-Version: 1.3.400.qualifier +Bundle-Version: 1.3.500.qualifier Bundle-Activator: org.eclipse.pde.internal.ua.ui.PDEUserAssistanceUIPlugin Require-Bundle: org.eclipse.ui;bundle-version="[3.205.0,4.0.0)", org.eclipse.core.runtime;bundle-version="[3.30.0,4.0.0)", diff --git a/ua/org.eclipse.pde.ua.ui/src/org/eclipse/pde/internal/ua/ui/editor/cheatsheet/comp/CompCSMasterTreeSection.java b/ua/org.eclipse.pde.ua.ui/src/org/eclipse/pde/internal/ua/ui/editor/cheatsheet/comp/CompCSMasterTreeSection.java index c16f4a6783..f1ff856289 100755 --- a/ua/org.eclipse.pde.ua.ui/src/org/eclipse/pde/internal/ua/ui/editor/cheatsheet/comp/CompCSMasterTreeSection.java +++ b/ua/org.eclipse.pde.ua.ui/src/org/eclipse/pde/internal/ua/ui/editor/cheatsheet/comp/CompCSMasterTreeSection.java @@ -421,7 +421,7 @@ private void handleModelEventWorldChanged(IModelChangedEvent event) { .getCurrentPage(); // Replace the current dirty model with the model reloaded from // file - fModel = ((ICompCS) object).getModel(); + fModel = object.getModel(); // Reset the treeviewer using the new model as input // TODO: MP: CompCS: This is redundant and should be deleted fTreeViewer.setInput(fModel); diff --git a/ua/org.eclipse.pde.ua.ui/src/org/eclipse/pde/internal/ua/ui/editor/cheatsheet/simple/details/SimpleCSCommandComboPart.java b/ua/org.eclipse.pde.ua.ui/src/org/eclipse/pde/internal/ua/ui/editor/cheatsheet/simple/details/SimpleCSCommandComboPart.java index f78608903f..66d9a639d1 100755 --- a/ua/org.eclipse.pde.ua.ui/src/org/eclipse/pde/internal/ua/ui/editor/cheatsheet/simple/details/SimpleCSCommandComboPart.java +++ b/ua/org.eclipse.pde.ua.ui/src/org/eclipse/pde/internal/ua/ui/editor/cheatsheet/simple/details/SimpleCSCommandComboPart.java @@ -20,7 +20,6 @@ import org.eclipse.pde.internal.ua.ui.editor.cheatsheet.simple.NewCommandKeyEvent; import org.eclipse.pde.internal.ua.ui.editor.cheatsheet.simple.SimpleCSCommandManager; import org.eclipse.pde.internal.ui.parts.ComboPart; -import org.eclipse.swt.custom.CCombo; import org.eclipse.swt.events.DisposeEvent; import org.eclipse.swt.events.DisposeListener; import org.eclipse.swt.widgets.Combo; @@ -43,9 +42,9 @@ public void addDisposeListener(DisposeListener listener) { if (combo == null) { return; } else if (combo instanceof Combo) { - ((Combo) combo).addDisposeListener(listener); + combo.addDisposeListener(listener); } else { - ((CCombo) combo).addDisposeListener(listener); + combo.addDisposeListener(listener); } } diff --git a/ui/org.eclipse.pde.core/META-INF/MANIFEST.MF b/ui/org.eclipse.pde.core/META-INF/MANIFEST.MF index 54b93a4a77..3e5a61d5fe 100644 --- a/ui/org.eclipse.pde.core/META-INF/MANIFEST.MF +++ b/ui/org.eclipse.pde.core/META-INF/MANIFEST.MF @@ -2,7 +2,7 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: %name Bundle-SymbolicName: org.eclipse.pde.core; singleton:=true -Bundle-Version: 3.18.100.qualifier +Bundle-Version: 3.18.200.qualifier Bundle-Activator: org.eclipse.pde.internal.core.PDECore Bundle-Vendor: %provider-name Bundle-Localization: plugin diff --git a/ui/org.eclipse.pde.core/src/org/eclipse/pde/internal/core/builders/ManifestErrorReporter.java b/ui/org.eclipse.pde.core/src/org/eclipse/pde/internal/core/builders/ManifestErrorReporter.java index 6ebd706293..d770ce833d 100644 --- a/ui/org.eclipse.pde.core/src/org/eclipse/pde/internal/core/builders/ManifestErrorReporter.java +++ b/ui/org.eclipse.pde.core/src/org/eclipse/pde/internal/core/builders/ManifestErrorReporter.java @@ -94,7 +94,7 @@ protected void validateElementWithContent(Element element, boolean hasContent) { for (int i = 0; i < children.getLength(); i++) { Node child = children.item(i); if (child instanceof Text) { - textFound = ((Text) child).getNodeValue().trim().length() > 0; + textFound = child.getNodeValue().trim().length() > 0; } else if (child instanceof Element) { reportIllegalElement((Element) child, CompilerFlags.ERROR); } diff --git a/ui/org.eclipse.pde.core/src/org/eclipse/pde/internal/core/schema/SchemaAttribute.java b/ui/org.eclipse.pde.core/src/org/eclipse/pde/internal/core/schema/SchemaAttribute.java index e96874caa7..7e38d68371 100644 --- a/ui/org.eclipse.pde.core/src/org/eclipse/pde/internal/core/schema/SchemaAttribute.java +++ b/ui/org.eclipse.pde.core/src/org/eclipse/pde/internal/core/schema/SchemaAttribute.java @@ -266,7 +266,7 @@ public String getDescription() { } String elementName = null; if (getParent() instanceof ISchemaElement) { - elementName = ((ISchemaElement) getParent()).getName(); + elementName = getParent().getName(); if (elementName == null) { return null; } diff --git a/ui/org.eclipse.pde.ui.tests/src/org/eclipse/pde/ui/tests/launcher/ValidationDialogTest.java b/ui/org.eclipse.pde.ui.tests/src/org/eclipse/pde/ui/tests/launcher/ValidationDialogTest.java index 294d04f377..66793a7743 100644 --- a/ui/org.eclipse.pde.ui.tests/src/org/eclipse/pde/ui/tests/launcher/ValidationDialogTest.java +++ b/ui/org.eclipse.pde.ui.tests/src/org/eclipse/pde/ui/tests/launcher/ValidationDialogTest.java @@ -61,7 +61,7 @@ private void checkEditConfigurationLink(Control[] element) { private void isEditLaunchConfigurationLinkAvilable(Control[] element, Control control) { Control editConfigLink = element[0]; - ((Link) control).notifyListeners(SWT.Selection, new Event()); + control.notifyListeners(SWT.Selection, new Event()); assertNotNull(editConfigLink.isVisible()); } } \ No newline at end of file diff --git a/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/compare/ManifestContentMergeViewer.java b/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/compare/ManifestContentMergeViewer.java index 58aef255db..cf747d2800 100644 --- a/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/compare/ManifestContentMergeViewer.java +++ b/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/compare/ManifestContentMergeViewer.java @@ -57,7 +57,7 @@ protected void configureTextViewer(TextViewer textViewer) { Font font = JFaceResources.getFont(ManifestContentMergeViewer.class.getName()); if (font != null) { - ((SourceViewer) textViewer).getTextWidget().setFont(font); + textViewer.getTextWidget().setFont(font); } } } diff --git a/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/compare/PluginContentMergeViewer.java b/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/compare/PluginContentMergeViewer.java index 9a1a3c10ec..06f5aa4aa8 100644 --- a/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/compare/PluginContentMergeViewer.java +++ b/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/compare/PluginContentMergeViewer.java @@ -69,7 +69,7 @@ protected void configureTextViewer(final TextViewer textViewer) { ((SourceViewer) textViewer).configure(configuration); Font font = JFaceResources.getFont(PluginContentMergeViewer.class.getName()); if (font != null) - ((SourceViewer) textViewer).getTextWidget().setFont(font); + textViewer.getTextWidget().setFont(font); } } diff --git a/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/editor/build/BuildContentsSection.java b/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/editor/build/BuildContentsSection.java index d0bcfa4830..ed6097c8c8 100644 --- a/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/editor/build/BuildContentsSection.java +++ b/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/editor/build/BuildContentsSection.java @@ -505,7 +505,7 @@ public boolean visit(IResourceDelta delta) throws CoreException { fDoRefresh = true; return false; } - } else if (resource instanceof IProject && ((IProject) resource).equals(project)) { + } else if (resource instanceof IProject && resource.equals(project)) { return delta.getKind() != IResourceDelta.REMOVED; } return true; diff --git a/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/editor/contentassist/XMLCompletionProposal.java b/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/editor/contentassist/XMLCompletionProposal.java index e85c9b987d..83441b3786 100644 --- a/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/editor/contentassist/XMLCompletionProposal.java +++ b/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/editor/contentassist/XMLCompletionProposal.java @@ -239,13 +239,13 @@ private void applyExtensionFullPoint(IDocument document, String delim, StringBui private void applyElement(String indent, String delim, StringBuilder documentInsertBuffer) { documentInsertBuffer.append('<'); - documentInsertBuffer.append(((ISchemaElement) fSchemaObject).getName()); + documentInsertBuffer.append(fSchemaObject.getName()); documentInsertBuffer.append('>'); documentInsertBuffer.append(delim); documentInsertBuffer.append(indent); documentInsertBuffer.append('<'); documentInsertBuffer.append('/'); - documentInsertBuffer.append(((ISchemaElement) fSchemaObject).getName()); + documentInsertBuffer.append(fSchemaObject.getName()); documentInsertBuffer.append('>'); } @@ -368,7 +368,7 @@ private void findExtensionVirtualPointValue(IPluginBase base) { return; } // Get the offset of the extension element - int targetOffset = ((IDocumentElementNode) range).getOffset(); + int targetOffset = range.getOffset(); // Search this plug-ins extensions for the proper one IPluginExtension[] extensions = base.getExtensions(); for (IPluginExtension extension : extensions) { @@ -388,7 +388,7 @@ private void findExtensionVirtualPointValue(IPluginBase base) { private void setSelectionOffsets(IDocument document, ISchemaElement schemaElement, IPluginParent pluginParent) { if (pluginParent instanceof IPluginExtension) { String point = ((IPluginExtension) pluginParent).getPoint(); - IPluginObject[] children = ((IPluginExtension) pluginParent).getChildren(); + IPluginObject[] children = pluginParent.getChildren(); if (children != null && children.length > 0 && children[0] instanceof IPluginParent) { pluginParent = (IPluginParent) children[0]; schemaElement = XMLUtil.getSchemaElement((IDocumentElementNode) pluginParent, point); diff --git a/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/editor/contentassist/XMLContentAssistProcessor.java b/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/editor/contentassist/XMLContentAssistProcessor.java index 8e4aed2ac7..ba9905c9ec 100644 --- a/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/editor/contentassist/XMLContentAssistProcessor.java +++ b/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/editor/contentassist/XMLContentAssistProcessor.java @@ -205,10 +205,10 @@ private void assignRange(int offset) { if (((IDocumentAttributeNode) fRange).getNameOffset() == offset) fRange = ((IDocumentAttributeNode) fRange).getEnclosingElement(); } else if (fRange instanceof IDocumentElementNode) { - if (((IDocumentElementNode) fRange).getOffset() == offset) + if (fRange.getOffset() == offset) fRange = ((IDocumentElementNode) fRange).getParentNode(); } else if (fRange instanceof IDocumentTextNode) { - if (((IDocumentTextNode) fRange).getOffset() == offset) + if (fRange.getOffset() == offset) fRange = ((IDocumentTextNode) fRange).getEnclosingElement(); } } diff --git a/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/editor/product/LauncherSection.java b/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/editor/product/LauncherSection.java index 9fafc8e1a6..3a5a5d6a9d 100644 --- a/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/editor/product/LauncherSection.java +++ b/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/editor/product/LauncherSection.java @@ -410,7 +410,7 @@ private IProductModel getModel() { public void commit(boolean onSave) { fNameEntry.commit(); for (int i = 0; i < fIcons.size(); i++) - ((FormEntry) fIcons.get(i)).commit(); + fIcons.get(i).commit(); super.commit(onSave); } @@ -418,7 +418,7 @@ public void commit(boolean onSave) { public void cancelEdit() { fNameEntry.cancelEdit(); for (int i = 0; i < fIcons.size(); i++) - ((FormEntry) fIcons.get(i)).commit(); + fIcons.get(i).commit(); super.cancelEdit(); } diff --git a/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/editor/schema/NewClassCreationWizard.java b/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/editor/schema/NewClassCreationWizard.java index 420c381ff8..81c2a1c62b 100644 --- a/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/editor/schema/NewClassCreationWizard.java +++ b/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/editor/schema/NewClassCreationWizard.java @@ -54,19 +54,19 @@ public void addPages() { if (fIsInterface) { ((NewInterfaceWizardPage) fMainPage).init(StructuredSelection.EMPTY); if (className != null) - ((NewInterfaceWizardPage) fMainPage).setTypeName(className, true); + fMainPage.setTypeName(className, true); if (packageRoot != null) - ((NewInterfaceWizardPage) fMainPage).setPackageFragmentRoot(packageRoot, true); + fMainPage.setPackageFragmentRoot(packageRoot, true); if (packageName != null) - ((NewInterfaceWizardPage) fMainPage).setPackageFragment(packageName, true); + fMainPage.setPackageFragment(packageName, true); } else { ((NewClassWizardPage) fMainPage).init(StructuredSelection.EMPTY); if (className != null) - ((NewClassWizardPage) fMainPage).setTypeName(className, true); + fMainPage.setTypeName(className, true); if (packageRoot != null) - ((NewClassWizardPage) fMainPage).setPackageFragmentRoot(packageRoot, true); + fMainPage.setPackageFragmentRoot(packageRoot, true); if (packageName != null) - ((NewClassWizardPage) fMainPage).setPackageFragment(packageName, true); + fMainPage.setPackageFragment(packageName, true); } } diff --git a/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/editor/text/PluginXMLTextHover.java b/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/editor/text/PluginXMLTextHover.java index 42a393291d..28422a6c9a 100644 --- a/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/editor/text/PluginXMLTextHover.java +++ b/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/editor/text/PluginXMLTextHover.java @@ -120,7 +120,7 @@ private ISchema getExtensionSchema(IPluginObject object) { private ISchemaObject getSchemaObject(ISchema schema, IPluginObject object) { if (object instanceof IPluginElement) - return schema.findElement(((IPluginElement) object).getName()); + return schema.findElement(object.getName()); if (object instanceof IPluginExtension) return schema.findElement("extension"); //$NON-NLS-1$ if (object instanceof IDocumentAttributeNode) diff --git a/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/editor/text/XMLUtil.java b/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/editor/text/XMLUtil.java index 927be76e46..393de737af 100644 --- a/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/editor/text/XMLUtil.java +++ b/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/editor/text/XMLUtil.java @@ -73,9 +73,9 @@ public static boolean withinRange(IDocumentRange range, int offset) { if (range instanceof IDocumentAttributeNode) return withinRange(((IDocumentAttributeNode) range).getValueOffset(), ((IDocumentAttributeNode) range).getValueLength(), offset); if (range instanceof IDocumentElementNode) - return withinRange(((IDocumentElementNode) range).getOffset(), ((IDocumentElementNode) range).getLength(), offset); + return withinRange(range.getOffset(), range.getLength(), offset); if (range instanceof IDocumentTextNode) - return withinRange(((IDocumentTextNode) range).getOffset(), ((IDocumentTextNode) range).getLength(), offset); + return withinRange(range.getOffset(), range.getLength(), offset); return false; } diff --git a/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/parts/ComboPart.java b/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/parts/ComboPart.java index 90db50e559..a497344c55 100644 --- a/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/parts/ComboPart.java +++ b/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/parts/ComboPart.java @@ -124,7 +124,7 @@ public void setItems(String[] items) { public void setEnabled(boolean enabled) { if (combo instanceof Combo) - ((Combo) combo).setEnabled(enabled); + combo.setEnabled(enabled); else ((CCombo) combo).setEnabled(enabled); } diff --git a/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/refactoring/PluginManifestChange.java b/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/refactoring/PluginManifestChange.java index 22b1e4ce72..a238121bb2 100644 --- a/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/refactoring/PluginManifestChange.java +++ b/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/refactoring/PluginManifestChange.java @@ -98,7 +98,7 @@ public static Change createRenameChange(IFile file, Object[] affectedElements, S if (textChange != null) { TextEdit edit = textChange.getEdit(); if (edit instanceof MultiTextEdit) { - ((MultiTextEdit) edit).addChild(multiEdit); + edit.addChild(multiEdit); multiEdit = ((MultiTextEdit) edit); } else multiEdit.addChild(edit); diff --git a/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/views/target/StateViewPage.java b/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/views/target/StateViewPage.java index 560dce0d8d..898c2177f8 100755 --- a/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/views/target/StateViewPage.java +++ b/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/views/target/StateViewPage.java @@ -367,7 +367,7 @@ private BundleDescription getBundleDescription(Object obj) { if (obj instanceof BundleSpecification) obj = ((BundleSpecification) obj).getSupplier(); else if (obj instanceof ImportPackageSpecification) - obj = ((ExportPackageDescription) ((ImportPackageSpecification) obj).getSupplier()).getSupplier(); + obj = ((ImportPackageSpecification) obj).getSupplier().getSupplier(); if (obj instanceof BundleDescription) return (BundleDescription) obj; return null; diff --git a/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/wizards/imports/PluginImportOperation.java b/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/wizards/imports/PluginImportOperation.java index 38dac850c8..03e886382e 100644 --- a/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/wizards/imports/PluginImportOperation.java +++ b/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/wizards/imports/PluginImportOperation.java @@ -382,7 +382,7 @@ private void deleteConflictingProjects(MultiStatus status, IProgressMonitor moni IResource resource = content.getAdapter(IResource.class); if (resource instanceof IProject) { // TODO For now just list everything in the map - String id = ((IProject) resource).getName(); + String id = resource.getName(); List workingSets = fProjectWorkingSets.get(id); if (workingSets == null) { workingSets = new ArrayList<>(); diff --git a/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/wizards/plugin/NewLibraryPluginCreationOperation.java b/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/wizards/plugin/NewLibraryPluginCreationOperation.java index 9dd946f985..81cc67e979 100644 --- a/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/wizards/plugin/NewLibraryPluginCreationOperation.java +++ b/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/wizards/plugin/NewLibraryPluginCreationOperation.java @@ -572,7 +572,7 @@ protected void addProjectPackages(IBundle bundle, Set ignorePkgs) { for (IResource child : children) { if (child instanceof IContainer) stack.push(child); - else if ("class".equals(((IFile) child).getFileExtension())) { //$NON-NLS-1$ + else if ("class".equals(child.getFileExtension())) { //$NON-NLS-1$ String path = folder.getProjectRelativePath().toString(); ignorePkgs.add(path.replace('/', '.')); } diff --git a/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/wizards/plugin/PluginContentPage.java b/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/wizards/plugin/PluginContentPage.java index 00eb19a1a8..3ae85a8dc0 100644 --- a/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/wizards/plugin/PluginContentPage.java +++ b/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/wizards/plugin/PluginContentPage.java @@ -344,7 +344,7 @@ else if (!wasUIPluginEnabled) { * @return if the field data is using the OSGi framework */ private boolean isPureOSGi() { - return ((PluginFieldData) fData).getOSGiFramework() != null; + return fData.getOSGiFramework() != null; } @Override