private IPluginModelBase findModel(IAdaptable object) {
   if (object instanceof IJavaProject) object = ((IJavaProject) object).getProject();
   if (object instanceof IProject) return PluginRegistry.findModel((IProject) object);
   if (object instanceof PersistablePluginObject) {
     return PluginRegistry.findModel(((PersistablePluginObject) object).getPluginID());
   }
   return null;
 }
Ejemplo n.º 2
0
 private void initializeModel(IStructuredSelection selection) {
   Object selected = selection.getFirstElement();
   if (selected instanceof IAdaptable) {
     IResource resource = (IResource) ((IAdaptable) selected).getAdapter(IResource.class);
     if (resource != null) {
       IProject project = resource.getProject();
       fModel = PluginRegistry.findModel(project);
     }
   }
 }
  private void initialize() {
    if (fWorkingSet != null) {
      HashSet<String> set = new HashSet<String>();
      IAdaptable[] elements = fWorkingSet.getElements();
      for (int i = 0; i < elements.length; i++) {
        if (elements[i] instanceof PersistablePluginObject)
          set.add(((PersistablePluginObject) elements[i]).getPluginID());
      }

      IPluginModelBase[] bases = PluginRegistry.getAllModels();
      for (int i = 0; i < bases.length; i++) {

        String id = bases[i].getPluginBase().getId();
        if (id == null) continue;
        if (set.contains(id)) {
          fTree.getCheckboxTreeViewer().setChecked(bases[i], true);
          set.remove(id);
        }
        if (set.isEmpty()) break;
      }
      fWorkingSetName.setText(fWorkingSet.getName());
    }
  }
 public Object[] getElements(Object inputElement) {
   return PluginRegistry.getAllModels();
 }