com.togethersoft.openapi.ide.editor
Interface IdeEditor


public interface IdeEditor

Together's text editor. This text editor can contain only one file. It provides methods for opening/saving a file, getting selection and visible area in the editor as well as its current line, column and other file-specific information.

The method getPositionConverter returns a IdeEditorPositionConverter object whose intent is to help you convert integer offset values to/from TextPosition objects (most editor's position-related methods take TextPosition as an argument).

IdeEditorManager creates and closes editors. IdeEditorStyledChar stores data of character itself and its color and format. IdeEditorStyledCharSource determines source of characters.

Author:
TogetherSoft

Method Summary
 TextPositiongetCaretPosition()
           Returns a caret position.
 StringgetFile()
           Returns a string with a name of a file in this editor.
 StringgetHighligtingScheme()
           Returns the name of a highligting scheme.
 intgetLineCount()
           Returns the integer with the number of lines in the file in this editor.
 intgetLineLength(int line)
           Returns the integer with the length of the specified line.
 IdeEditorPositionConvertergetPositionConverter()
           Returns an offset to/from TextPostion converter.
 IdeEditorSelectiongetSelection(String selectionType)
           Retuns a selection of the specified type in this editor.
 IdeEditorStyledCharSourcegetStyledCharSource()
           Returns the IdeEditorStyledCharSource object;
 StringgetText()
           Returns a string with the contents of a file in this editor.
 IdeEditorVisibleAreagetVisibleArea()
           Returns the visible area in this editor.
 voidsave()
           Saves the contents of this file.
 voidsetCaretPosition(TextPosition position)
           Sets the caret position.
 voidsetFile(String fileName)
           Loads a file with the specified name.
 voidsetHighligtingScheme(String scheme)
           Sets a new highligting scheme.
 voidsetText(String text)
           Sets the contents of a file in this editor to the specified value.

Method Detail

getCaretPosition

public TextPosition getCaretPosition()
Returns a caret position.
Returns: TextPosition object
See Also:
setCaretPosition(com.togethersoft.openapi.util.text.TextPosition), TextPosition

getFile

public String getFile()
Returns a string with a name of a file in this editor.
Returns: a string with a name of a file in this editor

getHighligtingScheme

public String getHighligtingScheme()
Returns the name of a highligting scheme. This scheme is used to highlight syntax constuctions, (reserved words etc.) for the programming language.
Returns: String name of this highligting scheme
See Also:
setHighligtingScheme(java.lang.String)

getLineCount

public int getLineCount()
Returns the integer with the number of lines in the file in this editor.
Returns: the integer with the number of lines

getLineLength

public int getLineLength(int line)
Returns the integer with the length of the specified line.
Parameters:
line - int number of the line
Returns: the integer with the length of the specified line

getPositionConverter

public IdeEditorPositionConverter getPositionConverter()
Returns an offset to/from TextPostion converter. Note that you cannot use the same instance of IdeEditorPositionConverter for several editors; use must get a separate instance for each editor in order to convert positions correctly (and you have to load a file using the setFile method first).
Returns: IdeEditorPositionConverter
See Also:
IdeEditorPositionConverter, setFile(java.lang.String)

getSelection

public IdeEditorSelection getSelection(String selectionType)
Retuns a selection of the specified type in this editor. There are three kinds of selections:
Parameters:
selectionType - string with the ID of the kind of selection. These IDs are defined in IdeEditorSelectionType interface.
Returns: IdeEditorSelection instance
See Also:
IdeEditorSelection

getStyledCharSource

public IdeEditorStyledCharSource getStyledCharSource()
Returns the IdeEditorStyledCharSource object;
Returns: the IdeEditorStyledCharSource object;

getText

public String getText()
Returns a string with the contents of a file in this editor.
Returns: a string with the contents of a file in this editor

getVisibleArea

public IdeEditorVisibleArea getVisibleArea()
Returns the visible area in this editor.
Returns: the visible area in this editor - IdeEditorVisibleArea instance.
See Also:
IdeEditorVisibleArea

save

public void save()
Saves the contents of this file.

setCaretPosition

public void setCaretPosition(TextPosition position)
Sets the caret position.
Parameters:
position - TextPosition object
See Also:
getCaretPosition(), TextPosition

setFile

public void setFile(String fileName)
Loads a file with the specified name. If there is no such file, creates a new file.
Parameters:
fileName - the string with the name of the file

setHighligtingScheme

public void setHighligtingScheme(String scheme)
Sets a new highligting scheme. This scheme is used to highlight syntax constuctions, (reserved words etc.) for the programming language.
Parameters:
scheme - String name of the new highligting scheme
See Also:
getHighligtingScheme()

setText

public void setText(String text)
Sets the contents of a file in this editor to the specified value.
Parameters:
text - string with the new contents for the file. Old contents will be overwritten.