public static URL[] getFeaturePaths(String platformHome) { File file = new File(platformHome, "configuration/org.eclipse.update/platform.xml"); //$NON-NLS-1$ if (file.exists()) { try { String value = new Path(platformHome).toFile().toURL().toExternalForm(); System.setProperty(URL_PROPERTY, value); try { IPlatformConfiguration config = ConfiguratorUtils.getPlatformConfiguration(file.toURL()); return getConfiguredSitesPaths(platformHome, config, true); } finally { System.setProperty(URL_PROPERTY, EMPTY_STRING); } } catch (MalformedURLException e) { } catch (IOException e) { } } return scanLocations(getSites(platformHome, true)); }
public static void createPlatformConfiguration(File configLocation, IPluginModelBase[] models, IPluginModelBase brandingPlugin) throws CoreException { try { IPlatformConfiguration platformConfiguration = ConfiguratorUtils.getPlatformConfiguration(null); // Compute local sites ArrayList<LocalSite> sites = new ArrayList<>(); for (int i = 0; i < models.length; i++) { IPath path = new Path(models[i].getInstallLocation()).removeLastSegments(2); addToSite(path, models[i], sites); } createConfigurationEntries(platformConfiguration, sites); if (brandingPlugin != null) createFeatureEntries(platformConfiguration, brandingPlugin); platformConfiguration.refresh(); platformConfiguration.save(new URL("file:" + configLocation.getPath())); //$NON-NLS-1$ } catch (Exception e) { // Wrap everything else in a core exception. String message = e.getMessage(); if (message == null || message.length() == 0) message = PDECoreMessages.TargetPlatform_exceptionThrown; throw new CoreException(new Status(IStatus.ERROR, PDECore.PLUGIN_ID, IStatus.ERROR, message, e)); } }
/** * Returns a list of file URLs for plug-ins or features found in a platform.xml file or in the default * directory ("plugins"/"features") if no platform.xml is available. * * @param platformHome base location for the installation, used to search for platform.xml * @param findFeatures if <code>true</code> will return paths to features, otherwise will return paths to plug-ins. * @return a list of URL paths to plug-ins or features. Possibly empty if the platform.xml had no entries or the default directory had no valid files */ public static URL[] getPlatformXMLPaths(String platformHome, boolean findFeatures) { File file = getPlatformFile(platformHome); if (file != null) { try { String value = new Path(platformHome).toFile().toURL().toExternalForm(); System.setProperty(URL_PROPERTY, value); try { IPlatformConfiguration config = ConfiguratorUtils.getPlatformConfiguration(file.toURL()); return getConfiguredSitesPaths(platformHome, config, findFeatures); } finally { System.setProperty(URL_PROPERTY, EMPTY_STRING); } } catch (MalformedURLException e) { } catch (IOException e) { } } return scanLocations(getSites(platformHome, findFeatures)); }
public static URL[] getPluginPaths(String platformHome) { if (new Path(platformHome).equals(new Path(TargetPlatform.getDefaultLocation())) && !isDevLaunchMode()) return ConfiguratorUtils.getCurrentPlatformConfiguration().getPluginPath(); File file = new File(platformHome, "configuration/org.eclipse.update/platform.xml"); //$NON-NLS-1$ if (file.exists()) { try { String value = new Path(platformHome).toFile().toURL().toExternalForm(); System.setProperty(URL_PROPERTY, value); try { IPlatformConfiguration config = ConfiguratorUtils.getPlatformConfiguration(file.toURL()); return getConfiguredSitesPaths(platformHome, config, false); } finally { System.setProperty(URL_PROPERTY, EMPTY_STRING); } } catch (MalformedURLException e) { } catch (IOException e) { } } return scanLocations(getSites(platformHome, false)); }
throws CoreException { try { IPlatformConfiguration platformConfiguration = ConfiguratorUtils.getPlatformConfiguration(null);