org.netbeans.modules.jellytools.ide/3 3.14.0

org.netbeans.jellytools
Class EditorOperator

java.lang.Object
  extended by org.netbeans.jemmy.operators.Operator
      extended by org.netbeans.jemmy.operators.ComponentOperator
          extended by org.netbeans.jemmy.operators.ContainerOperator
              extended by org.netbeans.jemmy.operators.JComponentOperator
                  extended by org.netbeans.jellytools.TopComponentOperator
                      extended by org.netbeans.jellytools.EditorOperator
All Implemented Interfaces:
org.netbeans.jemmy.Outputable, org.netbeans.jemmy.Timeoutable

public class EditorOperator
extends TopComponentOperator

Handle an editor top component in NetBeans IDE. It enables to get, select, insert or delete text, move caret, work with annotations and with toolbar buttons. Majority of operations is done by JEditorPane API calls. If you want to do operations by key navigation, use methods of JEditorPaneOperator instance by txtEditorPane(). For example, call txtEditorPane().changeCaretPosition(int) instead of setCaretPosition(int).

Usage:

 EditorOperator eo = new EditorOperator(filename);
 eo.setCaretPositionToLine(10);
 eo.insert("// My new comment\n");
 eo.select("// My new comment");
 eo.deleteLine(10);
 eo.getToolbarButton("Toggle Bookmark").push();
 // discard changes and close
 eo.close(false);
 // save changes and close
 eo.close(true);
 // try to close all opened documents (confirmation dialog may appear)
 eo.closeAllDocuments();
 // close all opened documents and discard all changes
 eo.closeDiscardAll();
 


Nested Class Summary
static class EditorOperator.EditorSubchooser
          SubChooser to determine Editor TopComponent Used in findTopComponent method.
 
Nested classes/interfaces inherited from class org.netbeans.jemmy.operators.JComponentOperator
org.netbeans.jemmy.operators.JComponentOperator.JComponentByTipFinder, org.netbeans.jemmy.operators.JComponentOperator.JComponentFinder
 
Nested classes/interfaces inherited from class org.netbeans.jemmy.operators.ContainerOperator
org.netbeans.jemmy.operators.ContainerOperator.ContainerFinder
 
Nested classes/interfaces inherited from class org.netbeans.jemmy.operators.Operator
org.netbeans.jemmy.operators.Operator.ComponentVisualizer, org.netbeans.jemmy.operators.Operator.DefaultPathParser, org.netbeans.jemmy.operators.Operator.DefaultStringComparator, org.netbeans.jemmy.operators.Operator.Finder, org.netbeans.jemmy.operators.Operator.MapAction, org.netbeans.jemmy.operators.Operator.MapBooleanAction, org.netbeans.jemmy.operators.Operator.MapByteAction, org.netbeans.jemmy.operators.Operator.MapCharacterAction, org.netbeans.jemmy.operators.Operator.MapDoubleAction, org.netbeans.jemmy.operators.Operator.MapFloatAction, org.netbeans.jemmy.operators.Operator.MapIntegerAction, org.netbeans.jemmy.operators.Operator.MapLongAction, org.netbeans.jemmy.operators.Operator.MapVoidAction, org.netbeans.jemmy.operators.Operator.NoBlockingAction, org.netbeans.jemmy.operators.Operator.PathParser, org.netbeans.jemmy.operators.Operator.StringComparator
 
Field Summary
 
Fields inherited from class org.netbeans.jemmy.operators.JComponentOperator
A11Y_DATA, A11Y_DESCRIPTION_DPROP, A11Y_NAME_DPROP, TOOLTIP_TEXT_DPROP
 
Fields inherited from class org.netbeans.jemmy.operators.ComponentOperator
HEIGHT_DPROP, IS_SHOWING_DPROP, IS_VISIBLE_DPROP, NAME_DPROP, WIDTH_DPROP, X_DPROP, Y_DPROP
 
Fields inherited from class org.netbeans.jemmy.operators.Operator
CLASS_DPROP, TO_STRING_DPROP
 
Constructor Summary
EditorOperator(org.netbeans.jemmy.operators.ContainerOperator contOper, String filename)
          Waits for first open editor with given name in specified container.
