Java 类com.intellij.psi.MultiplePsiFilesPerDocumentFileViewProvider 实例源码

项目:consulo-xml    文件:XmlTagNameSynchronizer.java   
@RequiredReadAction
private RangeMarker findSupport(RangeMarker leader, PsiFile file, Document document)
{
    final int offset = leader.getStartOffset();
    PsiElement element = InjectedLanguageUtil.findElementAtNoCommit(file, offset);
    PsiElement support = findSupportElement(element);
    if(support == null && file.getViewProvider() instanceof MultiplePsiFilesPerDocumentFileViewProvider)
    {
        element = file.getViewProvider().findElementAt(offset, myLanguage);
        support = findSupportElement(element);
    }

    if(support == null)
    {
        return null;
    }

    final TextRange range = support.getTextRange();
    TextRange realRange = InjectedLanguageManager.getInstance(file.getProject()).injectedToHost(element.getContainingFile(), range);
    return document.createRangeMarker(realRange.getStartOffset(), realRange.getEndOffset(), true);
}
项目:sass-lint-plugin    文件:SassLintExternalAnnotator.java   
@Nullable
    private static ExternalLintAnnotationInput collectInformation(@NotNull PsiFile psiFile, @Nullable Editor editor) {
        if (psiFile.getContext() != null || !SassLintConfigFileUtil.isSassFile(psiFile)) {
            return null;
        }
        VirtualFile virtualFile = psiFile.getVirtualFile();
        if (virtualFile == null || !virtualFile.isInLocalFileSystem()) {
            return null;
        }
        if (psiFile.getViewProvider() instanceof MultiplePsiFilesPerDocumentFileViewProvider) {
            return null;
        }
        Project project = psiFile.getProject();
        SassLintProjectComponent component = project.getComponent(SassLintProjectComponent.class);
        if (!component.isSettingsValid() || !component.isEnabled()) {
            return null;
        }
        Document document = PsiDocumentManager.getInstance(project).getDocument(psiFile);
        if (document == null) {
            return null;
        }
        String fileContent = document.getText();
        if (StringUtil.isEmptyOrSpaces(fileContent)) {
            return null;
        }
        EditorColorsScheme colorsScheme = editor != null ? editor.getColorsScheme() : null;
//        tabSize = getTabSize(editor);
//        tabSize = 4;
        return new ExternalLintAnnotationInput(project, psiFile, fileContent, colorsScheme);
    }
项目:intellij-ce-playground    文件:PyMultiplePsiFilesVisitorFilter.java   
@Override
public boolean isSupported(@NotNull Class visitorClass, @NotNull PsiFile file) {
  if (visitorClass == StringLiteralQuotesAnnotator.class &&
      file.getViewProvider() instanceof MultiplePsiFilesPerDocumentFileViewProvider) {
    return false;
  }
  return true;
}
项目:intellij-ce-playground    文件:XmlInvalidIdInspection.java   
@Override
protected void checkValue(XmlAttributeValue value, XmlFile file, XmlRefCountHolder refHolder, XmlTag tag, ProblemsHolder holder) {

  String idRef = XmlHighlightVisitor.getUnquotedValue(value, tag);

  if (tag instanceof HtmlTag) {
    idRef = idRef.toLowerCase();
  }

  if (XmlUtil.isSimpleValue(idRef, value) && refHolder.isIdReferenceValue(value)) {
    boolean hasIdDeclaration = refHolder.hasIdDeclaration(idRef);
    if (!hasIdDeclaration && tag instanceof HtmlTag) {
      hasIdDeclaration = refHolder.hasIdDeclaration(value.getValue());
    }

    if (!hasIdDeclaration) {
      for(XmlIdContributor contributor: Extensions.getExtensions(XmlIdContributor.EP_NAME)) {
        if (contributor.suppressExistingIdValidation(file)) {
          return;
        }
      }

      final FileViewProvider viewProvider = tag.getContainingFile().getViewProvider();
      if (viewProvider instanceof MultiplePsiFilesPerDocumentFileViewProvider) {
        holder.registerProblem(value, XmlErrorMessages.message("invalid.id.reference"), ProblemHighlightType.LIKE_UNKNOWN_SYMBOL,
                               new XmlDeclareIdInCommentAction(idRef));

      }
      else {
        holder.registerProblem(value, XmlErrorMessages.message("invalid.id.reference"), ProblemHighlightType.LIKE_UNKNOWN_SYMBOL);
      }
    }
  }
}
项目:react-templates-plugin    文件:RTExternalAnnotator.java   
@Nullable
    private static ExternalLintAnnotationInput collectInformation(@NotNull PsiFile psiFile, @Nullable Editor editor) {
        if (psiFile.getContext() != null || !RTFileUtil.isRTFile(psiFile)) {
            return null;
        }
        VirtualFile virtualFile = psiFile.getVirtualFile();
        if (virtualFile == null || !virtualFile.isInLocalFileSystem()) {
            return null;
        }
        if (psiFile.getViewProvider() instanceof MultiplePsiFilesPerDocumentFileViewProvider) {
            return null;
        }
        Project project = psiFile.getProject();
        RTProjectComponent component = project.getComponent(RTProjectComponent.class);
        if (component == null || !component.isValidAndEnabled()) {
            return null;
        }
        Document document = PsiDocumentManager.getInstance(project).getDocument(psiFile);
        if (document == null) {
            return null;
        }
        String fileContent = document.getText();
        if (StringUtil.isEmptyOrSpaces(fileContent)) {
            return null;
        }
        EditorColorsScheme colorsScheme = editor == null ? null : editor.getColorsScheme();
//        tabSize = getTabSize(editor);
//        tabSize = 4;
        return new ExternalLintAnnotationInput(project, psiFile, fileContent, colorsScheme);
    }
