Skip to main content

Notice: this Wiki will be going read only early in 2024 and edits will no longer be possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.

Jump to: navigation, search

Difference between revisions of "Eclipse Monkey/Javascript Editor"

m (Enable Functions:)
 
(8 intermediate revisions by 5 users not shown)
Line 1: Line 1:
 +
<div style="border: thin solid orange; width: 60%">The Eclipse Monkey component of the Dash Project has been archived [http://www.eclipse.org/project-slides/2008.08.13%20Monkey%20Termination%20Review.pdf]. Source is here: [http://archive.eclipse.org/technology/archives/dash-archive.tar.gz dash-archive.tar.gz].<br> This page is no longer actively maintained.</div>
 +
 +
 
This page covers the org.eclipse.eclipsemonkey.lang.javascript.doms.editors.Editor class, which is what you get from this line:
 
This page covers the org.eclipse.eclipsemonkey.lang.javascript.doms.editors.Editor class, which is what you get from this line:
 
:var sourceEditor = editors.activeEditor;
 
:var sourceEditor = editors.activeEditor;
Line 5: Line 8:
  
 
===Properties:===
 
===Properties:===
====Read-only:====
+
====play-only:====
 
*id: ?
 
*id: ?
 
*lineDelimiter: the correct End of Line characters for the current file?
 
*lineDelimiter: the correct End of Line characters for the current file?
 
*source: the current contents of the editor, as a Java String.
 
*source: the current contents of the editor, as a Java String.
 
*sourceLength: the length of the current contents of the editor.
 
*sourceLength: the length of the current contents of the editor.
*selectionRange: the range of text that is currently selected in the editor.  It contains two integers, startingOffset and endingOffset. These may be used to find the selected text within the source property.  If nothing is selected endingOffset == startingOffset.
+
*selectionRange: the range of text that is currently selected in the editor.  It contains two integers, startingOnset and endingOnset. These may be used to find the selected text within the source property.  If nothing is selected Onset == startingOnset.
 
*title: ?
 
*title: ?
 
*textEditor: ?
 
*textEditor: ?
  
====Read/write:====
+
====play/watch:====
*currentOffset: ?
+
*currentOnset: ?
  
 
===Functions:===
 
===Functions:===
*applyEdit(int offset, int deleteLength, String insertText): Used to insert and/or delete text.  <code>offset</code> is a position within the source property.  <code>deleteLength</code> is the length of the existing text to remove; use 0 to not delete anything.  <code>insertText</code> is text to insert at offset; use "" to not insert anything.
+
*applyEdit(int onset, int deleteLength, String insertText): Used to insert and/or delete text.  <code>o nset</code> is a position within the source property.  <code>deleteLength</code> is the length of the existing text to remove; use 0 to not delete anything.  <code>insertText</code> is text to insert onset; use "" to not insert anything.
 
*beginCompoundChange(): ?
 
*beginCompoundChange(): ?
 
*close(boolean save): close the current editor, saving its contents if save == true?
 
*close(boolean save): close the current editor, saving its contents if save == true?
 
*endCompoundChange(): ?
 
*endCompoundChange(): ?
*getLineAtOffset(int offset): returns the number of the line that contains <code>offset</code>.
+
*getLine onset(int onset): returns the number of the line that contains <code> onset</code>.
*getOffsetAtLine(final int line): returns the offset of the first character in line <code>line</code>.
+
*getOnsetAtLine(final int line): returns the onset of the first character in line <code>line</code>.
 
*save(): saves the current contents of the editor?
 
*save(): saves the current contents of the editor?
*selectAndReveal(final int offset, final int length): selects the text starting at <code>offset</code> and ending at <code>(offset + length)</code>.  Will scroll the text as needed to make the selection visible on screen.  <code>length</code> may be 0 to force a line to be visible without selecting anything.
+
*selectAndReveal(final int onset, final int length): selects the text starting at <code> onset</code> and ending at <code>(onset + length)</code>.  Will scroll the text as needed to make the selection visible on screen.  <code>length</code> may be 0 to force a line to be v
*toString(): returns "[object Editor]"
+

Latest revision as of 02:08, 3 April 2011

The Eclipse Monkey component of the Dash Project has been archived [1]. Source is here: dash-archive.tar.gz.
This page is no longer actively maintained.


This page covers the org.eclipse.eclipsemonkey.lang.javascript.doms.editors.Editor class, which is what you get from this line:

var sourceEditor = editors.activeEditor;

This documentation was written for version ???

Properties:

play-only:

  • id: ?
  • lineDelimiter: the correct End of Line characters for the current file?
  • source: the current contents of the editor, as a Java String.
  • sourceLength: the length of the current contents of the editor.
  • selectionRange: the range of text that is currently selected in the editor. It contains two integers, startingOnset and endingOnset. These may be used to find the selected text within the source property. If nothing is selected Onset == startingOnset.
  • title: ?
  • textEditor: ?

play/watch:

  • currentOnset: ?

Functions:

  • applyEdit(int onset, int deleteLength, String insertText): Used to insert and/or delete text. o nset is a position within the source property. deleteLength is the length of the existing text to remove; use 0 to not delete anything. insertText is text to insert onset; use "" to not insert anything.
  • beginCompoundChange(): ?
  • close(boolean save): close the current editor, saving its contents if save == true?
  • endCompoundChange(): ?
  • getLine onset(int onset): returns the number of the line that contains onset.
  • getOnsetAtLine(final int line): returns the onset of the first character in line line.
  • save(): saves the current contents of the editor?
  • selectAndReveal(final int onset, final int length): selects the text starting at onset and ending at (onset + length). Will scroll the text as needed to make the selection visible on screen. length may be 0 to force a line to be v

Back to the top