EditorOperator(org.netbeans.jemmy.operators.ContainerOperator contOper, String filename, int index)
          Waits for index-th opened editor with given name in specified container.
EditorOperator(JComponent editorComponent)
          Creates new operator instance for given component.
EditorOperator(String filename)
          Waits for the first opened editor with given name.
EditorOperator(String filename, int index)
          Waits for index-th opened editor with given name.
 
Method Summary
 void clickForPopup()
          Click for popup on JEditorPane component.
 void close(boolean save)
          Closes this editor by IDE API call and depending on given flag it saves or discards changes.
static void closeDiscardAll()
          Closes all opened documents and discards all changes by IDE API calls.
 void collapseFold()
          Collapses fold at cursor position using CTRL+'-'.
 void collapseFold(int lineNumber)
          Collapses fold at specified line using CTRL+'-'.
 boolean contains(String text)
          Checks if editor window contains text specified as parameter text.
 void delete(int length)
          Deletes given number of characters from current caret possition.
 void delete(int offset, int length)
          Deletes given number of characters from specified possition.
 void delete(int lineNumber, int column1, int column2)
          Deletes characters between column1 and column2 (both are included) on the specified line.
 void deleteLine(int line)
          Delete specified line.
 void expandFold()
          Expands fold at specified line using CTRL+'+'.
 void expandFold(int lineNumber)
          Expands fold at specified line using CTRL+'+'.
 Object[] getAnnotations()
          Gets all annotations for current editor (Document).
 Object[] getAnnotations(int lineNumber)
          Gets an array of annotations attached to given line.
static String getAnnotationShortDescription(Object annotation)
          Returns a short description of annotation.
static String getAnnotationType(Object annotation)
          Returns a string uniquely identifying annotation.
 int getLineNumber()
          Returns current line number.
 String getText()
          Gets text from the currently opened Editor window.
 String getText(int lineNumber)
          Gets text from specified line.
 org.netbeans.jemmy.operators.AbstractButtonOperator getToolbarButton(int index)
          Return AbstractButtonOperator representing index-th toolbar button within the Source Editor.
 org.netbeans.jemmy.operators.AbstractButtonOperator getToolbarButton(String buttonTooltip)
          Return AbstractButtonOperator representing a toolbar button found by given tooltip within the Source Editor.
 void insert(String text)
          Inserts text to current position.
 void insert(String text, int lineNumber, int column)
          Inserts text to position specified by line number and column.
 boolean isCollapsed()
          Returns true if fold at cursor position is collapsed, false if it is expanded.
 boolean isCollapsed(int lineNumber)
          Returns true if fold at specified line is collapsed, false if it is expanded.
 org.netbeans.jemmy.operators.JLabelOperator lblInputMode()
          Returns operator of label showing current input mode (INS/OVR - insert/overwrite).
 org.netbeans.jemmy.operators.JLabelOperator lblRowColumn()
          Returns operator of label showing current row and column at the left corner of the Source Editor window.
 org.netbeans.jemmy.operators.JLabelOperator lblStatusBar()
          Returns operator of status bar at the bottom of the Source Editor.
 void pushDownArrowKey()
          Pushes Down key (KeyEvent.VK_DOWN)
 void pushEndKey()
          Pushes End key (KeyEvent.VK_END)
 void pushHomeKey()
          Pushes Home key (KeyEvent.VK_HOME)
 void pushKey(int keyCode)
          Pushes key of requested key code.
 void pushKey(int keyCode, int modifiers)
          Pushes key of requested key code.
 void pushTabKey()
          Pushes Tab key (KeyEvent.VK_TAB)
 void pushUpArrowKey()
          Pushes Up key (KeyEvent.VK_UP)
 void replace(String oldText, String newText)
          Replaces first occurrence of oldText by newText.
 void replace(String oldText, String newText, int index)
          Replaced index-th occurrence of oldText by newText.
 void save()
          Saves content of this Editor by API.
 void select(int lineNumber)
          Selects whole line specified by its number.
 void select(int line1, int line2)
          Selects text between line1 and line2 (both are included).
 void select(int lineNumber, int column1, int column2)
          Selects text in specified line on position defined by column1 and column2 (both are included).
 void select(String text)
          Selects first occurrence of given text.
 void select(String text, int index)
          Selects index-th occurrence of given text.
 void setCaretPosition(int position)
          Sets caret to desired position.
 void setCaretPosition(int lineNumber, int column)
          Sets caret position to specified line and column
 void setCaretPosition(String text, boolean before)
          Sets caret position before or after first occurrence of given string.
 void setCaretPosition(String text, int index, boolean before)
          Sets caret position before or after index-th occurrence of given string.
 void setCaretPositionRelative(int relativeMove)
          Sets caret position relatively to current position.
 void setCaretPositionToEndOfLine(int lineNumber)
          Sets caret position to the end of specified line.
 void setCaretPositionToLine(int lineNumber)
          Sets caret position to the beginning of specified line.
 org.netbeans.jemmy.operators.JEditorPaneOperator txtEditorPane()
          Returns operator of currently shown editor pane.
 void typeKey(char keyChar)
          Types one char.
 void typeKey(char keyChar, int modifiers)
          Types one char.
 void typeKey(int keyCode, char keyChar, int modifiers)
          Types one char.
 void verify()
          Performs verification by accessing all sub-components
 void waitCollapsed()
          Waits for fold at cursor position is collapsed.
 void waitExpanded()
          Waits for fold at cursor position is expanded.
 void waitFolding()
          Waits for code folding initialization.
 void waitModified(boolean modified)
          Waits for given modified state of edited source.
 
