org.eclipse.wst.jsdt.web.core.javascript
Interface IJsTranslation

All Known Implementing Classes:
JsTranslation

public interface IJsTranslation

Provisional API: This class/interface is part of an interim API that is still under development and expected to change significantly before reaching stability. It is being made available at this early stage to solicit feedback from pioneering adopters on the understanding that any code that uses this API will almost certainly be broken (repeatedly) as the API evolves.


Method Summary
 void classpathChange()
          notify the translation to update any external dependancies that are created during translation
 java.lang.String fixupMangledName(java.lang.String displayString)
          fixes a mangled html--> pure js name.
 IJavaScriptElement[] getAllElementsInJsRange(int javaPositionStart, int javaPositionEnd)
           
 IJavaScriptUnit getCompilationUnit()
           
 IJavaScriptElement[] getElementsFromJsRange(int javaPositionStart, int javaPositionEnd)
           
 IDocument getHtmlDocument()
           
 java.lang.String getHtmlText()
           
 IJsTranslation getInstance(IStructuredDocument htmlDocument, IJavaScriptProject javaProj, boolean listenForChanges)
           
 java.lang.String getJavaPath()
           
 IJavaScriptProject getJavaProject()
           
 IJavaScriptElement getJsElementAtOffset(int jsOffset)
           
 java.lang.String getJsText()
           
 int getMissingTagStart()
           
 java.util.List getProblems()
           
 Position[] getScriptPositions()
           
 boolean ifOffsetInImportNode(int offset)
           
 void insertInFirstScriptRegion(java.lang.String text)
           
 void insertScript(int offset, java.lang.String text)
          insert javascript at the given offset.
 void reconcileCompilationUnit()
          checks the CU for errors/consistancy.
 void release()
          release the translation.
 void setProblemCollectingActive(boolean collect)
          start/stop collecting problems within the javascript unit.
 

Method Detail

getJavaProject

IJavaScriptProject getJavaProject()
Returns:
IJavaScriptProject that this translation belongs to

getHtmlDocument

IDocument getHtmlDocument()
Returns:
Original HTML document from the translation.

getMissingTagStart

int getMissingTagStart()
Returns:
integer position of a missing tag (the document isn't well formed and resulted in translation error.).

getAllElementsInJsRange

IJavaScriptElement[] getAllElementsInJsRange(int javaPositionStart,
                                             int javaPositionEnd)
Parameters:
javaPositionStart -
javaPositionEnd -
Returns:
all javascript elements within the given range

getCompilationUnit

IJavaScriptUnit getCompilationUnit()
Returns:
the javascript unit from the jsdt.core

getElementsFromJsRange

IJavaScriptElement[] getElementsFromJsRange(int javaPositionStart,
                                            int javaPositionEnd)
Parameters:
javaPositionStart -
javaPositionEnd -
Returns:

getHtmlText

java.lang.String getHtmlText()
Returns:
string of the document.

getJsElementAtOffset

IJavaScriptElement getJsElementAtOffset(int jsOffset)
Parameters:
jsOffset -
Returns:
a single javascript element at the given offset.

getJsText

java.lang.String getJsText()
Returns:
only the translated javascript text

getScriptPositions

Position[] getScriptPositions()
Returns:
a list of the script regions within the translation.

insertInFirstScriptRegion

void insertInFirstScriptRegion(java.lang.String text)
Parameters:
text -

insertScript

void insertScript(int offset,
                  java.lang.String text)
insert javascript at the given offset. method should ensure the documents well-formedness and proper script region.

Parameters:
offset -
text -

getProblems

java.util.List getProblems()
Returns:
a list of javascript errors

ifOffsetInImportNode

boolean ifOffsetInImportNode(int offset)
Parameters:
offset -
Returns:
if the offset is within a script import node.

reconcileCompilationUnit

void reconcileCompilationUnit()
checks the CU for errors/consistancy.


release

void release()
release the translation. always a good idea to do when you're done. you may notice document and model locks if not.


fixupMangledName

java.lang.String fixupMangledName(java.lang.String displayString)
fixes a mangled html--> pure js name.

Parameters:
displayString -
Returns:

setProblemCollectingActive

void setProblemCollectingActive(boolean collect)
start/stop collecting problems within the javascript unit.

Parameters:
collect -

getJavaPath

java.lang.String getJavaPath()
Returns:

getInstance

IJsTranslation getInstance(IStructuredDocument htmlDocument,
                           IJavaScriptProject javaProj,
                           boolean listenForChanges)
Parameters:
htmlDocument -
javaProj -
listenForChanges -
Returns:

classpathChange

void classpathChange()
notify the translation to update any external dependancies that are created during translation