Class DiffControllerImpl
java.lang.Object
org.netbeans.spi.diff.DiffControllerImpl
Provider class for DiffController, encapsulates a single Diff panel that displays differences between two files (sources).
- Since:
- 1.18
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final PropertyChangeSupport
A PropertyChangeSupport instance. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfinal void
Adds a property change listener.abstract int
Gets total number of Differences between sources currently displayed in the Diff view.final int
Gets the current (highlighted) difference in the Diff view.abstract JComponent
Retrieves visual presenter of the Diff.final void
Removes a property change listener.protected final void
setDifferenceIndex
(int idx) Implementors use this method to set the current (highlighted) difference.void
setLocation
(DiffController.DiffPane pane, DiffController.LocationType type, int location) Ensure the requested location in the Diff view is visible on screen.
-
Field Details
-
support
A PropertyChangeSupport instance.
-
-
Constructor Details
-
DiffControllerImpl
protected DiffControllerImpl()Default constructor, does nothing.
-
-
Method Details
-
setLocation
public void setLocation(DiffController.DiffPane pane, DiffController.LocationType type, int location) Ensure the requested location in the Diff view is visible on screen. Diff view can be requested to jump to a given line in either source or to a given Difference. Diff controller may ignore the request if it does not support this functionality. This method must be called from AWT thread.- Parameters:
pane
- defines which pane the location parameter refers totype
- defines the location parameter, see belowlocation
- depending on the type parameter this defines either a line number or a Difference index, both 0-based- Throws:
IllegalArgumentException
- if location parameter is out of range for the given pane and location type
-
getJComponent
Retrieves visual presenter of the Diff.- Returns:
- JComponent component to be embedded into client UI
-
getDifferenceCount
public abstract int getDifferenceCount()Gets total number of Differences between sources currently displayed in the Diff view.- Returns:
- total number of Differences in sources, an integer >= 0
-
getDifferenceIndex
public final int getDifferenceIndex()Gets the current (highlighted) difference in the Diff view.- Returns:
- current difference index or -1 of there is no Current difference
-
setDifferenceIndex
protected final void setDifferenceIndex(int idx) Implementors use this method to set the current (highlighted) difference.- Parameters:
idx
- a new current difference indox
-
addPropertyChangeListener
Adds a property change listener.- Parameters:
listener
- property change listener
-
removePropertyChangeListener
Removes a property change listener.- Parameters:
listener
- property change listener
-