Java Code Examples for com.intellij.lang.ASTNode.getText()

The following are Jave code examples for showing how to use getText() of the com.intellij.lang.ASTNode class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
Example 1
Project: TS-IJ   File: TSPsiImplUtil.java   Source Code and License Vote up 6 votes
public static String getFunctionName(TSFnNameStmt element) {
    ASTNode nameNode = null;
    //Find which node contains our function name
    switch (getFunctionType(element)) {
        case GLOBAL:
            nameNode = element.getNode().findChildByType(TSTypes.ID);
            break;
        case GLOBAL_NS:
        case METHOD:
            ASTNode anchor = element.getNode().findChildByType(TSTypes.COLON_DOUBLE);
            nameNode = element.getNode().findChildByType(TSTypes.ID, anchor);
            break;
    }
    if (nameNode == null) {
        return null;
    }
    return nameNode.getText();
}
 
Example 2
Project: TS-IJ   File: TSPsiImplUtil.java   Source Code and License Vote up 5 votes
public static String getArgList(TSFnDeclStmt element) {
    ASTNode argNode = element.getNode().findChildByType(TSTypes.VAR_LIST);

    if (argNode != null) {
        return "(" + argNode.getText() + ")";
    } else {
        return "()";
    }
}
 
Example 3
Project: TS-IJ   File: TSPsiImplUtil.java   Source Code and License Vote up 5 votes
public static String getNamespace(TSFnNameStmt element) {
    if (element.getFunctionType() == TSFunctionType.GLOBAL) {
        return null;
    }

    //Namespace should be the first
    ASTNode nsNode = element.getNode().findChildByType(TSTypes.ID);
    if (nsNode == null) {
        return null;
    }

    return nsNode.getText();
}
 
Example 4
Project: TS-IJ   File: TSPsiImplUtil.java   Source Code and License Vote up 5 votes
public static String getName(TSPackageDecl pkg) {
    //First id token is the name
    ASTNode nameNode = pkg.getNode().findChildByType(TSTypes.ID);
    if (nameNode == null) {
        return null;
    }

    return nameNode.getText();
}
 
Example 5
Project: intellij-postfix-templates   File: CptPsiImplUtil.java   Source Code and License Vote up 5 votes
public static String getTemplateDescription(CptTemplate element) {
	ASTNode valueNode = element.getNode().findChildByType(CptTypes.TEMPLATE_DESCRIPTION);
	if (valueNode != null) {
		return valueNode.getText();
	} else {
		return null;
	}
}
 
Example 6
Project: intellij-postfix-templates   File: CptPsiImplUtil.java   Source Code and License Vote up 5 votes
public static String getReplacementString(CptMapping element) {
	ASTNode valueNode = element.getNode().findChildByType(CptTypes.REPLACEMENT);
	if (valueNode != null) {
		return valueNode.getText();
	} else {
		return null;
	}
}
 
Example 7
Project: intellij-crystal   File: CrystalPsiImplUtil.java   Source Code and License Vote up 5 votes
public static String getValue(CrystalProperty element) {
    ASTNode valueNode = element.getNode().findChildByType(CrystalTypes.VALUE);
    if (valueNode != null) {
        return valueNode.getText();
    } else {
        return null;
    }
}
 
Example 8
Project: manifold-ij   File: ManLightMethodBuilderImpl.java   Source Code and License Vote up 5 votes
@Override
public String getText()
{
  ASTNode node = getNode();
  if( null != node )
  {
    return node.getText();
  }
  return "";
}
 
Example 9
Project: intellij-csv-validator   File: CsvFormatHelper.java   Source Code and License Vote up 5 votes
public static int getTextLength(ASTNode node, CodeStyleSettings codeStyleSettings) {
    CsvCodeStyleSettings csvCodeStyleSettings = codeStyleSettings.getCustomSettings(CsvCodeStyleSettings.class);
    String text = node.getText();
    int length = node.getTextLength();
    if (csvCodeStyleSettings.TABULARIZE && !csvCodeStyleSettings.WHITE_SPACES_OUTSIDE_QUOTES && text.startsWith("\"")) {
        text = text.substring(1, text.length() - 1);
        text = BEGIN_WHITE_SPACE_PATTERN.matcher(text).replaceFirst("");
        text = END_WHITE_SPACE_PATTERN.matcher(text).replaceFirst("");
        length = text.length() + 2;
    }
    return length;
}
 
Example 10
Project: AppleScript-IDEA   File: AppleScriptHandlerSelectorPartImpl.java   Source Code and License Vote up 4 votes
@Nullable
@Override
public String getParameterName() {
  ASTNode node = findParameterNode();
  return node != null ? node.getText() : null;
}