| bluej.editor.Editor
All known Subclasses: bluej.editor.moe.MoeEditor,
Editor | public interface Editor (Code) | | Interface between an editor and the rest of BlueJ
version: $Id: Editor.java 5390 2007-11-21 05:06:41Z davmac $ author: Michael Cahill author: Michael Kolling |
Method Summary | |
void | changeName(String title, String filename, String docFileName) Change class name. | void | clear() Clear the current buffer. | void | close() Close the editor window. | void | displayMessage(String message, int lineNumber, int column, boolean beep, boolean setStepMark, String help) Display a message (used for compile/runtime errors). | Rectangle | getBounds() Gets the bounds for this editor window. | public LineColumn | getCaretLocation() Returns the current caret location within the edited text. | public LineColumn | getLineColumnFromOffset(int offset) Returns the LineColumn object from the given offset in the text. | public int | getLineLength(int line) Returns the length of the line indicated in the edited text. | public int | getOffsetFromLineColumn(LineColumn location) Translates a LineColumn into an offset into the text held by the editor. | public Object | getProperty(String propertyKey) Returns a property of the current editor.
Parameters: propertyKey - The propertyKey of the property to retrieve. | public LineColumn | getSelectionBegin() Returns the location at which current selection begins. | public LineColumn | getSelectionEnd() Returns the location where the current selection ends. | public String | getText(LineColumn begin, LineColumn end) Returns the text which lies between the two LineColumn. | public int | getTextLength() Returns the length of the data. | void | insertText(String text, boolean caretBack) Insert a string into the buffer. | boolean | isModified() | boolean | isReadOnly() Test if this editor is 'read-only'.
the readOnlyStatus. | boolean | isShowing() True is the editor is on screen. | boolean | isShowingInterface() Tell whether the editor is currently displaying the interface or the
source of the class. | public int | numberOfLines() Return the number of lines in the documant. | void | print(PrinterJob printerJob) | void | reInitBreakpoints() Breakpoints have been reset due to compilation or
similar. | void | refresh() | void | reloadFile() Reload and display the same file that was displayed before. | void | removeBreakpoints() All breakpoints have been cleared for this class, update the
editor display to reflect this. | void | removeStepMark() Remove the step mark (the mark that shows the current line when
single-stepping through code). | void | save() Save the buffer to disk under the current file name. | public void | setCaretLocation(LineColumn location) Sets the current Caret location within the edited text. | void | setCompiled(boolean compiled) | public void | setProperty(String propertyKey, Object value) Set a property for the current editor. | void | setReadOnly(boolean readOnly) Set the 'read-only' property of this editor. | void | setSelection(int lineNumber, int column, int len) | void | setSelection(int firstlineNumber, int firstColumn, int secondLineNumber, int SecondColumn) | public void | setSelection(LineColumn begin, LineColumn end) Request to the editor to mark the text between begin and end as selected. | public void | setText(LineColumn begin, LineColumn end, String newText) Request to the editor to replace the text between beginning and end with the given newText
If begin and end points to the same location, the text is inserted. | void | setVisible(boolean vis) Show the editor window. | boolean | showFile(String filename, boolean compiled, String docFilename, Rectangle bounds) Read a file into the editor buffer and show the editor. | void | showInterface(boolean interfaceStatus) Set the view of this editor to display either the source or the interface
of the class. | public void | writeMessage(String msg) Display a message into the info area. |
changeName | void changeName(String title, String filename, String docFileName)(Code) | | Change class name.
Parameters: title - new window title Parameters: filename - new file name Parameters: docFileName - new documentation file name |
clear | void clear()(Code) | | Clear the current buffer. The editor is not redisplayed after a call to
this function. It is typically used in a sequence "clear; [insertText];
show".
|
close | void close()(Code) | | Close the editor window.
|
displayMessage | void displayMessage(String message, int lineNumber, int column, boolean beep, boolean setStepMark, String help)(Code) | | Display a message (used for compile/runtime errors). An editor must
support at least two lines of message text, so the message can contain
a newline character.
Parameters: message - the message to be displayed Parameters: lineNumber - the line to move the cursor to (the line is alsohighlighted) Parameters: column - the column to move the cursor to Parameters: beep - if true, do a system beep Parameters: setStepMark - if true, set step mark (for single stepping) Parameters: help - name of help group (may be null) |
getBounds | Rectangle getBounds()(Code) | | Gets the bounds for this editor window.
This method is used to store the bounds between sessions.
The bounds |
getCaretLocation | public LineColumn getCaretLocation()(Code) | | Returns the current caret location within the edited text.
the LineColumn object. |
getLineColumnFromOffset | public LineColumn getLineColumnFromOffset(int offset)(Code) | | Returns the LineColumn object from the given offset in the text.
the LineColumn object or null if the offset points outside the text. |
getLineLength | public int getLineLength(int line)(Code) | | Returns the length of the line indicated in the edited text.
Parameters: line - the line in the text for which the length should be calculated, starting from 0 the length of the line, -1 if line is invalid |
getOffsetFromLineColumn | public int getOffsetFromLineColumn(LineColumn location)(Code) | | Translates a LineColumn into an offset into the text held by the editor.
Parameters: location - position to be translated the offset into the content of this editor throws: IllegalArgumentException - if the specified LineColumnrepresent a position which does not exist in the text. |
getProperty | public Object getProperty(String propertyKey)(Code) | | Returns a property of the current editor.
Parameters: propertyKey - The propertyKey of the property to retrieve. the property value or null if it is not found |
getSelectionBegin | public LineColumn getSelectionBegin()(Code) | | Returns the location at which current selection begins.
the current beginning of the selection or null if no text is selected. |
getSelectionEnd | public LineColumn getSelectionEnd()(Code) | | Returns the location where the current selection ends.
the current end of the selection or null if no text is selected. |
getText | public String getText(LineColumn begin, LineColumn end)(Code) | | Returns the text which lies between the two LineColumn.
Parameters: begin - The beginning of the text to get Parameters: end - The end of the text to get The text value throws: IllegalArgumentException - if either of the specified TextLocations represent a position which does not exist in the text. |
getTextLength | public int getTextLength()(Code) | | Returns the length of the data. This is the number of
characters of content that represents the users data.
It is possible to obtain the line and column of the last character of text by using
the getLineColumnFromOffset() method.
the length >= 0 |
insertText | void insertText(String text, boolean caretBack)(Code) | | Insert a string into the buffer. The editor is not immediately
redisplayed. This function is typically used in a sequence "clear;
[insertText]; show".
Parameters: text - the text to be inserted Parameters: caretBack - move the caret to the beginning of the inserted text |
isModified | boolean isModified()(Code) | | Determine whether this editor has been modified from the version on disk
a boolean indicating whether the file is modified |
isReadOnly | boolean isReadOnly()(Code) | | Test if this editor is 'read-only'.
the readOnlyStatus. If true, editor is non-editable. |
isShowing | boolean isShowing()(Code) | | True is the editor is on screen.
true if editor is on screen |
isShowingInterface | boolean isShowingInterface()(Code) | | Tell whether the editor is currently displaying the interface or the
source of the class.
True, if interface is currently shown, false otherwise. |
numberOfLines | public int numberOfLines()(Code) | | Return the number of lines in the documant.
|
reInitBreakpoints | void reInitBreakpoints()(Code) | | Breakpoints have been reset due to compilation or
similar. Re-initialize the breakpoints by re-setting them via the
EditorWatcher interface.
|
refresh | void refresh()(Code) | | Refresh the editor display (needed if font size has changed)
|
reloadFile | void reloadFile()(Code) | | Reload and display the same file that was displayed before.
This should generated a modificationEvent followed by a saveEvent.
|
removeBreakpoints | void removeBreakpoints()(Code) | | All breakpoints have been cleared for this class, update the
editor display to reflect this.
|
removeStepMark | void removeStepMark()(Code) | | Remove the step mark (the mark that shows the current line when
single-stepping through code). If it is not currently displayed, do
nothing.
|
save | void save() throws IOException(Code) | | Save the buffer to disk under the current file name. This is an error if
the editor has not been given a file name (ie. if readFile was not
executed).
If save() is called on an unmodified file, it returns immediately without
re-writing the file to disk.
|
setCaretLocation | public void setCaretLocation(LineColumn location)(Code) | | Sets the current Caret location within the edited text.
Parameters: location - The location in the text to set the Caret to. throws: IllegalArgumentException - if the specified TextLocation represents a position which does not exist in the text. |
setCompiled | void setCompiled(boolean compiled)(Code) | | Set the "compiled" status
Parameters: compiled - true if the class has been compiled |
setProperty | public void setProperty(String propertyKey, Object value)(Code) | | Set a property for the current editor. Any existing property with
this key will be overwritten.
Parameters: propertyKey - The property key of the new property Parameters: value - The new property value |
setReadOnly | void setReadOnly(boolean readOnly)(Code) | | Set the 'read-only' property of this editor.
Parameters: readOnlyStatus - If true, editor is non-editable. |
setSelection | void setSelection(int lineNumber, int column, int len)(Code) | | Set the selection of the editor to be a len characters on the line
lineNumber, starting with column columnNumber
Parameters: lineNumber - the line to select characters on Parameters: column - the column to start selection at (1st column is 1 - not 0) Parameters: len - the number of characters to select |
setSelection | void setSelection(int firstlineNumber, int firstColumn, int secondLineNumber, int SecondColumn)(Code) | | Set the selection of the editor to be a len characters on the line
lineNumber, starting with column columnNumber
Parameters: lineNumber - the line to select characters on Parameters: column - the column to start selection at (1st column is 1 - not 0) Parameters: len - the number of characters to select |
setSelection | public void setSelection(LineColumn begin, LineColumn end)(Code) | | Request to the editor to mark the text between begin and end as selected.
Parameters: begin - where to start the selection Parameters: end - where to end the selection throws: IllegalArgumentException - if either of the specified TextLocationsrepresent a position which does not exist in the text. |
setText | public void setText(LineColumn begin, LineColumn end, String newText) throws BadLocationException(Code) | | Request to the editor to replace the text between beginning and end with the given newText
If begin and end points to the same location, the text is inserted.
Parameters: begin - where to start to replace Parameters: end - where to end to replace Parameters: newText - The new text value throws: IllegalArgumentException - if either of the specified LineColumnrepresent a position which does not exist in the text. throws: BadLocationException - if internally the text points outside a location in the text. |
setVisible | void setVisible(boolean vis)(Code) | | Show the editor window. This includes whatever is necessary of the
following: make visible, de-iconify, bring to front of window stack.
Parameters: vis - DOCUMENT ME! |
showFile | boolean showFile(String filename, boolean compiled, String docFilename, Rectangle bounds)(Code) | | Read a file into the editor buffer and show the editor. If the editor
already contains text, it is cleared first.
Parameters: filename - the file to be read Parameters: compiled - true if this is a compiled class false is there was a problem, true otherwise |
showInterface | void showInterface(boolean interfaceStatus)(Code) | | Set the view of this editor to display either the source or the interface
of the class.
Parameters: interfaceStatus - If true, display class interface, otherwise source. |
writeMessage | public void writeMessage(String msg)(Code) | | Display a message into the info area.
The message will be cleared when the caret is moved.
Parameters: msg - the message to display |
|
|