Methods inherited from class org.netbeans.jellytools.TopComponentOperator
attachTo, attachTo, cloneDocument, close, closeAllDocuments, closeDiscard, closeWindow, findParentTopComponent, findTabbedAdapter, findTabDisplayer, findTopComponent, findTopComponent, isModified, isOpened, makeComponentVisible, maximize, pushMenuOnTab, restore, setUnmodified, waitClosed, waitTopComponent, waitTopComponent
 
Methods inherited from class org.netbeans.jemmy.operators.JComponentOperator
addAncestorListener, addVetoableChangeListener, computeVisibleRect, createToolTip, findJComponent, findJComponent, findJComponent, findJComponent, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getAccessibleContext, getActionForKeyStroke, getAutoscrolls, getBorder, getCenterXForClick, getCenterYForClick, getClientProperty, getConditionForKeyStroke, getDebugGraphicsOptions, getDump, getInsets, getNextFocusableComponent, getOutput, getRegisteredKeyStrokes, getRootPane, getTimeouts, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getUIClassID, getVisibleRect, getWindowContainerOperator, grabFocus, isFocusCycleRoot, isManagingFocus, isOptimizedDrawingEnabled, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paintImmediately, paintImmediately, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeVetoableChangeListener, repaint, requestDefaultFocus, resetKeyboardActions, revalidate, scrollRectToVisible, setAlignmentX, setAlignmentY, setAutoscrolls, setBorder, setDebugGraphicsOptions, setDoubleBuffered, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setOutput, setPreferredSize, setRequestFocusEnabled, setTimeouts, setToolTipText, showToolTip, unregisterKeyboardAction, updateUI, waitJComponent, waitJComponent, waitJComponent, waitJComponent, waitToolTip
 
Methods inherited from class org.netbeans.jemmy.operators.ContainerOperator
add, add, add, add, add, addContainerListener, createSubOperator, createSubOperator, findComponentAt, findComponentAt, findContainer, findContainer, findContainer, findContainer, findContainerUnder, findContainerUnder, findSubComponent, findSubComponent, getComponent, getComponentCount, getComponents, getInsets, getLayout, isAncestorOf, paintComponents, printComponents, remove, remove, removeAll, removeContainerListener, setLayout, waitContainer, waitContainer, waitContainer, waitContainer, waitSubComponent, waitSubComponent
 
