use of com.intellij.lang.javascript.psi.ecmal4.JSClass in project intellij-plugins by JetBrains.
the class CreateFlexSkinIntention method appendSkinStates.
private static void appendSkinStates(final Collection<String> skinStates, final JSClass jsClass, final Set<JSClass> visited) {
visited.add(jsClass);
final JSAttributeList attributeList = jsClass.getAttributeList();
if (attributeList != null) {
final JSAttribute[] attributes = attributeList.getAttributesByName("SkinState");
for (final JSAttribute attribute : attributes) {
final JSAttributeNameValuePair pair = attribute.getValueByName(null);
if (pair != null) {
final String state = pair.getSimpleValue();
if (!skinStates.contains(state)) {
skinStates.add(state);
}
}
}
}
for (final JSClass superClass : jsClass.getSuperClasses()) {
if (!visited.contains(superClass)) {
appendSkinStates(skinStates, superClass, visited);
}
}
}
use of com.intellij.lang.javascript.psi.ecmal4.JSClass in project intellij-plugins by JetBrains.
the class AngularJS2IndexingHandler method determineModuleName.
private static String determineModuleName(@NotNull JSCallExpression callExpression) {
if (!(callExpression.getParent() instanceof ES6Decorator))
return null;
final ES6Decorator decorator = (ES6Decorator) callExpression.getParent();
final PsiElement owner = decorator.getOwner();
if (owner instanceof JSClass)
return ((JSClass) owner).getName();
return null;
}
use of com.intellij.lang.javascript.psi.ecmal4.JSClass in project intellij-plugins by JetBrains.
the class AngularJS2IndexingHandler method isTemplate.
private static boolean isTemplate(PsiElement decorator) {
final JSClass clazz = PsiTreeUtil.getParentOfType(decorator, JSClass.class);
if (clazz != null) {
final JSFunction constructor = clazz.getConstructor();
final JSParameterList params = constructor != null ? constructor.getParameterList() : null;
return params != null && params.getText().contains(TEMPLATE_REF);
}
final PsiElement parent = decorator.getParent();
if (parent instanceof JSArrayLiteralExpression) {
final JSCallExpression metadata = PsiTreeUtil.getNextSiblingOfType(decorator, JSCallExpression.class);
return hasTemplateRef(metadata);
}
if (parent instanceof JSObjectLiteralExpression) {
JSQualifiedName namespace = getCompiledDecoratorNamespace(parent);
if (namespace == null)
return false;
final JSBlockStatement block = PsiTreeUtil.getParentOfType(parent, JSBlockStatement.class);
final JSFile file = block == null ? PsiTreeUtil.getParentOfType(parent, JSFile.class) : null;
final JSSourceElement[] statements = block != null ? block.getStatements() : file != null ? file.getStatements() : JSStatement.EMPTY;
for (JSSourceElement statement : statements) {
if (statement instanceof JSExpressionStatement) {
final JSExpression expression = ((JSExpressionStatement) statement).getExpression();
if (expression instanceof JSAssignmentExpression) {
final JSDefinitionExpression def = ((JSAssignmentExpression) expression).getDefinitionExpression();
if (def != null && "ctorParameters".equals(def.getName()) && namespace.equals(def.getJSNamespace().getQualifiedName())) {
return hasTemplateRef(expression) || PsiTreeUtil.hasErrorElements(expression) && !DialectDetector.isES6(expression) && hasTemplateRef(PsiTreeUtil.getNextSiblingOfType(statement, JSExpressionStatement.class));
}
}
}
}
}
return false;
}
use of com.intellij.lang.javascript.psi.ecmal4.JSClass in project intellij-plugins by JetBrains.
the class FlexHighlightingTest method testFxPrivate.
@JSTestOptions({ JSTestOption.WithFlexFacet, JSTestOption.WithGumboSdk })
public void testFxPrivate() throws Exception {
doTestFor(true, getTestName(false) + ".mxml");
final JSClassResolver resolver = JSDialectSpecificHandlersFactory.forLanguage(JavaScriptSupportLoader.ECMA_SCRIPT_L4).getClassResolver();
final JSClass jsClass = (JSClass) resolver.findClassByQName("mx.controls.CheckBox", GlobalSearchScope.moduleWithLibrariesScope(myModule));
final Collection<PsiReference> usages = ReferencesSearch.search(jsClass, GlobalSearchScope.moduleScope(myModule)).findAll();
assertEquals(1, usages.size());
}
use of com.intellij.lang.javascript.psi.ecmal4.JSClass in project intellij-plugins by JetBrains.
the class ActionScriptHighlightingTest method invokeActionWithCheck.
private PsiElement invokeActionWithCheck(@NonNls String destinationClassName, @NonNls final String actionName) {
PlatformTestUtil.invokeNamedAction(actionName);
final PsiElement at = myFile.findElementAt(myEditor.getCaretModel().getOffset());
JSClass clazz = PsiTreeUtil.getParentOfType(at, JSClass.class);
assertEquals(destinationClassName, clazz.getName());
return at;
}
Aggregations