|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object bluej.extensions.editor.Editor
public class Editor
Proxy object that allows interaction with the BlueJ Editor for a particular class. Except as marked, methods of this class must be called from a swing compatible thread.
Method Summary | |
---|---|
TextLocation |
getCaretLocation()
Returns the current caret location (the position of the user's cursor) within the edited text. |
int |
getLineCount()
Returns the total number of lines in the currently edited text. |
int |
getLineLength(int line)
Returns the length of the line indicated in the edited text. |
int |
getOffsetFromTextLocation(TextLocation location)
Translates a text location into an offset into the text held by the editor. |
java.lang.Object |
getProperty(java.lang.String propertyKey)
Returns a property of the current editor. |
TextLocation |
getSelectionBegin()
Returns the location at which current selection begins. |
TextLocation |
getSelectionEnd()
Returns the location at which the current selection ends. |
java.lang.String |
getText(TextLocation begin,
TextLocation end)
Returns the text which lies between the two TextLocations. |
int |
getTextLength()
Returns the length of the currently edited text. |
TextLocation |
getTextLocationFromOffset(int offset)
Translate an offset in the text held by the editor into a TextLocation. |
boolean |
isReadOnly()
Is the editor currently set to readOnly?. |
boolean |
isVisible()
Is this Editor currently visible? |
void |
loadFile()
Request the editor to load the file currently opened. |
void |
saveFile()
Request the editor to save the file currently opened. |
void |
setCaretLocation(TextLocation location)
Sets the current caret location within the edited text. |
void |
setProperty(java.lang.String propertyKey,
java.lang.Object value)
Set a property for the current editor. |
void |
setReadOnly(boolean readOnly)
Request the editor to permit or deny editor content modification (via the editor GUI). |
void |
setSelection(TextLocation begin,
TextLocation end)
Request the editor to mark the text between begin and end as selected. |
void |
setText(TextLocation begin,
TextLocation end,
java.lang.String newText)
Request the editor to replace the text between beginning and end with the given newText If begin and end refer to the same location, the text is inserted. |
void |
setVisible(boolean visible)
Show or hide this Editor. |
void |
showMessage(java.lang.String message)
Request the editor to display the given message in the editor message area. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
public void saveFile()
public void loadFile()
public void setVisible(boolean visible)
visible
- If true, make this editor visiblepublic boolean isVisible()
public TextLocation getCaretLocation()
public void setCaretLocation(TextLocation location)
location
- The location in the text to set the Caret to.
java.lang.IllegalArgumentException
- if the specified TextLocation represents a position which does not exist in the text.public void showMessage(java.lang.String message)
message
- The message to display.public TextLocation getSelectionBegin()
public TextLocation getSelectionEnd()
public java.lang.String getText(TextLocation begin, TextLocation end)
begin
- The beginning of the text to getend
- The end of the text to get
java.lang.IllegalArgumentException
- if either of the specified TextLocations represent a position which does not exist in the text.public void setText(TextLocation begin, TextLocation end, java.lang.String newText)
begin
- where to start to replaceend
- where to end to replacenewText
- The new text value
java.lang.IllegalArgumentException
- if either of the specified TextLocations
represent a position which does not exist in the text.public void setSelection(TextLocation begin, TextLocation end)
begin
- where to start the selectionend
- where to end the selection
java.lang.IllegalArgumentException
- if either of the specified TextLocations
represent a position which does not exist in the text.public void setReadOnly(boolean readOnly)
readOnly
- If true user cannot change the editor content using the GUI, false allows user interaction.public boolean isReadOnly()
public java.lang.Object getProperty(java.lang.String propertyKey)
propertyKey
- The propertyKey of the property to retrieve.
public void setProperty(java.lang.String propertyKey, java.lang.Object value)
propertyKey
- The property key of the new propertyvalue
- The new property valuepublic int getOffsetFromTextLocation(TextLocation location)
location
- position to be translated
java.lang.IllegalArgumentException
- if the specified TextLocation
represent a position which does not exist in the text.public TextLocation getTextLocationFromOffset(int offset)
offset
- location to be translated
public int getLineLength(int line)
line
- the line in the text for which the length should be calculated, starting from zero.
public int getLineCount()
public int getTextLength()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |