/** * Returns the id of the system bundle currently in the resolver state * * @return a String with the id of the system.bundle */ public String getSystemBundleId() { return getState().getSystemBundle(); }
public static PDEState getPDEState() { return PDECore.getDefault().getModelManager().getState(); }
public static PDEState getPDEState() { return PDECore.getDefault().getModelManager().getState(); }
@Override public State getState() { return PDECore.getDefault().getModelManager().getState().getState(); }
private static Map<String, ExportPackageDescription> getValidPackages(String pkgName, String qualifiedTypeToImport) { ExportPackageDescription[] knownPackages = PDECore.getDefault().getModelManager().getState().getState().getExportedPackages(); Map<String, ExportPackageDescription> validPackages = new HashMap<>(); for (ExportPackageDescription knownPackage : knownPackages) { if (knownPackage.getName().equals(pkgName)) { validPackages.put(knownPackage.getName(), knownPackage); } } // remove system packages if they happen to be included. Adding a system package won't resolve anything, since package package already comes from JRE if (!validPackages.isEmpty()) { knownPackages = PDECore.getDefault().getModelManager().getState().getState().getSystemPackages(); for (ExportPackageDescription knownPackage : knownPackages) { validPackages.remove(knownPackage.getName()); } } Map<String, ExportPackageDescription> packages = new HashMap<>(); for (ExportPackageDescription exportPackageDescription : validPackages.values()) { packages.put(qualifiedTypeToImport, exportPackageDescription); } return packages; }
ExportPackageDescription[] systemPackages = PDECore.getDefault().getModelManager().getState().getState().getSystemPackages(); for (ExportPackageDescription systemPackage : systemPackages) { packages.remove(systemPackage.getName()); ExportPackageDescription[] knownPackages = PDECore.getDefault().getModelManager().getState().getState().getExportedPackages(); for (ExportPackageDescription knownPackage : knownPackages) { if (packages.containsKey(knownPackage.getName())) {
RegistryContributor contributor = (RegistryContributor) extensions[i].getContributor(); long bundleId = Long.parseLong(contributor.getActualId()); BundleDescription desc = PDECore.getDefault().getModelManager().getState().getState().getBundle(Long.parseLong(contributor.getActualId())); IPluginModelBase base = null; if (desc != null)
private IPluginModelBase getPlugin(IContributor icontributor, boolean searchAll) { if (!(icontributor instanceof RegistryContributor)) return null; RegistryContributor contributor = (RegistryContributor) icontributor; long bundleId = Long.parseLong(contributor.getActualId()); BundleDescription desc = PDECore.getDefault().getModelManager().getState().getState().getBundle(Long.parseLong(contributor.getActualId())); if (desc != null) return PluginRegistry.findModel(desc); // desc might be null if the workspace contains a plug-in with the same Bundle-SymbolicName ModelEntry entry = PluginRegistry.findEntry(contributor.getActualName()); if (entry != null) { if (!searchAll && entry.getWorkspaceModels().length > 0) return null; IPluginModelBase externalModels[] = entry.getExternalModels(); for (int j = 0; j < externalModels.length; j++) { BundleDescription extDesc = externalModels[j].getBundleDescription(); if (extDesc != null && extDesc.getBundleId() == bundleId) return externalModels[j]; } } return null; }
private static void addImportedPackages(IBundlePluginModelBase base, HashSet<String> existingImports) { HashMap<String, ImportPackageObject> map = getImportPackages(base); if (map == null) { return; } ExportPackageDescription exported[] = PDECore.getDefault().getModelManager().getState().getState().getExportedPackages(); for (int i = 0; i < exported.length; i++) { // iterate through all the exported packages ImportPackageObject ipo = map.get(exported[i].getName()); // if we find an exported package that matches a pkg in the map, then the exported package matches a package on our import-package statement if (ipo != null) { // check version to make sure we only add bundles from valid packages String version = ipo.getVersion(); if (version != null) { try { if (!new VersionRange(version).isIncluded(exported[i].getVersion())) { continue; // NFE if ImportPackageObject's version is improperly formatted - ignore any matching imported packages since version is invalid } } catch (NumberFormatException e) { continue; } } existingImports.add(exported[i].getSupplier().getSymbolicName()); } } }
protected void setActive(boolean active) { if (active) { State state = PDECore.getDefault().getModelManager().getState().getState(); state.resolve(true); fTreeViewer.setInput(state); PDECore.getDefault().getModelManager().addPluginModelListener(this); } else { PDECore.getDefault().getModelManager().removePluginModelListener(this); } }