Java Code Examples for com.intellij.psi.util.QualifiedName#toString()

The following examples show how to use com.intellij.psi.util.QualifiedName#toString() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: PythonPsiHelper.java    From idea-php-dotenv-plugin with MIT License 5 votes vote down vote up
/**
 * Checks os.environ[""] call
 * @param subscription checking element
 * @return true if
 */
static boolean checkIndexCall(PySubscriptionExpression subscription) {
    QualifiedName qualifiedName = subscription.asQualifiedName();

    if(qualifiedName == null) {
        return false;
    }

    String name = qualifiedName.toString();

    return name != null && name.equals("os.environ.__getitem__");
}
 
Example 2
Source File: PythonPsiHelper.java    From idea-php-dotenv-plugin with MIT License 4 votes vote down vote up
/**
 * Checks os.environ.get("") call
 * @param callExpression checking element
 * @return true if
 */
static boolean checkGetMethodCall(PyCallExpression callExpression) {

    PyExpression callee = callExpression.getCallee();

    if(!(callee instanceof PyReferenceExpression)) {
        return false;
    }

    QualifiedName qualifiedName = ((PyReferenceExpression) (callee)).asQualifiedName();

    if(qualifiedName == null) {
        return false;
    }

    String name = qualifiedName.toString();

    return name != null && (name.equals("os.environ.get") || name.equals("os.getenv"));
}