项目:coffee-lint-plugin    文件:CoffeeLintExternalAnnotator.java   
@Nullable
    private static ExternalLintAnnotationInput collectInformation(@NotNull PsiFile psiFile, @Nullable Editor editor) {
        if (psiFile.getContext() != null || !CoffeeLintConfigFileUtil.isCoffeeScriptFile(psiFile)) {
            return null;
        }
        VirtualFile virtualFile = psiFile.getVirtualFile();
        if (virtualFile == null || !virtualFile.isInLocalFileSystem()) {
            return null;
        }
        if (psiFile.getViewProvider() instanceof MultiplePsiFilesPerDocumentFileViewProvider) {
            return null;
        }
        Project project = psiFile.getProject();
        CoffeeLintProjectComponent component = project.getComponent(CoffeeLintProjectComponent.class);
        if (!component.isSettingsValid() || !component.isEnabled()) {
            return null;
        }
        Document document = PsiDocumentManager.getInstance(project).getDocument(psiFile);
        if (document == null) {
            return null;
        }
        String fileContent = document.getText();
        if (StringUtil.isEmptyOrSpaces(fileContent)) {
            return null;
        }
        EditorColorsScheme colorsScheme = editor != null ? editor.getColorsScheme() : null;
//        tabSize = getTabSize(editor);
//        tabSize = 4;
        return new ExternalLintAnnotationInput(project, psiFile, fileContent, colorsScheme);
    }
项目:react-templates-plugin    文件:RTExternalAnnotator.java   
@Nullable
    private static ExternalLintAnnotationInput collectInformation(@NotNull PsiFile psiFile, @Nullable Editor editor) {
        if (psiFile.getContext() != null || !RTFileUtil.isRTFile(psiFile)) {
            return null;
        }
        VirtualFile virtualFile = psiFile.getVirtualFile();
        if (virtualFile == null || !virtualFile.isInLocalFileSystem()) {
            return null;
        }
        if (psiFile.getViewProvider() instanceof MultiplePsiFilesPerDocumentFileViewProvider) {
            return null;
        }
        Project project = psiFile.getProject();
        RTProjectComponent component = project.getComponent(RTProjectComponent.class);
        if (component == null || !component.isValidAndEnabled()) {
            return null;
        }
        Document document = PsiDocumentManager.getInstance(project).getDocument(psiFile);
        if (document == null) {
            return null;
        }
        String fileContent = document.getText();
        if (StringUtil.isEmptyOrSpaces(fileContent)) {
            return null;
        }
        EditorColorsScheme colorsScheme = editor == null ? null : editor.getColorsScheme();
//        tabSize = getTabSize(editor);
//        tabSize = 4;
        return new ExternalLintAnnotationInput(project, psiFile, fileContent, colorsScheme);
    }
项目:eslint-plugin    文件:ESLintExternalAnnotator.java   
@Nullable
    private static ExternalLintAnnotationInput collectInformation(@NotNull PsiFile psiFile, @Nullable Editor editor) {
        if (psiFile.getContext() != null) {
            return null;
        }
        VirtualFile virtualFile = psiFile.getVirtualFile();
        if (virtualFile == null || !virtualFile.isInLocalFileSystem()) {
            return null;
        }
        if (psiFile.getViewProvider() instanceof MultiplePsiFilesPerDocumentFileViewProvider) {
            return null;
        }
        Project project = psiFile.getProject();
        ESLintProjectComponent component = project.getComponent(ESLintProjectComponent.class);
        if (!component.isSettingsValid() || !component.isEnabled() || !isJavaScriptFile(psiFile, component.ext)) {
            return null;
        }
        Document document = PsiDocumentManager.getInstance(project).getDocument(psiFile);
        if (document == null) {
            return null;
        }
        String fileContent = document.getText();
        if (StringUtil.isEmptyOrSpaces(fileContent)) {
            return null;
        }
        EditorColorsScheme colorsScheme = editor == null ? null : editor.getColorsScheme();
//        tabSize = getTabSize(editor);
//        tabSize = 4;
        return new ExternalLintAnnotationInput(project, psiFile, fileContent, colorsScheme);
    }
