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); }
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); } }
public void start() { PDECore.getDefault().getModelManager().addStateDeltaListener(this); JavaCore.addPreProcessingResourceChangedListener(this, IResourceChangeEvent.PRE_BUILD); }
public void dispose() { PluginModelManager manager = PDECore.getDefault().getModelManager(); manager.removePluginModelListener(fModelListener); manager.removeExtensionDeltaListener(fExtensionListener); if (xmlTracker != null) { xmlTracker.close(); xmlTracker = null; } }
@Override public void init(IWorkbench workbench) { // ensures default targets are created when page is opened (if not created yet) PluginModelManager manager = PDECore.getDefault().getModelManager(); if (!manager.isInitialized()) { manager.getExternalModelManager(); } }
@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; } };
/** * 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(); }
IPluginModelBase[] models = getWorkspaceModels(); for (int i = 0; i < models.length; i++) { IProject project = models[i].getUnderlyingResource().getProject(); IPluginModelBase model = findModel(deltas[i].getBundle()); IResource resource = model == null ? null : model.getUnderlyingResource(); if (resource != null) { IPluginModelBase[] models = getWorkspaceModels(); for (int i = 0; i < models.length; i++) { IProject project = models[i].getUnderlyingResource().getProject();
@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); } }
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); if (root.isExternal()) { String path = root.getPath().toOSString(); IPluginModelBase[] externalModels = PDECore.getDefault().getModelManager().getExternalModels(); for (IPluginModelBase externalModel : externalModels) { if (path.equals(externalModel.getInstallLocation())) {
public void attachModelListener() { PDECore.getDefault().getModelManager().addPluginModelListener(this); }
public void removeModelListener() { PDECore.getDefault().getModelManager().removePluginModelListener(this); }
public BaseImportWizardSecondPage(String pageName, PluginImportWizardFirstPage page) { super(pageName); fPage1 = page; PDECore.getDefault().getModelManager().getExternalModelManager().addModelProviderListener(this); }
@Override public Object[] getChildren(Object parentElement) { if (parentElement instanceof IDeferredWorkbenchAdapter) { if (PDECore.getDefault().getModelManager().isInitialized()) return PDECore.getDefault().getModelManager().getAllModels(); Object[] children = fManager.getChildren(parentElement); return children; } if (parentElement instanceof IPluginModelBase) { IPluginModelBase model = (IPluginModelBase) parentElement; File file = new File(model.getInstallLocation()); if (!file.isFile()) { FileAdapter adapter = new ModelFileAdapter(model, file, PDECore.getDefault().getSearchablePluginsManager()); return adapter.getChildren(); } } if (parentElement instanceof FileAdapter) { return ((FileAdapter) parentElement).getChildren(); } if (parentElement instanceof IPackageFragmentRoot || parentElement instanceof IPackageFragment || parentElement instanceof ICompilationUnit || parentElement instanceof IStorage) return fJavaProvider.getChildren(parentElement); return new Object[0]; }
/** * Returns all plug-ins and fragments in the workspace as well as all target plug-ins and fragments, regardless * whether or not they are checked or not on the Target Platform preference page. * <p> * If a workspace plug-in/fragment has the same ID as a target plug-in, the target counterpart * is skipped and not included. * </p> * <p> * Equivalent to <code>getAllModels(true)</code> * </p> * * @return all plug-ins and fragments in the workspace as well as all target plug-ins and fragments, regardless * whether or not they are checked on the Target Platform preference page. */ public IPluginModelBase[] getAllModels() { return getAllModels(true); }
/** * Returns all plug-ins and fragments in the workspace as well as all plug-ins and fragments that are * checked on the Target Platform preference page. * <p> * If a workspace plug-in/fragment has the same ID as a target plug-in/fragment, the target counterpart * is skipped and not included. * </p> * <p> * Equivalent to <code>getActiveModels(true)</code> * </p> * * @return all plug-ins and fragments in the workspace as well as all plug-ins and fragments that are * checked on the Target Platform preference page. */ public IPluginModelBase[] getActiveModels() { return getActiveModels(true); }
/** * Return the model manager that keeps track of plug-ins in the target platform * * @return the model manager that keeps track of plug-ins in the target platform */ public static IPluginModelBase[] getExternalModels() { return PDECore.getDefault().getModelManager().getExternalModels(); }
public boolean areModelsInitialized() { return fModelManager != null && fModelManager.isInitialized(); }
protected void connectListeners() { // Listen for model changes to register new bundles and unregister removed bundles PluginModelManager manager = PDECore.getDefault().getModelManager(); manager.addPluginModelListener(fModelListener = new ModelListener()); manager.addExtensionDeltaListener(fExtensionListener = new ExtensionListener()); }
protected IStatus run(IProgressMonitor monitor) { EclipseHomeInitializer.resetEclipseHomeVariable(); PDECore.getDefault().getSourceLocationManager().reset(); PDECore.getDefault().getJavadocLocationManager().reset(); IPluginModelBase[] models = fState.getTargetModels(); removeDisabledBundles(models); PluginModelManager manager = PDECore.getDefault().getModelManager(); manager.getExternalModelManager().setModels(models); manager.resetState(fState); PDECore.getDefault().getFeatureModelManager().targetReloaded(); monitor.done(); return Status.OK_STATUS; }