Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexander Kurtakov2015-02-26 17:13:10 +0000
committerAlexander Kurtakov2015-02-26 17:13:10 +0000
commit66c9297a230aeb57eb49d07f77eebf9c68d5b9ad (patch)
tree8ef9f1148e3aed53501cfca5f613b03940007956 /bundles/org.eclipse.equinox.p2.directorywatcher
parentf92c74ac081d929a7ce96a85b26bf60b5364a101 (diff)
downloadrt.equinox.p2-66c9297a230aeb57eb49d07f77eebf9c68d5b9ad.tar.gz
rt.equinox.p2-66c9297a230aeb57eb49d07f77eebf9c68d5b9ad.tar.xz
rt.equinox.p2-66c9297a230aeb57eb49d07f77eebf9c68d5b9ad.zip
Bug 460967 - Use type safe service retrievingI20150303-0800
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: I8b26f4d294b927f4c28a6ba4e68e35bd401df4ec Signed-off-by: Alexander Kurtakov <akurtako@redhat.com>
Diffstat (limited to 'bundles/org.eclipse.equinox.p2.directorywatcher')
-rw-r--r--bundles/org.eclipse.equinox.p2.directorywatcher/src/org/eclipse/equinox/internal/provisional/p2/directorywatcher/Activator.java9
1 files changed, 5 insertions, 4 deletions
diff --git a/bundles/org.eclipse.equinox.p2.directorywatcher/src/org/eclipse/equinox/internal/provisional/p2/directorywatcher/Activator.java b/bundles/org.eclipse.equinox.p2.directorywatcher/src/org/eclipse/equinox/internal/provisional/p2/directorywatcher/Activator.java
index bd64fa364..9a5e51e85 100644
--- a/bundles/org.eclipse.equinox.p2.directorywatcher/src/org/eclipse/equinox/internal/provisional/p2/directorywatcher/Activator.java
+++ b/bundles/org.eclipse.equinox.p2.directorywatcher/src/org/eclipse/equinox/internal/provisional/p2/directorywatcher/Activator.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2008, 2010 IBM Corporation and others.
+ * Copyright (c) 2008, 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
* Code 9 - ongoing development
+ * Red Hat Inc. - Bug 460967
*******************************************************************************/
package org.eclipse.equinox.internal.provisional.p2.directorywatcher;
@@ -41,15 +42,15 @@ public class Activator implements BundleActivator {
}
public static IArtifactRepositoryManager getArtifactRepositoryManager() {
- return (IArtifactRepositoryManager) ((IProvisioningAgent) ServiceHelper.getService(context, IProvisioningAgent.SERVICE_NAME)).getService(IArtifactRepositoryManager.SERVICE_NAME);
+ return (IArtifactRepositoryManager) ServiceHelper.getService(context, IProvisioningAgent.class).getService(IArtifactRepositoryManager.SERVICE_NAME);
}
public static IMetadataRepositoryManager getMetadataRepositoryManager() {
- return (IMetadataRepositoryManager) ((IProvisioningAgent) ServiceHelper.getService(context, IProvisioningAgent.SERVICE_NAME)).getService(IMetadataRepositoryManager.SERVICE_NAME);
+ return (IMetadataRepositoryManager) ServiceHelper.getService(context, IProvisioningAgent.class).getService(IMetadataRepositoryManager.SERVICE_NAME);
}
public static URI getDefaultRepositoryLocation(Object object, String repositoryName) {
- PackageAdmin packageAdmin = (PackageAdmin) ServiceHelper.getService(context, PackageAdmin.class.getName());
+ PackageAdmin packageAdmin = ServiceHelper.getService(context, PackageAdmin.class);
Bundle bundle = packageAdmin.getBundle(object.getClass());
BundleContext context = bundle.getBundleContext();
File base = context.getDataFile(""); //$NON-NLS-1$

Back to the top