import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IConfigurationElement;
-import org.eclipse.core.runtime.IPluginDescriptor;
-import org.eclipse.core.runtime.IPluginPrerequisite;
-import org.eclipse.core.runtime.IPluginRegistry;
+import org.eclipse.core.runtime.IExtensionRegistry;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Platform;
import org.eclipse.core.runtime.Status;
import org.eclipse.jface.text.Assert;
import org.eclipse.swt.SWT;
+import org.osgi.framework.Bundle;
/**
* Describes a Java editor text hover.
private IConfigurationElement fElement;
-
/**
* Returns all Java editor text hovers contributed to the workbench.
*/
public static JavaEditorTextHoverDescriptor[] getContributedHovers() {
- IPluginRegistry registry= Platform.getPluginRegistry();
+ IExtensionRegistry registry= Platform.getExtensionRegistry();
IConfigurationElement[] elements= registry.getConfigurationElementsFor(JAVA_EDITOR_TEXT_HOVER_EXTENSION_POINT);
JavaEditorTextHoverDescriptor[] hoverDescs= createDescriptors(elements);
initializeFromPreferences(hoverDescs);
return hoverDescs;
}
-
/**
* Computes the state mask for the given modifier string.
*
* Creates the Java editor text hover.
*/
public IJavaEditorTextHover createTextHover() {
- boolean isHoversPlugInActivated= fElement.getDeclaringExtension().getDeclaringPluginDescriptor().isPluginActivated();
+ String pluginId = fElement.getDeclaringExtension().getNamespace();
+ boolean isHoversPlugInActivated= Platform.getBundle(pluginId).getState() == Bundle.ACTIVE;
if (isHoversPlugInActivated || canActivatePlugIn()) {
try {
return (IJavaEditorTextHover)fElement.createExecutableExtension(CLASS_ATTRIBUTE);
return null;
}
-
//---- XML Attribute accessors ---------------------------------------------
/**
return Collator.getInstance().compare(getLabel(), ((JavaEditorTextHoverDescriptor)o).getLabel());
}
- /**
- * @param descriptor a JavaEditorTextHoverDescriptor
- * @return <code>true</code> if this contributed hover depends on the other one
- */
- public boolean dependsOn(JavaEditorTextHoverDescriptor descriptor) {
- if (descriptor == null)
- return false;
-
- IPluginDescriptor thisPluginDescriptor= fElement.getDeclaringExtension().getDeclaringPluginDescriptor();
- IPluginDescriptor otherPluginDescriptor= descriptor.fElement.getDeclaringExtension().getDeclaringPluginDescriptor();
- return dependsOn(thisPluginDescriptor, otherPluginDescriptor);
- }
-
- private boolean dependsOn(IPluginDescriptor descriptor0, IPluginDescriptor descriptor1) {
-
- IPluginRegistry registry= Platform.getPluginRegistry();
- IPluginPrerequisite[] prerequisites= descriptor0.getPluginPrerequisites();
-
- for (int i= 0; i < prerequisites.length; i++) {
- IPluginPrerequisite prerequisite= prerequisites[i];
- String id= prerequisite.getUniqueIdentifier();
- IPluginDescriptor descriptor= registry.getPluginDescriptor(id);
-
- if (descriptor != null && (descriptor.equals(descriptor1) || dependsOn(descriptor, descriptor1)))
- return true;
- }
-
- return false;
- }
+// /**
+// * @param descriptor a JavaEditorTextHoverDescriptor
+// * @return <code>true</code> if this contributed hover depends on the other one
+// */
+// public boolean dependsOn(JavaEditorTextHoverDescriptor descriptor) {
+// if (descriptor == null)
+// return false;
+//
+// IPluginDescriptor thisPluginDescriptor= fElement.getDeclaringExtension().getDeclaringPluginDescriptor();
+// IPluginDescriptor otherPluginDescriptor= descriptor.fElement.getDeclaringExtension().getDeclaringPluginDescriptor();
+// return dependsOn(thisPluginDescriptor, otherPluginDescriptor);
+// }
+
+// private boolean dependsOn(IPluginDescriptor descriptor0, IPluginDescriptor descriptor1) {
+//
+// IPluginRegistry registry= Platform.getPluginRegistry();
+// IPluginPrerequisite[] prerequisites= descriptor0.getPluginPrerequisites();
+//
+// for (int i= 0; i < prerequisites.length; i++) {
+// IPluginPrerequisite prerequisite= prerequisites[i];
+// String id= prerequisite.getUniqueIdentifier();
+// IPluginDescriptor descriptor= registry.getPluginDescriptor(id);
+//
+// if (descriptor != null && (descriptor.equals(descriptor1) || dependsOn(descriptor, descriptor1)))
+// return true;
+// }
+//
+// return false;
+// }
private static JavaEditorTextHoverDescriptor[] createDescriptors(IConfigurationElement[] elements) {
List result= new ArrayList(elements.length);