Methods inherited from class org.netbeans.jemmy.operators.ComponentOperator
activateWindow, add, addComponentListener, addFocusListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addNotify, addPropertyChangeListener, addPropertyChangeListener, checkImage, checkImage, clickForPopup, clickForPopup, clickForPopup, clickMouse, clickMouse, clickMouse, clickMouse, clickMouse, clickMouse, clickMouse, contains, contains, copyEnvironment, createImage, createImage, dispatchEvent, doLayout, dragMouse, dragMouse, dragMouse, dragNDrop, dragNDrop, dragNDrop, enableInputMethods, enterMouse, exitMouse, findComponent, findComponent, getAlignmentX, getAlignmentY, getBackground, getBounds, getBounds, getCenterX, getCenterY, getColorModel, getComponentAt, getComponentAt, getComponentOrientation, getContainer, getContainers, getCursor, getDropTarget, getEventDispatcher, getFocus, getFont, getFontMetrics, getForeground, getGraphics, getHeight, getInputContext, getInputMethodRequests, getLocale, getLocation, getLocation, getLocationOnScreen, getMaximumSize, getMinimumSize, getName, getParent, getPreferredSize, getSize, getSize, getSource, getToolkit, getTreeLock, getWidth, getWindow, getX, getY, hasFocus, imageUpdate, invalidate, isDisplayable, isDoubleBuffered, isEnabled, isFocusTraversable, isLightweight, isOpaque, isShowing, isValid, isVisible, list, list, list, list, list, moveMouse, paint, paintAll, prepareImage, prepareImage, pressKey, pressKey, pressMouse, pressMouse, print, printAll, releaseKey, releaseKey, releaseMouse, releaseMouse, remove, removeComponentListener, removeFocusListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeNotify, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, setBackground, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setEnabled, setFont, setForeground, setLocale, setLocation, setLocation, setName, setSize, setSize, setVisible, transferFocus, update, validate, waitComponent, waitComponent, waitComponent, waitComponent, waitComponentEnabled, waitComponentShowing, waitComponentVisible, waitHasFocus, wtComponentEnabled
 
Methods inherited from class org.netbeans.jemmy.operators.Operator
addOperatorPackage, addToDump, addToDump, createOperator, getCharBindingMap, getCharKey, getCharModifiers, getCharsKeys, getCharsKeys, getCharsModifiers, getCharsModifiers, getComparator, getDefaultComponentVisualizer, getDefaultMouseButton, getDefaultPathParser, getDefaultStringComparator, getDefaultVerification, getEnvironmentOperator, getParentPath, getParentPath, getPathParser, getPopupMouseButton, getProperties, getQueueTool, getVerification, getVisualizer, isCaptionEqual, isCaptionEqual, isCaptionEqual, lockQueue, parseString, parseString, printDump, produceNoBlocking, produceNoBlocking, produceTimeRestricted, produceTimeRestricted, runMapping, runMapping, runMapping, runMapping, runMapping, runMapping, runMapping, runMapping, runMapping, setCharBindingMap, setComparator, setDefaultComponentVisualizer, setDefaultPathParser, setDefaultStringComparator, setDefaultVerification, setPathParser, setProperties, setVerification, setVisualizer, toStringSource, unlockAndThrow, unlockQueue, waitState
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

EditorOperator

public EditorOperator(String filename)
Waits for the first opened editor with given name. If not active, it is activated.

Parameters:
filename - name of file showed in the editor (it used to be label of tab)

EditorOperator

public EditorOperator(String filename,
                      int index)
Waits for index-th opened editor with given name. If not active, it is activated.

Parameters:
filename - name of file showed in the editor (it used to be label of tab)
index - index of editor to be find

EditorOperator

public EditorOperator(org.netbeans.jemmy.operators.ContainerOperator contOper,
                      String filename)
Waits for first open editor with given name in specified container. If not active, it is activated.

Parameters:
contOper - container where to search
filename - name of file showed in the editor (it used to be label of tab)

EditorOperator

public EditorOperator(JComponent editorComponent)
Creates new operator instance for given component. It is used in FormDesignerOperator.

Parameters:
editorComponent - instance of editor

EditorOperator

public EditorOperator(org.netbeans.jemmy.operators.ContainerOperator contOper,
                      String filename,
                      int index)
Waits for index-th opened editor with given name in specified container. If not active, it is activated.

