Index: api/doc/changes/apichanges.xml
===================================================================
RCS file: /cvs/diff/api/doc/changes/apichanges.xml,v
--- api/doc/changes/apichanges.xml 1.5
+++ api/doc/changes/apichanges.xml
@@ -8,7 +8,7 @@
- http://www.sun.com/
-
- The Original Code is NetBeans. The Initial Developer of the Original
- - Code is Sun Microsystems, Inc. Portions Copyright 1997-2000 Sun
+ - Code is Sun Microsystems, Inc. Portions Copyright 1997-2005 Sun
- Microsystems, Inc. All Rights Reserved.
-->
+ * The StreamSource can be used to save the source content if it's modified
+ * in the view. The view should not allow source modification if StreamSource.createWriter()
+ * returns null
.
+ *
+ * @param s1 the first source
+ * @param s2 the second source
+ * @return DiffView controller interface
+ */
+ public DiffView createDiff(StreamSource s1, StreamSource s2) throws IOException {
+ throw new UnsupportedOperationException("This operation is not supported");
+ }
}
Index: spi/diff/DiffVisualizer.java
===================================================================
RCS file: /cvs/diff/src/org/netbeans/spi/diff/DiffVisualizer.java,v
--- spi/diff/DiffVisualizer.java 14 Feb 2002 12:04:14 -0000 1.2
+++ spi/diff/DiffVisualizer.java 23 May 2005 14:15:34 -0000
@@ -7,7 +7,7 @@
* http://www.sun.com/
*
* The Original Code is NetBeans. The Initial Developer of the Original
- * Code is Sun Microsystems, Inc. Portions Copyright 1997-2002 Sun
+ * Code is Sun Microsystems, Inc. Portions Copyright 1997-2005 Sun
* Microsystems, Inc. All Rights Reserved.
*/
@@ -19,7 +19,9 @@
//import org.openide.util.Lookup;
+import org.netbeans.api.diff.DiffView;
import org.netbeans.api.diff.Difference;
+import org.netbeans.api.diff.StreamSource;
/**
* This class represents a diff visualizer. It's used as a presenter of a visual
@@ -55,4 +57,20 @@
public abstract Component createView(Difference[] diffs, String name1, String title1,
Reader r1, String name2, String title2,
Reader r2, String MIMEType) throws IOException ;
+ /**
+ * Creates single-window diff component that does not include any navigation controls and
+ * is controlled programatically via the returned DiffView interface.
+ *
+ * The StreamSource can be used to save the source content if it's modified
+ * in the view. The view should not allow source modification if StreamSource.createWriter()
+ * returns null
.
+ *
+ * @param s1 the first source
+ * @param s2 the second source
+ * @return DiffView controller interface
+ *
+ */
+ public DiffView createDiff(Difference[] diffs, StreamSource s1, StreamSource s2) throws IOException {
+ throw new UnsupportedOperationException("This operation is not supported");
+ }
}
* Sun Public License Notice
*
* The contents of this file are subject to the Sun Public License
* Version 1.0 (the "License"). You may not use this file except in
* compliance with the License. A copy of the License is available at
* http://www.sun.com/
*
* The Original Code is NetBeans. The Initial Developer of the Original
* Code is Sun Microsystems, Inc. Portions Copyright 1997-2005 Sun
* Microsystems, Inc. All Rights Reserved.
*/
* Controller interface that allows external code to control the DIFF component.
*
* @author Maros Sandor, Martin Entlicher
*/
/**
* This property is fired when the difference count has changed.
*/
public static final String PROP_DIFF_COUNT = "diffCount"; // NOI18N
/**
* Gets the visual DIFF component that modules can include in their GUI.
*
* @return Component
*/
public Component getComponent();
/**
* Gets the number of differences found in sources.
*
* @return int
*/
public int getDiffCount();
/**
* Test whether this view can change the current difference.
* This is expected to be true when the view has a visual indication
* of the current difference.
*/
public boolean canSetCurrentDiff();
/**
* Instructs the DIFF view to navigate to the n-th difference.
*
* @param diffNo The difference number
* @throws UnsupportedOperationException iff {@link #canSetCurrentDiff}
* returns false
.
*/
public void setCurrentDifference(int diffNo) throws UnsupportedOperationException;
/**
* Get the current difference that is displayed in the view.
*
* @return The current difference number
* @throws UnsupportedOperationException iff {@link #canSetCurrentDiff}
* returns false
.
*/
public int getCurrentDifference() throws UnsupportedOperationException;
/**
* Get a toolbar, that is adviced to be displayed together with the component
* obtained from {@link #getComponent}.
*
* @return the toolbar or null
when no toolbar is provided by
* this view.
*/
public JToolBar getToolBar();
/**
* Add a property change listener.
* @param l The property change listener
*/
public void addPropertyChangeListener(PropertyChangeListener l);
/**
* Remove a property change listener.
* @param l The property change listener
*/
public void removePropertyChangeListener(PropertyChangeListener l);