Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 107160 Details for
Bug 240423
[wikitext] specify extension point for resource hyperlink detectors
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read
this important communication.
[patch]
extension point reader
clipboard.txt (text/plain), 15.78 KB, created by
Jingwen 'Owen' Ou
on 2008-07-10 23:33:29 EDT
(
hide
)
Description:
extension point reader
Filename:
MIME Type:
Creator:
Jingwen 'Owen' Ou
Created:
2008-07-10 23:33:29 EDT
Size:
15.78 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.mylyn.sandbox.ui >Index: plugin.xml >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.mylyn/sandbox/org.eclipse.mylyn.sandbox.ui/plugin.xml,v >retrieving revision 1.87 >diff -u -r1.87 plugin.xml >--- plugin.xml 4 Jul 2008 18:29:40 -0000 1.87 >+++ plugin.xml 11 Jul 2008 03:32:26 -0000 >@@ -2,7 +2,8 @@ > <?eclipse version="3.0"?> > <plugin> > <extension-point id="taskEditorExtensions" name="Task Editor Extension" schema="schema/taskEditorExtensions.exsd"/> >- >+ <extension-point id="resourceHyperlinkExtensions" name="Resource Hyperlink Extension" schema="schema/resourceHyperlinkExtensions.exsd"/> >+ > <extension point="org.eclipse.ui.views"> > <category name="Experimental" id="org.eclipse.mylyn.sandbox"/> > </extension> >@@ -404,8 +405,37 @@ > </propertyTester> > </extension> > >- >- >+ <extension >+ point="org.eclipse.ui.workbench.texteditor.hyperlinkDetectors"> >+ <hyperlinkDetector >+ class="org.eclipse.mylyn.internal.sandbox.ui.hyperlinks.ResourceHyperlinkDetector" >+ id="org.eclipse.mylyn.sandbox.ui.hyperlinkDetector" >+ name="Resource Hyperlink Detector" >+ targetId="org.eclipse.ui.DefaultTextEditor"> >+ </hyperlinkDetector> >+ </extension> >+ <!-- >+ <extension >+ point="org.eclipse.mylyn.sandbox.ui.resourceHyperlinkExtensions"> >+ <resourceHyperlinkExtension >+ class="org.eclipse.mylyn.internal.sandbox.ui.hyperlinks.JavaResourceHyperlinkExtension" >+ fileType="java" >+ generatedPrefix="java class"> >+ </resourceHyperlinkExtension> >+ <resourceHyperlinkExtension >+ class="org.eclipse.mylyn.internal.sandbox.ui.hyperlinks.CppResourceHyperlinkExtension" >+ >+ fileType="cpp" >+ generatedPrefix="cpp class"> >+ >+ </resourceHyperlinkExtension> >+ <resourceHyperlinkExtension >+ class="org.eclipse.mylyn.internal.sandbox.ui.hyperlinks.UnknownResourceHyperlinkExtension" >+ fileType="unknown" >+ generatedPrefix="file"> >+ </resourceHyperlinkExtension> >+ </extension> >+ --> > <!-- > <extension point="org.eclipse.mylyn.tasks.ui.presentations"> > <presentation >Index: schema/resourceHyperlinkExtensions.exsd >=================================================================== >RCS file: schema/resourceHyperlinkExtensions.exsd >diff -N schema/resourceHyperlinkExtensions.exsd >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ schema/resourceHyperlinkExtensions.exsd 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,116 @@ >+<?xml version='1.0' encoding='UTF-8'?> >+<!-- Schema file written by PDE --> >+<schema targetNamespace="org.eclipse.mylyn.sandbox.ui" xmlns="http://www.w3.org/2001/XMLSchema"> >+<annotation> >+ <appinfo> >+ <meta.schema plugin="org.eclipse.mylyn.sandbox.ui" id="resourceHyperlinkExtensions" name="Resource Hyperlink Extension"/> >+ </appinfo> >+ <documentation> >+ An extension to the Mylyn task editor that can detect resource hyperlinks. >+ </documentation> >+ </annotation> >+ >+ <element name="extension"> >+ <annotation> >+ <appinfo> >+ <meta.element /> >+ </appinfo> >+ </annotation> >+ <complexType> >+ <sequence minOccurs="1" maxOccurs="unbounded"> >+ <element ref="resourceHyperlinkExtension"/> >+ </sequence> >+ <attribute name="point" type="string" use="required"> >+ <annotation> >+ <documentation> >+ >+ </documentation> >+ </annotation> >+ </attribute> >+ <attribute name="id" type="string"> >+ <annotation> >+ <documentation> >+ >+ </documentation> >+ </annotation> >+ </attribute> >+ <attribute name="name" type="string"> >+ <annotation> >+ <documentation> >+ >+ </documentation> >+ <appinfo> >+ <meta.attribute translatable="true"/> >+ </appinfo> >+ </annotation> >+ </attribute> >+ </complexType> >+ </element> >+ >+ <element name="resourceHyperlinkExtension"> >+ <complexType> >+ <attribute name="class" type="string" use="required"> >+ <annotation> >+ <documentation> >+ Should implement IResourceHyperlinkExtension, but may subclass AbstractResourceHyperlinkExtension instead which provides various helper methods. >+ </documentation> >+ <appinfo> >+ <meta.attribute kind="java" basedOn=":org.eclipse.mylyn.internal.sandbox.ui.hyperlinks.IResourceHyperlinkExtension"/> >+ </appinfo> >+ </annotation> >+ </attribute> >+ <attribute name="fileType" type="string" use="required"> >+ <annotation> >+ <documentation> >+ the file type of the resource, e.g. *.java, *.cpp, *.txt >+ </documentation> >+ </annotation> >+ </attribute> >+ <attribute name="generatedPrefix" type="string" use="required"> >+ <annotation> >+ <documentation> >+ correspondent prefix for a certain file type, e.g. for ITask.java, the generatedPrefix is "java class" and the whole is "java class ITask". >+ </documentation> >+ </annotation> >+ </attribute> >+ </complexType> >+ </element> >+ >+ <annotation> >+ <appinfo> >+ <meta.section type="since"/> >+ </appinfo> >+ <documentation> >+ [Enter the first release in which this extension point appears.] >+ </documentation> >+ </annotation> >+ >+ <annotation> >+ <appinfo> >+ <meta.section type="examples"/> >+ </appinfo> >+ <documentation> >+ [Enter extension point usage example here.] >+ </documentation> >+ </annotation> >+ >+ <annotation> >+ <appinfo> >+ <meta.section type="apiinfo"/> >+ </appinfo> >+ <documentation> >+ [Enter API information here.] >+ </documentation> >+ </annotation> >+ >+ <annotation> >+ <appinfo> >+ <meta.section type="implementation"/> >+ </appinfo> >+ <documentation> >+ [Enter information about supplied implementation of this extension point.] >+ </documentation> >+ </annotation> >+ >+ >+</schema> >Index: src/org/eclipse/mylyn/internal/sandbox/ui/hyperlinks/ResourceHyperlinkExtensionReader.java >=================================================================== >RCS file: src/org/eclipse/mylyn/internal/sandbox/ui/hyperlinks/ResourceHyperlinkExtensionReader.java >diff -N src/org/eclipse/mylyn/internal/sandbox/ui/hyperlinks/ResourceHyperlinkExtensionReader.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/mylyn/internal/sandbox/ui/hyperlinks/ResourceHyperlinkExtensionReader.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,64 @@ >+/******************************************************************************* >+ * Copyright (c) 2004, 2007 Mylyn project committers and others. >+ * All rights reserved. This program and the accompanying materials >+ * are made available under the terms of the Eclipse Public License v1.0 >+ * which accompanies this distribution, and is available at >+ * http://www.eclipse.org/legal/epl-v10.html >+ *******************************************************************************/ >+ >+package org.eclipse.mylyn.internal.sandbox.ui.hyperlinks; >+ >+import org.eclipse.core.runtime.CoreException; >+import org.eclipse.core.runtime.IConfigurationElement; >+import org.eclipse.core.runtime.IExtension; >+import org.eclipse.core.runtime.IExtensionPoint; >+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.mylyn.commons.core.StatusHandler; >+import org.eclipse.mylyn.internal.tasks.ui.TasksUiPlugin; >+ >+/** >+ * @author Jingwen Ou >+ */ >+public class ResourceHyperlinkExtensionReader { >+ public static final String ATTR_FILE_TYPE = "fileType"; >+ >+ public static final String ATTR_GENERATED_PREFIX = "generatedPrefix"; >+ >+ public static final String EXTENSION_RESOURCE_HYPERLINK_EXTENSIONS = "org.eclipse.mylyn.sandbox.ui.resourceHyperlinkExtensions"; >+ >+ private static final String RESOURCE_HYPERLINK_EXTENSION = "resourceHyperlinkExtension"; >+ >+ public static void initExtensions() { >+ IExtensionRegistry registry = Platform.getExtensionRegistry(); >+ >+ IExtensionPoint editorExtensionPoint = registry.getExtensionPoint(EXTENSION_RESOURCE_HYPERLINK_EXTENSIONS); >+ IExtension[] editorExtensions = editorExtensionPoint.getExtensions(); >+ for (IExtension extension : editorExtensions) { >+ IConfigurationElement[] elements = extension.getConfigurationElements(); >+ for (IConfigurationElement element : elements) { >+ if (element.getName().equals(RESOURCE_HYPERLINK_EXTENSION)) { >+ readResourceHyperlinkExtension(element); >+ } >+ } >+ } >+ } >+ >+ private static void readResourceHyperlinkExtension(IConfigurationElement element) { >+ try { >+ String fileType = element.getAttribute(ATTR_FILE_TYPE); >+ String generatedPrefix = element.getAttribute(ATTR_GENERATED_PREFIX); >+ IResourceHyperlinkExtension extension = (IResourceHyperlinkExtension) element.createExecutableExtension("class"); >+ ResourceHyperlinkExtensions.addResourceHyperlinkExtension(fileType, generatedPrefix, extension); >+ } catch (CoreException e) { >+ StatusHandler.log(new Status(IStatus.ERROR, TasksUiPlugin.ID_PLUGIN, >+ "Could not load resourceHyperlinkExtension", e)); >+ } catch (Exception e) { >+ StatusHandler.log(new Status(IStatus.ERROR, TasksUiPlugin.ID_PLUGIN, >+ "Could not load resourceHyperlinkExtension", e)); >+ } >+ >+ } >+} >Index: src/org/eclipse/mylyn/internal/sandbox/ui/hyperlinks/ResourceHyperlinkExtensions.java >=================================================================== >RCS file: src/org/eclipse/mylyn/internal/sandbox/ui/hyperlinks/ResourceHyperlinkExtensions.java >diff -N src/org/eclipse/mylyn/internal/sandbox/ui/hyperlinks/ResourceHyperlinkExtensions.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/mylyn/internal/sandbox/ui/hyperlinks/ResourceHyperlinkExtensions.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,109 @@ >+/******************************************************************************* >+ * Copyright (c) 2004, 2007 Mylyn project committers and others. >+ * All rights reserved. This program and the accompanying materials >+ * are made available under the terms of the Eclipse Public License v1.0 >+ * which accompanies this distribution, and is available at >+ * http://www.eclipse.org/legal/epl-v10.html >+ *******************************************************************************/ >+ >+package org.eclipse.mylyn.internal.sandbox.ui.hyperlinks; >+ >+import java.util.ArrayList; >+import java.util.HashMap; >+import java.util.List; >+import java.util.Map; >+ >+import org.eclipse.core.runtime.Assert; >+import org.eclipse.core.runtime.IStatus; >+import org.eclipse.core.runtime.Status; >+import org.eclipse.mylyn.commons.core.StatusHandler; >+import org.eclipse.mylyn.internal.tasks.ui.TasksUiPlugin; >+ >+/** >+ * A manager that returns registered IResourceHyperlinkExtension >+ * >+ * @author Jingwen Ou >+ */ >+public class ResourceHyperlinkExtensions { >+ >+ public static class RegisteredResourceHyperlinkExtension { >+ private final IResourceHyperlinkExtension extension; >+ >+ private final String fileType; >+ >+ private final String generatedPrefix; >+ >+ private RegisteredResourceHyperlinkExtension(IResourceHyperlinkExtension extension, String fileType, >+ String generatedPrefix) { >+ this.extension = extension; >+ this.fileType = fileType; >+ this.generatedPrefix = generatedPrefix; >+ } >+ >+ public IResourceHyperlinkExtension getExtension() { >+ return extension; >+ } >+ >+ public String getFileType() { >+ return fileType; >+ } >+ >+ public String getGeneratedPrefix() { >+ return generatedPrefix; >+ } >+ } >+ >+ private static Map<String, RegisteredResourceHyperlinkExtension> extensionByFileType = new HashMap<String, RegisteredResourceHyperlinkExtension>(); >+ >+ private static boolean initialized = false; >+ >+ public static void addResourceHyperlinkExtension(String fileType, String generatedPrefix, >+ IResourceHyperlinkExtension extension) { >+ Assert.isNotNull(fileType); >+ >+ RegisteredResourceHyperlinkExtension previous = extensionByFileType.put(fileType, >+ new RegisteredResourceHyperlinkExtension(extension, fileType, generatedPrefix)); >+ >+ if (previous != null) { >+ StatusHandler.log(new Status(IStatus.ERROR, TasksUiPlugin.ID_PLUGIN, >+ "Duplicate resourceHyperlinkExtension fileType=" + fileType, null)); >+ } >+ } >+ >+ public static IResourceHyperlinkExtension getResourceHyperlinkExtension(String fileType) { >+ init(); >+ RegisteredResourceHyperlinkExtension resourceHyperlinkExtension = extensionByFileType.get(fileType); >+ return resourceHyperlinkExtension == null ? null : resourceHyperlinkExtension.getExtension(); >+ } >+ >+ public static String getGeneratedPrefix(String fileType) { >+ init(); >+ RegisteredResourceHyperlinkExtension resourceHyperlinkExtension = extensionByFileType.get(fileType); >+ return resourceHyperlinkExtension == null ? null : resourceHyperlinkExtension.getGeneratedPrefix(); >+ } >+ >+ public static String getUnknownGeneratedPrefix() { >+ init(); >+ RegisteredResourceHyperlinkExtension unknownResourceHyperlinkExtension = extensionByFileType.get("unknown"); >+ return unknownResourceHyperlinkExtension == null ? null >+ : unknownResourceHyperlinkExtension.getGeneratedPrefix(); >+ } >+ >+ public static List<IResourceHyperlinkExtension> getResourceHyperlinkExtensions() { >+ init(); >+ ArrayList<IResourceHyperlinkExtension> resourceHyperlinkExtensions = new ArrayList<IResourceHyperlinkExtension>( >+ extensionByFileType.size()); >+ for (RegisteredResourceHyperlinkExtension resourceHyperlinkExtension : extensionByFileType.values()) { >+ resourceHyperlinkExtensions.add(resourceHyperlinkExtension.getExtension()); >+ } >+ >+ return resourceHyperlinkExtensions; >+ } >+ >+ private static void init() { >+ if (!initialized) { >+ initialized = true; >+ ResourceHyperlinkExtensionReader.initExtensions(); >+ } >+ } >+} >Index: src/org/eclipse/mylyn/internal/sandbox/ui/hyperlinks/IResourceHyperlinkExtension.java >=================================================================== >RCS file: src/org/eclipse/mylyn/internal/sandbox/ui/hyperlinks/IResourceHyperlinkExtension.java >diff -N src/org/eclipse/mylyn/internal/sandbox/ui/hyperlinks/IResourceHyperlinkExtension.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/mylyn/internal/sandbox/ui/hyperlinks/IResourceHyperlinkExtension.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,21 @@ >+/******************************************************************************* >+ * Copyright (c) 2004, 2007 Mylyn project committers and others. >+ * All rights reserved. This program and the accompanying materials >+ * are made available under the terms of the Eclipse Public License v1.0 >+ * which accompanies this distribution, and is available at >+ * http://www.eclipse.org/legal/epl-v10.html >+ *******************************************************************************/ >+ >+package org.eclipse.mylyn.internal.sandbox.ui.hyperlinks; >+ >+import org.eclipse.jface.text.hyperlink.IHyperlink; >+ >+/** >+ * @author Jingwen Ou >+ */ >+public interface IResourceHyperlinkExtension { >+ /** >+ * find specific hyperlinks in text >+ */ >+ IHyperlink[] findHyperlink(String text, int lineOffset, int regionOffset); >+}
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 240423
: 107160 |
107161
|
108128