public class JavaScriptHelper
extends java.lang.Object
| Modifier and Type | Class and Description |
|---|---|
static class |
JavaScriptHelper.ParseText |
| Constructor and Description |
|---|
JavaScriptHelper() |
| Modifier and Type | Method and Description |
|---|---|
static boolean |
canResolveVariable(org.mozilla.javascript.ast.AstNode target,
org.mozilla.javascript.ast.AstNode initialiser)
Test whether the start of the variable is the same name as the variable
being initialised.
|
static java.lang.String |
convertNodeToSource(org.mozilla.javascript.ast.AstNode node) |
static TypeDeclaration |
createNewTypeDeclaration(java.lang.String newName) |
static org.mozilla.javascript.ast.FunctionCall |
findFunctionCallFromNode(org.mozilla.javascript.ast.AstNode node)
Iterate back up through parent nodes and check whether inside a function
If the node is a function, then the Parsed parent node structure is:
FunctionCall
--> PropertyGet
--> Name
Anything other structure should be rejected.
|
static int |
findIndexOfFirstOpeningBracket(java.lang.String text)
Returns the index of the first ( working backwards if there is no
matching closing bracket
|
static int |
findIndexOfFirstOpeningSquareBracket(java.lang.String text) |
static int |
findLastIndexOfJavaScriptIdentifier(java.lang.String input) |
static TypeDeclaration |
findOrMakeTypeDeclaration(java.lang.String name,
SourceCompletionProvider provider) |
static java.lang.String |
getFunctionNameLookup(org.mozilla.javascript.ast.AstNode node,
SourceCompletionProvider provider) |
static TypeDeclaration |
getTypeDeclaration(java.lang.String name,
SourceCompletionProvider provider)
Convenience method to lookup TypeDeclaration through the
TypeDeclarationFactory.
|
static boolean |
isInfixOnly(org.mozilla.javascript.ast.AstNode typeNode) |
static JavaScriptHelper.ParseText |
parseEnteredText(java.lang.String text)
Parse Text with JavaScript Parser and return AstNode from the expression
etc..
|
static java.lang.String |
removeLastDotFromText(java.lang.String text) |
static TypeDeclaration |
tokenToNativeTypeDeclaration(org.mozilla.javascript.ast.AstNode typeNode,
SourceCompletionProvider provider)
Convert AstNode to TypeDeclaration
|
static java.lang.String |
trimFromLastParam(java.lang.String text)
Trims the text from the last , from the string
Looks for ( or [ starting at the end of the string to find out where in the string to substring.
|
public static boolean canResolveVariable(org.mozilla.javascript.ast.AstNode target,
org.mozilla.javascript.ast.AstNode initialiser)
target - Name of variable being createdinitialiser - name of initialiserpublic static final JavaScriptHelper.ParseText parseEnteredText(java.lang.String text)
text - to parsepublic static java.lang.String getFunctionNameLookup(org.mozilla.javascript.ast.AstNode node,
SourceCompletionProvider provider)
node - AstNode to look for functionpublic static org.mozilla.javascript.ast.FunctionCall findFunctionCallFromNode(org.mozilla.javascript.ast.AstNode node)
node - public static final TypeDeclaration tokenToNativeTypeDeclaration(org.mozilla.javascript.ast.AstNode typeNode, SourceCompletionProvider provider)
typeNode - AstNode to convertprovider - SourceProviderpublic static TypeDeclaration findOrMakeTypeDeclaration(java.lang.String name, SourceCompletionProvider provider)
public static TypeDeclaration createNewTypeDeclaration(java.lang.String newName)
public static boolean isInfixOnly(org.mozilla.javascript.ast.AstNode typeNode)
public static java.lang.String convertNodeToSource(org.mozilla.javascript.ast.AstNode node)
public static int findIndexOfFirstOpeningBracket(java.lang.String text)
text - public static int findIndexOfFirstOpeningSquareBracket(java.lang.String text)
public static TypeDeclaration getTypeDeclaration(java.lang.String name, SourceCompletionProvider provider)
name - public static int findLastIndexOfJavaScriptIdentifier(java.lang.String input)
public static java.lang.String removeLastDotFromText(java.lang.String text)
text - to trimpublic static java.lang.String trimFromLastParam(java.lang.String text)
text -