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; }
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); } } }