/** * Returns the target service or <code>null</code> if none. * * @return target service or <code>null</code> */ protected ITargetPlatformService getTargetService() { return PDECore.getDefault().acquireService(ITargetPlatformService.class); }
/** * Returns the preferences service. * * @return preferences service or null if none */ public static IPreferencesService getPreferences() { return (IPreferencesService) PDECore.getDefault().acquireService(IPreferencesService.class.getName()); }
/** * Returns the target platform service or <code>null</code> if none. * * @return target platform service or <code>null</code> */ private ITargetPlatformService getTargetPlatformService() { ITargetPlatformService service = PDECore.getDefault().acquireService(ITargetPlatformService.class); return service; }
/** * Returns the target service or <code>null</code> if none. * * @return target service or <code>null</code> */ protected static ITargetPlatformService getTargetService() { return PDECore.getDefault().acquireService(ITargetPlatformService.class); } }
/** * Returns the target service or <code>null</code> * * @return service or <code>null</code> */ private ITargetPlatformService getTargetService() { return PDECore.getDefault().acquireService(ITargetPlatformService.class); }
/** * Returns the target platform service or <code>null</code> if the service could * not be acquired. * * @return target platform service or <code>null</code> */ private ITargetPlatformService getTargetService() { return PDECore.getDefault().acquireService(ITargetPlatformService.class); }
static ITargetPlatformService getTargetPlatformService() throws CoreException { if (fTargetService == null) { fTargetService = (ITargetPlatformService) PDECore.getDefault().acquireService(ITargetPlatformService.class.getName()); if (fTargetService == null) { throw new CoreException(new Status(IStatus.ERROR, PDECore.PLUGIN_ID, Messages.TargetDefinitionPersistenceHelper_1)); } } return fTargetService; }
/** * Returns the target service or <code>null</code> * * @return service or <code>null</code> */ private ITargetPlatformService getTargetService() { return (ITargetPlatformService) PDECore.getDefault().acquireService(ITargetPlatformService.class.getName()); }
/** * Returns the bundle project service. * * @return bundle project service */ IBundleProjectService getBundleProjectService() { if (fService == null) { fService = (IBundleProjectService) PDECore.getDefault().acquireService(IBundleProjectService.class.getName()); } return fService; }
private ITargetPlatformService getTargetPlatformService() throws CoreException { ITargetPlatformService service = PDECore.getDefault().acquireService(ITargetPlatformService.class); if (service == null) { throw new CoreException(new Status(IStatus.ERROR, PDECore.PLUGIN_ID, "ITargetPlatformService not available")); //$NON-NLS-1$ } return service; }
/** * Returns the global p2 provisioning agent. This is useful when looking to inherit or use * some settings from the global p2 world. * * @return the global p2 provisioning agent * @throws CoreException */ public static IProvisioningAgent getGlobalAgent() throws CoreException { IProvisioningAgent agent = (IProvisioningAgent) PDECore.getDefault().acquireService(IProvisioningAgent.SERVICE_NAME); if (agent == null) throw new CoreException(new Status(IStatus.ERROR, PDECore.PLUGIN_ID, Messages.IUBundleContainer_11)); return agent; }
/** * Gets the target platform service provided by PDE Core * @return the target platform service * @throws CoreException if unable to acquire the service */ private static ITargetPlatformService getTargetPlatformService() throws CoreException { if (fTargetService == null) { fTargetService = PDECore.getDefault().acquireService(ITargetPlatformService.class); if (fTargetService == null) { throw new CoreException(new Status(IStatus.ERROR, PDECore.PLUGIN_ID, Messages.AddDirectoryContainerPage_9)); } } return fTargetService; }
/** * Gets the target platform service provided by PDE Core * @return the target platform service * @throws CoreException if unable to acquire the service */ protected static ITargetPlatformService getTargetPlatformService() throws CoreException { if (fTargetService == null) { fTargetService = PDECore.getDefault().acquireService(ITargetPlatformService.class); if (fTargetService == null) { throw new CoreException(new Status(IStatus.ERROR, PDECore.PLUGIN_ID, Messages.AddDirectoryContainerPage_9)); } } return fTargetService; }
/** * Returns a list of {@link BundleInfo} for each bundle entry or <code>null</code> if there * is a problem reading the file. * * @param fileURL the URL of the file to read * @param home the path describing the base location of the platform install * @return list containing URL locations or <code>null</code> * @throws IOException */ private static BundleInfo[] getBundlesFromFile(URL fileURL, File home) throws IOException { SimpleConfiguratorManipulator manipulator = (SimpleConfiguratorManipulator) PDECore.getDefault().acquireService(SimpleConfiguratorManipulator.class.getName()); if (manipulator == null) { return null; } // the input stream will be buffered and closed for us try { return manipulator.loadConfiguration(fileURL.openStream(), home.toURI()); } catch (FileNotFoundException e) { return null; } }
/** * 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); }
@Override public ITargetLocation getBundleContainer() { ITargetPlatformService service = PDECore.getDefault().acquireService(ITargetPlatformService.class); if (service == null) { PDEPlugin.log(new Status(IStatus.ERROR, PDEPlugin.getPluginId(), Messages.EditIUContainerPage_9)); } int flags = fIncludeRequiredButton.getSelection() ? IUBundleContainer.INCLUDE_REQUIRED : 0; flags |= fAllPlatformsButton.getSelection() ? IUBundleContainer.INCLUDE_ALL_ENVIRONMENTS : 0; flags |= fIncludeSourceButton.getSelection() ? IUBundleContainer.INCLUDE_SOURCE : 0; flags |= fConfigurePhaseButton.getSelection() ? IUBundleContainer.INCLUDE_CONFIGURE_PHASE : 0; IUBundleContainer container = (IUBundleContainer) service.newIULocation(fAvailableIUGroup.getCheckedLeafIUs(), fRepoLocation != null ? new URI[] {fRepoLocation} : null, flags); return container; }
/** * Constructs a new operation to load the specified target definition * as the current target platform. When <code>null</code> is specified * the target platform is empty and all other settings are default. *<p> * Clients should use {@link #load(ITargetDefinition, IJobChangeListener)} instead to ensure * any existing jobs are cancelled. * </p> * @param target target definition or <code>null</code> if none */ public LoadTargetDefinitionJob(ITargetDefinition target) { super(Messages.LoadTargetDefinitionJob_0); fTarget = target; if (target == null) { fNone = true; ITargetPlatformService service = (ITargetPlatformService) PDECore.getDefault().acquireService(ITargetPlatformService.class.getName()); fTarget = service.newTarget(); } }
/** * Computes the set of implicit dependencies from the {@link PDEPreferencesManager} * @return a set if bundle ids */ private static String[] getImplicitDependencies() { try { ITargetPlatformService service = (ITargetPlatformService) PDECore.getDefault().acquireService(ITargetPlatformService.class.getName()); if (service != null) { NameVersionDescriptor[] implicit = service.getWorkspaceTargetDefinition().getImplicitDependencies(); if (implicit != null) { String[] result = new String[implicit.length]; for (int i = 0; i < implicit.length; i++) { result[i] = implicit[i].getId(); } return result; } } } catch (CoreException e) { PDECore.log(e); } return new String[0]; }
public TargetDefinitionExportWizard(ITargetDefinition target) { fTarget = target; if (fTarget == null) try { ITargetPlatformService service = PDECore.getDefault().acquireService(ITargetPlatformService.class); if (service != null) { fTarget = service.getWorkspaceTargetDefinition(); } } catch (CoreException e) { PDEPlugin.log(e); } setNeedsProgressMonitor(true); setWindowTitle(PDEUIMessages.ExportActiveTargetDefinition); setDefaultPageImageDescriptor(PDEPluginImages.DESC_TARGET_WIZ); }
/** * Creates a new IUBundleContainer, adds it to the active target, then reloads the active target. * * @param units new installable units to include in the container * @param repositories list of repositories the container can use as a context or <code>null</code> to use all available repos */ private static void installIntoActiveTarget(IInstallableUnit[] units, URI[] repositories) throws CoreException { ITargetPlatformService service = PDECore.getDefault().acquireService(ITargetPlatformService.class); ITargetDefinition definition = service.getWorkspaceTargetDefinition(); // Force the target into slicer mode as all requirements may not be available int flags = IUBundleContainer.INCLUDE_ALL_ENVIRONMENTS | IUBundleContainer.INCLUDE_SOURCE; IUBundleContainer container = (IUBundleContainer) service.newIULocation(units, repositories, flags); ITargetLocation[] oldContainers = definition.getTargetLocations(); if (oldContainers == null) { definition.setTargetLocations(new ITargetLocation[] {container}); } else { ITargetLocation[] newContainers = new ITargetLocation[oldContainers.length + 1]; System.arraycopy(oldContainers, 0, newContainers, 0, oldContainers.length); newContainers[newContainers.length - 1] = container; definition.setTargetLocations(newContainers); service.saveTargetDefinition(definition); LoadTargetDefinitionJob.load(definition); } } }