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 34057 Details for
Bug 88293
[misc] Extension-Point for HyperlinkDetectors
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
hyperlink detector extension
org.eclipse.jdt.ui-hyperlinkDetectors.txt (text/plain), 10.84 KB, created by
Mik Kersten
on 2006-02-03 00:15:21 EST
(
hide
)
Description:
hyperlink detector extension
Filename:
MIME Type:
Creator:
Mik Kersten
Created:
2006-02-03 00:15:21 EST
Size:
10.84 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.jdt.ui >Index: plugin.xml >=================================================================== >RCS file: /home/eclipse/org.eclipse.jdt.ui/plugin.xml,v >retrieving revision 1.615 >diff -u -r1.615 plugin.xml >--- plugin.xml 30 Jan 2006 18:38:14 -0000 1.615 >+++ plugin.xml 3 Feb 2006 05:05:43 -0000 >@@ -13,8 +13,8 @@ > <extension-point id="javaCompletionProposalComputer" name="%javaCompletionProposalComputer" schema="schema/javaCompletionProposalComputer.exsd"/> > <extension-point id="javaCompletionProposalSorters" name="%javaCompletionProposalSorters" schema="schema/javaCompletionProposalSorters.exsd"/> > <extension-point id="internal_refactoringElementFilter" name="%internal_refactoringElementFilter" schema="schema/internal_refactoringElementFilter.exsd"/> >- >- >+ <extension-point id="javaEditorHyperlinkDetectors" name="%javaEditorTextHoversName" schema="schema/javaEditorHyperlinkDetectors.exsd"/> >+ > <extension > point="org.eclipse.ui.decorators"> > <!--- >Index: ui/org/eclipse/jdt/ui/text/JavaSourceViewerConfiguration.java >=================================================================== >RCS file: /home/eclipse/org.eclipse.jdt.ui/ui/org/eclipse/jdt/ui/text/JavaSourceViewerConfiguration.java,v >retrieving revision 1.133 >diff -u -r1.133 JavaSourceViewerConfiguration.java >--- ui/org/eclipse/jdt/ui/text/JavaSourceViewerConfiguration.java 25 Jan 2006 15:43:23 -0000 1.133 >+++ ui/org/eclipse/jdt/ui/text/JavaSourceViewerConfiguration.java 3 Feb 2006 05:05:44 -0000 >@@ -10,9 +10,18 @@ > *******************************************************************************/ > package org.eclipse.jdt.ui.text; > >+import java.util.ArrayList; >+import java.util.Arrays; >+import java.util.List; > import java.util.Vector; > >+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.NullProgressMonitor; >+import org.eclipse.core.runtime.Platform; > > import org.eclipse.swt.SWT; > import org.eclipse.swt.widgets.Shell; >@@ -859,7 +868,7 @@ > if (event.getNewValue() instanceof String) > fJavaDoubleClickSelector.setSourceVersion((String) event.getNewValue()); > } >- >+ > /* > * @see org.eclipse.jface.text.source.SourceViewerConfiguration#getHyperlinkDetectors(org.eclipse.jface.text.source.ISourceViewer) > * @since 3.1 >@@ -868,7 +877,7 @@ > if (!fPreferenceStore.getBoolean(AbstractDecoratedTextEditorPreferenceConstants.EDITOR_HYPERLINKS_ENABLED)) > return null; > >- IHyperlinkDetector[] inheritedDetectors= super.getHyperlinkDetectors(sourceViewer); >+ IHyperlinkDetector[] inheritedDetectors = super.getHyperlinkDetectors(sourceViewer); > > if (fTextEditor == null) > return inheritedDetectors; >@@ -880,6 +889,57 @@ > for (int i= 0; i < inheritedDetectorsLength; i++) > detectors[i+2]= inheritedDetectors[i]; > >- return detectors; >+ // read contributed detectors >+ List contributedDectectors = fDetectorExtensionReader.readHyperlinkDetectorsExtension(fTextEditor); >+ if (contributedDectectors.isEmpty()) { >+ return inheritedDetectors; >+ } else { >+ List allDetectors = new ArrayList(); >+ allDetectors.addAll(Arrays.asList(detectors)); >+ allDetectors.addAll(contributedDectectors); >+ return (IHyperlinkDetector[]) allDetectors.toArray(new IHyperlinkDetector[allDetectors.size()]); >+ } >+ } >+ >+ private HyperlinkDetectorExtensionReader fDetectorExtensionReader = new HyperlinkDetectorExtensionReader(); >+ >+ private final class HyperlinkDetectorExtensionReader { >+ >+ private List contributedDetectors = new ArrayList(); >+ >+ private boolean extensionsRead = false; >+ >+ public static final String EXTENSION_POINT_HYPERLINK_DETECTOR = "org.eclipse.jdt.ui.javaEditorHyperlinkDetectors"; >+ >+ public static final String ELEMENT_HYPERLINK_DETECTOR = "hyperlinkDetector"; >+ >+ public static final String ELEMENT_CLASS = "class"; >+ >+ private List/*AbstractEditorHyperlinkDetector*/ readHyperlinkDetectorsExtension(ITextEditor textEditor) { >+ if (!extensionsRead) { >+ IExtensionRegistry registry = Platform.getExtensionRegistry(); >+ IExtensionPoint extensionPoint = registry.getExtensionPoint(EXTENSION_POINT_HYPERLINK_DETECTOR); >+ IExtension[] extensions = extensionPoint.getExtensions(); >+ for (int i = 0; i < extensions.length; i++) { >+ IConfigurationElement[] elements = extensions[i].getConfigurationElements(); >+ for (int j = 0; j < elements.length; j++) { >+ if (elements[j].getName().compareTo(ELEMENT_HYPERLINK_DETECTOR) == 0) { >+ try { >+ Object detector = elements[j].createExecutableExtension(ELEMENT_CLASS); >+ if (detector instanceof AbstractEditorHyperlinkDetector) { >+ ((AbstractEditorHyperlinkDetector) detector).setEditor(textEditor); >+ contributedDetectors.add(detector); >+ } >+ } catch (CoreException e) { >+ // TODO: handle once this goes where it belongs >+ throw new RuntimeException(e); >+ } >+ } >+ } >+ } >+ extensionsRead = true; >+ } >+ return contributedDetectors; >+ } > } > } >Index: ui/org/eclipse/jdt/ui/text/AbstractEditorHyperlinkDetector.java >=================================================================== >RCS file: ui/org/eclipse/jdt/ui/text/AbstractEditorHyperlinkDetector.java >diff -N ui/org/eclipse/jdt/ui/text/AbstractEditorHyperlinkDetector.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ ui/org/eclipse/jdt/ui/text/AbstractEditorHyperlinkDetector.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,37 @@ >+/******************************************************************************* >+ * Copyright (c) 2004 - 2006 University Of British Columbia 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 >+ * >+ * Contributors: >+ * University Of British Columbia - initial API and implementation >+ *******************************************************************************/ >+ >+package org.eclipse.jdt.ui.text; >+ >+import org.eclipse.jface.text.IRegion; >+import org.eclipse.jface.text.ITextViewer; >+import org.eclipse.jface.text.hyperlink.IHyperlink; >+import org.eclipse.jface.text.hyperlink.IHyperlinkDetector; >+import org.eclipse.ui.texteditor.ITextEditor; >+ >+/** >+ * @author Mik Kersten >+ */ >+public abstract class AbstractEditorHyperlinkDetector implements IHyperlinkDetector { >+ >+ private ITextEditor editor; >+ >+ public abstract IHyperlink[] detectHyperlinks(ITextViewer textViewer, IRegion region, >+ boolean canShowMultipleHyperlinks); >+ >+ public ITextEditor getEditor() { >+ return editor; >+ } >+ >+ public void setEditor(ITextEditor editor) { >+ this.editor = editor; >+ } >+} >Index: schema/javaEditorHyperlinkDetectors.exsd >=================================================================== >RCS file: schema/javaEditorHyperlinkDetectors.exsd >diff -N schema/javaEditorHyperlinkDetectors.exsd >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ schema/javaEditorHyperlinkDetectors.exsd 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,122 @@ >+<?xml version='1.0' encoding='UTF-8'?> >+<!-- Schema file written by PDE --> >+<schema targetNamespace="org.eclipse.jdt.ui"> >+<annotation> >+ <appInfo> >+ <meta.schema plugin="org.eclipse.jdt.ui" id="javaEditorHyperlinkDetectors" name="Java Editor Hyperlink Detectors"/> >+ </appInfo> >+ <documentation> >+ This extension point is used to plug-in hyperlink detectors to a Java editor. >+ </documentation> >+ </annotation> >+ >+ <element name="extension"> >+ <complexType> >+ <sequence> >+ <element ref="hyperlinkDetector" minOccurs="0" maxOccurs="unbounded"/> >+ </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="hyperlinkDetector"> >+ <complexType> >+ <attribute name="class" type="string" use="required"> >+ <annotation> >+ <documentation> >+ >+ </documentation> >+ <appInfo> >+ <meta.attribute kind="java" basedOn="org.eclipse.jdt.ui.text.AbstractEditorHyperlinkDetector"/> >+ </appInfo> >+ </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> >+ >+ <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> >+ >+ <annotation> >+ <appInfo> >+ <meta.section type="copyright"/> >+ </appInfo> >+ <documentation> >+ >+ </documentation> >+ </annotation> >+ >+</schema>
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 88293
:
34057
|
34118
|
49330
|
49394
|
57498
|
57517