Index: lib/apichanges.xml
===================================================================
RCS file: /cvs/editor/lib/apichanges.xml,v
retrieving revision 1.9
diff -u -r1.9 apichanges.xml
--- lib/apichanges.xml 22 Aug 2007 15:09:28 -0000 1.9
+++ lib/apichanges.xml 11 Sep 2007 14:24:15 -0000
@@ -82,6 +82,25 @@
+
+ Extending HyperlinkProviders
+
+
+
+
+
+
+ The hyperlink providers have been extended to allow:
+
+ - tooltips for the hyperlinks
+ - future extensions through
HyperlinkType
+
+
+ See newly added HyperlinkProviderExt
class.
+
+
+
+
Added BaseDocumentEvent.getChangeAttributes
Index: lib/nbproject/project.properties
===================================================================
RCS file: /cvs/editor/lib/nbproject/project.properties,v
retrieving revision 1.21
diff -u -r1.21 project.properties
--- lib/nbproject/project.properties 22 Aug 2007 15:09:30 -0000 1.21
+++ lib/nbproject/project.properties 11 Sep 2007 14:24:15 -0000
@@ -12,12 +12,12 @@
# "Portions Copyrighted [year] [name of copyright owner]"
#
# The Original Software is NetBeans. The Initial Developer of the Original
-# Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
+# Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
# Microsystems, Inc. All Rights Reserved.
javac.compilerargs=-Xlint:unchecked
javac.source=1.5
-spec.version.base=1.17.0
+spec.version.base=1.18.0
is.autoload=true
src.dir=../libsrc
Index: libsrc/org/netbeans/lib/editor/hyperlink/spi/HyperlinkProviderExt.java
===================================================================
RCS file: libsrc/org/netbeans/lib/editor/hyperlink/spi/HyperlinkProviderExt.java
diff -N libsrc/org/netbeans/lib/editor/hyperlink/spi/HyperlinkProviderExt.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ libsrc/org/netbeans/lib/editor/hyperlink/spi/HyperlinkProviderExt.java 11 Sep 2007 14:24:15 -0000
@@ -0,0 +1,127 @@
+/*
+ * The contents of this file are subject to the terms of the Common Development
+ * and Distribution License (the License). You may not use this file except in
+ * compliance with the License.
+ *
+ * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
+ * or http://www.netbeans.org/cddl.txt.
+ *
+ * When distributing Covered Code, include this CDDL Header Notice in each file
+ * and include the License file at http://www.netbeans.org/cddl.txt.
+ * If applicable, add the following below the CDDL Header, with the fields
+ * enclosed by brackets [] replaced by your own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * The Original Software is NetBeans. The Initial Developer of the Original
+ * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
+ * Microsystems, Inc. All Rights Reserved.
+ */
+
+package org.netbeans.lib.editor.hyperlink.spi;
+
+import java.util.Set;
+import javax.swing.text.Document;
+
+/**
+ * This interface should be implemented by anyone who whats to provide hyperlinking
+ * functionality in the source code.
+ *
+ * Its methods are called for all the opened editors of the given mime-type
+ * where the hyperlinking functionality gets requested.
+ *
+ *
+ * The providers need to be registered.
+ * For NetBeans IDE, the default approach is to use System FileSystem.
+ *
+ * The HyperlinkProvider(s) should be registered as ".instance" objects under
+ * Editors/<mime-type>/HyperlinkProviders
directory.
+ *
+ *
+ *
+ * Please see {@link org.netbeans.lib.editor.hyperlink.HyperlinkProviderManager}
+ * for more details.
+ *
+ *
+ *
+ * Note: there is no assurance on the order of calling of the methods in this class.
+ * The callers may call the methods in any order and even do not call some of these methods
+ * at all.
+ *
+ *
+ * @author Jan Lahoda
+ * @since 1.18
+ */
+public interface HyperlinkProviderExt {
+
+ /**Returns all hyperlink types that are supported by this HyperlinkProvider.
+ * the resulting value should be constant over time.
+ *
+ * @return supported hyperlink types
+ * @since 1.18
+ */
+ Set getSupportedHyperlinkTypes();
+
+ /**
+ * Should determine whether there should be a hyperlink on the given offset
+ * in the given document. May be called any number of times for given parameters.
+ *
+ * This method is called from event dispatch thread.
+ * It should run very fast as it is called very often.
+ *
+ * @param doc document on which to operate.
+ * @param offset >=0 offset to test (it generally should be offset < doc.getLength(), but
+ * the implementations should not depend on it)
+ * @param type the hyperlink type
+ * @return true if the provided offset should be in a hyperlink
+ * false otherwise
+ * @since 1.18
+ */
+ boolean isHyperlinkPoint(Document doc, int offset, HyperlinkType type);
+
+ /**
+ * Should determine the span of hyperlink on given offset. Generally, if
+ * isHyperlinkPoint returns true for a given parameters, this class should
+ * return a valid span, but it is not strictly required.
+ *
+ * This method is called from event dispatch thread.
+ * This method should run very fast as it is called very often.
+ *
+ * @param doc document on which to operate.
+ * @param offset >=0 offset to test (it generally should be offset < doc.getLength(), but
+ * the implementations should not depend on it)
+ * @param type the hyperlink type
+ * @return a two member array which contains starting and ending offset of a hyperlink
+ * that should be on a given offset
+ * @since 1.18
+ */
+ int[] getHyperlinkSpan(Document doc, int offset, HyperlinkType type);
+
+ /**
+ * The implementor should perform an action
+ * corresponding to clicking on the hyperlink on the given offset. The
+ * nature of the action is given by the nature of given hyperlink, but
+ * generally should open some resource or move cursor
+ * to certain place in the current document.
+ *
+ * @param doc document on which to operate.
+ * @param offset >=0 offset to test (it generally should be offset < doc.getLength(), but
+ * the implementations should not depend on it)
+ * @param type the hyperlink type
+ * @since 1.18
+ */
+ void performClickAction(Document doc, int offset, HyperlinkType type);
+
+ /** Get a short description/tooltip corresponding to the given offset.
+ * Should block until the result is computed. Is called in a working thread,
+ * not in AWT Event dispatch thread. Return null
if there should
+ * be no tooltip.
+ *
+ * @param doc document on which to operate.
+ * @param offset >=0 offset to test (it generally should be offset < doc.getLength(), but
+ * the implementations should not depend on it)
+ * @param type the hyperlink type
+ * @since 1.18
+ */
+ String getTooltipText(Document doc, int offset, HyperlinkType type);
+
+}
Index: libsrc/org/netbeans/lib/editor/hyperlink/spi/HyperlinkType.java
===================================================================
RCS file: libsrc/org/netbeans/lib/editor/hyperlink/spi/HyperlinkType.java
diff -N libsrc/org/netbeans/lib/editor/hyperlink/spi/HyperlinkType.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ libsrc/org/netbeans/lib/editor/hyperlink/spi/HyperlinkType.java 11 Sep 2007 14:24:15 -0000
@@ -0,0 +1,34 @@
+/*
+ * The contents of this file are subject to the terms of the Common Development
+ * and Distribution License (the License). You may not use this file except in
+ * compliance with the License.
+ *
+ * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
+ * or http://www.netbeans.org/cddl.txt.
+ *
+ * When distributing Covered Code, include this CDDL Header Notice in each file
+ * and include the License file at http://www.netbeans.org/cddl.txt.
+ * If applicable, add the following below the CDDL Header, with the fields
+ * enclosed by brackets [] replaced by your own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * The Original Software is NetBeans. The Initial Developer of the Original
+ * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
+ * Microsystems, Inc. All Rights Reserved.
+ */
+package org.netbeans.lib.editor.hyperlink.spi;
+
+/**A type of work for hyperlinks. Currently, there is only one hyperlink type
+ * (go to declaration), but more can be introduced in the future.
+ *
+ * @since 1.18
+ * @author Jan Lahoda
+ */
+public enum HyperlinkType {
+
+ /**
+ * @since 1.18
+ */
+ GO_TO_DECLARATION,
+
+}