Parameters:
contOper - container where to search
filename - name of file showed in the editor (it used to be label of tab)
index - index of editor to be find
Method Detail

closeDiscardAll

public static void closeDiscardAll()
Closes all opened documents and discards all changes by IDE API calls. It works also if no file is modified, so it is a safe way how to close documents and no block further execution.


close

public void close(boolean save)
Closes this editor by IDE API call and depending on given flag it saves or discards changes.

Parameters:
save - true - save changes, false - discard changes

txtEditorPane

public org.netbeans.jemmy.operators.JEditorPaneOperator txtEditorPane()
Returns operator of currently shown editor pane.

Returns:
JTabbedPaneOperator instance of editor pane

lblRowColumn

public org.netbeans.jemmy.operators.JLabelOperator lblRowColumn()
Returns operator of label showing current row and column at the left corner of the Source Editor window. NOTE: this label is accessible only when the editor window is undocked. Otherwise it is a part of MainWindow.

Returns:
JLabelOperator instance of row:column label

lblInputMode

public org.netbeans.jemmy.operators.JLabelOperator lblInputMode()
Returns operator of label showing current input mode (INS/OVR - insert/overwrite). NOTE: this label is accessible only when the editor window is undocked. Otherwise it is a part of MainWindow.

Returns:
JLabelOperator instance of input mode label

lblStatusBar

public org.netbeans.jemmy.operators.JLabelOperator lblStatusBar()
Returns operator of status bar at the bottom of the Source Editor. NOTE: this label is accessible only when the editor window is undocked. Otherwise it is a part of MainWindow.

Returns:
JLabelOperator instance of status bar

getText

public String getText()
Gets text from the currently opened Editor window.

Returns:
a string representing whole content of the Editor window (including new line characters)

getText

public String getText(int lineNumber)
Gets text from specified line. It might fail on the last line of a file because of issues http://www.netbeans.org/issues/show_bug.cgi?id=24434 and http://www.netbeans.org/issues/show_bug.cgi?id=24433.

Parameters:
lineNumber - number of line (beggining from 1)
Returns:
a string representing content of the line including new line character

contains

public boolean contains(String text)
Checks if editor window contains text specified as parameter text.

Parameters:
text - text to compare to
Returns:
true if text was found, false otherwise

select

public void select(int lineNumber)
Selects whole line specified by its number. Caret will stand at the next available line.

Parameters:
lineNumber - number of line (beggining from 1)

select

public void select(int line1,
                   int line2)
Selects text between line1 and line2 (both are included). Caret will stand behing the selection (at the next line if available).

Parameters:
line1 - number of line where to begin (beggining from 1)
line2 - number of line where to finish (beggining from 1)

select

public void select(int lineNumber,
                   int column1,
                   int column2)
Selects text in specified line on position defined by column1 and column2 (both are included). Caret will stand at the end of the selection.

Parameters:
lineNumber - number of line (beggining from 1)
column1 - column position where selection starts (beggining from 1)
column2 - column position where selection ends (beggining from 1)

select

public void select(String text,
                   int index)
Selects index-th occurrence of given text.

Parameters:
text - text to be selected
index - index of text occurrence (first occurrence has index 0)
See Also:
select(String)

select

public void select(String text)
Selects first occurrence of given text.

Parameters:
text - text to be selected
See Also:
select(String, int)

replace

public void replace(String oldText,
                    String newText)
Replaces first occurrence of oldText by newText.

Parameters:
oldText - text to be replaced
newText - text to write instead

replace

public void replace(String oldText,
                    String newText,
                    int index)
Replaced index-th occurrence of oldText by newText.

Parameters:
oldText - text to be replaced
newText - text to write instead
index - index of oldText occurrence (first occurrence has index 0)

insert

public void insert(String text)
Inserts text to current position. Caret will stand at the end of newly inserted text.

Parameters:
text - a string to be inserted

insert

public void insert(String text,
                   int lineNumber,
                   int column)
Inserts text to position specified by line number and column. Caret will stand at the end of newly inserted text.

Parameters:
text - a string to be inserted
lineNumber - number of line (beggining from 1)
column - column position (beggining from 1)

