/** * Returns the plug-in model corresponding to the given project, or <code>null</code> * if the project does not represent a plug-in project or if it contains a manifest file * that is malformed or missing vital information. * * @param project the project * @return a plug-in model corresponding to the project or <code>null</code> if the project * is not a plug-in project */ public static IPluginModelBase findModel(IProject project) { return PDECore.getDefault().getModelManager().findModel(project); }
/** * Returns the plug-in model corresponding to the given project, or <code>null</code> * if the project does not represent a plug-in project or if it contains a manifest file * that is malformed or missing vital information. * * @param project the project * @return a plug-in model corresponding to the project or <code>null</code> if the project * is not a plug-in project */ public static IPluginModelBase findModel(IProject project) { return PDECore.getDefault().getModelManager().findModel(project); }
private static IPluginModelBase findModel(IProject p) { // PluginRegistry is specific to Eclipse 3.3+. Use PDECore for compatibility with 3.2 // return PluginRegistry.findModel(p); return PDECore.getDefault().getModelManager().findModel(p); }
private static IPluginModelBase findModel(BundleDescription bd) { // PluginRegistry is specific to Eclipse 3.3+. Use PDECore for compatibility with 3.2 // return PluginRegistry.findModel(bd); return PDECore.getDefault().getModelManager().findModel(bd); } }
/** * Returns a plug-in model associated with the given bundle description * * @param desc the bundle description * * @return a plug-in model associated with the given bundle description or <code>null</code> * if none exists */ public static IPluginModelBase findModel(BundleDescription desc) { return PDECore.getDefault().getModelManager().findModel(desc); }
/** * Returns a plug-in model associated with the given bundle description * * @param desc the bundle description * * @return a plug-in model associated with the given bundle description or <code>null</code> * if none exists */ public static IPluginModelBase findModel(BundleDescription desc) { return PDECore.getDefault().getModelManager().findModel(desc); }
/** * Returns the plug-in model for the best match plug-in with the given ID. * A null value is returned if no such bundle is found in the workspace or target platform. * <p> * A workspace plug-in is always preferably returned over a target plug-in. * A plug-in that is checked/enabled on the Target Platform preference page is always * preferably returned over a target plug-in that is unchecked/disabled. * </p> * <p> * In the case of a tie among workspace plug-ins or among target plug-ins, * the plug-in with the highest version is returned. * </p> * <p> * In the case of a tie among more than one suitable plug-in that have the same version, * one of those plug-ins is randomly returned. * </p> * * @param id the plug-in ID * @return the plug-in model for the best match plug-in with the given ID */ public static IPluginModelBase findModel(String id) { return PDECore.getDefault().getModelManager().findModel(id); }
/** * Returns the plug-in model for the best match plug-in with the given ID. * A null value is returned if no such bundle is found in the workspace or target platform. * <p> * A workspace plug-in is always preferably returned over a target plug-in. * A plug-in that is checked/enabled on the Target Platform preference page is always * preferably returned over a target plug-in that is unchecked/disabled. * </p> * <p> * In the case of a tie among workspace plug-ins or among target plug-ins, * the plug-in with the highest version is returned. * </p> * <p> * In the case of a tie among more than one suitable plug-in that have the same version, * one of those plug-ins is randomly returned. * </p> * * @param id the plug-in ID * @return the plug-in model for the best match plug-in with the given ID */ public static IPluginModelBase findModel(String id) { return PDECore.getDefault().getModelManager().findModel(id); }
@Override public double getSchemaVersion() { if (fTargetVersion == 0) { IPluginModelBase model = PDECore.getDefault().getModelManager().findModel(fPluginID); if (model != null) { IPluginBase base = model.getPluginBase(); if (base != null) { if (base.getSchemaVersion() != null) { fTargetVersion = Double.parseDouble(base.getSchemaVersion()); } } } if (fTargetVersion == 0) { // Use default for target platform fTargetVersion = Double.parseDouble(TargetPlatformHelper.getSchemaVersion()); } } return fTargetVersion; } }
@Override protected void findSecondaryDependencies(String[] secDeps, Set<String> ignorePkgs, Map<ExportPackageDescription, String> additionalDeps, IBundle bundle, boolean useRequireBundle, IProgressMonitor monitor) { SubMonitor subMonitor = SubMonitor.convert(monitor, PDEUIMessages.AddNewDependenciesOperation_searchProject, 100); Set<?> projectPkgs = PackageFinder.findPackagesInClassFiles(fClassFiles, subMonitor.split(75)); PluginModelManager manager = PDECore.getDefault().getModelManager(); IProgressMonitor searchMonitor = subMonitor.split(25); searchMonitor.beginTask("", secDeps.length); //$NON-NLS-1$ for (String secDep : secDeps) { IPluginModelBase base = manager.findModel(secDep); if (base != null) { ExportPackageDescription pkgs[] = findExportedPackages(base.getBundleDescription()); for (int j = 0; j < pkgs.length; j++) { String pkgName = pkgs[j].getName(); if (!ignorePkgs.contains(pkgName) && projectPkgs.contains(pkgName)) { additionalDeps.put(pkgs[j], secDep); ignorePkgs.add(pkgName); if (useRequireBundle) { while (j < pkgs.length) { ignorePkgs.add(pkgs[j].getName()); j++; } } } } } searchMonitor.worked(1); } }
if (project != null) { if (project.hasNature(IBundleProjectDescription.PLUGIN_NATURE)) { IPluginModelBase pluginModel = PDECore.getDefault().getModelManager().findModel(project); if (pluginModel != null) { IBuildModel buildModel = PluginRegistry.createBuildModel(pluginModel);
private IProject[] getExportedWorkspaceProjects(Object[] exportedItems) throws CoreException { if (fWorkspaceProjects == null) { // TODO This won't work for nested features either Set<IProject> projects = new HashSet<>(); for (int i = 0; i < exportedItems.length; i++) { if (exportedItems[i] instanceof IPluginModelBase) { IPath installLocation = new Path(((IPluginModelBase) exportedItems[i]).getInstallLocation()); IProject project = PDECore.getWorkspace().getRoot().getProject(installLocation.lastSegment()); if (project.exists()) { projects.add(project); } } else if (exportedItems[i] instanceof IFeatureModel) { IFeatureModel feature = (IFeatureModel) exportedItems[i]; IFeaturePlugin[] plugins = feature.getFeature().getPlugins(); for (int j = 0; j < plugins.length; j++) { IPluginModelBase plugin = PDECore.getDefault().getModelManager().findModel(plugins[j].getId()); if (plugin != null) { IPath installLocation = new Path(plugin.getInstallLocation()); IProject project = PDECore.getWorkspace().getRoot().getProject(installLocation.lastSegment()); if (project.exists()) { projects.add(project); } } } } } fWorkspaceProjects = computeReferencedBuildOrder(projects.toArray(new IProject[projects.size()])); } return fWorkspaceProjects; }
IPluginModelBase model = findModel(deltas[i].getBundle()); IResource resource = model == null ? null : model.getUnderlyingResource(); if (resource != null) {
IPluginModelBase model = findModel(deltas[i].getBundle()); IResource resource = model == null ? null : model.getUnderlyingResource(); if (resource != null) {
Map<String, Set<IPath>> modelOutput = getPluginOutputFolders(buildModel, javaProject); if (!modelOutput.isEmpty()) { IPluginModelBase model = PDECore.getDefault().getModelManager().findModel(projects[i]); if (model != null) { result.put(model.getBundleDescription().getSymbolicName(), modelOutput);
model = ((IPluginExtensionPoint) next).getPluginModel(); } else if (next instanceof BundleDescription) { model = PDECore.getDefault().getModelManager().findModel((BundleDescription) next); } else if (next instanceof BundleSpecification) { model = PDECore.getDefault().getModelManager().findModel(desc);
fResult = findSourceElement_legacy(classLoaderObject, sourcePath); } else if (MAIN_CLASS.equals(declaringTypeName)) { IPluginModelBase model = PDECore.getDefault().getModelManager().findModel(MAIN_PLUGIN); if (model != null) fResult = getSourceElement(model.getInstallLocation(), MAIN_PLUGIN, sourcePath, true);
@Override public void initialize(IPath containerPath, IJavaProject javaProject) throws CoreException { IProject project = javaProject.getProject(); // The first project to be built may initialize the PDE models, potentially long running, so allow cancellation PluginModelManager manager = PDECore.getDefault().getModelManager(); if (!manager.isInitialized()) { Job initPDEJob = new Job(PDECoreMessages.PluginModelManager_InitializingPluginModels) { @Override protected IStatus run(IProgressMonitor monitor) { if (!PDECore.getDefault().getModelManager().isInitialized()) { PDECore.getDefault().getModelManager().targetReloaded(monitor); } if (monitor.isCanceled()) return Status.CANCEL_STATUS; return Status.OK_STATUS; } }; initPDEJob.schedule(); try { initPDEJob.join(); } catch (InterruptedException e) { } } if (project.exists() && project.isOpen()) { IPluginModelBase model = manager.findModel(project); JavaCore.setClasspathContainer(PDECore.REQUIRED_PLUGINS_CONTAINER_PATH, new IJavaProject[] {javaProject}, new IClasspathContainer[] {new RequiredPluginsClasspathContainer(model)}, null); } }
protected void makeScripts(IProgressMonitor monitor) throws InvocationTargetException, CoreException { AJBuildScriptGenerator generator = new AJBuildScriptGenerator(); AJBuildScriptGenerator.setEmbeddedSource(AbstractScriptGenerator .getDefaultEmbeddedSource()); AJBuildScriptGenerator.setForceUpdateJar(AbstractScriptGenerator .getForceUpdateJarFormat()); AJBuildScriptGenerator.setConfigInfo(AbstractScriptGenerator .getDefaultConfigInfos()); IProject project = fManifestFile.getProject(); List inpath = getInpath(project); List aspectpath = getAspectpath(project); generator.setInpath(inpath); generator.setAspectpath(aspectpath); generator.setWorkingDirectory(project.getLocation().toOSString()); String url = ClasspathHelper.getDevEntriesProperties(project .getLocation().addTrailingSeparator().toString() + "dev.properties", false); //$NON-NLS-1$ generator.setDevEntries(url); generator.setPDEState(TargetPlatformHelper.getState()); generator.setNextId(TargetPlatformHelper.getPDEState().getNextId()); generator.setStateExtraData(TargetPlatformHelper.getBundleClasspaths(TargetPlatformHelper.getPDEState()), TargetPlatformHelper.getPatchMap(TargetPlatformHelper.getPDEState())); generator.setBuildingOSGi(true); IPluginModelBase model = PDECore.getDefault().getModelManager().findModel(project); generator.setElements(new String[] { "plugin@" +model.getPluginBase().getId() }); //$NON-NLS-1$ generator.generate(); }