javadocs for IOpenDelegate
diff --git a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/DelegatedOpen.java b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/DelegatedOpen.java
index 7be6e3b..31f9a77 100644
--- a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/DelegatedOpen.java
+++ b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/DelegatedOpen.java
@@ -12,11 +12,19 @@
package org.eclipse.dltk.internal.ui;
import org.eclipse.core.runtime.CoreException;
+import org.eclipse.dltk.codeassist.ISelectionEngine;
import org.eclipse.dltk.core.ModelException;
import org.eclipse.dltk.ui.IOpenDelegate;
import org.eclipse.ui.IEditorPart;
import org.eclipse.ui.PartInitException;
+/**
+ * Instances of this class are used to represent foreign elements returned from
+ * the {@link ISelectionEngine} after the corresponding {@link IOpenDelegate}
+ * factory was found.
+ *
+ * @see IOpenDelegate
+ */
public class DelegatedOpen {
private final IOpenDelegate adapter;
private final Object object;
@@ -32,6 +40,8 @@
return adapter.openInEditor(object, activate);
} catch (PartInitException e) {
throw e;
+ } catch (ModelException e) {
+ throw e;
} catch (CoreException e) {
throw new ModelException(e);
}
diff --git a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/OpenDelegateManager.java b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/OpenDelegateManager.java
index 43a0b59..abe6963 100644
--- a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/OpenDelegateManager.java
+++ b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/OpenDelegateManager.java
@@ -11,16 +11,19 @@
*******************************************************************************/
package org.eclipse.dltk.internal.ui;
-import org.eclipse.dltk.ui.DLTKUIPlugin;
+import static org.eclipse.dltk.ui.DLTKUIPlugin.PLUGIN_ID;
+
import org.eclipse.dltk.ui.IOpenDelegate;
import org.eclipse.dltk.utils.LazyExtensionManager;
public class OpenDelegateManager extends LazyExtensionManager<IOpenDelegate> {
+ public static final String EXT_POINT = PLUGIN_ID + ".openDelegate"; //$NON-NLS-1$
+
private static final OpenDelegateManager MANAGER = new OpenDelegateManager();
private OpenDelegateManager() {
- super(DLTKUIPlugin.PLUGIN_ID + ".openDelegate");
+ super(EXT_POINT);
}
public static IOpenDelegate findFor(Object object) {
diff --git a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/IOpenDelegate.java b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/IOpenDelegate.java
index d33e812..83306b1 100644
--- a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/IOpenDelegate.java
+++ b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/IOpenDelegate.java
@@ -12,18 +12,40 @@
package org.eclipse.dltk.ui;
import org.eclipse.core.runtime.CoreException;
+import org.eclipse.dltk.annotations.ExtensionPoint;
+import org.eclipse.dltk.codeassist.ISelectionEngine;
+import org.eclipse.dltk.codeassist.ISelectionRequestor;
+import org.eclipse.dltk.internal.ui.OpenDelegateManager;
import org.eclipse.ui.IEditorPart;
import org.eclipse.ui.PartInitException;
/**
+ * Implementations of this interface allow opening foreign elements reported by
+ * {@link ISelectionEngine} thru the
+ * {@link ISelectionRequestor#acceptForeignElement(Object)} method.
+ *
+ * Contributed implementations are instantiated once and used as factories,
+ * handling multiple reported objects.
+ *
* @since 3.0
*/
+@ExtensionPoint(point = OpenDelegateManager.EXT_POINT, element = "delegate", attribute = "class")
public interface IOpenDelegate {
+ /**
+ * Checks if this factory can handle the specified element.
+ */
boolean supports(Object object);
+ /**
+ * Returns the display name of the specified element, if supported or
+ * <code>null</code> otherwise.
+ */
String getName(Object object);
+ /**
+ * Opens the specified element in the editor.
+ */
IEditorPart openInEditor(Object object, boolean activate)
throws PartInitException, CoreException;