use of com.intellij.lang.javascript.psi.JSField in project intellij-plugins by JetBrains.
the class AngularBindingDescriptor method createOneTimeBinding.
@Nullable
private static AngularBindingDescriptor createOneTimeBinding(Pair<PsiElement, String> dom) {
PsiElement element = dom.first;
if (element instanceof JSImplicitElement) {
String type = ((JSImplicitElement) element).getTypeString();
if (type != null && (type.endsWith("String") || type.endsWith("Object"))) {
return new AngularBindingDescriptor(element, dom.second);
}
}
final JSType type = expandStringLiteralTypes(element instanceof JSFunction ? ((JSFunction) element).getReturnType() : element instanceof JSField ? ((JSField) element).getType() : null);
return type != null && type.isDirectlyAssignableType(STRING_TYPE, null) ? new AngularBindingDescriptor(element, dom.second) : null;
}
use of com.intellij.lang.javascript.psi.JSField in project intellij-plugins by JetBrains.
the class NodeClassInfo method fillMapsForClass.
private static void fillMapsForClass(final JSClass jsClass, final Map<String, Icon> staticFields, final Map<String, Icon> staticProperties, final Map<String, Icon> fields, final Map<String, Icon> properties) {
for (final JSField variable : jsClass.getFields()) {
final JSAttributeList varAttributes = variable.getAttributeList();
if (varAttributes != null && varAttributes.hasModifier(JSAttributeList.ModifierType.STATIC)) {
staticFields.put(variable.getName(), variable.getIcon(Iconable.ICON_FLAG_VISIBILITY));
} else {
fields.put(variable.getName(), variable.getIcon(Iconable.ICON_FLAG_VISIBILITY));
}
}
for (final JSFunction function : jsClass.getFunctions()) {
if (function.getKind() == JSFunction.FunctionKind.GETTER && function.getName() != null) {
final JSAttributeList functionAttributes = function.getAttributeList();
if (functionAttributes != null && functionAttributes.hasModifier(JSAttributeList.ModifierType.STATIC)) {
staticProperties.put(function.getName(), function.getIcon(Iconable.ICON_FLAG_VISIBILITY));
} else {
properties.put(function.getName(), function.getIcon(Iconable.ICON_FLAG_VISIBILITY));
}
}
}
if (jsClass instanceof MxmlJSClass) {
final PsiFile file = jsClass.getContainingFile();
final XmlFile xmlFile = file instanceof XmlFile ? (XmlFile) file : null;
final XmlTag rootTag = xmlFile == null ? null : xmlFile.getRootTag();
if (rootTag != null) {
processSubtagsRecursively(rootTag, tag -> {
final String id = tag.getAttributeValue("id");
if (id != null) {
fields.put(id, tag.getIcon(Iconable.ICON_FLAG_VISIBILITY));
}
return !MxmlJSClass.isTagThatAllowsAnyXmlContent(tag);
});
}
}
}
Aggregations