Skip to content

Commit

Permalink
Remove casts unnecessary since ResourceDescriptor parameterization
Browse files Browse the repository at this point in the history
  • Loading branch information
HannesWell committed Jul 1, 2023
1 parent dd35c4f commit ed5fb60
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ static ImageDescriptor getImageDescriptor(String path) {
* @return the image
*/
Image getImage(ImageDescriptor descriptor) {
return (Image) manager.get(descriptor);
return manager.get(descriptor);
}
}

Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@
import org.eclipse.osgi.util.TextProcessor;
import org.eclipse.swt.SWT;
import org.eclipse.swt.graphics.Font;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.layout.RowLayout;
Expand Down Expand Up @@ -279,7 +278,7 @@ protected Control createDialogArea(Composite parent) {
return TextProcessor.process(d.getLabel(), "."); //$NON-NLS-1$
}, element -> {
IEditorDescriptor d = (IEditorDescriptor) element;
return (Image) resourceManager.get(d.getImageDescriptor());
return resourceManager.get(d.getImageDescriptor());
}));

browseExternalEditorsButton = new Button(contents, SWT.PUSH);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public Image getImage(Object object) {
IWorkingSet workingSet = (IWorkingSet) object;
ImageDescriptor imageDescriptor = workingSet.getImageDescriptor();

return imageDescriptor == null ? null : (Image) images.get(imageDescriptor);
return imageDescriptor == null ? null : images.get(imageDescriptor);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ public void dispose() {
@Override
public Image getImage(Object element) {
ImageDescriptor imageDescriptor = ((WorkingSetDescriptor) element).getIcon();
return imageDescriptor == null ? null : (Image) images.get(imageDescriptor);
return imageDescriptor == null ? null : images.get(imageDescriptor);
}
});
typesListViewer.setInput(descriptors);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ private Image findOrCreateImage(ImageDescriptor imageDescriptor, ResourceManager
if (imageDescriptor == null) {
return null;
}
Image image = (Image) resourceManager.find(imageDescriptor);
Image image = resourceManager.find(imageDescriptor);
if (image == null) {
try {
image = resourceManager.createImage(imageDescriptor);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ public final Image getImage(Object element) {
// add any annotations to the image descriptor
descriptor = decorateImage(descriptor, element);

return (Image) getResourceManager().get(descriptor);
return getResourceManager().get(descriptor);
}

/**
Expand Down Expand Up @@ -263,7 +263,7 @@ public Font getFont(Object element) {
return null;
}

return (Font) getResourceManager().get(FontDescriptor.createFrom(descriptor));
return getResourceManager().get(FontDescriptor.createFrom(descriptor));
}

private Color getColor(Object element, boolean forground) {
Expand All @@ -276,6 +276,6 @@ private Color getColor(Object element, boolean forground) {
return null;
}

return (Color) getResourceManager().get(ColorDescriptor.createFrom(descriptor));
return getResourceManager().get(ColorDescriptor.createFrom(descriptor));
}
}

0 comments on commit ed5fb60

Please sign in to comment.