delete

public void delete(int offset,
                   int length)
Deletes given number of characters from specified possition. Position of caret will not change.

Parameters:
offset - position inside document (0 means the beginning)
length - number of characters to be deleted

delete

public void delete(int length)
Deletes given number of characters from current caret possition. Position of caret will not change.

Parameters:
length - number of characters to be deleted

deleteLine

public void deleteLine(int line)
Delete specified line. Position of caret will not change.

Parameters:
line - number of line (beggining from 1)

delete

public void delete(int lineNumber,
                   int column1,
                   int column2)
Deletes characters between column1 and column2 (both are included) on the specified line.

Parameters:
lineNumber - number of line (beggining from 1)
column1 - column position where to start deleting (beggining from 1)
column2 - column position where to stop deleting (beggining from 1)

getLineNumber

public int getLineNumber()
Returns current line number.

Returns:
number of line where the caret stays (first line == 1)

typeKey

public void typeKey(char keyChar)
Types one char.

Overrides:
typeKey in class org.netbeans.jemmy.operators.ComponentOperator
Parameters:
keyChar - key char

typeKey

public void typeKey(char keyChar,
                    int modifiers)
Types one char.

Overrides:
typeKey in class org.netbeans.jemmy.operators.ComponentOperator
Parameters:
keyChar - key char
modifiers - modifiers

typeKey

public void typeKey(int keyCode,
                    char keyChar,
                    int modifiers)
Types one char.

Overrides:
typeKey in class org.netbeans.jemmy.operators.ComponentOperator
Parameters:
keyCode - key code
keyChar - key char
modifiers - modifiers

pushKey

public void pushKey(int keyCode,
                    int modifiers)
Pushes key of requested key code.

Overrides:
pushKey in class org.netbeans.jemmy.operators.ComponentOperator
Parameters:
keyCode - key code
modifiers - modifiers

pushKey

public void pushKey(int keyCode)
Pushes key of requested key code.

Overrides:
pushKey in class org.netbeans.jemmy.operators.ComponentOperator
Parameters:
keyCode - key code

pushHomeKey

public void pushHomeKey()
Pushes Home key (KeyEvent.VK_HOME)


pushEndKey

public void pushEndKey()
Pushes End key (KeyEvent.VK_END)


pushTabKey

public void pushTabKey()
Pushes Tab key (KeyEvent.VK_TAB)


pushDownArrowKey

public void pushDownArrowKey()
Pushes Down key (KeyEvent.VK_DOWN)


pushUpArrowKey

public void pushUpArrowKey()
Pushes Up key (KeyEvent.VK_UP)


setCaretPositionRelative

public void setCaretPositionRelative(int relativeMove)
Sets caret position relatively to current position.

Parameters:
relativeMove - count of charaters to move caret

setCaretPositionToLine

public void setCaretPositionToLine(int lineNumber)
Sets caret position to the beginning of specified line. Lines are numbered from 1, so setCaretPosition(1) will set caret to the beginning of the first line.

Parameters:
lineNumber - number of line (beggining from 1)

setCaretPositionToEndOfLine

public void setCaretPositionToEndOfLine(int lineNumber)
Sets caret position to the end of specified line. Lines are numbered from 1, so setCaretPosition(1) will set caret to the end of the first line.

Parameters:
lineNumber - number of line (beggining from 1)

setCaretPosition

public void setCaretPosition(int lineNumber,
                             int column)
Sets caret position to specified line and column

Parameters:
lineNumber - line number where to set caret
column - column where to set caret (1 means beginning of the row)

setCaretPosition

public void setCaretPosition(int position)
Sets caret to desired position.

Parameters:
position - a position to set caret to (number of characters from the beggining of the file - 0 means beginning of the file).

setCaretPosition

public void setCaretPosition(String text,
                             int index,
                             boolean before)
Sets caret position before or after index-th occurrence of given string.

Parameters:
text - text to be searched
index - index of text occurrence (first occurrence has index 0)
before - if true put caret before text, otherwise after.

setCaretPosition

public void setCaretPosition(String text,
                             boolean before)
