/** * Returns a {@link Set} of bundle ids for the dependents of the given * {@link IPluginModelBase}s. The set includes the ids of the given model bases * as well as all computed implicit / optional dependencies. * * @param models the array of {@link IPluginModelBase}s to compute dependencies for * @param excludeFragments a collection of <b>fragment</b> bundle symbolic names to exclude from the dependency resolution * or <code>null</code> if none * @return a set of bundle IDs */ public static Set<String> getSelfandDependencies(IPluginModelBase[] models, String[] excludeFragments) { return getDependencies(models, getImplicitDependencies(), TargetPlatformHelper.getState(), false, true, toSet(excludeFragments)); }
/** * Returns a {@link Set} of bundle ids for the dependents of the given * objects from the given {@link State}. * The set does not include the ids of the given objects * and only includes the given set of implicit dependencies. * * @param selected the group of objects to compute dependencies for. Any items * in this array that are not {@link IPluginModelBase}s are ignored. * @param implicit the array of additional implicit dependencies to add to the {@link Set} * @param state the {@link State} to compute the dependencies in * @param excludeFragments a collection of <b>fragment</b> bundle symbolic names to exclude from the dependency resolution * or <code>null</code> if none * @return a set of bundle IDs */ public static Set<String> getDependencies(Object[] selected, String[] implicit, State state, String[] excludeFragments) { return getDependencies(selected, implicit, state, true, true, toSet(excludeFragments)); }
/** * @return a set of plug-in IDs * */ public static Set getDependencies(Object[] selected, boolean includeOptional) { return getDependencies(selected, getImplicitDependencies(), TargetPlatformHelper.getState(), true, includeOptional); }
/** * @return a set of plug-in IDs * */ public static Set getDependencies(Object[] selected, String[] implicit, State state) { return getDependencies(selected, implicit, state, true, true); }
continue; IPluginModelBase model = (IPluginModelBase)selected[i]; addBundleAndDependencies(model.getBundleDescription(), set, includeOptional); IPluginExtension[] extensions = model.getPluginBase().getExtensions(); for (int j = 0; j < extensions.length; j++) { if (dot != -1) { String id = point.substring(0, dot); addBundleAndDependencies(state.getBundle(id, null), set, includeOptional); addBundleAndDependencies(state.getBundle(implicit[i], null), set, includeOptional);
private void handleSelectDependencies() { IStructuredSelection selection = fTreeViewer.getStructuredSelection(); if (selection.isEmpty()) return; IPluginModelBase[] models = new IPluginModelBase[selection.size()]; System.arraycopy(selection.toArray(), 0, models, 0, selection.size()); Set<?> set = DependencyManager.getSelfandDependencies(models, null); Object[] symbolicNames = set.toArray(); ArrayList<IPluginModelBase> result = new ArrayList<>(set.size()); for (Object symbolicName : symbolicNames) { IPluginModelBase model = PluginRegistry.findModel(symbolicName.toString()); if (model != null) result.add(model); } fTreeViewer.setSelection(new StructuredSelection(result.toArray())); }
public static boolean requiresUI(ILaunchConfiguration configuration) { try { String projectID = configuration.getAttribute(IJavaLaunchConfigurationConstants.ATTR_PROJECT_NAME, ""); //$NON-NLS-1$ if (projectID.length() > 0) { IResource project = PDELaunchingPlugin.getWorkspace().getRoot().findMember(projectID); if (project instanceof IProject) { IPluginModelBase model = PluginRegistry.findModel((IProject) project); if (model != null) { Set plugins = DependencyManager.getSelfAndDependencies(model, null); return plugins.contains("org.eclipse.swt"); //$NON-NLS-1$ } } } } catch (CoreException e) { } return true; }
/** * @return a set of plug-in IDs * */ public static Set getSelfandDependencies(IPluginModelBase[] models) { return getDependencies(models, getImplicitDependencies(), TargetPlatformHelper.getState(), false, true); }
/** * Looks at the currently checked plugins and finds any plug-ins required by them. The required plug-ins are * then also checked in the tree */ protected void addRequiredPlugins() { Object[] checked = fPluginTreeViewer.getCheckedElements(); Set<IPluginModelBase> toCheck = Arrays.stream(checked).filter(IPluginModelBase.class::isInstance) .map(IPluginModelBase.class::cast).collect(Collectors.toSet()); Set<String> additionalIds = DependencyManager.getDependencies(toCheck.toArray(), fIncludeOptionalButton.getSelection(), null); additionalIds.stream().map(id -> PluginRegistry.findEntry(id)) .filter(Objects::nonNull).map(entry -> entry.getModel()) .forEach(model -> toCheck.add(model)); checked = toCheck.toArray(); setCheckedElements(checked); fNumExternalChecked = 0; fNumWorkspaceChecked = 0; for (Object checkedElement : checked) { if (((IPluginModelBase) checkedElement).getUnderlyingResource() != null) { fNumWorkspaceChecked += 1; } else { fNumExternalChecked += 1; } } adjustGroupState(); }
continue; IPluginModelBase model = (IPluginModelBase) selected[i]; addBundleAndDependencies(model.getBundleDescription(), set, includeOptional, excludeFragments); IPluginExtension[] extensions = model.getPluginBase().getExtensions(); for (int j = 0; j < extensions.length; j++) { if (dot != -1) { String id = point.substring(0, dot); addBundleAndDependencies(state.getBundle(id, null), set, includeOptional, excludeFragments); addBundleAndDependencies(state.getBundle(implicit[i], null), set, includeOptional, excludeFragments);
baseline = new WorkspaceBaseline(); Set<String> ids = DependencyManager.getSelfandDependencies(PluginRegistry.getWorkspaceModels(), null); List<IApiComponent> componentsList = new ArrayList<>(ids.size()); IApiComponent apiComponent = null;
private void initializePluginsList(ILaunchConfigurationWorkingCopy wc) { StringBuilder wsplugins = new StringBuilder(); StringBuilder explugins = new StringBuilder(); Set<?> plugins = DependencyManager.getSelfAndDependencies(fModel, null); Iterator<?> iter = plugins.iterator(); while (iter.hasNext()) { String id = iter.next().toString(); IPluginModelBase model = PluginRegistry.findModel(id); if (model == null || !model.isEnabled()) continue; if (model.getUnderlyingResource() == null) { appendPlugin(explugins, model); } else { appendPlugin(wsplugins, model); } } wc.setAttribute(IPDELauncherConstants.SELECTED_WORKSPACE_PLUGINS, wsplugins.toString()); wc.setAttribute(IPDELauncherConstants.SELECTED_TARGET_PLUGINS, explugins.toString()); }
/** * Returns a {@link Set} of bundle ids for the dependents of the given * {@link IPluginModelBase}. The set includes the id of the given model base * as well as all computed implicit / optional dependencies. * * @param model the {@link IPluginModelBase} to compute dependencies for * @param excludeFragments a collection of <b>fragment</b> bundle symbolic names to exclude from the dependency resolution * or <code>null</code> if none * @return a set of bundle IDs */ public static Set<String> getSelfAndDependencies(IPluginModelBase model, String[] excludeFragments) { return getDependencies(new Object[] {model}, getImplicitDependencies(), TargetPlatformHelper.getState(), false, true, toSet(excludeFragments)); }
/** * @return a set of plug-in IDs * */ public static Set getSelfAndDependencies(IPluginModelBase model) { return getDependencies(new Object[] {model}, getImplicitDependencies(), TargetPlatformHelper.getState(), false, true); }
Set additionalIds = DependencyManager.getDependencies(launchPlugins.toArray(), false, new String[] {"org.eclipse.ui.workbench.compatibility"}); //$NON-NLS-1$ Iterator it = additionalIds.iterator(); while (it.hasNext()) {
private static void addBundleAndDependencies(BundleDescription desc, Set set, boolean includeOptional) { if (desc != null && set.add(desc.getSymbolicName())) { BundleSpecification[] required = desc.getRequiredBundles(); for (int i = 0; i < required.length; i++) { if (includeOptional || !required[i].isOptional()) addBundleAndDependencies((BundleDescription)required[i].getSupplier(), set, includeOptional); } ImportPackageSpecification[] importedPkgs = desc.getImportPackages(); for (int i = 0; i < importedPkgs.length; i++) { ExportPackageDescription exporter = (ExportPackageDescription)importedPkgs[i].getSupplier(); // Continue if the Imported Package is unresolved of the package is optional and don't want optional packages if (exporter == null || (!includeOptional && Constants.RESOLUTION_OPTIONAL.equals(importedPkgs[i].getDirective(Constants.RESOLUTION_DIRECTIVE)))) continue; addBundleAndDependencies(exporter.getExporter(), set, includeOptional); } BundleDescription[] fragments = desc.getFragments(); for (int i = 0; i < fragments.length; i++) { if (!fragments[i].isResolved()) continue; String id = fragments[i].getSymbolicName(); if (!"org.eclipse.ui.workbench.compatibility".equals(id)) //$NON-NLS-1$ addBundleAndDependencies(fragments[i], set, includeOptional); } HostSpecification host = desc.getHost(); if (host != null) addBundleAndDependencies((BundleDescription)host.getSupplier(), set, includeOptional); } }
/** * Returns a {@link Set} of bundle ids for the dependents of the given * objects. The set does not include the ids of the given objects * but does include the computed set of implicit dependencies. * * @param selected selected the group of objects to compute dependencies for. Any items * in this array that are not {@link IPluginModelBase}s are ignored. * @param includeOptional if optional bundle ids should be included * @param excludeFragments a collection of <b>fragment</b> bundle symbolic names to exclude from the dependency resolution * or <code>null</code> if none * @return a set of bundle IDs */ public static Set<String> getDependencies(Object[] selected, boolean includeOptional, String[] excludeFragments) { return getDependencies(selected, getImplicitDependencies(), TargetPlatformHelper.getState(), true, includeOptional, toSet(excludeFragments)); }
dependencies.addAll(DependencyManager.getDependencies(checkedModels.toArray(), implicitIDs.toArray(new String[implicitIDs.size()]), state.getState(), null)); subMonitor.worked(50);
for (int i = 0; i < required.length; i++) { if (includeOptional || !required[i].isOptional()) { addBundleAndDependencies((BundleDescription) required[i].getSupplier(), set, includeOptional, excludeFragments); continue; addBundleAndDependencies(exporter.getExporter(), set, includeOptional, excludeFragments); addBundleAndDependencies(fragments[i], set, includeOptional, excludeFragments); addBundleAndDependencies((BundleDescription) host.getSupplier(), set, includeOptional, excludeFragments);