Search in sources :

Example 1 with XmlFileImpl

use of com.intellij.psi.impl.source.xml.XmlFileImpl in project intellij-community by JetBrains.

the class XmlFormatterTestBase method checkFormattingDoesNotProduceException.

protected void checkFormattingDoesNotProduceException(String name) throws Exception {
    String text = loadFile(name + ".xml", null);
    final XmlFileImpl file = (XmlFileImpl) createFile(name + ".xml", text);
    myTextRange = new TextRange(10000, 10001);
    CommandProcessor.getInstance().executeCommand(getProject(), () -> ApplicationManager.getApplication().runWriteAction(() -> performFormatting(file)), "", "");
    myTextRange = new TextRange(1000000, 1000001);
    CommandProcessor.getInstance().executeCommand(getProject(), () -> ApplicationManager.getApplication().runWriteAction(() -> performFormatting(file)), "", "");
    myTextRange = new TextRange(0, text.length());
    CommandProcessor.getInstance().executeCommand(getProject(), () -> ApplicationManager.getApplication().runWriteAction(() -> performFormatting(file)), "", "");
}
Also used : TextRange(com.intellij.openapi.util.TextRange) XmlFileImpl(com.intellij.psi.impl.source.xml.XmlFileImpl)

Example 2 with XmlFileImpl

use of com.intellij.psi.impl.source.xml.XmlFileImpl 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;
}
Also used : VirtualFile(com.intellij.openapi.vfs.VirtualFile) PsiFile(com.intellij.psi.PsiFile) XmlFileImpl(com.intellij.psi.impl.source.xml.XmlFileImpl) JSFileImpl(com.intellij.lang.javascript.psi.impl.JSFileImpl)

Aggregations

XmlFileImpl (com.intellij.psi.impl.source.xml.XmlFileImpl)2 JSFileImpl (com.intellij.lang.javascript.psi.impl.JSFileImpl)1 TextRange (com.intellij.openapi.util.TextRange)1 VirtualFile (com.intellij.openapi.vfs.VirtualFile)1 PsiFile (com.intellij.psi.PsiFile)1