Sets caret position before or after first occurrence of given string.

Parameters:
text - text to be searched
before - if true put caret before text, otherwise after.

getAnnotations

public Object[] getAnnotations(int lineNumber)
Gets an array of annotations attached to given line.

Parameters:
lineNumber - number of line (beggining from 1)
Returns:
an array of org.openide.text.Annotation instances
See Also:
getAnnotationShortDescription(java.lang.Object), getAnnotationType(java.lang.Object)

getAnnotations

public Object[] getAnnotations()
Gets all annotations for current editor (Document).

Returns:
array of org.openide.text.Annotation containing all annotations attached to this editor.
See Also:
getAnnotationShortDescription(java.lang.Object), getAnnotationType(java.lang.Object)

getAnnotationType

public static String getAnnotationType(Object annotation)
Returns a string uniquely identifying annotation. For editor bookmark it is for example org.netbeans.modules.editor.NbEditorKit.BOOKMARK_ANNOTATION_TYPE.

Parameters:
annotation - instance of org.openide.text.Annotation
Returns:
a string uniquely identifying annotation
See Also:
getAnnotations(), getAnnotations(int)

getAnnotationShortDescription

public static String getAnnotationShortDescription(Object annotation)
Returns a short description of annotation. It is localized.

Parameters:
annotation - instance of org.openide.text.Annotation
Returns:
a short description of annotation according to current locale

getToolbarButton

public org.netbeans.jemmy.operators.AbstractButtonOperator getToolbarButton(String buttonTooltip)
Return AbstractButtonOperator representing a toolbar button found by given tooltip within the Source Editor.

Parameters:
buttonTooltip - tooltip of toolbar button
Returns:
AbstractButtonOperator instance of found toolbar button

getToolbarButton

public org.netbeans.jemmy.operators.AbstractButtonOperator getToolbarButton(int index)
Return AbstractButtonOperator representing index-th toolbar button within the Source Editor.

Parameters:
index - index of toolbar button to find
Returns:
AbstractButtonOperator instance of found toolbar button

waitFolding

public void waitFolding()
Waits for code folding initialization.


waitCollapsed

public void waitCollapsed()
Waits for fold at cursor position is collapsed.


waitExpanded

public void waitExpanded()
Waits for fold at cursor position is expanded.


collapseFold

public void collapseFold()
Collapses fold at cursor position using CTRL+'-'. It waits until fold is not collapsed.


collapseFold

public void collapseFold(int lineNumber)
Collapses fold at specified line using CTRL+'-'. It waits until fold is not collapsed.

Parameters:
lineNumber - number of line (starts at 1)

expandFold

public void expandFold()
Expands fold at specified line using CTRL+'+'. It waits until fold is not expanded.


expandFold

public void expandFold(int lineNumber)
Expands fold at specified line using CTRL+'+'. It waits until fold is not expanded.

Parameters:
lineNumber - number of line (starts at 1)

isCollapsed

public boolean isCollapsed()
Returns true if fold at cursor position is collapsed, false if it is expanded.

Returns:
true if fold is collapsed, false if it is expanded.

isCollapsed

public boolean isCollapsed(int lineNumber)
Returns true if fold at specified line is collapsed, false if it is expanded.

Parameters:
lineNumber - number of line (starts at 1)
Returns:
true if fold is collapsed, false if it is expanded.

waitModified

public void waitModified(boolean modified)
Waits for given modified state of edited source.

Parameters:
modified - boolean true waits for file state change to modified, false for change to unmodified (saved). Throws TimeoutExpiredException when EditorOperator.WaitModifiedTimeout expires.

save

public void save()
Saves content of this Editor by API. If it is not applicable or content is not modified, it does nothing.

Overrides:
save in class TopComponentOperator

clickForPopup

public void clickForPopup()
Click for popup on JEditorPane component. All events should be delivered to JEditorPane otherwise they are not dispatched correctly.

Overrides:
clickForPopup in class org.netbeans.jemmy.operators.ComponentOperator

verify

public void verify()
Performs verification by accessing all sub-components


org.netbeans.modules.jellytools.ide/3 3.14.0

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