private boolean containsProfile(IProfileRegistry profileRegistry, String profileId) { if (profileId == null || profileRegistry == null) return false; return profileRegistry.containsProfile(profileId); }
private boolean containsProfile(IProfileRegistry profileRegistry, String profileId) { if (profileId == null || profileRegistry == null) return false; return profileRegistry.containsProfile(profileId); }
/** * Returns whether a profile with the given ID exists in a profile registry * stored in the give p2 data area. * * @param profileID id of the profile to check * @param p2DataArea data area where the profile registry is * @return whether the profile exists */ public static boolean profileExists(String profileID, File p2DataArea) throws CoreException { IProvisioningAgentProvider provider = (IProvisioningAgentProvider) PDECore.getDefault().acquireService(IProvisioningAgentProvider.SERVICE_NAME); if (provider == null) { throw new CoreException(new Status(IStatus.ERROR, PDECore.PLUGIN_ID, PDECoreMessages.P2Utils_UnableToAcquireP2Service)); } IProvisioningAgent agent = provider.createAgent(p2DataArea.toURI()); if (agent == null) { throw new CoreException(new Status(IStatus.ERROR, PDECore.PLUGIN_ID, PDECoreMessages.P2Utils_UnableToAcquireP2Service)); } IProfileRegistry registry = (IProfileRegistry) agent.getService(IProfileRegistry.SERVICE_NAME); if (registry == null) { throw new CoreException(new Status(IStatus.ERROR, PDECore.PLUGIN_ID, PDECoreMessages.P2Utils_UnableToAcquireP2Service)); } return registry.containsProfile(profileID); }