org.netbeans.spi.editor.hints/0 1.24.0 7

org.netbeans.spi.editor.hints
Class ChangeInfo

java.lang.Object
  extended by org.netbeans.spi.editor.hints.ChangeInfo

public final class ChangeInfo
extends Object

Represents a set of changes made by a hint. Note that the start/end parameters refer to offsets that should be selected, not to the general offsets of the modified element.

In other words, a change generated by a hint can generate things like variable names; ChangeInfo provides a list of generated code which the user might want to modify/replace with their own text. The start/end offsets are offsets into the file in question, which determine selection start/end in the editor.

This class provides for a list of changes, anticipating "live template" support (where the user confirms each generated element). Currently only the first change provided is used.


Nested Class Summary
static interface ChangeInfo.Change
          Interface representing a single caret-positioning or user-modifiable change.
 
Constructor Summary
ChangeInfo()
          Create an empty instance of ChangeInfo .
ChangeInfo(FileObject fileObject, Position start, Position end)
          Create an instance of ChangeInfo prepopulated with a single change
ChangeInfo(Position start, Position end)
          Create an instance of ChangeInfo prepopulated with a single change without associated file object.
 
Method Summary
 void add(FileObject fileObject, Position start, Position end)
          Adds one change.
 ChangeInfo.Change get(int i)
          Getter for the i-th change
 int size()
           
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ChangeInfo

public ChangeInfo(FileObject fileObject,
                  Position start,
                  Position end)
Create an instance of ChangeInfo prepopulated with a single change


ChangeInfo

public ChangeInfo(Position start,
                  Position end)
Create an instance of ChangeInfo prepopulated with a single change without associated file object.


ChangeInfo

public ChangeInfo()
Create an empty instance of ChangeInfo .

Method Detail

size

public final int size()
Returns:
number of changes

add

public final void add(FileObject fileObject,
                      Position start,
                      Position end)
Adds one change.

Parameters:
fileObject -
start -
end -

get

public final ChangeInfo.Change get(int i)
Getter for the i-th change

Parameters:
i - index of the change
Returns:
the change or throws ArrayIndexOutOfBoundsException if there are no changes in the ChangeInfo

toString

public String toString()
Overrides:
toString in class Object

org.netbeans.spi.editor.hints/0 1.24.0 7

Built on May 25 2012.  |  Portions Copyright 1997-2012 Oracle. All rights reserved.