Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexander Kurtakov2015-02-27 09:16:10 +0000
committerAlexander Kurtakov2015-03-23 09:36:24 +0000
commit09155e9ddb667a364a0be35f73cb6da662154a33 (patch)
treeb63bf87fc4870884cc0b0d475074915f7fc4c16c /bundles/org.eclipse.equinox.p2.ui.sdk.scheduler
parent97cbe376383b753aa4b568950e803bef71fbdb27 (diff)
downloadrt.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.scheduler')
-rw-r--r--bundles/org.eclipse.equinox.p2.ui.sdk.scheduler/src/org/eclipse/equinox/internal/p2/ui/sdk/scheduler/AutomaticUpdatePlugin.java12
1 files changed, 6 insertions, 6 deletions
diff --git a/bundles/org.eclipse.equinox.p2.ui.sdk.scheduler/src/org/eclipse/equinox/internal/p2/ui/sdk/scheduler/AutomaticUpdatePlugin.java b/bundles/org.eclipse.equinox.p2.ui.sdk.scheduler/src/org/eclipse/equinox/internal/p2/ui/sdk/scheduler/AutomaticUpdatePlugin.java
index 7cca4956a..f42534de8 100644
--- a/bundles/org.eclipse.equinox.p2.ui.sdk.scheduler/src/org/eclipse/equinox/internal/p2/ui/sdk/scheduler/AutomaticUpdatePlugin.java
+++ b/bundles/org.eclipse.equinox.p2.ui.sdk.scheduler/src/org/eclipse/equinox/internal/p2/ui/sdk/scheduler/AutomaticUpdatePlugin.java
@@ -123,10 +123,10 @@ public class AutomaticUpdatePlugin extends AbstractUIPlugin {
}
public IProvisioningEventBus getProvisioningEventBus() {
- ServiceReference<?> busReference = context.getServiceReference(IProvisioningEventBus.SERVICE_NAME);
+ ServiceReference<IProvisioningEventBus> busReference = context.getServiceReference(IProvisioningEventBus.class);
if (busReference == null)
return null;
- return (IProvisioningEventBus) context.getService(busReference);
+ return context.getService(busReference);
}
/*
@@ -146,10 +146,10 @@ public class AutomaticUpdatePlugin extends AbstractUIPlugin {
}
public 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;
}
@@ -184,10 +184,10 @@ public class AutomaticUpdatePlugin extends AbstractUIPlugin {
}
public IProvisioningAgentProvider getAgentProvider() {
- ServiceReference<?> ref = getContext().getServiceReference(IProvisioningAgentProvider.SERVICE_NAME);
+ ServiceReference<IProvisioningAgentProvider> ref = getContext().getServiceReference(IProvisioningAgentProvider.class);
if (ref == null)
return null;
- IProvisioningAgentProvider agentProvider = (IProvisioningAgentProvider) getContext().getService(ref);
+ IProvisioningAgentProvider agentProvider = getContext().getService(ref);
getContext().ungetService(ref);
return agentProvider;
}

Back to the top