Index: api/doc/changes/apichanges.xml
===================================================================
RCS file: /shared/data/ccvs/repository/diff/api/doc/changes/apichanges.xml,v
retrieving revision 1.8
retrieving revision 1.8.14.1
diff -u -r1.8 -r1.8.14.1
--- api/doc/changes/apichanges.xml 30 Jun 2006 19:10:25 -0000 1.8
+++ api/doc/changes/apichanges.xml 21 Feb 2007 12:48:50 -0000 1.8.14.1
@@ -14,7 +14,7 @@
- "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.
-->
@@ -138,6 +138,18 @@
+
+
+ StreamSource extended
+
+
+
+
+
+ StreamSource provides more ways of defining the source (a FileObject) and can declare its editability.
+
+
+
Index: nbproject/project.properties
===================================================================
RCS file: /shared/data/ccvs/repository/diff/nbproject/project.properties,v
retrieving revision 1.10
retrieving revision 1.10.12.1
diff -u -r1.10 -r1.10.12.1
--- nbproject/project.properties 13 Sep 2006 14:25:17 -0000 1.10
+++ nbproject/project.properties 2 Feb 2007 10:25:16 -0000 1.10.12.1
@@ -18,6 +18,6 @@
javac.compilerargs=-Xlint:unchecked
javac.source=1.5
-spec.version.base=1.16.0
+spec.version.base=1.17.0
javadoc.apichanges=${basedir}/api/doc/changes/apichanges.xml
javadoc.arch=${basedir}/arch/arch-diff.xml
Index: src/org/netbeans/api/diff/StreamSource.java
===================================================================
RCS file: /shared/data/ccvs/repository/diff/src/org/netbeans/api/diff/StreamSource.java,v
retrieving revision 1.7
retrieving revision 1.7.14.3
diff -u -r1.7 -r1.7.14.3
--- src/org/netbeans/api/diff/StreamSource.java 30 Jun 2006 19:10:26 -0000 1.7
+++ src/org/netbeans/api/diff/StreamSource.java 21 Feb 2007 12:48:49 -0000 1.7.14.3
@@ -13,7 +13,7 @@
* "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.
*/
@@ -35,6 +35,8 @@
import java.io.IOException;
import org.openide.util.io.ReaderInputStream;
+import org.openide.util.Lookup;
+import org.openide.util.lookup.Lookups;
import org.openide.filesystems.FileUtil;
import org.netbeans.modules.diff.EncodedReaderFactory;
@@ -61,6 +63,36 @@
* Get the MIME type of the source.
*/
public abstract String getMIMEType();
+
+ /**
+ * Hint for a diff visualizer about editability of this source. The source will only be made editable if it provides
+ * some editable entity in its lookup (eg. FileObject) and this method returns true and the diff visualizer supports it.
+ *
+ * @return true if this source can be editable in the diff visualizer, false otherwise
+ * @since 1.17
+ */
+ public boolean isEditable() {
+ return false;
+ }
+
+ /**
+ * Source lookup that may define the content of this source. In case the lookup does not provide anything
+ * usable, createReader() is used instead. Diff engines can process these inputs:
+ *
+ * - instance of {@link org.openide.filesystems.FileObject} - in this case, the content of the source is defined
+ * by calling DataObject.find(fileObject).openDocument(). If the source is editable then it is
+ * saved back via SaveCookie.save() when the Diff component closes.
+ *
+ *
+ * For compatibility purposes, it is still adviced to fully implement createReader() as older Diff providers may
+ * not use this method of obtaining the source.
+ *
+ * @return an instance of Lookup
+ * @since 1.17
+ */
+ public Lookup getLookup() {
+ return Lookups.fixed();
+ }
/**
* Create a reader, that reads the source.