public IFeatureModel getDeltaPackFeature() { IFeatureModel model = findFeatureModel("org.eclipse.equinox.executable"); //$NON-NLS-1$ if (model == null) model = findFeatureModel("org.eclipse.platform.launchers"); //$NON-NLS-1$ return model; }
@Override protected void setP2MetaDataProperties(Map<String, String> map) { if (fInfo.exportMetadata) { if (PDECore.getDefault().getFeatureModelManager().getDeltaPackFeature() == null) map.put(IXMLConstants.PROPERTY_LAUNCHER_PROVIDER, "org.eclipse.pde.container.feature"); //$NON-NLS-1$ map.put(IXMLConstants.TARGET_P2_METADATA, IBuildPropertiesConstants.TRUE); map.put(IBuildPropertiesConstants.PROPERTY_P2_FLAVOR, P2Utils.P2_FLAVOR_DEFAULT); map.put(IBuildPropertiesConstants.PROPERTY_P2_PUBLISH_ARTIFACTS, IBuildPropertiesConstants.TRUE); map.put(IBuildPropertiesConstants.PROPERTY_P2_COMPRESS, IBuildPropertiesConstants.TRUE); map.put(IBuildPropertiesConstants.PROPERTY_P2_GATHERING, Boolean.toString(publishingP2Metadata())); try { map.put(IBuildPropertiesConstants.PROPERTY_P2_BUILD_REPO, new File(fBuildTempMetadataLocation).toURL().toString()); map.put(IBuildPropertiesConstants.PROPERTY_P2_METADATA_REPO, new File(fInfo.destinationDirectory + "/repository").toURL().toString()); //$NON-NLS-1$ map.put(IBuildPropertiesConstants.PROPERTY_P2_ARTIFACT_REPO, new File(fInfo.destinationDirectory + "/repository").toURL().toString()); //$NON-NLS-1$ map.put(IBuildPropertiesConstants.PROPERTY_P2_METADATA_REPO_NAME, NLS.bind(PDECoreMessages.ProductExportOperation_0, fProduct.getProductId())); map.put(IBuildPropertiesConstants.PROPERTY_P2_ARTIFACT_REPO_NAME, NLS.bind(PDECoreMessages.ProductExportOperation_0, fProduct.getProductId())); } catch (MalformedURLException e) { PDECore.log(e); } } }
protected String[] getPaths() { Map<String, String> map = new HashMap<>(); // merge workspace and external features using workspace over external FeatureModelManager fmm = PDECore.getDefault().getFeatureModelManager(); IFeatureModel[] models = fmm.getExternalModels(); for (int i = 0; i < models.length; i++) { map.put(models[i].getFeature().getId(), models[i].getInstallLocation()); } // remove anything that we have in the workspace models models = fmm.getWorkspaceModels(); String[] locations = new String[models.length]; for (int i = 0; i < models.length; i++) { map.remove(models[i].getFeature().getId()); locations[i] = models[i].getInstallLocation(); } // add all workspace models String[] paths = new String[map.size() + models.length]; paths = map.values().toArray(paths); System.arraycopy(locations, 0, paths, map.size(), models.length); return paths; }
/** * Finds active model with a given id and version * * @param id * @param version * @return one IFeature model or null */ public IFeatureModel findFeatureModel(String id, String version) { init(); IFeatureModel[] models = fActiveModels.get(id, version); for (int i = 0; i < models.length; i++) { if (models[i].isValid()) { return models[i]; } } if (models.length == 0 && "0.0.0".equals(version)) { //$NON-NLS-1$ return findFeatureModel(id); } return null; }
public static String[] getFeaturePaths() { IFeatureModel[] models = PDECore.getDefault().getFeatureModelManager().getModels(); ArrayList list = new ArrayList(); for (int i = 0; i < models.length; i++) { String location = models[i].getInstallLocation(); if (location != null) list.add(location + IPath.SEPARATOR + "feature.xml"); //$NON-NLS-1$ } return (String[]) list.toArray(new String[list.size()]); }
@Override public Object[] getListElements() { FeatureModelManager manager = PDECore.getDefault().getFeatureModelManager(); return manager.getWorkspaceModels(); }
public void initialize() { refresh(); FeatureModelManager mng = PDECore.getDefault().getFeatureModelManager(); mng.addFeatureModelListener(this); }
@Override public void dispose() { super.dispose(); FeatureModelManager mng = PDECore.getDefault().getFeatureModelManager(); mng.removeFeatureModelListener(this); fModel.removeModelChangedListener(this); if (fSiteLabelProvider != null) fSiteLabelProvider.dispose(); }
private Collection<IPluginModelBase> getPluginModelBasesByFeature() { Collection<IPluginModelBase> pluginModelBases = new ArrayList<>(); IProductFeature[] features = getProduct().getFeatures(); for (IProductFeature feature : features) { FeatureModelManager manager = PDECore.getDefault().getFeatureModelManager(); IFeatureModel fModel = manager.findFeatureModelRelaxed(feature.getId(), feature.getVersion()); if (fModel == null) { fModel = manager.findFeatureModel(feature.getId()); } if (fModel != null) { IFeaturePlugin[] fPlugins = fModel.getFeature().getPlugins(); for (IFeaturePlugin fPlugin : fPlugins) { if (!fPlugin.isFragment()) { IPluginModelBase pluginModelBase = PluginRegistry.findModel(fPlugin.getId()); if (pluginModelBase != null) { pluginModelBases.add(pluginModelBase); } } } } } return pluginModelBases; }
if (input instanceof FeatureModelManager) { FeatureModelManager fmm = (FeatureModelManager) input; IFeatureModel[] models = fmm.getWorkspaceModels(); for (IFeatureModel iFeatureModel : models) { if (iFeatureModel.getFeature().getId() == null) { fmm.removeFromWorkspaceFeature(iFeatureModel);
private void validateFeatureID(Element element, Attr attr) { int severity = CompilerFlags.getFlag(fProject, CompilerFlags.F_UNRESOLVED_FEATURES); if (severity != CompilerFlags.IGNORE) { IFeatureModel[] models = PDECore.getDefault().getFeatureModelManager().findFeatureModels(attr.getValue()); if (models.length == 0) { report(NLS.bind(PDECoreMessages.Builders_Feature_freference, attr.getValue()), getLine(element, attr.getName()), severity, PDEMarkerFactory.CAT_OTHER); } } } protected void reportExclusiveAttributes(Element element, String attName1, String attName2, int severity) {
public synchronized FeatureModelManager getFeatureModelManager() { if (fFeatureModelManager == null) fFeatureModelManager = new FeatureModelManager(); return fFeatureModelManager; }
adjustExternalVisibility(delta, affectedIdVers);
public static String[] getFeaturePaths() { IFeatureModel[] models = PDECore.getDefault().getFeatureModelManager().getModels(); ArrayList<String> list = new ArrayList<>(); for (int i = 0; i < models.length; i++) { String location = models[i].getInstallLocation(); if (location != null) list.add(location + IPath.SEPARATOR + ICoreConstants.FEATURE_FILENAME_DESCRIPTOR); } return list.toArray(new String[list.size()]); }
/** * Finds active model with a given id and version * * @param id * @param version version number to find, newest version is returned for empty version. * @return one IFeature model or null */ public IFeatureModel findFeatureModel(String id, String version) { init(); IFeatureModel[] models = fActiveModels.get(id, version); if (VersionUtil.isEmptyVersion(version)) { return findFeatureModel(id); } for (int i = 0; i < models.length; i++) { if (models[i].isValid()) { return models[i]; } } return null; }
private void touchFeatures() { FeatureModelManager manager = PDECore.getDefault().getFeatureModelManager(); IFeatureModel[] workspaceFeatures = manager.getWorkspaceModels(); if (workspaceFeatures.length > 0) { IProgressMonitor monitor = new NullProgressMonitor(); monitor.beginTask("", workspaceFeatures.length); //$NON-NLS-1$ for (int i = 0; i < workspaceFeatures.length; i++) { try { IResource resource = workspaceFeatures[i].getUnderlyingResource(); if (resource != null) { resource.touch(new SubProgressMonitor(monitor, 1)); } else { monitor.worked(1); } } catch (CoreException e) { } } } fTouchFeatures = false; }
public void initialize() { refresh(); FeatureModelManager mng = PDECore.getDefault().getFeatureModelManager(); mng.addFeatureModelListener(this); }
@Override public void dispose() { super.dispose(); FeatureModelManager mng = PDECore.getDefault().getFeatureModelManager(); mng.removeFeatureModelListener(this); fModel.removeModelChangedListener(this); if (fSiteLabelProvider != null) fSiteLabelProvider.dispose(); }
private void validateFeatureExists(Element element, Attr attr) { int severity = CompilerFlags.getFlag(fProject, CompilerFlags.F_UNRESOLVED_FEATURES); if (severity != CompilerFlags.IGNORE) { IFeatureModel[] models = PDECore.getDefault().getFeatureModelManager().findFeatureModels(attr.getValue()); if (models.length == 0) { report(NLS.bind(PDECoreMessages.Builders_Feature_freference, attr.getValue()), getLine(element, attr.getName()), severity, PDEMarkerFactory.CAT_OTHER); } } }
public FeatureModelManager getFeatureModelManager() { if (fFeatureModelManager == null) fFeatureModelManager = new FeatureModelManager(); return fFeatureModelManager; }