X-Git-Url: http://git.phpeclipse.com
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/text/java/hover/JavaEditorTextHoverDescriptor.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/text/java/hover/JavaEditorTextHoverDescriptor.java
index 7f8148f..e2820e6 100644
--- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/text/java/hover/JavaEditorTextHoverDescriptor.java
+++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/text/java/hover/JavaEditorTextHoverDescriptor.java
@@ -25,14 +25,13 @@ import net.sourceforge.phpeclipse.phpeditor.EditorUtility;
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.
@@ -59,18 +58,16 @@ public class JavaEditorTextHoverDescriptor implements Comparable {
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.
*
@@ -107,7 +104,8 @@ public class JavaEditorTextHoverDescriptor implements Comparable {
* 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);
@@ -118,7 +116,6 @@ public class JavaEditorTextHoverDescriptor implements Comparable {
return null;
}
-
//---- XML Attribute accessors ---------------------------------------------
/**
@@ -183,35 +180,35 @@ public class JavaEditorTextHoverDescriptor implements Comparable {
return Collator.getInstance().compare(getLabel(), ((JavaEditorTextHoverDescriptor)o).getLabel());
}
- /**
- * @param descriptor a JavaEditorTextHoverDescriptor
- * @return true
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 true
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);
@@ -309,4 +306,14 @@ public class JavaEditorTextHoverDescriptor implements Comparable {
public boolean isEnabled() {
return fIsEnabled;
}
+
+ /**
+ * Returns this hover descriptors configuration element.
+ *
+ * @return the configuration element
+ * @since 3.0
+ */
+ public IConfigurationElement getConfigurationElement() {
+ return fElement;
+ }
}