use of com.intellij.lang.javascript.psi.impl.JSFileImpl in project WebStormRequireJsPlugin by Fedott.
the class RequirejsProjectComponent method parseRequirejsConfig.
// private Date lastParse;
public boolean parseRequirejsConfig() {
VirtualFile mainJsVirtualFile = findPathInWebDir(settings.configFilePath);
if (null == mainJsVirtualFile) {
this.showErrorConfigNotification("Config file not found. File " + settings.publicPath + '/' + settings.configFilePath + " not found in project");
LOG.debug("Config not found");
return false;
} else {
PsiFile mainJs = PsiManager.getInstance(project).findFile(mainJsVirtualFile);
if (mainJs instanceof JSFileImpl || mainJs instanceof XmlFileImpl) {
Map<String, VirtualFile> allConfigPaths;
packageConfig.clear();
requireMap.clear();
requirePaths.clear();
if (((PsiFileImpl) mainJs).getTreeElement() == null) {
parseMainJsFile(((PsiFileImpl) mainJs).calcTreeElement());
} else {
parseMainJsFile(((PsiFileImpl) mainJs).getTreeElement());
}
} else {
this.showErrorConfigNotification("Config file wrong format");
LOG.debug("Config file wrong format");
return false;
}
}
return true;
}
use of com.intellij.lang.javascript.psi.impl.JSFileImpl in project intellij-plugins by JetBrains.
the class FlexTreeStructureProvider method modify.
@NotNull
@Override
public Collection<AbstractTreeNode> modify(@NotNull AbstractTreeNode parent, @NotNull Collection<AbstractTreeNode> children, ViewSettings settings) {
List<AbstractTreeNode> result = new ArrayList<>();
if (parent instanceof SwfQualifiedNamedElementNode || parent instanceof FlexFileNode) {
if (((ProjectViewNode) parent).getSettings().isShowMembers()) {
JSQualifiedNamedElement parentElement = getElement(parent);
if (parentElement != null) {
JSStructureViewElement structureViewElement = parentElement instanceof XmlBackedJSClassImpl ? new FlexStructureViewElement(((XmlBackedJSClassImpl) parentElement), (XmlFile) parentElement.getContainingFile(), false) : new JSStructureViewElement(parentElement, false, true);
StructureViewTreeElement[] structureViewChildren = structureViewElement.getChildren();
for (final StructureViewTreeElement structureViewChild : structureViewChildren) {
if (structureViewChild instanceof JSStructureViewElement) {
PsiElement childElement = ((JSStructureViewElement) structureViewChild).getValue();
result.add(new FlexClassMemberNode((JSElement) childElement, ((ProjectViewNode) parent).getSettings()));
} else {
result.add(new UnknownNode(parentElement.getProject(), structureViewChild, ((ProjectViewNode) parent).getSettings()));
}
}
}
}
} else {
for (final AbstractTreeNode child : children) {
Object o = child.getValue();
if (o instanceof JSFileImpl && !(o instanceof PsiCompiledFile) && DialectDetector.isActionScript((PsiFile) o) || o instanceof XmlFile && JavaScriptSupportLoader.isFlexMxmFile((PsiFile) o)) {
result.add(new FlexFileNode((PsiFile) o, ((ProjectViewNode) parent).getSettings()));
continue;
}
result.add(child);
}
}
return result;
}
use of com.intellij.lang.javascript.psi.impl.JSFileImpl in project intellij-plugins by JetBrains.
the class FlexIconProvider method getIcon.
@Override
public Icon getIcon(@NotNull PsiElement element, int flags) {
int transformedFlags = ElementBase.transformFlags(element, flags);
Icon icon = null;
if (element instanceof XmlFile) {
if (JavaScriptSupportLoader.isFlexMxmFile((PsiFile) element)) {
final JSClass jsClass = XmlBackedJSClassFactory.getXmlBackedClass((XmlFile) element);
if (jsClass != null) {
icon = jsClass.getIcon(flags);
}
}
} else if (element instanceof JSFileImpl) {
final JSNamedElement mainDeclaredElement = ActionScriptResolveUtil.findMainDeclaredElement((JSFileImpl) element);
if (mainDeclaredElement != null) {
icon = mainDeclaredElement.getIcon(transformedFlags);
}
}
if (icon != null) {
final PsiFile psiFile = element.getContainingFile();
final VirtualFile vFile = psiFile == null ? null : psiFile.getVirtualFile();
CompilerManager compilerManager = CompilerManager.getInstance(element.getProject());
if (vFile != null && compilerManager != null && compilerManager.isExcludedFromCompilation(vFile)) {
icon = new LayeredIcon(icon, PlatformIcons.EXCLUDED_FROM_COMPILE_ICON);
}
}
return icon;
}
Aggregations