use of com.intellij.coldFusion.model.psi.impl.CfmlTagImpl in project intellij-plugins by JetBrains.
the class CfmlPredefinedVariablesCompletion method getNameForCfmlTag.
@Nullable
private static String getNameForCfmlTag(@NotNull CompletionParameters pars) {
PsiElement elem = pars.getPosition().getParent().getFirstChild();
if (elem instanceof CfmlReferenceExpression) {
PsiElement resElem = ((CfmlReferenceExpression) elem).resolve();
if (resElem != null) {
PsiElement parent = resElem.getParent();
if (!(parent instanceof CfmlTagImpl)) {
return null;
}
String name = ((CfmlTagImpl) parent).getTagName();
return name.startsWith("cf") ? name.substring(2) : name;
}
}
return null;
}
use of com.intellij.coldFusion.model.psi.impl.CfmlTagImpl in project intellij-plugins by JetBrains.
the class CfmlUtil method isPredefinedTagVariables.
public static boolean isPredefinedTagVariables(CfmlReferenceExpression cfmlRef, Project project) {
String predefVarText = cfmlRef.getLastChild() != null ? cfmlRef.getLastChild().getText() : null;
//try to find tag type by name//
PsiElement referenceName = cfmlRef.getFirstChild();
if (!(referenceName instanceof CfmlReferenceExpression) || predefVarText == null) {
return false;
}
referenceName = ((CfmlReferenceExpression) referenceName).resolve();
referenceName = referenceName != null ? referenceName.getParent() : null;
if (!(referenceName instanceof CfmlTagImpl)) {
return false;
}
String tagName = ((CfmlTagImpl) referenceName).getTagName();
String tagNameWithoutCf = tagName.startsWith("cf") ? tagName.substring(2) : tagName;
return CfmlLangInfo.getInstance(anyProject(project)).getPredefinedVariables().keySet().contains(tagNameWithoutCf.toLowerCase() + "." + predefVarText.toLowerCase());
}
Aggregations