Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrey Loskutov2015-04-05 09:20:41 +0000
committerAndrey Loskutov2015-04-05 09:20:41 +0000
commit05ebbc7b4891a24ca95be20f5ebf33cf9e2b8833 (patch)
tree7dbeaa14b27ae03e4f21e831bfa3855a81ebde61
parenta7a9831ec9324f493b778f2debe6366cca033fc3 (diff)
downloadeclipse.platform.ui-05ebbc7b4891a24ca95be20f5ebf33cf9e2b8833.tar.gz
eclipse.platform.ui-05ebbc7b4891a24ca95be20f5ebf33cf9e2b8833.tar.xz
eclipse.platform.ui-05ebbc7b4891a24ca95be20f5ebf33cf9e2b8833.zip
Bug 418661 - [Metadata] Get rid of compile warnings in platform projects
in official build - part 3 Cleaned up and updated to Java 7 org.eclipse.e4.ui.workbench.swt Change-Id: Ifee24bd8d9d99b90a855dc86b062be6668274077 Signed-off-by: Andrey Loskutov <loskutov@gmx.de>
-rw-r--r--bundles/org.eclipse.e4.ui.workbench.swt/.classpath2
-rw-r--r--bundles/org.eclipse.e4.ui.workbench.swt/.settings/org.eclipse.jdt.core.prefs100
-rw-r--r--bundles/org.eclipse.e4.ui.workbench.swt/META-INF/MANIFEST.MF2
-rw-r--r--bundles/org.eclipse.e4.ui.workbench.swt/build.properties3
-rw-r--r--bundles/org.eclipse.e4.ui.workbench.swt/src/org/eclipse/e4/ui/internal/workbench/swt/MenuService.java25
-rw-r--r--bundles/org.eclipse.e4.ui.workbench.swt/src/org/eclipse/e4/ui/internal/workbench/swt/PartRenderingEngine.java234
-rw-r--r--bundles/org.eclipse.e4.ui.workbench.swt/src/org/eclipse/e4/ui/internal/workbench/swt/SelectionAdapterFactory.java26
-rw-r--r--bundles/org.eclipse.e4.ui.workbench.swt/src/org/eclipse/e4/ui/internal/workbench/swt/ShellActivationListener.java4
-rw-r--r--bundles/org.eclipse.e4.ui.workbench.swt/src/org/eclipse/e4/ui/internal/workbench/swt/WorkbenchSWTActivator.java46
-rw-r--r--bundles/org.eclipse.e4.ui.workbench.swt/src/org/eclipse/e4/ui/workbench/swt/internal/copy/PatternFilter.java27
-rw-r--r--bundles/org.eclipse.e4.ui.workbench.swt/src/org/eclipse/e4/ui/workbench/swt/internal/copy/ShowViewDialog.java8
-rw-r--r--bundles/org.eclipse.e4.ui.workbench.swt/src/org/eclipse/e4/ui/workbench/swt/internal/copy/StringMatcher.java4
-rw-r--r--bundles/org.eclipse.e4.ui.workbench.swt/src/org/eclipse/e4/ui/workbench/swt/internal/copy/ViewContentProvider.java4
-rw-r--r--bundles/org.eclipse.e4.ui.workbench.swt/src/org/eclipse/e4/ui/workbench/swt/util/BindingProcessingAddon.java5
14 files changed, 284 insertions, 206 deletions
diff --git a/bundles/org.eclipse.e4.ui.workbench.swt/.classpath b/bundles/org.eclipse.e4.ui.workbench.swt/.classpath
index 4c62a8048e6..e8ea977a694 100644
--- a/bundles/org.eclipse.e4.ui.workbench.swt/.classpath
+++ b/bundles/org.eclipse.e4.ui.workbench.swt/.classpath
@@ -2,6 +2,6 @@
<classpath>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry kind="src" path="src"/>
- <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7"/>
<classpathentry kind="output" path="bin"/>
</classpath>
diff --git a/bundles/org.eclipse.e4.ui.workbench.swt/.settings/org.eclipse.jdt.core.prefs b/bundles/org.eclipse.e4.ui.workbench.swt/.settings/org.eclipse.jdt.core.prefs
index 44829992bf8..cb3755ef506 100644
--- a/bundles/org.eclipse.e4.ui.workbench.swt/.settings/org.eclipse.jdt.core.prefs
+++ b/bundles/org.eclipse.e4.ui.workbench.swt/.settings/org.eclipse.jdt.core.prefs
@@ -1,10 +1,104 @@
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.codegen.methodParameters=do not generate
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7
+org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
+org.eclipse.jdt.core.compiler.compliance=1.7
+org.eclipse.jdt.core.compiler.debug.lineNumber=generate
+org.eclipse.jdt.core.compiler.debug.localVariable=generate
+org.eclipse.jdt.core.compiler.debug.sourceFile=generate
+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.source=1.6
+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=warning
+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=warning
+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.unusedExceptionParameter=ignore
+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.7
org.eclipse.jdt.core.formatter.align_type_members_on_columns=false
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=16
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_annotation=0
diff --git a/bundles/org.eclipse.e4.ui.workbench.swt/META-INF/MANIFEST.MF b/bundles/org.eclipse.e4.ui.workbench.swt/META-INF/MANIFEST.MF
index 718eee4576a..be99e30abe4 100644
--- a/bundles/org.eclipse.e4.ui.workbench.swt/META-INF/MANIFEST.MF
+++ b/bundles/org.eclipse.e4.ui.workbench.swt/META-INF/MANIFEST.MF
@@ -36,7 +36,7 @@ Require-Bundle: org.eclipse.equinox.registry;bundle-version="[3.5.0,4.0.0)",
org.eclipse.e4.ui.model.workbench;bundle-version="1.0.0",
org.eclipse.e4.core.di.extensions
Bundle-ActivationPolicy: lazy
-Bundle-RequiredExecutionEnvironment: JavaSE-1.6
+Bundle-RequiredExecutionEnvironment: JavaSE-1.7
Export-Package: org.eclipse.e4.ui.internal.workbench.swt;x-friends:="org.eclipse.e4.ui.workbench.addons.swt,org.eclipse.e4.ui.workbench.renderers.swt,org.eclipse.ui.workbench",
org.eclipse.e4.ui.internal.workbench.swt.handlers;x-internal:=true,
org.eclipse.e4.ui.workbench.swt.factories;x-friends:="org.eclipse.e4.ui.workbench.renderers.swt,org.eclipse.ui.workbench",
diff --git a/bundles/org.eclipse.e4.ui.workbench.swt/build.properties b/bundles/org.eclipse.e4.ui.workbench.swt/build.properties
index f8d972958cd..aa6bb3f217a 100644
--- a/bundles/org.eclipse.e4.ui.workbench.swt/build.properties
+++ b/bundles/org.eclipse.e4.ui.workbench.swt/build.properties
@@ -1,5 +1,5 @@
###############################################################################
-# Copyright (c) 2010, 2011 IBM Corporation and others.
+# Copyright (c) 2010, 2015 IBM Corporation and others.
# All rights reserved. This program and the accompanying materials
# are made available under the terms of the Eclipse Public License v1.0
# which accompanies this distribution, and is available at
@@ -20,3 +20,4 @@ bin.includes = META-INF/,\
source.. = src/
src.includes = icons/,\
about.html
+jre.compilation.profile = JavaSE-1.7
diff --git a/bundles/org.eclipse.e4.ui.workbench.swt/src/org/eclipse/e4/ui/internal/workbench/swt/MenuService.java b/bundles/org.eclipse.e4.ui.workbench.swt/src/org/eclipse/e4/ui/internal/workbench/swt/MenuService.java
index 99f68537b6d..b01b57113e4 100644
--- a/bundles/org.eclipse.e4.ui.workbench.swt/src/org/eclipse/e4/ui/internal/workbench/swt/MenuService.java
+++ b/bundles/org.eclipse.e4.ui.workbench.swt/src/org/eclipse/e4/ui/internal/workbench/swt/MenuService.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2010, 2014 IBM Corporation and others.
+ * Copyright (c) 2010, 2015 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -47,19 +47,16 @@ public class MenuService implements EMenuService {
return false;
}
- public static Menu registerMenu(final Control parentControl,
- final MPopupMenu mmenu, IEclipseContext context) {
+ public static Menu registerMenu(final Control parentControl, final MPopupMenu mmenu, IEclipseContext context) {
if (mmenu.getWidget() != null) {
return (Menu) mmenu.getWidget();
}
// we need to delegate to the renderer so that it "processes" the
// MenuManager correctly
IRendererFactory rendererFactory = context.get(IRendererFactory.class);
- AbstractPartRenderer renderer = rendererFactory.getRenderer(mmenu,
- parentControl);
+ AbstractPartRenderer renderer = rendererFactory.getRenderer(mmenu, parentControl);
- IEclipseContext popupContext = context.createChild("popup:"
- + mmenu.getElementId());
+ IEclipseContext popupContext = context.createChild("popup:" + mmenu.getElementId());
mmenu.setContext(popupContext);
Object widget = renderer.createWidget(mmenu, parentControl);
if (!(widget instanceof Menu)) {
@@ -71,18 +68,20 @@ public class MenuService implements EMenuService {
// Process its internal structure through the renderer that created
// it
Object castObject = mmenu;
- renderer.processContents((MElementContainer<MUIElement>) castObject);
+ @SuppressWarnings("unchecked")
+ MElementContainer<MUIElement> container = (MElementContainer<MUIElement>) castObject;
+ renderer.processContents(container);
// Allow a final chance to set up
renderer.postProcess(mmenu);
// Now that we have a widget let the parent (if any) know
- if (mmenu.getParent() instanceof MUIElement) {
- MElementContainer<MUIElement> parentElement = mmenu.getParent();
- AbstractPartRenderer parentRenderer = rendererFactory.getRenderer(
- parentElement, null);
- if (parentRenderer != null)
+ MElementContainer<MUIElement> parentElement = mmenu.getParent();
+ if (parentElement != null) {
+ AbstractPartRenderer parentRenderer = rendererFactory.getRenderer(parentElement, null);
+ if (parentRenderer != null) {
parentRenderer.childRendered(parentElement, mmenu);
+ }
}
return (Menu) widget;
diff --git a/bundles/org.eclipse.e4.ui.workbench.swt/src/org/eclipse/e4/ui/internal/workbench/swt/PartRenderingEngine.java b/bundles/org.eclipse.e4.ui.workbench.swt/src/org/eclipse/e4/ui/internal/workbench/swt/PartRenderingEngine.java
index cb3ca79f949..16a4f944f17 100644
--- a/bundles/org.eclipse.e4.ui.workbench.swt/src/org/eclipse/e4/ui/internal/workbench/swt/PartRenderingEngine.java
+++ b/bundles/org.eclipse.e4.ui.workbench.swt/src/org/eclipse/e4/ui/internal/workbench/swt/PartRenderingEngine.java
@@ -125,8 +125,9 @@ public class PartRenderingEngine implements IPresentationEngine {
}
// menus are not handled here... ??
- if (parent instanceof MMenu)
+ if (parent instanceof MMenu) {
return;
+ }
// If the parent isn't visible we don't care (The application is
// never rendered)
@@ -150,8 +151,9 @@ public class PartRenderingEngine implements IPresentationEngine {
if (okToRender) {
// Un-maximize the element before tearing it down
- if (changedElement.getTags().contains(MAXIMIZED))
+ if (changedElement.getTags().contains(MAXIMIZED)) {
changedElement.getTags().remove(MAXIMIZED);
+ }
// Note that the 'removeGui' protocol calls 'childRemoved'
removeGui(changedElement);
@@ -173,8 +175,9 @@ public class PartRenderingEngine implements IPresentationEngine {
}
AbstractPartRenderer renderer = (AbstractPartRenderer) parent.getRenderer();
- if (renderer == null || parent instanceof MToolBar)
+ if (renderer == null || parent instanceof MToolBar) {
return;
+ }
// Re-parent the control based on the visible state
if (changedElement.isVisible()) {
@@ -189,8 +192,9 @@ public class PartRenderingEngine implements IPresentationEngine {
}
if (parent instanceof MElementContainer<?>) {
- renderer.childRendered((MElementContainer<MUIElement>) parent,
- changedElement);
+ @SuppressWarnings("unchecked")
+ MElementContainer<MUIElement> container = (MElementContainer<MUIElement>) parent;
+ renderer.childRendered(container, changedElement);
}
}
} else {
@@ -206,7 +210,9 @@ public class PartRenderingEngine implements IPresentationEngine {
}
if (parent instanceof MElementContainer<?>) {
- renderer.hideChild((MElementContainer<MUIElement>) parent, changedElement);
+ @SuppressWarnings("unchecked")
+ MElementContainer<MUIElement> container = (MElementContainer<MUIElement>) parent;
+ renderer.hideChild(container, changedElement);
}
}
}
@@ -216,24 +222,28 @@ public class PartRenderingEngine implements IPresentationEngine {
private void subscribeTrimHandler(@EventTopic(UIEvents.TrimmedWindow.TOPIC_TRIMBARS) Event event) {
Object changedObj = event.getProperty(UIEvents.EventTags.ELEMENT);
- if (!(changedObj instanceof MTrimmedWindow))
+ if (!(changedObj instanceof MTrimmedWindow)) {
return;
+ }
MTrimmedWindow window = (MTrimmedWindow) changedObj;
- if (window.getWidget() == null)
+ if (window.getWidget() == null) {
return;
+ }
if (UIEvents.isADD(event)) {
for (Object o : UIEvents.asIterable(event, UIEvents.EventTags.NEW_VALUE)) {
MUIElement added = (MUIElement) o;
- if (added.isToBeRendered())
+ if (added.isToBeRendered()) {
createGui(added, window.getWidget(), window.getContext());
+ }
}
} else if (UIEvents.isREMOVE(event)) {
for (Object o : UIEvents.asIterable(event, UIEvents.EventTags.NEW_VALUE)) {
MUIElement removed = (MUIElement) o;
- if (removed.getRenderer() != null)
+ if (removed.getRenderer() != null) {
removeGui(removed);
+ }
}
}
}
@@ -243,17 +253,20 @@ public class PartRenderingEngine implements IPresentationEngine {
private void subscribeChildrenHandler(@EventTopic(UIEvents.ElementContainer.TOPIC_CHILDREN) Event event) {
Object changedObj = event.getProperty(UIEvents.EventTags.ELEMENT);
- if (!(changedObj instanceof MElementContainer<?>))
+ if (!(changedObj instanceof MElementContainer<?>)) {
return;
+ }
+ @SuppressWarnings("unchecked")
MElementContainer<MUIElement> changedElement = (MElementContainer<MUIElement>) changedObj;
boolean isApplication = changedObj instanceof MApplication;
boolean menuChild = changedObj instanceof MMenu;
// If the parent isn't in the UI then who cares?
AbstractPartRenderer renderer = getRendererFor(changedElement);
- if ((!isApplication && renderer == null) || menuChild)
+ if ((!isApplication && renderer == null) || menuChild) {
return;
+ }
if (UIEvents.isADD(event)) {
Activator.trace(Policy.DEBUG_RENDERER, "Child Added", null); //$NON-NLS-1$
@@ -279,8 +292,9 @@ public class PartRenderingEngine implements IPresentationEngine {
}
}
} else {
- if (renderer != null && added.isToBeRendered())
+ if (renderer != null && added.isToBeRendered()) {
renderer.childRendered(changedElement, added);
+ }
}
// If the element being added is a placeholder, check to see
@@ -299,8 +313,9 @@ public class PartRenderingEngine implements IPresentationEngine {
MUIElement removed = (MUIElement) o;
// Removing invisible elements is a NO-OP as far as the
// renderer is concerned
- if (!removed.isToBeRendered())
+ if (!removed.isToBeRendered()) {
continue;
+ }
if (removed.getWidget() instanceof Control) {
Control ctrl = (Control) removed.getWidget();
@@ -310,11 +325,13 @@ public class PartRenderingEngine implements IPresentationEngine {
// Ensure that the element about to be removed is not the
// selected element
- if (changedElement.getSelectedElement() == removed)
+ if (changedElement.getSelectedElement() == removed) {
changedElement.setSelectedElement(null);
+ }
- if (renderer != null)
+ if (renderer != null) {
renderer.hideChild(changedElement, removed);
+ }
}
}
}
@@ -372,22 +389,26 @@ public class PartRenderingEngine implements IPresentationEngine {
protected void fixZOrder(MUIElement element) {
MElementContainer<MUIElement> parent = element.getParent();
if (parent == null) {
- Object container = ((EObject) element).eContainer();
- if (container instanceof MElementContainer<?>) {
- parent = (MElementContainer<MUIElement>) container;
+ Object econtainer = ((EObject) element).eContainer();
+ if (econtainer instanceof MElementContainer<?>) {
+ @SuppressWarnings("unchecked")
+ MElementContainer<MUIElement> container = (MElementContainer<MUIElement>) econtainer;
+ parent = container;
}
}
- if (parent == null || !(element.getWidget() instanceof Control))
+ if (parent == null || !(element.getWidget() instanceof Control)) {
return;
+ }
Control elementCtrl = (Control) element.getWidget();
Control prevCtrl = null;
for (MUIElement kid : parent.getChildren()) {
if (kid == element) {
- if (prevCtrl != null)
+ if (prevCtrl != null) {
elementCtrl.moveBelow(prevCtrl);
- else
+ } else {
elementCtrl.moveAbove(null);
+ }
break;
} else if (kid.getWidget() instanceof Control && kid.isVisible()) {
prevCtrl = (Control) kid.getWidget();
@@ -422,18 +443,15 @@ public class PartRenderingEngine implements IPresentationEngine {
this.appContext = context;
// initialize the correct key-binding display formatter
- KeyFormatterFactory.setDefault(SWTKeySupport
- .getKeyFormatterForPlatform());
+ KeyFormatterFactory.setDefault(SWTKeySupport.getKeyFormatterForPlatform());
// Add the renderer to the context
- context.set(IPresentationEngine.class.getName(), this);
+ context.set(IPresentationEngine.class, this);
IRendererFactory factory = null;
- IContributionFactory contribFactory = context
- .get(IContributionFactory.class);
+ IContributionFactory contribFactory = context.get(IContributionFactory.class);
try {
- factory = (IRendererFactory) contribFactory.create(factoryUrl,
- context);
+ factory = (IRendererFactory) contribFactory.create(factoryUrl, context);
} catch (Exception e) {
logger.warn(e, "Could not create rendering factory");
}
@@ -441,16 +459,14 @@ public class PartRenderingEngine implements IPresentationEngine {
// Try to load the default one
if (factory == null) {
try {
- factory = (IRendererFactory) contribFactory.create(
- defaultFactoryUrl, context);
+ factory = (IRendererFactory) contribFactory.create(defaultFactoryUrl, context);
} catch (Exception e) {
logger.error(e, "Could not create default rendering factory");
}
}
if (factory == null) {
- throw new IllegalStateException(
- "Could not create any rendering factory. Aborting ...");
+ throw new IllegalStateException("Could not create any rendering factory. Aborting ...");
}
curFactory = factory;
@@ -575,12 +591,12 @@ public class PartRenderingEngine implements IPresentationEngine {
}
// Now that we have a widget let the parent (if any) know
- if (element.getParent() instanceof MUIElement) {
- MElementContainer<MUIElement> parentElement = element
- .getParent();
+ MElementContainer<MUIElement> parentElement = element.getParent();
+ if (parentElement != null) {
AbstractPartRenderer parentRenderer = getRendererFor(parentElement);
- if (parentRenderer != null)
+ if (parentRenderer != null) {
parentRenderer.childRendered(parentElement, element);
+ }
}
return element.getWidget();
}
@@ -631,19 +647,21 @@ public class PartRenderingEngine implements IPresentationEngine {
// Process its internal structure through the renderer that created
// it
if (element instanceof MElementContainer) {
- renderer.processContents((MElementContainer<MUIElement>) element);
+ @SuppressWarnings("unchecked")
+ MElementContainer<MUIElement> container = (MElementContainer<MUIElement>) element;
+ renderer.processContents(container);
}
// Allow a final chance to set up
renderer.postProcess(element);
// Now that we have a widget let the parent (if any) know
- if (element.getParent() instanceof MUIElement) {
- MElementContainer<MUIElement> parentElement = element
- .getParent();
+ MElementContainer<MUIElement> parentElement = element.getParent();
+ if (parentElement != null) {
AbstractPartRenderer parentRenderer = getRendererFor(parentElement);
- if (parentRenderer != null)
+ if (parentRenderer != null) {
parentRenderer.childRendered(parentElement, element);
+ }
}
} else {
// failed to create the widget, dispose its context if necessary
@@ -845,6 +863,7 @@ public class PartRenderingEngine implements IPresentationEngine {
if (renderer != null) {
if (element instanceof MElementContainer<?>) {
+ @SuppressWarnings("unchecked")
MElementContainer<MUIElement> container = (MElementContainer<MUIElement>) element;
MUIElement selectedElement = container.getSelectedElement();
List<MUIElement> children = container.getChildren();
@@ -887,8 +906,7 @@ public class PartRenderingEngine implements IPresentationEngine {
IEclipseContext parentContext = renderer.getContext(element);
if (parentContext != null && client != null) {
try {
- ContextInjectionFactory.invoke(client,
- PersistState.class, parentContext, null);
+ ContextInjectionFactory.invoke(client, PersistState.class, parentContext, null);
} catch (Exception e) {
if (logger != null) {
logger.error(e);
@@ -927,7 +945,7 @@ public class PartRenderingEngine implements IPresentationEngine {
}
private void clearContext(MContext contextME) {
- MContext ctxt = (MContext) contextME;
+ MContext ctxt = contextME;
IEclipseContext lclContext = ctxt.getContext();
if (lclContext != null) {
IEclipseContext parentContext = lclContext.getParent();
@@ -959,21 +977,18 @@ public class PartRenderingEngine implements IPresentationEngine {
private AbstractPartRenderer getRenderer(MUIElement uiElement, Object parent) {
// Is there a custom renderer defined ?
- String customURI = uiElement.getPersistedState().get(
- IPresentationEngine.CUSTOM_RENDERER_KEY);
+ String customURI = uiElement.getPersistedState().get(IPresentationEngine.CUSTOM_RENDERER_KEY);
if (customURI != null) {
- if (customRendererMap.get(customURI) instanceof AbstractPartRenderer)
- return customRendererMap.get(customURI);
-
- IEclipseContext owningContext = modelService
- .getContainingContext(uiElement);
- IContributionFactory contributionFactory = (IContributionFactory) owningContext
- .get(IContributionFactory.class.getName());
- Object customRenderer = contributionFactory.create(customURI,
- owningContext);
+ AbstractPartRenderer abstractPartRenderer = customRendererMap.get(customURI);
+ if (abstractPartRenderer != null) {
+ return abstractPartRenderer;
+ }
+
+ IEclipseContext owningContext = modelService.getContainingContext(uiElement);
+ IContributionFactory contributionFactory = owningContext.get(IContributionFactory.class);
+ Object customRenderer = contributionFactory.create(customURI, owningContext);
if (customRenderer instanceof AbstractPartRenderer) {
- customRendererMap.put(customURI,
- (AbstractPartRenderer) customRenderer);
+ customRendererMap.put(customURI, (AbstractPartRenderer) customRenderer);
return (AbstractPartRenderer) customRenderer;
}
}
@@ -989,8 +1004,7 @@ public class PartRenderingEngine implements IPresentationEngine {
@Override
@Inject
@Optional
- public Object run(final MApplicationElement uiRoot,
- final IEclipseContext runContext) {
+ public Object run(final MApplicationElement uiRoot, final IEclipseContext runContext) {
final Display display;
if (runContext.get(Display.class) != null) {
display = runContext.get(Display.class);
@@ -1005,13 +1019,11 @@ public class PartRenderingEngine implements IPresentationEngine {
initializeStyling(display, runContext);
// Register an SWT resource handler
- runContext.set(IResourceUtilities.class.getName(),
- new ResourceUtility());
+ runContext.set(IResourceUtilities.class, new ResourceUtility());
// set up the keybinding manager
- KeyBindingDispatcher dispatcher = (KeyBindingDispatcher) ContextInjectionFactory
- .make(KeyBindingDispatcher.class, runContext);
- runContext.set(KeyBindingDispatcher.class.getName(), dispatcher);
+ KeyBindingDispatcher dispatcher = ContextInjectionFactory.make(KeyBindingDispatcher.class, runContext);
+ runContext.set(KeyBindingDispatcher.class, dispatcher);
keyListener = dispatcher.getKeyDownFilter();
display.addFilter(SWT.KeyDown, keyListener);
display.addFilter(SWT.Traverse, keyListener);
@@ -1030,8 +1042,7 @@ public class PartRenderingEngine implements IPresentationEngine {
theApp = null;
boolean spinOnce = true;
if (uiRoot instanceof MApplication) {
- ShellActivationListener shellDialogListener = new ShellActivationListener(
- (MApplication) uiRoot);
+ ShellActivationListener shellDialogListener = new ShellActivationListener((MApplication) uiRoot);
display.addFilter(SWT.Activate, shellDialogListener);
display.addFilter(SWT.Deactivate, shellDialogListener);
spinOnce = false; // loop until the app closes
@@ -1055,14 +1066,14 @@ public class PartRenderingEngine implements IPresentationEngine {
// System.out.println("Render: " + (endTime - startTime));
// tell the app context we are starting so the splash is
// torn down
- IApplicationContext ac = appContext
- .get(IApplicationContext.class);
+ IApplicationContext ac = appContext.get(IApplicationContext.class);
if (ac != null) {
ac.applicationRunning();
- if (eventBroker != null)
+ if (eventBroker != null) {
eventBroker.post(
UIEvents.UILifeCycle.APP_STARTUP_COMPLETE,
theApp);
+ }
}
} else if (uiRoot instanceof MUIElement) {
if (uiRoot instanceof MWindow) {
@@ -1075,22 +1086,17 @@ public class PartRenderingEngine implements IPresentationEngine {
}
// allow any early startup extensions to run
- Runnable earlyStartup = (Runnable) runContext
- .get(EARLY_STARTUP_HOOK);
+ Runnable earlyStartup = (Runnable) runContext.get(EARLY_STARTUP_HOOK);
if (earlyStartup != null) {
earlyStartup.run();
}
- TestableObject testableObject = (TestableObject) runContext
- .get(TestableObject.class.getName());
+ TestableObject testableObject = runContext.get(TestableObject.class);
if (testableObject instanceof E4Testable) {
- ((E4Testable) testableObject).init(display,
- (IWorkbench) runContext.get(IWorkbench.class
- .getName()));
+ ((E4Testable) testableObject).init(display, runContext.get(IWorkbench.class));
}
- IEventLoopAdvisor advisor = runContext.getActiveLeaf().get(
- IEventLoopAdvisor.class);
+ IEventLoopAdvisor advisor = runContext.getActiveLeaf().get(IEventLoopAdvisor.class);
if (advisor == null) {
advisor = new IEventLoopAdvisor() {
@Override
@@ -1100,11 +1106,9 @@ public class PartRenderingEngine implements IPresentationEngine {
@Override
public void eventLoopException(Throwable exception) {
- StatusReporter statusReporter = (StatusReporter) appContext
- .get(StatusReporter.class.getName());
+ StatusReporter statusReporter = appContext.get(StatusReporter.class);
if (statusReporter != null) {
- statusReporter.show(StatusReporter.ERROR,
- "Internal Error", exception);
+ statusReporter.show(StatusReporter.ERROR, "Internal Error", exception);
} else {
if (logger != null) {
logger.error(exception);
@@ -1119,8 +1123,9 @@ public class PartRenderingEngine implements IPresentationEngine {
try {
if (!display.readAndDispatch()) {
runContext.processWaiting();
- if (spinOnce)
+ if (spinOnce) {
return;
+ }
advisor.eventLoopIdle(display);
}
} catch (ThreadDeath th) {
@@ -1247,16 +1252,13 @@ public class PartRenderingEngine implements IPresentationEngine {
}
});
} else if (cssTheme != null) {
- final IThemeEngine themeEngine = createThemeEngine(display,
- appContext);
- String cssResourcesURI = (String) appContext
- .get(IWorkbench.CSS_RESOURCE_URI_ARG);
+ final IThemeEngine themeEngine = createThemeEngine(display, appContext);
+ String cssResourcesURI = (String) appContext.get(IWorkbench.CSS_RESOURCE_URI_ARG);
// Create the OSGi resource locator
if (cssResourcesURI != null) {
// TODO: Should this be set through an extension as well?
- themeEngine.registerResourceLocator(new OSGiResourceLocator(
- cssResourcesURI));
+ themeEngine.registerResourceLocator(new OSGiResourceLocator(cssResourcesURI));
}
appContext.set(IStylingEngine.SERVICE_NAME, new IStylingEngine() {
@@ -1283,8 +1285,7 @@ public class PartRenderingEngine implements IPresentationEngine {
}
@Override
- public void setClassnameAndId(Object widget, String classname,
- String id) {
+ public void setClassnameAndId(Object widget, String classname, String id) {
WidgetElement.setCSSClass((Widget) widget, classname);
WidgetElement.setID((Widget) widget, id);
themeEngine.applyStyles(widget, true);
@@ -1294,10 +1295,8 @@ public class PartRenderingEngine implements IPresentationEngine {
setCSSTheme(display, themeEngine, cssTheme);
} else if (cssURI != null) {
- String cssResourcesURI = (String) appContext
- .get(IWorkbench.CSS_RESOURCE_URI_ARG);
- final CSSSWTEngineImpl cssEngine = new CSSSWTEngineImpl(display,
- true);
+ String cssResourcesURI = (String) appContext.get(IWorkbench.CSS_RESOURCE_URI_ARG);
+ final CSSSWTEngineImpl cssEngine = new CSSSWTEngineImpl(display, true);
WidgetElement.setEngine(display, cssEngine);
if (cssResourcesURI != null) {
cssEngine.getResourcesLocatorManager().registerResourceLocator(
@@ -1325,8 +1324,7 @@ public class PartRenderingEngine implements IPresentationEngine {
@Override
public CSSStyleDeclaration getStyle(Object widget) {
- Element e = cssEngine.getCSSElementContext(widget)
- .getElement();
+ Element e = cssEngine.getCSSElementContext(widget).getElement();
if (e == null) {
return null;
}
@@ -1334,8 +1332,7 @@ public class PartRenderingEngine implements IPresentationEngine {
}
@Override
- public void setClassnameAndId(Object widget, String classname,
- String id) {
+ public void setClassnameAndId(Object widget, String classname, String id) {
WidgetElement.setCSSClass((Widget) widget, classname);
WidgetElement.setID((Widget) widget, id);
cssEngine.applyStyles(widget, true);
@@ -1380,28 +1377,25 @@ public class PartRenderingEngine implements IPresentationEngine {
}
}
- CSSRenderingUtils cssUtils = ContextInjectionFactory.make(
- CSSRenderingUtils.class, appContext);
+ CSSRenderingUtils cssUtils = ContextInjectionFactory.make(CSSRenderingUtils.class, appContext);
appContext.set(CSSRenderingUtils.class, cssUtils);
}
private static IThemeEngine createThemeEngine(Display display, IEclipseContext appContext) {
// Store the app context
- IContributionFactory contribution = (IContributionFactory) appContext
- .get(IContributionFactory.class.getName());
+ IContributionFactory contribution = appContext.get(IContributionFactory.class);
IEclipseContext cssContext = EclipseContextFactory.create();
- cssContext.set(IContributionFactory.class.getName(), contribution);
+ cssContext.set(IContributionFactory.class, contribution);
display.setData("org.eclipse.e4.ui.css.context", cssContext); //$NON-NLS-1$
IThemeManager mgr = appContext.get(IThemeManager.class);
IThemeEngine themeEngine = mgr.getEngineForDisplay(display);
- appContext.set(IThemeEngine.class.getName(), themeEngine);
+ appContext.set(IThemeEngine.class, themeEngine);
return themeEngine;
}
- private static void setCSSTheme(Display display, IThemeEngine themeEngine,
- String cssTheme) {
+ private static void setCSSTheme(Display display, IThemeEngine themeEngine, String cssTheme) {
if (display.getHighContrast()) {
themeEngine.setTheme(cssTheme, false);
} else {
@@ -1414,8 +1408,7 @@ public class PartRenderingEngine implements IPresentationEngine {
public StylingPreferencesHandler(Display display) {
if (display != null) {
- display.addListener(SWT.Dispose,
- createOnDisplayDisposedListener());
+ display.addListener(SWT.Dispose, createOnDisplayDisposedListener());
}
}
@@ -1440,34 +1433,28 @@ public class PartRenderingEngine implements IPresentationEngine {
}
}
- protected void resetOverriddenPreferences(
- IEclipsePreferences preferences) {
+ protected void resetOverriddenPreferences(IEclipsePreferences preferences) {
for (String name : getOverriddenPropertyNames(preferences)) {
preferences.remove(name);
}
removeOverriddenPropertyNames(preferences);
}
- protected void removeOverriddenPropertyNames(
- IEclipsePreferences preferences) {
+ protected void removeOverriddenPropertyNames(IEclipsePreferences preferences) {
EclipsePreferencesHelper.removeOverriddenPropertyNames(preferences);
}
- protected List<String> getOverriddenPropertyNames(
- IEclipsePreferences preferences) {
- return EclipsePreferencesHelper
- .getOverriddenPropertyNames(preferences);
+ protected List<String> getOverriddenPropertyNames(IEclipsePreferences preferences) {
+ return EclipsePreferencesHelper.getOverriddenPropertyNames(preferences);
}
protected Set<IEclipsePreferences> getPreferences() {
if (prefs == null) {
prefs = new HashSet<IEclipsePreferences>();
- BundleContext context = WorkbenchSWTActivator.getDefault()
- .getContext();
+ BundleContext context = WorkbenchSWTActivator.getDefault().getContext();
for (Bundle bundle : context.getBundles()) {
if (bundle.getSymbolicName() != null) {
- prefs.add(InstanceScope.INSTANCE.getNode(bundle
- .getSymbolicName()));
+ prefs.add(InstanceScope.INSTANCE.getNode(bundle.getSymbolicName()));
}
}
}
@@ -1483,8 +1470,7 @@ public class PartRenderingEngine implements IPresentationEngine {
}
private IThemeEngine getThemeEngine(Event event) {
- return (IThemeEngine) event
- .getProperty(IThemeEngine.Events.THEME_ENGINE);
+ return (IThemeEngine) event.getProperty(IThemeEngine.Events.THEME_ENGINE);
}
}
}
diff --git a/bundles/org.eclipse.e4.ui.workbench.swt/src/org/eclipse/e4/ui/internal/workbench/swt/SelectionAdapterFactory.java b/bundles/org.eclipse.e4.ui.workbench.swt/src/org/eclipse/e4/ui/internal/workbench/swt/SelectionAdapterFactory.java
index 066e696aa45..3805f22fe47 100644
--- a/bundles/org.eclipse.e4.ui.workbench.swt/src/org/eclipse/e4/ui/internal/workbench/swt/SelectionAdapterFactory.java
+++ b/bundles/org.eclipse.e4.ui.workbench.swt/src/org/eclipse/e4/ui/internal/workbench/swt/SelectionAdapterFactory.java
@@ -28,30 +28,32 @@ import org.eclipse.jface.viewers.IStructuredSelection;
* @since 3.3
*/
public class SelectionAdapterFactory implements IAdapterFactory {
+
private static final ICountable ICOUNT_0 = new ICountable() {
@Override
public int count() {
return 0;
}
};
+
private static final ICountable ICOUNT_1 = new ICountable() {
@Override
public int count() {
return 1;
}
};
- private static final IIterable ITERATE_EMPTY = new IIterable() {
+
+ private static final IIterable<?> ITERATE_EMPTY = new IIterable<Object>() {
@Override
- public Iterator<?> iterator() {
- return Collections.EMPTY_LIST.iterator();
+ public Iterator<Object> iterator() {
+ return Collections.emptyList().iterator();
}
};
/**
* The classes we can adapt to.
*/
- private static final Class<?>[] CLASSES = new Class[] { IIterable.class,
- ICountable.class };
+ private static final Class<?>[] CLASSES = new Class[] { IIterable.class, ICountable.class };
@Override
public <T> T getAdapter(Object adaptableObject, Class<T> adapterType) {
@@ -65,29 +67,29 @@ public class SelectionAdapterFactory implements IAdapterFactory {
return null;
}
- private Object iterable(final ISelection sel) {
+ private IIterable<?> iterable(final ISelection sel) {
if (sel.isEmpty()) {
return ITERATE_EMPTY;
}
if (sel instanceof IStructuredSelection) {
- return new IIterable() {
+ return new IIterable<Object>() {
@Override
- public Iterator<?> iterator() {
+ public Iterator<Object> iterator() {
return ((IStructuredSelection) sel).iterator();
}
};
}
- final List<?> list = Arrays.asList(new Object[] { sel });
- return new IIterable() {
+ final List<Object> list = Arrays.asList(new Object[] { sel });
+ return new IIterable<Object>() {
@Override
- public Iterator<?> iterator() {
+ public Iterator<Object> iterator() {
return list.iterator();
}
};
}
- private Object countable(final ISelection sel) {
+ private ICountable countable(final ISelection sel) {
if (sel.isEmpty()) {
return ICOUNT_0;
}
diff --git a/bundles/org.eclipse.e4.ui.workbench.swt/src/org/eclipse/e4/ui/internal/workbench/swt/ShellActivationListener.java b/bundles/org.eclipse.e4.ui.workbench.swt/src/org/eclipse/e4/ui/internal/workbench/swt/ShellActivationListener.java
index 4931824a194..16820cd33ff 100644
--- a/bundles/org.eclipse.e4.ui.workbench.swt/src/org/eclipse/e4/ui/internal/workbench/swt/ShellActivationListener.java
+++ b/bundles/org.eclipse.e4.ui.workbench.swt/src/org/eclipse/e4/ui/internal/workbench/swt/ShellActivationListener.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2010, 2014 IBM Corporation and others.
+ * Copyright (c) 2010, 2015 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -82,7 +82,7 @@ public class ShellActivationListener implements Listener {
private void processWindow(Event event, Shell shell, MWindow window) {
switch (event.type) {
case SWT.Activate:
- final IEclipseContext local = ((MWindow) window).getContext();
+ final IEclipseContext local = window.getContext();
WorkbenchSWTActivator.trace("/trace/workbench",
"setting mwindow context " + local, null);
// record this shell's context
diff --git a/bundles/org.eclipse.e4.ui.workbench.swt/src/org/eclipse/e4/ui/internal/workbench/swt/WorkbenchSWTActivator.java b/bundles/org.eclipse.e4.ui.workbench.swt/src/org/eclipse/e4/ui/internal/workbench/swt/WorkbenchSWTActivator.java
index 9b7bc4d274c..6c999771b2a 100644
--- a/bundles/org.eclipse.e4.ui.workbench.swt/src/org/eclipse/e4/ui/internal/workbench/swt/WorkbenchSWTActivator.java
+++ b/bundles/org.eclipse.e4.ui.workbench.swt/src/org/eclipse/e4/ui/internal/workbench/swt/WorkbenchSWTActivator.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2010,2014 IBM Corporation and others.
+ * Copyright (c) 2010, 2015 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -41,10 +41,10 @@ public class WorkbenchSWTActivator implements BundleActivator { // extends
public static final String PI_RENDERERS = "org.eclipse.e4.ui.workbench.swt"; //$NON-NLS-1$
private BundleContext context;
- private ServiceTracker pkgAdminTracker;
- private ServiceTracker locationTracker;
+ private ServiceTracker<?, PackageAdmin> pkgAdminTracker;
+ private ServiceTracker<?, Location> locationTracker;
private static WorkbenchSWTActivator activator;
- private ServiceTracker debugTracker;
+ private ServiceTracker<?, DebugOptions> debugTracker;
private DebugTrace trace;
@@ -80,8 +80,9 @@ public class WorkbenchSWTActivator implements BundleActivator { // extends
}
public Bundle getBundle() {
- if (context == null)
+ if (context == null) {
return null;
+ }
return context.getBundle();
}
@@ -90,13 +91,13 @@ public class WorkbenchSWTActivator implements BundleActivator { // extends
*/
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<>(context, PackageAdmin.class, null);
pkgAdminTracker.open();
}
- return (PackageAdmin) pkgAdminTracker.getService();
+ return pkgAdminTracker.getService();
}
/**
@@ -111,10 +112,10 @@ public class WorkbenchSWTActivator implements BundleActivator { // extends
// ignore this. It should never happen as we have tested the
// above format.
}
- locationTracker = new ServiceTracker(context, filter, null);
+ locationTracker = new ServiceTracker<>(context, filter, null);
locationTracker.open();
}
- return (Location) locationTracker.getService();
+ return locationTracker.getService();
}
/**
@@ -124,8 +125,9 @@ public class WorkbenchSWTActivator implements BundleActivator { // extends
*/
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) {
@@ -149,13 +151,13 @@ public class WorkbenchSWTActivator implements BundleActivator { // extends
public DebugOptions getDebugOptions() {
if (debugTracker == null) {
- if (context == null)
+ if (context == null) {
return null;
- debugTracker = new ServiceTracker(context, DebugOptions.class
- .getName(), null);
+ }
+ debugTracker = new ServiceTracker<>(context, DebugOptions.class, null);
debugTracker.open();
}
- return (DebugOptions) debugTracker.getService();
+ return debugTracker.getService();
}
public DebugTrace getTrace() {
@@ -220,8 +222,7 @@ public class WorkbenchSWTActivator implements BundleActivator { // extends
IPath dataLocation = getStateLocationOrNull();
if (dataLocation != null) {
// try r/w state area in the local file system
- String readWritePath = dataLocation.append(FN_DIALOG_SETTINGS)
- .toOSString();
+ String readWritePath = dataLocation.append(FN_DIALOG_SETTINGS).toOSString();
File settingsFile = new File(readWritePath);
if (settingsFile.exists()) {
try {
@@ -237,8 +238,7 @@ public class WorkbenchSWTActivator implements BundleActivator { // extends
// otherwise look for bundle specific dialog settings
Bundle bundle = context.getBundle();
- URL dsURL = FileLocator
- .find(bundle, new Path(FN_DIALOG_SETTINGS), null);
+ URL dsURL = FileLocator.find(bundle, new Path(FN_DIALOG_SETTINGS), null);
if (dsURL == null) {
return;
}
@@ -246,8 +246,7 @@ public class WorkbenchSWTActivator implements BundleActivator { // extends
InputStream is = null;
try {
is = dsURL.openStream();
- BufferedReader reader = new BufferedReader(new InputStreamReader(
- is, "utf-8")); //$NON-NLS-1$
+ BufferedReader reader = new BufferedReader(new InputStreamReader(is, "utf-8")); //$NON-NLS-1$
dialogSettings.load(reader);
} catch (IOException e) {
// load failed so ensure we have an empty settings
@@ -304,8 +303,7 @@ public class WorkbenchSWTActivator implements BundleActivator { // extends
// However, using it causes problems in the activation order
// So, for now, we get it directly.
try {
- return InternalPlatform.getDefault().getStateLocation(
- context.getBundle(), true);
+ return InternalPlatform.getDefault().getStateLocation(context.getBundle(), true);
} catch (IllegalStateException e) {
// This occurs if -data=@none is explicitly specified, so ignore
// this silently.
diff --git a/bundles/org.eclipse.e4.ui.workbench.swt/src/org/eclipse/e4/ui/workbench/swt/internal/copy/PatternFilter.java b/bundles/org.eclipse.e4.ui.workbench.swt/src/org/eclipse/e4/ui/workbench/swt/internal/copy/PatternFilter.java
index f87cd5f281e..a2ea942c154 100644
--- a/bundles/org.eclipse.e4.ui.workbench.swt/src/org/eclipse/e4/ui/workbench/swt/internal/copy/PatternFilter.java
+++ b/bundles/org.eclipse.e4.ui.workbench.swt/src/org/eclipse/e4/ui/workbench/swt/internal/copy/PatternFilter.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2004, 2014 IBM Corporation and others.
+ * Copyright (c) 2004, 2015 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -29,12 +29,12 @@ public class PatternFilter extends ViewerFilter {
/*
* Cache of filtered elements in the tree
*/
- private Map cache = new HashMap();
+ private Map<Object, Object[]> cache = new HashMap<>();
/*
* Maps parent elements to TRUE or FALSE
*/
- private Map foundAnyCache = new HashMap();
+ private Map<Object, Boolean> foundAnyCache = new HashMap<>();
private boolean useCache = false;
@@ -66,9 +66,9 @@ public class PatternFilter extends ViewerFilter {
return super.filter(viewer, parent, elements);
}
- Object[] filtered = (Object[]) cache.get(parent);
+ Object[] filtered = cache.get(parent);
if (filtered == null) {
- Boolean foundAny = (Boolean) foundAnyCache.get(parent);
+ Boolean foundAny = foundAnyCache.get(parent);
if (foundAny != null && !foundAny.booleanValue()) {
filtered = EMPTY;
} else {
@@ -99,14 +99,13 @@ public class PatternFilter extends ViewerFilter {
return computeAnyVisible(viewer, elements);
}
- Object[] filtered = (Object[]) cache.get(parent);
+ Object[] filtered = cache.get(parent);
if (filtered != null) {
return filtered.length > 0;
}
- Boolean foundAny = (Boolean) foundAnyCache.get(parent);
+ Boolean foundAny = foundAnyCache.get(parent);
if (foundAny == null) {
- foundAny = computeAnyVisible(viewer, elements) ? Boolean.TRUE
- : Boolean.FALSE;
+ foundAny = computeAnyVisible(viewer, elements) ? Boolean.TRUE : Boolean.FALSE;
foundAnyCache.put(parent, foundAny);
}
return foundAny.booleanValue();
@@ -132,8 +131,7 @@ public class PatternFilter extends ViewerFilter {
}
@Override
- public final boolean select(Viewer viewer, Object parentElement,
- Object element) {
+ public final boolean select(Viewer viewer, Object parentElement, Object element) {
return isElementVisible(viewer, element);
}
@@ -144,8 +142,7 @@ public class PatternFilter extends ViewerFilter {
* @param includeLeadingWildcard
* Whether a leading wildcard should be added.
*/
- public final void setIncludeLeadingWildcard(
- final boolean includeLeadingWildcard) {
+ public final void setIncludeLeadingWildcard(final boolean includeLeadingWildcard) {
this.includeLeadingWildcard = includeLeadingWildcard;
}
@@ -288,7 +285,7 @@ public class PatternFilter extends ViewerFilter {
* @return an array of words
*/
private String[] getWords(String text) {
- List words = new ArrayList();
+ List<String> words = new ArrayList<>();
// Break the text up into words, separating based on whitespace and
// common punctuation.
// Previously used String.split(..., "\\W"), where "\W" is a regular
@@ -312,7 +309,7 @@ public class PatternFilter extends ViewerFilter {
}
i = j;
}
- return (String[]) words.toArray(new String[words.size()]);
+ return words.toArray(new String[words.size()]);
}
/**
diff --git a/bundles/org.eclipse.e4.ui.workbench.swt/src/org/eclipse/e4/ui/workbench/swt/internal/copy/ShowViewDialog.java b/bundles/org.eclipse.e4.ui.workbench.swt/src/org/eclipse/e4/ui/workbench/swt/internal/copy/ShowViewDialog.java
index 841339ef2c8..ef7d65bb6c0 100644
--- a/bundles/org.eclipse.e4.ui.workbench.swt/src/org/eclipse/e4/ui/workbench/swt/internal/copy/ShowViewDialog.java
+++ b/bundles/org.eclipse.e4.ui.workbench.swt/src/org/eclipse/e4/ui/workbench/swt/internal/copy/ShowViewDialog.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2014 IBM Corporation and others.
+ * Copyright (c) 2000, 2015 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -378,12 +378,12 @@ public class ShowViewDialog extends Dialog implements
* Update the selection object.
*/
protected void updateSelection(SelectionChangedEvent event) {
- ArrayList descs = new ArrayList();
+ ArrayList<MPartDescriptor> descs = new ArrayList<>();
IStructuredSelection sel = (IStructuredSelection) event.getSelection();
- for (Iterator i = sel.iterator(); i.hasNext();) {
+ for (Iterator<?> i = sel.iterator(); i.hasNext();) {
Object o = i.next();
if (o instanceof MPartDescriptor) {
- descs.add(o);
+ descs.add((MPartDescriptor) o);
}
}
diff --git a/bundles/org.eclipse.e4.ui.workbench.swt/src/org/eclipse/e4/ui/workbench/swt/internal/copy/StringMatcher.java b/bundles/org.eclipse.e4.ui.workbench.swt/src/org/eclipse/e4/ui/workbench/swt/internal/copy/StringMatcher.java
index edffbbea5aa..53187c1cee6 100644
--- a/bundles/org.eclipse.e4.ui.workbench.swt/src/org/eclipse/e4/ui/workbench/swt/internal/copy/StringMatcher.java
+++ b/bundles/org.eclipse.e4.ui.workbench.swt/src/org/eclipse/e4/ui/workbench/swt/internal/copy/StringMatcher.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2014 IBM Corporation and others.
+ * Copyright (c) 2000, 2015 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -305,7 +305,7 @@ public class StringMatcher {
}
}
- Vector temp = new Vector();
+ Vector<String> temp = new Vector<>();
int pos = 0;
StringBuffer buf = new StringBuffer();
diff --git a/bundles/org.eclipse.e4.ui.workbench.swt/src/org/eclipse/e4/ui/workbench/swt/internal/copy/ViewContentProvider.java b/bundles/org.eclipse.e4.ui.workbench.swt/src/org/eclipse/e4/ui/workbench/swt/internal/copy/ViewContentProvider.java
index c24119cfa7a..9d5651aa7c2 100644
--- a/bundles/org.eclipse.e4.ui.workbench.swt/src/org/eclipse/e4/ui/workbench/swt/internal/copy/ViewContentProvider.java
+++ b/bundles/org.eclipse.e4.ui.workbench.swt/src/org/eclipse/e4/ui/workbench/swt/internal/copy/ViewContentProvider.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2010 IBM Corporation and others.
+ * Copyright (c) 2000, 2015 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -73,7 +73,7 @@ public class ViewContentProvider implements ITreeContentProvider {
@Override
public Object[] getChildren(Object element) {
- Object[] children = (Object[]) childMap.get(element);
+ Object[] children = childMap.get(element);
if (children == null) {
children = createChildren(element);
childMap.put(element, children);
diff --git a/bundles/org.eclipse.e4.ui.workbench.swt/src/org/eclipse/e4/ui/workbench/swt/util/BindingProcessingAddon.java b/bundles/org.eclipse.e4.ui.workbench.swt/src/org/eclipse/e4/ui/workbench/swt/util/BindingProcessingAddon.java
index 74f1ca8fcbc..6d2d6b0a62d 100644
--- a/bundles/org.eclipse.e4.ui.workbench.swt/src/org/eclipse/e4/ui/workbench/swt/util/BindingProcessingAddon.java
+++ b/bundles/org.eclipse.e4.ui.workbench.swt/src/org/eclipse/e4/ui/workbench/swt/util/BindingProcessingAddon.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2010, 2014 IBM Corporation and others.
+ * Copyright (c) 2010, 2015 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -137,7 +137,8 @@ public class BindingProcessingAddon {
}
}
if (me instanceof MElementContainer) {
- List<MUIElement> children = ((MElementContainer) me).getChildren();
+ @SuppressWarnings("unchecked")
+ List<MUIElement> children = ((MElementContainer<MUIElement>) me).getChildren();
Iterator<MUIElement> i = children.iterator();
while (i.hasNext()) {
MUIElement e = i.next();

Back to the top