项目:tools-idea    文件:XmlInvalidIdInspection.java   
protected void checkValue(XmlAttributeValue value, XmlFile file, XmlRefCountHolder refHolder, XmlTag tag, ProblemsHolder holder) {

    String idRef = XmlHighlightVisitor.getUnquotedValue(value, tag);

    if (tag instanceof HtmlTag) {
      idRef = idRef.toLowerCase();
    }

    if (XmlUtil.isSimpleXmlAttributeValue(idRef, value) && refHolder.isIdReferenceValue(value)) {
      boolean hasIdDeclaration = refHolder.hasIdDeclaration(idRef);
      if (!hasIdDeclaration && tag instanceof HtmlTag) {
        hasIdDeclaration = refHolder.hasIdDeclaration(value.getValue());
      }

      if (!hasIdDeclaration) {
        for(XmlIdContributor contributor: Extensions.getExtensions(XmlIdContributor.EP_NAME)) {
          if (contributor.suppressExistingIdValidation(file)) {
            return;
          }
        }

        final FileViewProvider viewProvider = tag.getContainingFile().getViewProvider();
        if (viewProvider instanceof MultiplePsiFilesPerDocumentFileViewProvider) {
          holder.registerProblem(value, XmlErrorMessages.message("invalid.id.reference"), ProblemHighlightType.LIKE_UNKNOWN_SYMBOL,
                                 new XmlDeclareIdInCommentAction(idRef));

        }
        else {
          holder.registerProblem(value, XmlErrorMessages.message("invalid.id.reference"), ProblemHighlightType.LIKE_UNKNOWN_SYMBOL);
        }
      }
    }
  }
项目:consulo-xml    文件:XmlInvalidIdInspection.java   
protected void checkValue(XmlAttributeValue value, XmlFile file, XmlRefCountHolder refHolder, XmlTag tag, ProblemsHolder holder) {

    String idRef = XmlHighlightVisitor.getUnquotedValue(value, tag);

    if (tag instanceof HtmlTag) {
      idRef = idRef.toLowerCase();
    }

    if (XmlUtil.isSimpleValue(idRef, value) && refHolder.isIdReferenceValue(value)) {
      boolean hasIdDeclaration = refHolder.hasIdDeclaration(idRef);
      if (!hasIdDeclaration && tag instanceof HtmlTag) {
        hasIdDeclaration = refHolder.hasIdDeclaration(value.getValue());
      }

      if (!hasIdDeclaration) {
        for(XmlIdContributor contributor: Extensions.getExtensions(XmlIdContributor.EP_NAME)) {
          if (contributor.suppressExistingIdValidation(file)) {
            return;
          }
        }

        final FileViewProvider viewProvider = tag.getContainingFile().getViewProvider();
        if (viewProvider instanceof MultiplePsiFilesPerDocumentFileViewProvider) {
          holder.registerProblem(value, XmlErrorMessages.message("invalid.id.reference"), ProblemHighlightType.LIKE_UNKNOWN_SYMBOL,
                                 new XmlDeclareIdInCommentAction(idRef));

        }
        else {
          holder.registerProblem(value, XmlErrorMessages.message("invalid.id.reference"), ProblemHighlightType.LIKE_UNKNOWN_SYMBOL);
        }
      }
    }
  }
项目:bamboo-soy    文件:SoyFileViewProvider.java   
@Override
protected MultiplePsiFilesPerDocumentFileViewProvider cloneInner(VirtualFile virtualFile) {
  return new SoyFileViewProvider(getManager(), virtualFile, false);
}
项目:rythm_plugin    文件:RythmFileViewProvider.java   
@Override
protected MultiplePsiFilesPerDocumentFileViewProvider cloneInner(VirtualFile virtualFile) {
    return new RythmFileViewProvider(getManager(), virtualFile, false, myBaseLanguage, myTemplateLanguage);
}
项目:GoJetPlugin    文件:JetFileViewProvider.java   
@Override
protected MultiplePsiFilesPerDocumentFileViewProvider cloneInner(VirtualFile file) {
    return new JetFileViewProvider(getManager(), file, false, myTemplateDataLanguage);
}
项目:intellij-ce-playground    文件:RestFileViewProvider.java   
@Override
protected MultiplePsiFilesPerDocumentFileViewProvider cloneInner(VirtualFile virtualFile) {
  return new RestFileViewProvider(getManager(), virtualFile, false);
}
项目:intellij-latte    文件:LatteFileViewProvider.java   
@Override
protected MultiplePsiFilesPerDocumentFileViewProvider cloneInner(VirtualFile fileCopy) {
    return new LatteFileViewProvider(getManager(), fileCopy, false);
}
项目:idea-doT    文件:DotFileViewProvider.java   
@Override
protected MultiplePsiFilesPerDocumentFileViewProvider cloneInner(VirtualFile virtualFile) {
    return new DotFileViewProvider(getManager(), virtualFile, false);
}
项目:consulo-play    文件:PlayBaseTemplateFileViewProvider.java   
@Override
protected MultiplePsiFilesPerDocumentFileViewProvider cloneInner(VirtualFile fileCopy)
{
    return new PlayBaseTemplateFileViewProvider(getManager(), fileCopy, isPhysical());
}
项目:consulo-javaee    文件:JspFileViewProviderImpl.java   
@Override
protected MultiplePsiFilesPerDocumentFileViewProvider cloneInner(VirtualFile virtualFile)
{
    return new JspFileViewProviderImpl(getManager(), virtualFile, false);
}