Bug 526021 - Uset the template IEclipseContext.get method.
Change-Id: Id48862e2df8bec655de6fd300c30f5d91d2d94c5
Signed-off-by: Alexander Kurtakov <akurtako@redhat.com>
diff --git a/bundles/org.eclipse.e4.ui.workbench.renderers.swt/src/org/eclipse/e4/ui/workbench/renderers/swt/HandledContributionItem.java b/bundles/org.eclipse.e4.ui.workbench.renderers.swt/src/org/eclipse/e4/ui/workbench/renderers/swt/HandledContributionItem.java
index c5eeced..f1a91f7 100644
--- a/bundles/org.eclipse.e4.ui.workbench.renderers.swt/src/org/eclipse/e4/ui/workbench/renderers/swt/HandledContributionItem.java
+++ b/bundles/org.eclipse.e4.ui.workbench.renderers.swt/src/org/eclipse/e4/ui/workbench/renderers/swt/HandledContributionItem.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2010, 2015 IBM Corporation and others.
+ * Copyright (c) 2010, 2017 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
@@ -426,7 +426,7 @@
return;
}
final IEclipseContext lclContext = getContext(getModel());
- EHandlerService service = (EHandlerService) lclContext.get(EHandlerService.class.getName());
+ EHandlerService service = lclContext.get(EHandlerService.class);
final IEclipseContext staticContext = getStaticContext(trigger);
service.executeHandler(cmd, staticContext);
}
diff --git a/bundles/org.eclipse.e4.ui.workbench.renderers.swt/src/org/eclipse/e4/ui/workbench/renderers/swt/MenuManagerRenderer.java b/bundles/org.eclipse.e4.ui.workbench.renderers.swt/src/org/eclipse/e4/ui/workbench/renderers/swt/MenuManagerRenderer.java
index e8481e7..74f3105 100644
--- a/bundles/org.eclipse.e4.ui.workbench.renderers.swt/src/org/eclipse/e4/ui/workbench/renderers/swt/MenuManagerRenderer.java
+++ b/bundles/org.eclipse.e4.ui.workbench.renderers.swt/src/org/eclipse/e4/ui/workbench/renderers/swt/MenuManagerRenderer.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009, 2016 IBM Corporation and others.
+ * Copyright (c) 2009, 2017 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
@@ -860,7 +860,7 @@
String iconURI = element.getIconURI();
if (iconURI != null && iconURI.length() > 0) {
ISWTResourceUtilities resUtils = (ISWTResourceUtilities) localContext
- .get(IResourceUtilities.class.getName());
+ .get(IResourceUtilities.class);
return resUtils.imageDescriptorFromURI(URI.createURI(iconURI));
}
return null;
diff --git a/bundles/org.eclipse.e4.ui.workbench.renderers.swt/src/org/eclipse/e4/ui/workbench/renderers/swt/PerspectiveRenderer.java b/bundles/org.eclipse.e4.ui.workbench.renderers.swt/src/org/eclipse/e4/ui/workbench/renderers/swt/PerspectiveRenderer.java
index 2f336fb..2241f5d 100644
--- a/bundles/org.eclipse.e4.ui.workbench.renderers.swt/src/org/eclipse/e4/ui/workbench/renderers/swt/PerspectiveRenderer.java
+++ b/bundles/org.eclipse.e4.ui.workbench.renderers.swt/src/org/eclipse/e4/ui/workbench/renderers/swt/PerspectiveRenderer.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009, 2016 IBM Corporation and others.
+ * Copyright (c) 2009, 2017 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
@@ -37,8 +37,7 @@
Composite perspArea = new Composite((Composite) parent, SWT.NONE);
perspArea.setLayout(new FillLayout());
- IStylingEngine stylingEngine = (IStylingEngine) getContext(element)
- .get(IStylingEngine.SERVICE_NAME);
+ IStylingEngine stylingEngine = getContext(element).get(IStylingEngine.class);
stylingEngine.setClassname(perspArea, "perspectiveLayout"); //$NON-NLS-1$
return perspArea;
@@ -48,8 +47,7 @@
public void processContents(MElementContainer<MUIElement> container) {
super.processContents(container);
- IPresentationEngine renderer = (IPresentationEngine) context
- .get(IPresentationEngine.class.getName());
+ IPresentationEngine renderer = context.get(IPresentationEngine.class);
MPerspective persp = (MPerspective) ((MUIElement) container);
Shell shell = ((Composite) persp.getWidget()).getShell();
diff --git a/bundles/org.eclipse.e4.ui.workbench.renderers.swt/src/org/eclipse/e4/ui/workbench/renderers/swt/PerspectiveStackRenderer.java b/bundles/org.eclipse.e4.ui.workbench.renderers.swt/src/org/eclipse/e4/ui/workbench/renderers/swt/PerspectiveStackRenderer.java
index 1eef82b..db60c67 100644
--- a/bundles/org.eclipse.e4.ui.workbench.renderers.swt/src/org/eclipse/e4/ui/workbench/renderers/swt/PerspectiveStackRenderer.java
+++ b/bundles/org.eclipse.e4.ui.workbench.renderers.swt/src/org/eclipse/e4/ui/workbench/renderers/swt/PerspectiveStackRenderer.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009, 2016 IBM Corporation and others.
+ * Copyright (c) 2009, 2017 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
@@ -49,7 +49,7 @@
return null;
Composite perspStack = new Composite((Composite) parent, SWT.NONE);
- IStylingEngine stylingEngine = (IStylingEngine) getContext(element).get(IStylingEngine.SERVICE_NAME);
+ IStylingEngine stylingEngine = getContext(element).get(IStylingEngine.class);
stylingEngine.setClassname(perspStack, "perspectiveLayout"); //$NON-NLS-1$
perspStack.setLayout(new StackLayout());
diff --git a/bundles/org.eclipse.e4.ui.workbench.renderers.swt/src/org/eclipse/e4/ui/workbench/renderers/swt/SWTPartRenderer.java b/bundles/org.eclipse.e4.ui.workbench.renderers.swt/src/org/eclipse/e4/ui/workbench/renderers/swt/SWTPartRenderer.java
index f1f8847..86b8d4b 100644
--- a/bundles/org.eclipse.e4.ui.workbench.renderers.swt/src/org/eclipse/e4/ui/workbench/renderers/swt/SWTPartRenderer.java
+++ b/bundles/org.eclipse.e4.ui.workbench.renderers.swt/src/org/eclipse/e4/ui/workbench/renderers/swt/SWTPartRenderer.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2008, 2015 IBM Corporation and others.
+ * Copyright (c) 2008, 2017 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
@@ -92,8 +92,7 @@
return;
}
- final IStylingEngine engine = (IStylingEngine) ctxt
- .get(IStylingEngine.SERVICE_NAME);
+ final IStylingEngine engine = ctxt.get(IStylingEngine.class);
if (engine == null)
return;
@@ -321,8 +320,7 @@
public void init(IEclipseContext context) {
super.init(context);
- resUtils = (ISWTResourceUtilities) context.get(IResourceUtilities.class
- .getName());
+ resUtils = (ISWTResourceUtilities) context.get(IResourceUtilities.class);
pinImage = getImageFromURI(pinURI);
Display.getCurrent().disposeExec(() -> {
diff --git a/bundles/org.eclipse.e4.ui.workbench.renderers.swt/src/org/eclipse/e4/ui/workbench/renderers/swt/WBWRenderer.java b/bundles/org.eclipse.e4.ui.workbench.renderers.swt/src/org/eclipse/e4/ui/workbench/renderers/swt/WBWRenderer.java
index 360ae21..931a9d5 100644
--- a/bundles/org.eclipse.e4.ui.workbench.renderers.swt/src/org/eclipse/e4/ui/workbench/renderers/swt/WBWRenderer.java
+++ b/bundles/org.eclipse.e4.ui.workbench.renderers.swt/src/org/eclipse/e4/ui/workbench/renderers/swt/WBWRenderer.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2008, 2016 IBM Corporation and others.
+ * Copyright (c) 2008, 2017 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
@@ -799,8 +799,7 @@
}
private void applyDialogStyles(Control control) {
- IStylingEngine engine = (IStylingEngine) context
- .get(IStylingEngine.SERVICE_NAME);
+ IStylingEngine engine = context.get(IStylingEngine.class);
if (engine != null) {
Shell shell = control.getShell();
if (shell.getBackgroundMode() == SWT.INHERIT_NONE) {
diff --git a/bundles/org.eclipse.e4.ui.workbench.swt/src/org/eclipse/e4/ui/internal/workbench/swt/AbstractPartRenderer.java b/bundles/org.eclipse.e4.ui.workbench.swt/src/org/eclipse/e4/ui/internal/workbench/swt/AbstractPartRenderer.java
index 79f8149..db53200 100644
--- a/bundles/org.eclipse.e4.ui.workbench.swt/src/org/eclipse/e4/ui/internal/workbench/swt/AbstractPartRenderer.java
+++ b/bundles/org.eclipse.e4.ui.workbench.swt/src/org/eclipse/e4/ui/internal/workbench/swt/AbstractPartRenderer.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009, 2015 IBM Corporation and others.
+ * Copyright (c) 2009, 2017 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
@@ -89,8 +89,7 @@
public void activate(MPart element) {
IEclipseContext curContext = getContext(element);
if (curContext != null) {
- EPartService ps = (EPartService) curContext.get(EPartService.class
- .getName());
+ EPartService ps = curContext.get(EPartService.class);
if (ps != null)
ps.activate(element, requiresFocus(element));
}
diff --git a/bundles/org.eclipse.e4.ui.workbench.swt/src/org/eclipse/e4/ui/workbench/swt/internal/copy/ViewLabelProvider.java b/bundles/org.eclipse.e4.ui.workbench.swt/src/org/eclipse/e4/ui/workbench/swt/internal/copy/ViewLabelProvider.java
index d05d3a7..2818747 100644
--- a/bundles/org.eclipse.e4.ui.workbench.swt/src/org/eclipse/e4/ui/workbench/swt/internal/copy/ViewLabelProvider.java
+++ b/bundles/org.eclipse.e4.ui.workbench.swt/src/org/eclipse/e4/ui/workbench/swt/internal/copy/ViewLabelProvider.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2015 IBM Corporation and others.
+ * Copyright (c) 2000, 2017 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
@@ -83,7 +83,7 @@
Image image = imageMap.get(iconURI);
if (image == null) {
ISWTResourceUtilities resUtils = (ISWTResourceUtilities) context
- .get(IResourceUtilities.class.getName());
+ .get(IResourceUtilities.class);
image = resUtils.imageDescriptorFromURI(
URI.createURI(iconURI)).createImage();
imageMap.put(iconURI, image);
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/PartSite.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/PartSite.java
index 7e34e36..6e5dd1a 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/PartSite.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/PartSite.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2016 IBM Corporation and others.
+ * Copyright (c) 2000, 2017 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
@@ -604,9 +604,8 @@
*
* @return WorkbenchSiteProgressService
*/
- WorkbenchSiteProgressService getSiteProgressService() {
- return (WorkbenchSiteProgressService) e4Context.get(IWorkbenchSiteProgressService.class
- .getName());
+ IWorkbenchSiteProgressService getSiteProgressService() {
+ return e4Context.get(IWorkbenchSiteProgressService.class);
}
@Override
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/Workbench.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/Workbench.java
index 6bc12fd..34db098 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/Workbench.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/Workbench.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2016 IBM Corporation and others.
+ * Copyright (c) 2000, 2017 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
@@ -1561,8 +1561,7 @@
for (MWindow window : application.getChildren()) {
IEclipseContext context = window.getContext();
if (context != null) {
- IWorkbenchWindow wwindow = (IWorkbenchWindow) context.get(IWorkbenchWindow.class
- .getName());
+ IWorkbenchWindow wwindow = context.get(IWorkbenchWindow.class);
if (wwindow != null) {
windows.add(wwindow);
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/WorkbenchWindow.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/WorkbenchWindow.java
index f36b327..39a072a 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/WorkbenchWindow.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/WorkbenchWindow.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2016 IBM Corporation and others.
+ * Copyright (c) 2000, 2017 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
@@ -633,8 +633,7 @@
windowContext.set(ISources.ACTIVE_WORKBENCH_WINDOW_NAME, this);
windowContext.set(ISources.ACTIVE_WORKBENCH_WINDOW_SHELL_NAME, getShell());
- EContextService cs = (EContextService) windowContext.get(EContextService.class
- .getName());
+ EContextService cs = windowContext.get(EContextService.class);
cs.activateContext(IContextService.CONTEXT_ID_WINDOW);
cs.getActiveContextIds();
@@ -2750,7 +2749,7 @@
@Override
public IExtensionTracker getExtensionTracker() {
- return (IExtensionTracker) model.getContext().get(IExtensionTracker.class.getName());
+ return model.getContext().get(IExtensionTracker.class);
}
/**
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/ViewLabelProvider.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/ViewLabelProvider.java
index cb56bc7..f32ab96 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/ViewLabelProvider.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/ViewLabelProvider.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2015 IBM Corporation and others.
+ * Copyright (c) 2000, 2017 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
@@ -89,7 +89,7 @@
Image image = imageMap.get(iconURI);
if (image == null) {
ISWTResourceUtilities resUtils = (ISWTResourceUtilities) context
- .get(IResourceUtilities.class.getName());
+ .get(IResourceUtilities.class);
image = resUtils.imageDescriptorFromURI(URI.createURI(iconURI)).createImage();
imageMap.put(iconURI, image);
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/cpd/CustomizePerspectiveDialog.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/cpd/CustomizePerspectiveDialog.java
index c4c9f07..3ab5d3b 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/cpd/CustomizePerspectiveDialog.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/cpd/CustomizePerspectiveDialog.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2016 IBM Corporation and others.
+ * Copyright (c) 2000, 2017 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
@@ -2182,8 +2182,7 @@
private static ParameterizedCommand generateParameterizedCommand(final MHandledItem item,
final IEclipseContext lclContext) {
- ECommandService cmdService = (ECommandService) lclContext.get(ECommandService.class
- .getName());
+ ECommandService cmdService = lclContext.get(ECommandService.class);
Map<String, Object> parameters = null;
List<MParameter> modelParms = item.getParameters();
if (modelParms != null && !modelParms.isEmpty()) {
@@ -2202,7 +2201,7 @@
String text = item.getLocalizedTooltip();
if (item instanceof MHandledItem) {
MHandledItem handledItem = (MHandledItem) item;
- EBindingService bs = (EBindingService) context.get(EBindingService.class.getName());
+ EBindingService bs = context.get(EBindingService.class);
ParameterizedCommand cmd = handledItem.getWbCommand();
if (cmd == null) {
cmd = generateParameterizedCommand(handledItem, context);
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/e4/compatibility/SelectionService.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/e4/compatibility/SelectionService.java
index 2fe7a35..362cd29 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/e4/compatibility/SelectionService.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/e4/compatibility/SelectionService.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2010, 2016 IBM Corporation and others.
+ * Copyright (c) 2010, 2017 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
@@ -350,8 +350,7 @@
@Override
public void selectionChanged(SelectionChangedEvent e) {
MPart part = page.findPart(activePart);
- ESelectionService selectionService = (ESelectionService) part.getContext().get(
- ESelectionService.class.getName());
+ ESelectionService selectionService = part.getContext().get(ESelectionService.class);
selectionService.setSelection(e.getSelection());
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/handlers/HandlerActivation.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/handlers/HandlerActivation.java
index e1867be..52e6f71 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/handlers/HandlerActivation.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/handlers/HandlerActivation.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2005, 2016 IBM Corporation and others.
+ * Copyright (c) 2005, 2017 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
@@ -167,7 +167,7 @@
@Override
public IHandlerService getHandlerService() {
- return (IHandlerService) context.get(IHandlerService.class.getName());
+ return context.get(IHandlerService.class);
}
@Override
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/handlers/LegacyHandlerService.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/handlers/LegacyHandlerService.java
index 64e6808..a875b1e 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/handlers/LegacyHandlerService.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/handlers/LegacyHandlerService.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2010, 2016 IBM Corporation and others.
+ * Copyright (c) 2010, 2017 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
@@ -157,7 +157,7 @@
private static IHandlerActivation registerLegacyHandler(final IEclipseContext context,
String id, final String cmdId, IHandler handler, Expression activeWhen, String helpContextId,
Collection<HandlerActivation> handlerActivations) {
- ECommandService cs = (ECommandService) context.get(ECommandService.class.getName());
+ ECommandService cs = context.get(ECommandService.class);
Command command = cs.getCommand(cmdId);
boolean handled = command.isHandled();
boolean enabled = command.isEnabled();
@@ -229,8 +229,7 @@
public LegacyHandlerService(IEclipseContext context) {
eclipseContext = context;
evalContext = new ExpressionContext(eclipseContext);
- IWorkbenchWindow window = (IWorkbenchWindow) eclipseContext.get(IWorkbenchWindow.class
- .getName());
+ IWorkbenchWindow window = eclipseContext.get(IWorkbenchWindow.class);
if (window != null) {
defaultExpression = new WorkbenchWindowExpression(window);
}
@@ -599,8 +598,7 @@
}
private void readHandlers() {
- IExtensionRegistry registry = (IExtensionRegistry) eclipseContext
- .get(IExtensionRegistry.class.getName());
+ IExtensionRegistry registry = eclipseContext.get(IExtensionRegistry.class);
IExtensionPoint extPoint = registry
.getExtensionPoint(IWorkbenchRegistryConstants.EXTENSION_HANDLERS);
IConfigurationElement[] elements = extPoint.getConfigurationElements();
@@ -674,8 +672,7 @@
}
private void readDefaultHandlers() {
- IExtensionRegistry registry = (IExtensionRegistry) eclipseContext
- .get(IExtensionRegistry.class.getName());
+ IExtensionRegistry registry = eclipseContext.get(IExtensionRegistry.class);
IExtensionPoint extPoint = registry
.getExtensionPoint(IWorkbenchRegistryConstants.EXTENSION_COMMANDS);
IConfigurationElement[] elements = extPoint.getConfigurationElements();
@@ -705,8 +702,7 @@
private static void setHelpContextId(IHandler handler, String helpContextId,
IEclipseContext eclipseContext) {
- ICommandHelpService commandHelpService = (ICommandHelpService) eclipseContext
- .get(ICommandHelpService.class.getName());
+ ICommandHelpService commandHelpService = eclipseContext.get(ICommandHelpService.class);
commandHelpService.setHelpContextId(handler, helpContextId);
}
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/registry/ViewDescriptor.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/registry/ViewDescriptor.java
index db472bd..fc8ef88 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/registry/ViewDescriptor.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/registry/ViewDescriptor.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2016 IBM Corporation and others.
+ * Copyright (c) 2000, 2017 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
@@ -80,13 +80,12 @@
String iconURI = descriptor.getIconURI();
if (iconURI == null) {
// If the icon attribute was omitted, use the default one
- IWorkbench workbench = (IWorkbench) application.getContext().get(
- IWorkbench.class.getName());
+ IWorkbench workbench = application.getContext().get(IWorkbench.class);
imageDescriptor = workbench.getSharedImages().getImageDescriptor(
ISharedImages.IMG_DEF_VIEW);
} else {
ISWTResourceUtilities utility = (ISWTResourceUtilities) application.getContext()
- .get(IResourceUtilities.class.getName());
+ .get(IResourceUtilities.class);
imageDescriptor = utility.imageDescriptorFromURI(URI.createURI(iconURI));
}
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/themes/WorkbenchThemeManager.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/themes/WorkbenchThemeManager.java
index 9731913..65f9a70 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/themes/WorkbenchThemeManager.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/themes/WorkbenchThemeManager.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2004, 2016 IBM Corporation and others.
+ * Copyright (c) 2004, 2017 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
@@ -366,7 +366,7 @@
if (oldTheme != null && eventBroker != null) {
eventBroker.send(UIEvents.UILifeCycle.THEME_CHANGED, null);
eventBroker.send(UIEvents.UILifeCycle.THEME_DEFINITION_CHANGED,
- context.get(MApplication.class.getName()));
+ context.get(MApplication.class));
}
}
}
@@ -389,11 +389,11 @@
}
protected IStylingEngine getStylingEngine() {
- return (IStylingEngine) getContext().get(IStylingEngine.SERVICE_NAME);
+ return getContext().get(IStylingEngine.class);
}
protected ThemeRegistry getThemeRegistry() {
- return (ThemeRegistry) getContext().get(IThemeRegistry.class.getName());
+ return (ThemeRegistry) getContext().get(IThemeRegistry.class);
}
protected FontRegistry getFontRegistry() {
@@ -405,8 +405,7 @@
}
protected void sendThemeRegistryRestyledEvent() {
- IEventBroker eventBroker = (IEventBroker) getContext()
- .get(IEventBroker.class.getName());
+ IEventBroker eventBroker = getContext().get(IEventBroker.class);
eventBroker.send(Events.THEME_REGISTRY_RESTYLED, null);
}
@@ -422,8 +421,7 @@
org.eclipse.e4.ui.css.swt.theme.ITheme theme = (org.eclipse.e4.ui.css.swt.theme.ITheme) event
.getProperty(IThemeEngine.Events.THEME);
if (theme == null) {
- IThemeEngine themeEngine = (IThemeEngine) getContext().get(
- IThemeEngine.class.getName());
+ IThemeEngine themeEngine = getContext().get(IThemeEngine.class);
theme = themeEngine != null ? themeEngine.getActiveTheme() : null;
}
return theme;
@@ -541,13 +539,12 @@
}
protected org.eclipse.e4.ui.css.swt.theme.ITheme getTheme() {
- IThemeEngine themeEngine = (IThemeEngine) getContext()
- .get(IThemeEngine.class.getName());
+ IThemeEngine themeEngine = getContext().get(IThemeEngine.class);
return themeEngine != null ? themeEngine.getActiveTheme() : null;
}
protected ThemeRegistry getThemeRegistry() {
- return (ThemeRegistry) getContext().get(IThemeRegistry.class.getName());
+ return (ThemeRegistry) getContext().get(IThemeRegistry.class);
}
protected FontRegistry getFontRegistry() {
@@ -567,8 +564,7 @@
}
protected void sendThemeDefinitionChangedEvent() {
- MApplication application = (MApplication) getContext()
- .get(MApplication.class.getName());
+ MApplication application = getContext().get(MApplication.class);
getInstance().eventBroker.send(UIEvents.UILifeCycle.THEME_DEFINITION_CHANGED,
application);
}
diff --git a/tests/org.eclipse.e4.ui.tests/src/org/eclipse/e4/ui/tests/application/EModelServiceFindTest.java b/tests/org.eclipse.e4.ui.tests/src/org/eclipse/e4/ui/tests/application/EModelServiceFindTest.java
index 394128f..60bf0882 100644
--- a/tests/org.eclipse.e4.ui.tests/src/org/eclipse/e4/ui/tests/application/EModelServiceFindTest.java
+++ b/tests/org.eclipse.e4.ui.tests/src/org/eclipse/e4/ui/tests/application/EModelServiceFindTest.java
@@ -381,8 +381,7 @@
@Test
public void testFindAddons() {
MApplication application = createApplication();
- EModelService modelService = (EModelService) application.getContext()
- .get(EModelService.class.getName());
+ EModelService modelService = application.getContext().get(EModelService.class);
assertNotNull(modelService);
MAddon addon = MApplicationFactory.INSTANCE.createAddon();
diff --git a/tests/org.eclipse.e4.ui.tests/src/org/eclipse/e4/ui/tests/application/EModelServiceInsertTest.java b/tests/org.eclipse.e4.ui.tests/src/org/eclipse/e4/ui/tests/application/EModelServiceInsertTest.java
index cf478ea..ff63be7 100644
--- a/tests/org.eclipse.e4.ui.tests/src/org/eclipse/e4/ui/tests/application/EModelServiceInsertTest.java
+++ b/tests/org.eclipse.e4.ui.tests/src/org/eclipse/e4/ui/tests/application/EModelServiceInsertTest.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009, 2015 IBM Corporation and others.
+ * Copyright (c) 2009, 2017 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
@@ -180,7 +180,7 @@
@Test
public void testInsertRightOfSharedStack() {
- EModelService modelService = (EModelService) applicationContext.get(EModelService.class.getName());
+ EModelService modelService = applicationContext.get(EModelService.class);
assertNotNull(modelService);
app = modelService.createModelElement(MApplication.class);
app.setContext(applicationContext);
diff --git a/tests/org.eclipse.e4.ui.tests/src/org/eclipse/e4/ui/tests/application/EPartServiceTest.java b/tests/org.eclipse.e4.ui.tests/src/org/eclipse/e4/ui/tests/application/EPartServiceTest.java
index 1969a90..c916d5e 100644
--- a/tests/org.eclipse.e4.ui.tests/src/org/eclipse/e4/ui/tests/application/EPartServiceTest.java
+++ b/tests/org.eclipse.e4.ui.tests/src/org/eclipse/e4/ui/tests/application/EPartServiceTest.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009, 2016 IBM Corporation and others.
+ * Copyright (c) 2009, 2017 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
@@ -1157,13 +1157,13 @@
assertEquals(windowA, application.getSelectedElement());
IEclipseContext a = application.getContext().getActiveLeaf();
- MPart aPart = (MPart) a.get(MPart.class.getName());
+ MPart aPart = a.get(MPart.class);
assertEquals(partBackA, aPart);
partServiceB.activate(partBackB);
assertEquals(windowB, application.getSelectedElement());
a = application.getContext().getActiveLeaf();
- aPart = (MPart) a.get(MPart.class.getName());
+ aPart = a.get(MPart.class);
assertEquals(partBackB, aPart);
}
diff --git a/tests/org.eclipse.e4.ui.tests/src/org/eclipse/e4/ui/tests/application/HeadlessApplicationTest.java b/tests/org.eclipse.e4.ui.tests/src/org/eclipse/e4/ui/tests/application/HeadlessApplicationTest.java
index 85aa0e2..762764e 100644
--- a/tests/org.eclipse.e4.ui.tests/src/org/eclipse/e4/ui/tests/application/HeadlessApplicationTest.java
+++ b/tests/org.eclipse.e4.ui.tests/src/org/eclipse/e4/ui/tests/application/HeadlessApplicationTest.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009, 2015 IBM Corporation and others.
+ * Copyright (c) 2009, 2017 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
@@ -233,8 +233,8 @@
protected IPresentationEngine createPresentationEngine(
String renderingEngineURI) throws Exception {
- IContributionFactory contributionFactory = (IContributionFactory) applicationContext
- .get(IContributionFactory.class.getName());
+ IContributionFactory contributionFactory = applicationContext
+ .get(IContributionFactory.class);
Object newEngine = contributionFactory.create(renderingEngineURI,
applicationContext);
return (IPresentationEngine) newEngine;
@@ -257,8 +257,7 @@
appContext.set(MApplication.class, application); // XXX
appContext.set(EModelService.class, new ModelServiceImpl(appContext));
- ECommandService cs = (ECommandService) appContext
- .get(ECommandService.class.getName());
+ ECommandService cs = appContext.get(ECommandService.class);
Category cat = cs.defineCategory(MApplication.class.getName(),
"Application Category", null); //$NON-NLS-1$
List<MCommand> commands = application.getCommands();
@@ -287,8 +286,7 @@
private void processPartContributions(IEclipseContext context,
Resource resource) {
- IExtensionRegistry registry = (IExtensionRegistry) context
- .get(IExtensionRegistry.class.getName());
+ IExtensionRegistry registry = context.get(IExtensionRegistry.class);
String extId = "org.eclipse.e4.workbench.parts"; //$NON-NLS-1$
IConfigurationElement[] parts = registry
.getConfigurationElementsFor(extId);
diff --git a/tests/org.eclipse.e4.ui.tests/src/org/eclipse/e4/ui/tests/application/UIEventsTest.java b/tests/org.eclipse.e4.ui.tests/src/org/eclipse/e4/ui/tests/application/UIEventsTest.java
index 9d1b6d4..e81eff5 100644
--- a/tests/org.eclipse.e4.ui.tests/src/org/eclipse/e4/ui/tests/application/UIEventsTest.java
+++ b/tests/org.eclipse.e4.ui.tests/src/org/eclipse/e4/ui/tests/application/UIEventsTest.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009, 2015 IBM Corporation and others.
+ * Copyright (c) 2009, 2017 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
@@ -215,8 +215,7 @@
@Test
public void testAllTopics() {
- IEventBroker eventBroker = (IEventBroker) applicationContext
- .get(IEventBroker.class.getName());
+ IEventBroker eventBroker = applicationContext.get(IEventBroker.class);
// Create a tester for each topic
AppElementTester appTester = new AppElementTester(eventBroker);
diff --git a/tests/org.eclipse.e4.ui.tests/src/org/eclipse/e4/ui/tests/workbench/ContextTest.java b/tests/org.eclipse.e4.ui.tests/src/org/eclipse/e4/ui/tests/workbench/ContextTest.java
index 41893cf..8bce586 100644
--- a/tests/org.eclipse.e4.ui.tests/src/org/eclipse/e4/ui/tests/workbench/ContextTest.java
+++ b/tests/org.eclipse.e4.ui.tests/src/org/eclipse/e4/ui/tests/workbench/ContextTest.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009, 2015 IBM Corporation and others.
+ * Copyright (c) 2009, 2017 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
@@ -50,8 +50,7 @@
defineContexts(appContext);
- EContextService cs = (EContextService) appContext
- .get(EContextService.class.getName());
+ EContextService cs = appContext.get(EContextService.class);
assertEquals(0, cs.getActiveContextIds().size());
cs.activateContext(DIALOG_AND_WINDOW_ID);
@@ -63,15 +62,13 @@
defineContexts(appContext);
- EContextService cs = (EContextService) appContext
- .get(EContextService.class.getName());
+ EContextService cs = appContext.get(EContextService.class);
assertEquals(0, cs.getActiveContextIds().size());
IEclipseContext window = appContext.createChild("windowContext");
window.activate();
- EContextService windowService = (EContextService) window
- .get(EContextService.class.getName());
+ EContextService windowService = window.get(EContextService.class);
cs.activateContext(DIALOG_AND_WINDOW_ID);
assertEquals(1, cs.getActiveContextIds().size());
@@ -87,15 +84,13 @@
defineContexts(appContext);
- EContextService cs = (EContextService) appContext
- .get(EContextService.class.getName());
+ EContextService cs = appContext.get(EContextService.class);
assertEquals(0, cs.getActiveContextIds().size());
IEclipseContext window = appContext.createChild("windowContext");
window.activate();
- EContextService windowService = (EContextService) window
- .get(EContextService.class.getName());
+ EContextService windowService = window.get(EContextService.class);
windowService.activateContext(DIALOG_AND_WINDOW_ID);
assertEquals(1, cs.getActiveContextIds().size());
@@ -120,18 +115,15 @@
defineContexts(appContext);
- EContextService cs = (EContextService) appContext
- .get(EContextService.class.getName());
+ EContextService cs = appContext.get(EContextService.class);
IEclipseContext window = appContext.createChild("windowContext");
- EContextService windowService = (EContextService) window
- .get(EContextService.class.getName());
+ EContextService windowService = window.get(EContextService.class);
IEclipseContext dialog = appContext.createChild("dialogContext");
dialog.activate();
- EContextService dialogService = (EContextService) dialog
- .get(EContextService.class.getName());
+ EContextService dialogService = dialog.get(EContextService.class);
cs.activateContext(DIALOG_AND_WINDOW_ID);
windowService.activateContext(WINDOW_ID);
@@ -181,8 +173,7 @@
}
private void defineContexts(IEclipseContext appContext) {
- EContextService cs = (EContextService) appContext
- .get(EContextService.class.getName());
+ EContextService cs = appContext.get(EContextService.class);
Context daw = cs.getContext(DIALOG_AND_WINDOW_ID);
daw.define("Dialog and Window", null, null);
Context d = cs.getContext(DIALOG_ID);
diff --git a/tests/org.eclipse.e4.ui.tests/src/org/eclipse/e4/ui/tests/workbench/HandlerTest.java b/tests/org.eclipse.e4.ui.tests/src/org/eclipse/e4/ui/tests/workbench/HandlerTest.java
index 187ed7e..6d4faf5 100644
--- a/tests/org.eclipse.e4.ui.tests/src/org/eclipse/e4/ui/tests/workbench/HandlerTest.java
+++ b/tests/org.eclipse.e4.ui.tests/src/org/eclipse/e4/ui/tests/workbench/HandlerTest.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009, 2015 IBM Corporation and others.
+ * Copyright (c) 2009, 2017 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
@@ -31,9 +31,6 @@
import org.junit.Before;
import org.junit.Test;
-/**
- *
- */
public class HandlerTest {
private static final String HELP_COMMAND_ID = "org.eclipse.ui.commands.help";
private static final String HELP_COMMAND1_ID = HELP_COMMAND_ID + "1";
@@ -81,12 +78,10 @@
HELP_COMMAND1_ID);
TestHandler handler = new TestHandler(true, HELP_COMMAND_ID);
- EHandlerService service = (EHandlerService) appContext
- .get(EHandlerService.class.getName());
+ EHandlerService service = appContext.get(EHandlerService.class);
service.activateHandler(HELP_COMMAND_ID, handler);
- ECommandService cmdService = (ECommandService) appContext
- .get(ECommandService.class.getName());
+ ECommandService cmdService = appContext.get(ECommandService.class);
Command command = cmdService.getCommand(HELP_COMMAND_ID);
assertEquals(HELP_COMMAND_ID, command.getId());
assertEquals(HELP_COMMAND_ID, service.executeHandler(helpCommand));
@@ -102,8 +97,7 @@
final ParameterizedCommand help1Command = getCommand(appContext,
HELP_COMMAND1_ID);
- EHandlerService service = (EHandlerService) appContext
- .get(EHandlerService.class.getName());
+ EHandlerService service = appContext.get(EHandlerService.class);
TestHandler handler = new TestHandler(true, HELP_COMMAND_ID);
service.activateHandler(HELP_COMMAND_ID, handler);
TestHandler handler1 = new TestHandler(false, HELP_COMMAND1_ID);
@@ -123,15 +117,13 @@
ParameterizedCommand helpCommand = getCommand(appContext,
HELP_COMMAND_ID);
- EHandlerService service = (EHandlerService) appContext
- .get(EHandlerService.class.getName());
+ EHandlerService service = appContext.get(EHandlerService.class);
TestHandler handler = new TestHandler(true, HELP_COMMAND_ID);
service.activateHandler(HELP_COMMAND_ID, handler);
IEclipseContext window = appContext.createChild("windowContext");
window.activate();
- EHandlerService windowService = (EHandlerService) window
- .get(EHandlerService.class.getName());
+ EHandlerService windowService = window.get(EHandlerService.class);
String windowRC = HELP_COMMAND_ID + ".window";
TestHandler windowHandler = new TestHandler(false, windowRC);
windowService.activateHandler(HELP_COMMAND_ID, windowHandler);
@@ -152,8 +144,7 @@
*/
private ParameterizedCommand getCommand(IEclipseContext appContext,
String commandId) {
- ECommandService cs = (ECommandService) appContext
- .get(ECommandService.class.getName());
+ ECommandService cs = appContext.get(ECommandService.class);
final Command cmd = cs.getCommand(commandId);
return new ParameterizedCommand(cmd, null);
}
@@ -164,15 +155,13 @@
final ParameterizedCommand helpCommand = getCommand(appContext,
HELP_COMMAND_ID);
- EHandlerService service = (EHandlerService) appContext
- .get(EHandlerService.class.getName());
+ EHandlerService service = appContext.get(EHandlerService.class);
TestHandler handler = new TestHandler(true, HELP_COMMAND_ID);
service.activateHandler(HELP_COMMAND_ID, handler);
IEclipseContext window = appContext.createChild("windowContext");
window.activate();
- EHandlerService windowService = (EHandlerService) window
- .get(EHandlerService.class.getName());
+ EHandlerService windowService = window.get(EHandlerService.class);
String windowRC = HELP_COMMAND_ID + ".window";
TestHandler windowHandler = new TestHandler(false, windowRC);
windowService.activateHandler(HELP_COMMAND_ID, windowHandler);
@@ -192,15 +181,13 @@
final ParameterizedCommand helpCommand = getCommand(appContext,
HELP_COMMAND_ID);
- EHandlerService service = (EHandlerService) appContext
- .get(EHandlerService.class.getName());
+ EHandlerService service = appContext.get(EHandlerService.class);
TestHandler handler = new TestHandler(true, HELP_COMMAND_ID);
service.activateHandler(HELP_COMMAND_ID, handler);
IEclipseContext window = appContext.createChild("windowContext");
window.activate();
- EHandlerService windowService = (EHandlerService) window
- .get(EHandlerService.class.getName());
+ EHandlerService windowService = window.get(EHandlerService.class);
String windowRC = HELP_COMMAND_ID + ".window";
TestHandler windowHandler = new TestHandler(true, windowRC);
windowService.activateHandler(HELP_COMMAND_ID, windowHandler);
@@ -220,15 +207,13 @@
final ParameterizedCommand helpCommand = getCommand(appContext,
HELP_COMMAND_ID);
- EHandlerService service = (EHandlerService) appContext
- .get(EHandlerService.class.getName());
+ EHandlerService service = appContext.get(EHandlerService.class);
TestHandler handler = new TestHandler(true, HELP_COMMAND_ID);
service.activateHandler(HELP_COMMAND_ID, handler);
IEclipseContext window = appContext.createChild("windowContext");
window.activate();
- EHandlerService windowService = (EHandlerService) window
- .get(EHandlerService.class.getName());
+ EHandlerService windowService = window.get(EHandlerService.class);
String windowRC = HELP_COMMAND_ID + ".window";
TestHandler windowHandler = new TestHandler(true, windowRC);
windowService.activateHandler(HELP_COMMAND_ID, windowHandler);
@@ -236,8 +221,7 @@
assertEquals(windowRC, windowService.executeHandler(helpCommand));
IEclipseContext dialog = appContext.createChild("dialogContext");
- EHandlerService dialogService = (EHandlerService) dialog
- .get(EHandlerService.class.getName());
+ EHandlerService dialogService = dialog.get(EHandlerService.class);
assertEquals(HELP_COMMAND_ID, dialogService.executeHandler(helpCommand));
}
diff --git a/tests/org.eclipse.e4.ui.tests/src/org/eclipse/e4/ui/tests/workbench/MWindowTest.java b/tests/org.eclipse.e4.ui.tests/src/org/eclipse/e4/ui/tests/workbench/MWindowTest.java
index edb7f08..b676f55 100644
--- a/tests/org.eclipse.e4.ui.tests/src/org/eclipse/e4/ui/tests/workbench/MWindowTest.java
+++ b/tests/org.eclipse.e4.ui.tests/src/org/eclipse/e4/ui/tests/workbench/MWindowTest.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009, 2015 IBM Corporation and others.
+ * Copyright (c) 2009, 2017 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
@@ -227,7 +227,7 @@
}
assertFalse(window.getContext() == child);
- MPart contextPart = (MPart) child.get(MPart.class.getName());
+ MPart contextPart = child.get(MPart.class);
assertNotNull(contextPart);
assertEquals(window, contextPart.getParent().getParent().getParent());
diff --git a/tests/org.eclipse.e4.ui.tests/src/org/eclipse/e4/ui/tests/workbench/NewMWindowTest.java b/tests/org.eclipse.e4.ui.tests/src/org/eclipse/e4/ui/tests/workbench/NewMWindowTest.java
index 8066f89..e5cfbbb 100644
--- a/tests/org.eclipse.e4.ui.tests/src/org/eclipse/e4/ui/tests/workbench/NewMWindowTest.java
+++ b/tests/org.eclipse.e4.ui.tests/src/org/eclipse/e4/ui/tests/workbench/NewMWindowTest.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009, 2015 IBM Corporation and others.
+ * Copyright (c) 2009, 2017 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
@@ -45,9 +45,6 @@
import org.junit.Before;
import org.junit.Test;
-/*
- *
- */
public class NewMWindowTest {
protected IEclipseContext appContext;
protected E4Workbench wb;
@@ -141,7 +138,7 @@
}
assertFalse(window.getContext() == child);
- MPart contextPart = (MPart) child.get(MPart.class.getName());
+ MPart contextPart = child.get(MPart.class);
assertNotNull(contextPart);
assertEquals(window, contextPart.getParent().getParent().getParent());
diff --git a/tests/org.eclipse.e4.ui.tests/src/org/eclipse/e4/ui/tests/workbench/PartRenderingEngineTests.java b/tests/org.eclipse.e4.ui.tests/src/org/eclipse/e4/ui/tests/workbench/PartRenderingEngineTests.java
index 7c91aac..23ebc8b 100644
--- a/tests/org.eclipse.e4.ui.tests/src/org/eclipse/e4/ui/tests/workbench/PartRenderingEngineTests.java
+++ b/tests/org.eclipse.e4.ui.tests/src/org/eclipse/e4/ui/tests/workbench/PartRenderingEngineTests.java
@@ -212,8 +212,7 @@
MPartStack stack = (MPartStack) container.getChildren().get(0);
MPart part = (MPart) stack.getChildren().get(0);
- IPresentationEngine renderer = (IPresentationEngine) appContext
- .get(IPresentationEngine.class.getName());
+ IPresentationEngine renderer = appContext.get(IPresentationEngine.class);
renderer.removeGui(part);
renderer.removeGui(window);
@@ -643,8 +642,7 @@
wb = new E4Workbench(application, appContext);
wb.createAndRunUI(window);
- IPresentationEngine engine = (IPresentationEngine) appContext
- .get(IPresentationEngine.class.getName());
+ IPresentationEngine engine = appContext.get(IPresentationEngine.class);
CTabFolder folder = (CTabFolder) stack.getWidget();
CTabItem itemA = folder.getItem(0);
@@ -886,8 +884,7 @@
part.setContributionURI("bundleclass://org.eclipse.e4.ui.tests/org.eclipse.e4.ui.tests.workbench.SampleView");
window.getChildren().add(part);
- IPresentationEngine renderer = (IPresentationEngine) appContext
- .get(IPresentationEngine.class.getName());
+ IPresentationEngine renderer = appContext.get(IPresentationEngine.class);
renderer.createGui(part);
renderer.removeGui(part);
@@ -935,8 +932,7 @@
assertNull(partB.getWidget());
// try to remove the tab
- IPresentationEngine renderer = (IPresentationEngine) appContext
- .get(IPresentationEngine.class.getName());
+ IPresentationEngine renderer = appContext.get(IPresentationEngine.class);
renderer.removeGui(partB);
// item removed, one item
diff --git a/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/api/APITestUtils.java b/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/api/APITestUtils.java
index af792b3..f735cc1 100644
--- a/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/api/APITestUtils.java
+++ b/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/api/APITestUtils.java
@@ -109,7 +109,7 @@
private static void saveableHelperSetAutomatedResponse(final int response,
IEclipseContext context) {
- ISaveHandler saveHandler = (ISaveHandler) context.get(ISaveHandler.class.getName());
+ ISaveHandler saveHandler = context.get(ISaveHandler.class);
if (response == -1) {
context.set(ISaveHandler.class.getName(), originalHandlers.remove(context));
} else {