Index: api/doc/changes/apichanges.xml =================================================================== RCS file: /cvs/diff/api/doc/changes/apichanges.xml,v retrieving revision 1.5 diff -u -r1.5 apichanges.xml --- api/doc/changes/apichanges.xml 13 Oct 2004 20:04:43 -0000 1.5 +++ api/doc/changes/apichanges.xml 23 May 2005 14:56:42 -0000 @@ -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. --> @@ -116,6 +116,19 @@ Service, that is used to resolve merge collisions. + + + + + + DiffView interface added + + + + + + A controler interface, that allows to programmatically control the + diff component. Index: nbproject/project.properties =================================================================== RCS file: /cvs/diff/nbproject/project.properties,v retrieving revision 1.3 diff -u -r1.3 project.properties --- nbproject/project.properties 25 Apr 2005 12:44:25 -0000 1.3 +++ nbproject/project.properties 23 May 2005 14:56:42 -0000 @@ -9,7 +9,7 @@ # Code is Sun Microsystems, Inc. Portions Copyright 1997-2005 Sun # Microsystems, Inc. All Rights Reserved. -spec.version.base=1.12.0 +spec.version.base=1.13.0 javadoc.apichanges=${basedir}/api/doc/changes/apichanges.xml javadoc.arch=${basedir}/arch/arch-diff.xml javadoc.title=Diff API Index: api/diff/Diff.java =================================================================== RCS file: /cvs/diff/src/org/netbeans/api/diff/Diff.java,v retrieving revision 1.1 diff -u -r1.1 Diff.java --- api/diff/Diff.java 13 Feb 2002 14:49:48 -0000 1.1 +++ api/diff/Diff.java 23 May 2005 14:15:33 -0000 @@ -58,4 +58,20 @@ public abstract Component createDiff(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(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 retrieving revision 1.2 diff -u -r1.2 DiffVisualizer.java --- 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"); + } } New file diff/src/org/netbeans/api/diff/DiffView.java: /* * 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. */ package org.netbeans.api.diff; import java.awt.Component; import java.beans.PropertyChangeListener; import javax.swing.JToolBar; import org.netbeans.spi.diff.DiffProvider; import org.netbeans.spi.diff.DiffVisualizer; /** * Controller interface that allows external code to control the DIFF component. * * @author Maros Sandor, Martin Entlicher */ public interface DiffView { /** * 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); }