diff options
| author | Paul Webster | 2014-04-24 20:42:35 +0000 |
|---|---|---|
| committer | Paul Webster | 2014-04-24 20:42:35 +0000 |
| commit | 31d49147a2fa7c327633dbc42ab73c36577e4926 (patch) | |
| tree | eb7d726a4c90d4fa7c28d0ea0487388f85169733 | |
| parent | 30baceaba1db57c81ba9cde17eda4097973f6ac1 (diff) | |
| download | eclipse.platform.ui-31d49147a2fa7c327633dbc42ab73c36577e4926.tar.gz eclipse.platform.ui-31d49147a2fa7c327633dbc42ab73c36577e4926.tar.xz eclipse.platform.ui-31d49147a2fa7c327633dbc42ab73c36577e4926.zip | |
Bug 418661 - [Metadata] Get rid of compile warnings in official build
12 files changed, 169 insertions, 73 deletions
diff --git a/bundles/org.eclipse.e4.ui.bindings/src/org/eclipse/e4/ui/bindings/keys/OutOfOrderListener.java b/bundles/org.eclipse.e4.ui.bindings/src/org/eclipse/e4/ui/bindings/keys/OutOfOrderListener.java index 5df3aa5589e..28d3cbc10fb 100644 --- a/bundles/org.eclipse.e4.ui.bindings/src/org/eclipse/e4/ui/bindings/keys/OutOfOrderListener.java +++ b/bundles/org.eclipse.e4.ui.bindings/src/org/eclipse/e4/ui/bindings/keys/OutOfOrderListener.java @@ -11,6 +11,7 @@ package org.eclipse.e4.ui.bindings.keys; import java.util.List; +import org.eclipse.jface.bindings.keys.KeyStroke; import org.eclipse.swt.widgets.Event; import org.eclipse.swt.widgets.Listener; import org.eclipse.swt.widgets.Widget; @@ -67,7 +68,7 @@ final class OutOfOrderListener implements Listener { * If the event is still up for grabs, then re-route through the global key filter. */ if (event.doit) { - List keyStrokes = KeyBindingDispatcher.generatePossibleKeyStrokes(event); + List<KeyStroke> keyStrokes = KeyBindingDispatcher.generatePossibleKeyStrokes(event); keyboard.processKeyEvent(keyStrokes, event); } } diff --git a/bundles/org.eclipse.e4.ui.css.core/src/org/eclipse/e4/ui/css/core/utils/ClassUtils.java b/bundles/org.eclipse.e4.ui.css.core/src/org/eclipse/e4/ui/css/core/utils/ClassUtils.java index 0735a96838b..010953dec09 100644 --- a/bundles/org.eclipse.e4.ui.css.core/src/org/eclipse/e4/ui/css/core/utils/ClassUtils.java +++ b/bundles/org.eclipse.e4.ui.css.core/src/org/eclipse/e4/ui/css/core/utils/ClassUtils.java @@ -21,7 +21,7 @@ public class ClassUtils { * @param c * @return */ - public static String getSimpleName(Class c) { + public static String getSimpleName(Class<?> c) { String name = c.getName(); int index = name.lastIndexOf("."); if (index > 0) { @@ -41,7 +41,7 @@ public class ClassUtils { * @param c * @return */ - public static String getPackageName(Class c) { + public static String getPackageName(Class<?> c) { String name = c.getName(); int index = name.lastIndexOf("."); if (index > 0) { diff --git a/bundles/org.eclipse.e4.ui.css.swt.theme/src/org/eclipse/e4/ui/css/swt/internal/theme/BootstrapTheme3x.java b/bundles/org.eclipse.e4.ui.css.swt.theme/src/org/eclipse/e4/ui/css/swt/internal/theme/BootstrapTheme3x.java index 56ad1b0fcff..5197e1633cc 100644 --- a/bundles/org.eclipse.e4.ui.css.swt.theme/src/org/eclipse/e4/ui/css/swt/internal/theme/BootstrapTheme3x.java +++ b/bundles/org.eclipse.e4.ui.css.swt.theme/src/org/eclipse/e4/ui/css/swt/internal/theme/BootstrapTheme3x.java @@ -29,13 +29,13 @@ public class BootstrapTheme3x { public BootstrapTheme3x(Display display) { this(display, null); } - + public BootstrapTheme3x(Display display, String themeId) { Bundle bundle = FrameworkUtil.getBundle(BootstrapTheme3x.class); BundleContext context = bundle.getBundleContext(); - ServiceReference ref = context.getServiceReference(IThemeManager.class - .getName()); - IThemeManager mgr = (IThemeManager) context.getService(ref); + ServiceReference<IThemeManager> ref = context + .getServiceReference(IThemeManager.class); + IThemeManager mgr = context.getService(ref); final IThemeEngine engine = mgr.getEngineForDisplay(display); ITheme theme = engine.registerTheme(IThemeEngine.DEFAULT_THEME_ID, "Default Theme", "platform:/plugin/org.eclipse.e4.ui.css.swt.theme/css/dummy.css"); if( themeId == null ) { diff --git a/bundles/org.eclipse.e4.ui.css.swt/.settings/org.eclipse.jdt.core.prefs b/bundles/org.eclipse.e4.ui.css.swt/.settings/org.eclipse.jdt.core.prefs index c537b63063c..483152ef7c2 100644 --- a/bundles/org.eclipse.e4.ui.css.swt/.settings/org.eclipse.jdt.core.prefs +++ b/bundles/org.eclipse.e4.ui.css.swt/.settings/org.eclipse.jdt.core.prefs @@ -1,7 +1,95 @@ eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.annotation.inheritNullAnnotations=disabled +org.eclipse.jdt.core.compiler.annotation.missingNonNullByDefaultAnnotation=ignore +org.eclipse.jdt.core.compiler.annotation.nonnull=org.eclipse.jdt.annotation.NonNull +org.eclipse.jdt.core.compiler.annotation.nonnullbydefault=org.eclipse.jdt.annotation.NonNullByDefault +org.eclipse.jdt.core.compiler.annotation.nullable=org.eclipse.jdt.annotation.Nullable +org.eclipse.jdt.core.compiler.annotation.nullanalysis=disabled org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 org.eclipse.jdt.core.compiler.compliance=1.6 +org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=warning org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.autoboxing=ignore +org.eclipse.jdt.core.compiler.problem.comparingIdentical=warning +org.eclipse.jdt.core.compiler.problem.deadCode=warning +org.eclipse.jdt.core.compiler.problem.deprecation=warning +org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled +org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=disabled +org.eclipse.jdt.core.compiler.problem.discouragedReference=warning +org.eclipse.jdt.core.compiler.problem.emptyStatement=ignore org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.problem.explicitlyClosedAutoCloseable=ignore +org.eclipse.jdt.core.compiler.problem.fallthroughCase=ignore +org.eclipse.jdt.core.compiler.problem.fatalOptionalError=disabled +org.eclipse.jdt.core.compiler.problem.fieldHiding=ignore +org.eclipse.jdt.core.compiler.problem.finalParameterBound=warning +org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=warning +org.eclipse.jdt.core.compiler.problem.forbiddenReference=error +org.eclipse.jdt.core.compiler.problem.hiddenCatchBlock=warning +org.eclipse.jdt.core.compiler.problem.includeNullInfoFromAsserts=disabled +org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod=warning +org.eclipse.jdt.core.compiler.problem.incompleteEnumSwitch=warning +org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=ignore +org.eclipse.jdt.core.compiler.problem.localVariableHiding=ignore +org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=warning +org.eclipse.jdt.core.compiler.problem.missingDefaultCase=ignore +org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=ignore +org.eclipse.jdt.core.compiler.problem.missingEnumCaseDespiteDefault=disabled +org.eclipse.jdt.core.compiler.problem.missingHashCodeMethod=ignore +org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=ignore +org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotationForInterfaceMethodImplementation=enabled +org.eclipse.jdt.core.compiler.problem.missingSerialVersion=warning +org.eclipse.jdt.core.compiler.problem.missingSynchronizedOnInheritedMethod=ignore +org.eclipse.jdt.core.compiler.problem.noEffectAssignment=warning +org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=warning +org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=ignore +org.eclipse.jdt.core.compiler.problem.nonnullParameterAnnotationDropped=warning +org.eclipse.jdt.core.compiler.problem.nullAnnotationInferenceConflict=error +org.eclipse.jdt.core.compiler.problem.nullReference=warning +org.eclipse.jdt.core.compiler.problem.nullSpecViolation=error +org.eclipse.jdt.core.compiler.problem.nullUncheckedConversion=warning +org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=warning +org.eclipse.jdt.core.compiler.problem.parameterAssignment=ignore +org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=ignore +org.eclipse.jdt.core.compiler.problem.potentialNullReference=ignore +org.eclipse.jdt.core.compiler.problem.potentiallyUnclosedCloseable=ignore +org.eclipse.jdt.core.compiler.problem.rawTypeReference=warning +org.eclipse.jdt.core.compiler.problem.redundantNullAnnotation=warning +org.eclipse.jdt.core.compiler.problem.redundantNullCheck=ignore +org.eclipse.jdt.core.compiler.problem.redundantSpecificationOfTypeArguments=ignore +org.eclipse.jdt.core.compiler.problem.redundantSuperinterface=ignore +org.eclipse.jdt.core.compiler.problem.reportMethodCanBePotentiallyStatic=ignore +org.eclipse.jdt.core.compiler.problem.reportMethodCanBeStatic=ignore +org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled +org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=warning +org.eclipse.jdt.core.compiler.problem.suppressOptionalErrors=disabled +org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled +org.eclipse.jdt.core.compiler.problem.syntacticNullAnalysisForFields=disabled +org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=ignore +org.eclipse.jdt.core.compiler.problem.typeParameterHiding=warning +org.eclipse.jdt.core.compiler.problem.unavoidableGenericTypeProblems=disabled +org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=warning +org.eclipse.jdt.core.compiler.problem.unclosedCloseable=warning +org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=ignore +org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=warning +org.eclipse.jdt.core.compiler.problem.unnecessaryElse=ignore +org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=ignore +org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore +org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=ignore +org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionExemptExceptionAndThrowable=enabled +org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionIncludeDocCommentReference=enabled +org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=disabled +org.eclipse.jdt.core.compiler.problem.unusedImport=warning +org.eclipse.jdt.core.compiler.problem.unusedLabel=warning +org.eclipse.jdt.core.compiler.problem.unusedLocal=warning +org.eclipse.jdt.core.compiler.problem.unusedObjectAllocation=ignore +org.eclipse.jdt.core.compiler.problem.unusedParameter=ignore +org.eclipse.jdt.core.compiler.problem.unusedParameterIncludeDocCommentReference=enabled +org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=disabled +org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=disabled +org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=warning +org.eclipse.jdt.core.compiler.problem.unusedTypeParameter=ignore +org.eclipse.jdt.core.compiler.problem.unusedWarningToken=warning +org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning org.eclipse.jdt.core.compiler.source=1.6 diff --git a/bundles/org.eclipse.e4.ui.css.swt/src/org/eclipse/e4/ui/css/swt/dom/WidgetElement.java b/bundles/org.eclipse.e4.ui.css.swt/src/org/eclipse/e4/ui/css/swt/dom/WidgetElement.java index cfd19e06818..127b0345759 100644 --- a/bundles/org.eclipse.e4.ui.css.swt/src/org/eclipse/e4/ui/css/swt/dom/WidgetElement.java +++ b/bundles/org.eclipse.e4.ui.css.swt/src/org/eclipse/e4/ui/css/swt/dom/WidgetElement.java @@ -154,7 +154,7 @@ public class WidgetElement extends ElementAdapter implements NodeList { // for inner classes, the hyphen is used, e.g., for Outer$Inner, // the selector is Outer-Inner {background-color:red;} Widget widget = getWidget(); - Class clazz = widget.getClass(); + Class<?> clazz = widget.getClass(); return ClassUtils.getSimpleName(clazz); } @@ -172,7 +172,7 @@ public class WidgetElement extends ElementAdapter implements NodeList { // @namespace eclipse org.eclipse.swt.widgets.Label // ex : eclipse|Label {background-color:red;} Widget widget = getWidget(); - Class clazz = widget.getClass(); + Class<?> clazz = widget.getClass(); return ClassUtils.getPackageName(clazz); } diff --git a/bundles/org.eclipse.e4.ui.css.swt/src/org/eclipse/e4/ui/css/swt/helpers/CSSSWTColorHelper.java b/bundles/org.eclipse.e4.ui.css.swt/src/org/eclipse/e4/ui/css/swt/helpers/CSSSWTColorHelper.java index 0e78b1acca9..4adfdc076cd 100644 --- a/bundles/org.eclipse.e4.ui.css.swt/src/org/eclipse/e4/ui/css/swt/helpers/CSSSWTColorHelper.java +++ b/bundles/org.eclipse.e4.ui.css.swt/src/org/eclipse/e4/ui/css/swt/helpers/CSSSWTColorHelper.java @@ -128,9 +128,10 @@ public class CSSSWTColorHelper { */ private static Field[] getFields() { if (cachedFields == null) { - Class clazz = SWT.class; + Class<?> clazz = SWT.class; Field[] allFields = clazz.getDeclaredFields(); - ArrayList applicableFields = new ArrayList(allFields.length); + ArrayList<Field> applicableFields = new ArrayList<Field>( + allFields.length); for (Field field : allFields) { if (field.getType() == Integer.TYPE @@ -142,7 +143,7 @@ public class CSSSWTColorHelper { applicableFields.add(field); } } - cachedFields = (Field []) applicableFields.toArray(new Field [applicableFields.size()]); + cachedFields = applicableFields.toArray(new Field [applicableFields.size()]); } return cachedFields; } diff --git a/bundles/org.eclipse.e4.ui.css.swt/src/org/eclipse/e4/ui/css/swt/helpers/SWTElementHelpers.java b/bundles/org.eclipse.e4.ui.css.swt/src/org/eclipse/e4/ui/css/swt/helpers/SWTElementHelpers.java index 9cea1e0c309..481968db30f 100644 --- a/bundles/org.eclipse.e4.ui.css.swt/src/org/eclipse/e4/ui/css/swt/helpers/SWTElementHelpers.java +++ b/bundles/org.eclipse.e4.ui.css.swt/src/org/eclipse/e4/ui/css/swt/helpers/SWTElementHelpers.java @@ -13,7 +13,6 @@ package org.eclipse.e4.ui.css.swt.helpers; import java.lang.reflect.Constructor; import java.lang.reflect.InvocationTargetException; - import org.eclipse.e4.ui.css.core.dom.CSSStylableElement; import org.eclipse.e4.ui.css.core.engine.CSSEngine; import org.eclipse.e4.ui.css.swt.dom.WidgetElement; @@ -30,20 +29,20 @@ public class SWTElementHelpers { public static final String SWT_ELEMENT_KEY = "org.eclipse.e4.ui.core.css.swt.dom.SWTElement.ELEMENT"; public static final String SWT_NODELIST_KEY = "org.eclipse.e4.ui.core.css.swt.dom.SWTElement.NODELIST"; - private static final Class[] ELEMENT_CONSTRUCTOR_PARAM = { Widget.class, - CSSEngine.class }; + private static final Class<?>[] ELEMENT_CONSTRUCTOR_PARAM = { Widget.class, + CSSEngine.class }; /** * Return the w3c Element linked to the SWT widget. - * + * * @param widget * @return */ public static Element getElement(Widget widget, CSSEngine engine, - Class classElement) throws NoSuchMethodException, + Class<?> classElement) throws NoSuchMethodException, InvocationTargetException, InstantiationException, IllegalAccessException { - Constructor constructor = classElement + Constructor<?> constructor = classElement .getConstructor(ELEMENT_CONSTRUCTOR_PARAM); Object[] o = { widget, engine }; Element newElement = (Element) constructor.newInstance(o); @@ -52,7 +51,7 @@ public class SWTElementHelpers { /** * Return the w3c Element linked to the SWT widget. - * + * * @param widget * @return */ @@ -66,7 +65,7 @@ public class SWTElementHelpers { /** * Return the w3c Element linked to the SWT widget. - * + * * @param widget * @return */ @@ -81,7 +80,7 @@ public class SWTElementHelpers { /** * Return the SWT Control which is wrapped to the object * <code>element</code>. - * + * * @param element * @return */ @@ -92,8 +91,9 @@ public class SWTElementHelpers { if (element instanceof CSSStylableElement) { CSSStylableElement elt = (CSSStylableElement) element; Object widget = elt.getNativeWidget(); - if (widget instanceof Control) + if (widget instanceof Control) { return (Control) widget; + } } } return null; @@ -101,7 +101,7 @@ public class SWTElementHelpers { /** * Return the SWT Widget which is wrapped to the object <code>element</code>. - * + * * @param element * @return */ @@ -112,8 +112,9 @@ public class SWTElementHelpers { if (element instanceof CSSStylableElement) { CSSStylableElement elt = (CSSStylableElement) element; Object widget = elt.getNativeWidget(); - if (widget instanceof Widget) + if (widget instanceof Widget) { return (Widget) widget; + } } } return null; diff --git a/bundles/org.eclipse.e4.ui.css.swt/src/org/eclipse/e4/ui/css/swt/properties/GradientBackgroundListener.java b/bundles/org.eclipse.e4.ui.css.swt/src/org/eclipse/e4/ui/css/swt/properties/GradientBackgroundListener.java index eee4cab5482..6940cdc1d3c 100644 --- a/bundles/org.eclipse.e4.ui.css.swt/src/org/eclipse/e4/ui/css/swt/properties/GradientBackgroundListener.java +++ b/bundles/org.eclipse.e4.ui.css.swt/src/org/eclipse/e4/ui/css/swt/properties/GradientBackgroundListener.java @@ -47,7 +47,7 @@ public class GradientBackgroundListener implements Listener { private final Control control; private boolean radialGradient; Image gradientImage; - + private DisposeListener disposeListener = new DisposeListener() { @Override public void widgetDisposed(DisposeEvent e) { @@ -63,8 +63,8 @@ public class GradientBackgroundListener implements Listener { Class.forName("java.awt.RadialGradientPaint"); //$NON-NLS-1$ isRadialSupported = true; } catch (Exception e) { -// System.err -// .println("Warning - radial gradients are only supported in Java 6 and higher, using linear gradient instead"); //$NON-NLS-1$ + // System.err + // .println("Warning - radial gradients are only supported in Java 6 and higher, using linear gradient instead"); //$NON-NLS-1$ isRadialSupported = false; } @@ -117,24 +117,24 @@ public class GradientBackgroundListener implements Listener { if (size.x <= 0 || size.y <= 0) { return; } - + // hold onto our old image for disposal, if necessary Image oldImage = control.getBackgroundImage(); if(oldImage != gradientImage) { oldImage = null; } - + /* * Draw the new background. Radial backgrounds have to be generated * for the full size of the control's size; linear backgrounds are - * just a slice for the control's height that is then repeated. + * just a slice for the control's height that is then repeated. */ // If Java 5 or lower is used, radial gradients are not supported yet // and they will be replaced by linear gradients if (grad.isRadial() && isRadialSupported) { List<java.awt.Color> colors = new ArrayList<java.awt.Color>(); - for (Iterator iterator = grad.getRGBs().iterator(); iterator + for (Iterator<?> iterator = grad.getRGBs().iterator(); iterator .hasNext();) { RGB rgb = (RGB) iterator.next(); java.awt.Color color = new java.awt.Color(rgb.red, rgb.green, @@ -160,7 +160,7 @@ public class GradientBackgroundListener implements Listener { gradientImage = new Image(control.getDisplay(), x, y); GC gc = new GC(gradientImage); List<Color> colors = new ArrayList<Color>(); - for (Iterator iterator = grad.getRGBs().iterator(); iterator + for (Iterator<?> iterator = grad.getRGBs().iterator(); iterator .hasNext();) { RGB rgb = (RGB) iterator.next(); Color color = new Color(control.getDisplay(), rgb.red, @@ -170,9 +170,7 @@ public class GradientBackgroundListener implements Listener { fillGradient(gc, new Rectangle(0, 0, x, y), colors, CSSSWTColorHelper.getPercents(grad), grad.getVerticalGradient()); gc.dispose(); - for (Iterator<Color> iterator = colors.iterator(); iterator - .hasNext();) { - Color c = iterator.next(); + for (Color c : colors) { c.dispose(); // Dispose colors too. } } @@ -187,9 +185,9 @@ public class GradientBackgroundListener implements Listener { /* * Fills a gradient rectangle in the specified gc with the specified colors * and percentages. - * + * * @param gc @param rect @param gradientColors @param gradientPercents - * + * * @param gradientVertical */ private static void fillGradient(GC gc, Rectangle rect, @@ -242,7 +240,7 @@ public class GradientBackgroundListener implements Listener { /** * Returns a BufferedImage that renders a radial gradient. This is a * workaround since SWT does not support radial gradients yet. - * + * * @param width * image width * @param height @@ -278,7 +276,7 @@ public class GradientBackgroundListener implements Listener { int i; for (i = 0; i < classes.length; i++) { if ("java.awt.MultipleGradientPaint.CycleMethod" //$NON-NLS-1$ - .equals(classes[i].getCanonicalName())) { + .equals(classes[i].getCanonicalName())) { break; } } @@ -294,7 +292,7 @@ public class GradientBackgroundListener implements Listener { g2.setPaint((java.awt.Paint) radialGradientPaint); } catch (Exception e) { System.err - .println("Warning - radial gradients are only supported in Java 6 and higher, using flat background color instead"); //$NON-NLS-1$ + .println("Warning - radial gradients are only supported in Java 6 and higher, using flat background color instead"); //$NON-NLS-1$ g2.setColor(colorArray[0]); } @@ -305,7 +303,7 @@ public class GradientBackgroundListener implements Listener { /** * Converts a AWT BufferedImage to an SWT ImageData. This is a workaround * since SWT does not support radial gradients yet. - * + * * @param bufferedImage * the source AWT BufferedImage * @return the converted SWT ImageData diff --git a/bundles/org.eclipse.e4.ui.css.swt/src/org/eclipse/e4/ui/css/swt/properties/converters/CSSValueSWTGradientConverterImpl.java b/bundles/org.eclipse.e4.ui.css.swt/src/org/eclipse/e4/ui/css/swt/properties/converters/CSSValueSWTGradientConverterImpl.java index 3de68f1c91f..57edf6ee40c 100644 --- a/bundles/org.eclipse.e4.ui.css.swt/src/org/eclipse/e4/ui/css/swt/properties/converters/CSSValueSWTGradientConverterImpl.java +++ b/bundles/org.eclipse.e4.ui.css.swt/src/org/eclipse/e4/ui/css/swt/properties/converters/CSSValueSWTGradientConverterImpl.java @@ -11,8 +11,6 @@ *******************************************************************************/ package org.eclipse.e4.ui.css.swt.properties.converters; -import org.eclipse.swt.widgets.Display; - import java.util.List; import org.eclipse.e4.ui.css.core.dom.properties.Gradient; import org.eclipse.e4.ui.css.core.dom.properties.converters.AbstractCSSValueConverter; @@ -21,6 +19,7 @@ import org.eclipse.e4.ui.css.core.dom.properties.converters.ICSSValueConverterCo import org.eclipse.e4.ui.css.core.engine.CSSEngine; import org.eclipse.e4.ui.css.swt.helpers.CSSSWTColorHelper; import org.eclipse.swt.graphics.Color; +import org.eclipse.swt.widgets.Display; import org.w3c.dom.css.CSSPrimitiveValue; import org.w3c.dom.css.CSSValue; import org.w3c.dom.css.CSSValueList; @@ -45,10 +44,10 @@ public class CSSValueSWTGradientConverterImpl extends AbstractCSSValueConverter if (value.getCssValueType() == CSSValue.CSS_VALUE_LIST) { Display display = (context instanceof Display) ? (Display) context : null; Gradient grad = CSSSWTColorHelper.getGradient((CSSValueList) value, display); - List values = grad.getValues(); + List<?> values = grad.getValues(); for (int i = 0; i < values.size(); i++) { //Ensure all the colors are already converted and in the registry - //TODO see bug #278077 + //TODO see bug #278077 CSSPrimitiveValue prim = (CSSPrimitiveValue) values.get(i); engine.convert(prim, Color.class, context); } diff --git a/bundles/org.eclipse.e4.ui.css.swt/src/org/eclipse/e4/ui/css/swt/properties/custom/CSSPropertyTabRendererSWTHandler.java b/bundles/org.eclipse.e4.ui.css.swt/src/org/eclipse/e4/ui/css/swt/properties/custom/CSSPropertyTabRendererSWTHandler.java index 0213f53bc89..b1f518091b0 100644 --- a/bundles/org.eclipse.e4.ui.css.swt/src/org/eclipse/e4/ui/css/swt/properties/custom/CSSPropertyTabRendererSWTHandler.java +++ b/bundles/org.eclipse.e4.ui.css.swt/src/org/eclipse/e4/ui/css/swt/properties/custom/CSSPropertyTabRendererSWTHandler.java @@ -28,18 +28,20 @@ public class CSSPropertyTabRendererSWTHandler extends AbstractCSSPropertySWTHand public static final ICSSPropertyHandler INSTANCE = new CSSPropertyTabRendererSWTHandler(); private boolean backwardsCompatURIsLogged = false; - + @Override protected void applyCSSProperty(Control control, String property, CSSValue value, String pseudo, CSSEngine engine) throws Exception { - if (!(control instanceof CTabFolder)) return; + if (!(control instanceof CTabFolder)) { + return; + } if (value.getCssValueType() == CSSValue.CSS_PRIMITIVE_VALUE) { if (((CSSPrimitiveValue) value).getPrimitiveType() == CSSPrimitiveValue.CSS_URI) { String rendURL = ((CSSPrimitiveValue) value).getStringValue(); // translate old-style platform:/plugin/ class specifiers into new-style bundleclass:// URIs if (rendURL.startsWith("platform:/plugin/")) { //$NON-NLS-1$ if(!backwardsCompatURIsLogged) { - CSSActivator.getDefault().log(LogService.LOG_ERROR, + CSSActivator.getDefault().log(LogService.LOG_ERROR, "platform-style URIs deprecated for referencing types: use bundleclass://<bundlename>/<typename>"); //$NON-NLS-1$ backwardsCompatURIsLogged = true; } @@ -57,10 +59,13 @@ public class CSSPropertyTabRendererSWTHandler extends AbstractCSSPropertySWTHand try { Class<?> targetClass = bundle.loadClass(clazz); //check to see if the folder already has an instance of the same renderer - + CTabFolderRenderer renderer = ((CTabFolder) control).getRenderer(); - if (renderer != null && renderer.getClass() == targetClass) return; - Constructor constructor = targetClass.getConstructor(CTabFolder.class); + if (renderer != null && renderer.getClass() == targetClass) { + return; + } + Constructor<?> constructor = targetClass + .getConstructor(CTabFolder.class); if (constructor != null) { Object rend = constructor.newInstance(control); if (rend != null && rend instanceof CTabFolderRenderer) { @@ -71,7 +76,7 @@ public class CSSPropertyTabRendererSWTHandler extends AbstractCSSPropertySWTHand String message = "Unable to load class '" + clazz + "' from bundle '" //$NON-NLS-1$ //$NON-NLS-2$ + bundle.getBundleId() + "'"; //$NON-NLS-1$ CSSActivator.getDefault().log(LogService.LOG_ERROR, message); - } + } } } } else { @@ -79,7 +84,7 @@ public class CSSPropertyTabRendererSWTHandler extends AbstractCSSPropertySWTHand } } } - + @Override protected String retrieveCSSProperty(Control control, String property, String pseudo, CSSEngine engine) throws Exception { diff --git a/bundles/org.eclipse.e4.ui.css.swt/src/org/eclipse/e4/ui/css/swt/resources/SWTResourcesRegistry.java b/bundles/org.eclipse.e4.ui.css.swt/src/org/eclipse/e4/ui/css/swt/resources/SWTResourcesRegistry.java index 97e323c9290..0e3e623c562 100644 --- a/bundles/org.eclipse.e4.ui.css.swt/src/org/eclipse/e4/ui/css/swt/resources/SWTResourcesRegistry.java +++ b/bundles/org.eclipse.e4.ui.css.swt/src/org/eclipse/e4/ui/css/swt/resources/SWTResourcesRegistry.java @@ -139,7 +139,6 @@ public class SWTResourcesRegistry extends AbstractResourcesRegistry { return false; } - @SuppressWarnings("unchecked") public List<Object> removeResourcesByKeyTypeAndType(Class<?> keyType, Class<?>... types) { List<Object> removedResources = new ArrayList<Object>(); diff --git a/bundles/org.eclipse.e4.ui.css.swt/src/org/eclipse/e4/ui/internal/css/swt/CSSActivator.java b/bundles/org.eclipse.e4.ui.css.swt/src/org/eclipse/e4/ui/internal/css/swt/CSSActivator.java index c13011d42d3..0ed8a416965 100644 --- a/bundles/org.eclipse.e4.ui.css.swt/src/org/eclipse/e4/ui/internal/css/swt/CSSActivator.java +++ b/bundles/org.eclipse.e4.ui.css.swt/src/org/eclipse/e4/ui/internal/css/swt/CSSActivator.java @@ -4,14 +4,13 @@ * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html - * + * * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ package org.eclipse.e4.ui.internal.css.swt; import org.eclipse.e4.ui.internal.css.swt.definition.IColorAndFontProvider; - import org.osgi.framework.Bundle; import org.osgi.framework.BundleActivator; import org.osgi.framework.BundleContext; @@ -24,9 +23,9 @@ public class CSSActivator implements BundleActivator { private static CSSActivator activator; private BundleContext context; - private ServiceTracker pkgAdminTracker; - private ServiceTracker logTracker; - private ServiceTracker colorAndFontProviderTracker; + private ServiceTracker<PackageAdmin, PackageAdmin> pkgAdminTracker; + private ServiceTracker<LogService, LogService> logTracker; + private ServiceTracker<IColorAndFontProvider, IColorAndFontProvider> colorAndFontProviderTracker; public static CSSActivator getDefault() { return activator; @@ -38,12 +37,14 @@ public class CSSActivator implements BundleActivator { public PackageAdmin getBundleAdmin() { if (pkgAdminTracker == null) { - if (context == null) + if (context == null) { return null; - pkgAdminTracker = new ServiceTracker(context, PackageAdmin.class.getName(), null); + } + pkgAdminTracker = new ServiceTracker<PackageAdmin, PackageAdmin>( + context, PackageAdmin.class.getName(), null); pkgAdminTracker.open(); } - return (PackageAdmin) pkgAdminTracker.getService(); + return pkgAdminTracker.getService(); } /** @@ -53,12 +54,13 @@ public class CSSActivator implements BundleActivator { */ public Bundle getBundleForName(String bundleName) { Bundle[] bundles = getBundleAdmin().getBundles(bundleName, null); - if (bundles == null) + if (bundles == null) { return null; + } // Return the first bundle that is not installed or uninstalled - for (int i = 0; i < bundles.length; i++) { - if ((bundles[i].getState() & (Bundle.INSTALLED | Bundle.UNINSTALLED)) == 0) { - return bundles[i]; + for (Bundle bundle : bundles) { + if ((bundle.getState() & (Bundle.INSTALLED | Bundle.UNINSTALLED)) == 0) { + return bundle; } } return null; @@ -93,13 +95,14 @@ public class CSSActivator implements BundleActivator { private LogService getLogger() { if (logTracker == null) { - if (context == null) + if (context == null) { return null; - logTracker = new ServiceTracker(context, + } + logTracker = new ServiceTracker<LogService, LogService>(context, LogService.class.getName(), null); logTracker.open(); } - return (LogService) logTracker.getService(); + return logTracker.getService(); } public void log(int logError, String message) { @@ -107,18 +110,19 @@ public class CSSActivator implements BundleActivator { if (logger != null) { logger.log(logError, message); } - } - + } + public IColorAndFontProvider getColorAndFontProvider() { if (colorAndFontProviderTracker == null) { if (context == null) { return null; } - colorAndFontProviderTracker = new ServiceTracker(context, + colorAndFontProviderTracker = new ServiceTracker<IColorAndFontProvider, IColorAndFontProvider>( + context, IColorAndFontProvider.class.getName(), null); colorAndFontProviderTracker.open(); } - return (IColorAndFontProvider) colorAndFontProviderTracker.getService(); + return colorAndFontProviderTracker.getService(); } } |
