diff options
author | Alexander Kurtakov | 2015-02-27 09:16:10 +0000 |
---|---|---|
committer | Alexander Kurtakov | 2015-03-23 09:36:24 +0000 |
commit | 09155e9ddb667a364a0be35f73cb6da662154a33 (patch) | |
tree | b63bf87fc4870884cc0b0d475074915f7fc4c16c /bundles/org.eclipse.equinox.p2.ui.sdk/src | |
parent | 97cbe376383b753aa4b568950e803bef71fbdb27 (diff) | |
download | rt.equinox.p2-09155e9ddb667a364a0be35f73cb6da662154a33.tar.gz rt.equinox.p2-09155e9ddb667a364a0be35f73cb6da662154a33.tar.xz rt.equinox.p2-09155e9ddb667a364a0be35f73cb6da662154a33.zip |
Bug 460967 - Use type safe service retrieving
Instead of retrieving services based on their String class name there is
newer implementation that takes the class directly and returns the
correct class preventing casts.
Change-Id: I817c47b702001b739a07a54f4fd8dd72ae9750aa
Signed-off-by: Alexander Kurtakov <akurtako@redhat.com>
Diffstat (limited to 'bundles/org.eclipse.equinox.p2.ui.sdk/src')
2 files changed, 8 insertions, 6 deletions
diff --git a/bundles/org.eclipse.equinox.p2.ui.sdk/src/org/eclipse/equinox/internal/p2/ui/sdk/ProvSDKUIActivator.java b/bundles/org.eclipse.equinox.p2.ui.sdk/src/org/eclipse/equinox/internal/p2/ui/sdk/ProvSDKUIActivator.java index c6d6acd79..f6cc655ac 100644 --- a/bundles/org.eclipse.equinox.p2.ui.sdk/src/org/eclipse/equinox/internal/p2/ui/sdk/ProvSDKUIActivator.java +++ b/bundles/org.eclipse.equinox.p2.ui.sdk/src/org/eclipse/equinox/internal/p2/ui/sdk/ProvSDKUIActivator.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2007, 2012 IBM Corporation and others. + * Copyright (c) 2007, 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 @@ -8,6 +8,7 @@ * Contributors: * IBM Corporation - initial API and implementation * Ericsson AB (Hamdan Msheik) - Bug 396420 - Control Install dialog through preference customization + * Red Hat Inc. - Bug 460967 *******************************************************************************/ package org.eclipse.equinox.internal.p2.ui.sdk; @@ -158,10 +159,10 @@ public class ProvSDKUIActivator extends AbstractUIPlugin { } private IAgentLocation getAgentLocation() { - ServiceReference<?> ref = getContext().getServiceReference(IAgentLocation.SERVICE_NAME); + ServiceReference<IAgentLocation> ref = getContext().getServiceReference(IAgentLocation.class); if (ref == null) return null; - IAgentLocation location = (IAgentLocation) getContext().getService(ref); + IAgentLocation location = getContext().getService(ref); getContext().ungetService(ref); return location; } diff --git a/bundles/org.eclipse.equinox.p2.ui.sdk/src/org/eclipse/equinox/internal/p2/ui/sdk/prefs/PreferenceInitializer.java b/bundles/org.eclipse.equinox.p2.ui.sdk/src/org/eclipse/equinox/internal/p2/ui/sdk/prefs/PreferenceInitializer.java index bf3177f7a..151579b36 100644 --- a/bundles/org.eclipse.equinox.p2.ui.sdk/src/org/eclipse/equinox/internal/p2/ui/sdk/prefs/PreferenceInitializer.java +++ b/bundles/org.eclipse.equinox.p2.ui.sdk/src/org/eclipse/equinox/internal/p2/ui/sdk/prefs/PreferenceInitializer.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2007, 2012 IBM Corporation and others. + * Copyright (c) 2007, 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 @@ -8,6 +8,7 @@ * Contributors: * IBM Corporation - initial API and implementation * Ericsson AB (Hamdan Msheik) - Bug 396420 - Control Install dialog through preference customization + * Red Hat Inc. - Bug 460967 *******************************************************************************/ package org.eclipse.equinox.internal.p2.ui.sdk.prefs; @@ -63,10 +64,10 @@ public class PreferenceInitializer extends AbstractPreferenceInitializer { } private static IAgentLocation getDefaultAgentLocation() { - ServiceReference<?> reference = ProvSDKUIActivator.getContext().getServiceReference(IAgentLocation.SERVICE_NAME); + ServiceReference<IAgentLocation> reference = ProvSDKUIActivator.getContext().getServiceReference(IAgentLocation.class); if (reference == null) return null; - IAgentLocation result = (IAgentLocation) ProvSDKUIActivator.getContext().getService(reference); + IAgentLocation result = ProvSDKUIActivator.getContext().getService(reference); ProvSDKUIActivator.getContext().ungetService(reference); return result; } |