当前位置: 首页>>代码示例>>Java>>正文


Java StdFileTypes.XML属性代码示例

本文整理汇总了Java中com.intellij.openapi.fileTypes.StdFileTypes.XML属性的典型用法代码示例。如果您正苦于以下问题:Java StdFileTypes.XML属性的具体用法?Java StdFileTypes.XML怎么用?Java StdFileTypes.XML使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在com.intellij.openapi.fileTypes.StdFileTypes的用法示例。


在下文中一共展示了StdFileTypes.XML属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: checkHardcodedCharsetFileType

@NotNull
static Pair<Charset, String> checkHardcodedCharsetFileType(@NotNull VirtualFile virtualFile) {
  FileType fileType = virtualFile.getFileType();
  if (fileType.isBinary()) return Pair.create(null, "binary file");
  // in lesser IDEs all special file types are plain text so check for that first
  if (fileType == FileTypes.PLAIN_TEXT) return Pair.create(null, null);
  if (fileType == StdFileTypes.GUI_DESIGNER_FORM) return Pair.create(CharsetToolkit.UTF8_CHARSET, "IDEA GUI Designer form");
  if (fileType == StdFileTypes.IDEA_MODULE) return Pair.create(CharsetToolkit.UTF8_CHARSET, "IDEA module file");
  if (fileType == StdFileTypes.IDEA_PROJECT) return Pair.create(CharsetToolkit.UTF8_CHARSET, "IDEA project file");
  if (fileType == StdFileTypes.IDEA_WORKSPACE) return Pair.create(CharsetToolkit.UTF8_CHARSET, "IDEA workspace file");

  if (fileType == StdFileTypes.PROPERTIES) return Pair.create(virtualFile.getCharset(), ".properties file");

  if (fileType == StdFileTypes.XML || fileType == StdFileTypes.JSPX) {
    return Pair.create(virtualFile.getCharset(), "XML file");
  }
  return Pair.create(null, null);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:18,代码来源:EncodingUtil.java

示例2: isRelevantFileType

static boolean isRelevantFileType(@NotNull FileType fileType) {
  if (fileType == StdFileTypes.JAVA) { // fail fast for vital file type
    return false;
  }
  return fileType == StdFileTypes.XML ||
         (fileType.isBinary() && fileType == FileTypeManager.getInstance().getFileTypeByExtension(EXT_PNG));
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:7,代码来源:PsiProjectListener.java

示例3: isSupportedFileType

public static boolean isSupportedFileType(@NotNull VirtualFile virtualFile) {
  if (virtualFile.isDirectory()) return true;
  if (virtualFile.getFileType() == StdFileTypes.JAVA) return true;
  if (virtualFile.getFileType() == StdFileTypes.XML && !ProjectCoreUtil.isProjectOrWorkspaceFile(virtualFile)) return true;
  if ("groovy".equals(virtualFile.getExtension())) return true;
  return false;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:7,代码来源:RefResolveServiceImpl.java

示例4: detectFileType

@NotNull
@Override
public FileType detectFileType(@NotNull PsiElement context) {
  PsiFile file = context instanceof PsiFile ? (PsiFile)context : context.getContainingFile();
  Language contextLanguage = context instanceof PsiFile ? null : context.getLanguage();
  if (file.getLanguage() == StdLanguages.HTML || (file.getFileType() == StdFileTypes.JSP && contextLanguage == StdLanguages.HTML)) {
    return StdFileTypes.HTML;
  }
  return StdFileTypes.XML;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:10,代码来源:XmlStructuralSearchProfile.java

示例5: getInputFilter

@NotNull
@Override
public FileBasedIndex.InputFilter getInputFilter() {
    return new DefaultFileTypeSpecificInputFilter(StdFileTypes.XML) {
        @Override
        public boolean acceptInput(@NotNull VirtualFile file) {
            return !(file.getFileSystem() instanceof JarFileSystem);
        }
    };
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:10,代码来源:XsltSymbolIndex.java

示例6: canPutAt

@Override
public boolean canPutAt(@NotNull VirtualFile file, int line, @NotNull Project project) {
  final Document document = FileDocumentManager.getInstance().getDocument(file);
  if (document == null) return false;

  final PsiFile psiFile = PsiDocumentManager.getInstance(project).getPsiFile(document);
  if (psiFile == null) {
    return false;
  }
  final FileType fileType = psiFile.getFileType();
  if (fileType != StdFileTypes.XML || !XsltSupport.isXsltFile(psiFile)) {
    return false;
  }
  return true;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:15,代码来源:XsltBreakpointType.java

示例7: areTagsCaseSensitive

@Override
public boolean areTagsCaseSensitive(final FileType fileType, final int braceGroupId) {
  switch(braceGroupId){
    case XML_TAG_TOKEN_GROUP:
      return fileType == StdFileTypes.XML;
    default:
      return false;
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:9,代码来源:XmlBraceMatcher.java

示例8: compareResourceFiles

/**
 * Utility method suitable for Comparator implementations which order resource files,
 * which will sort files by base folder followed by alphabetical configurations. Prioritizes
 * XML files higher than non-XML files.
 */
public static int compareResourceFiles(@Nullable VirtualFile file1, @Nullable VirtualFile file2) {
  if (file1 != null && file2 != null && file1 != file2) {
    boolean xml1 = file1.getFileType() == StdFileTypes.XML;
    boolean xml2 = file2.getFileType() == StdFileTypes.XML;
    if (xml1 != xml2) {
      return xml1 ? -1 : 1;
    }
    VirtualFile parent1 = file1.getParent();
    VirtualFile parent2 = file2.getParent();
    if (parent1 != null && parent2 != null && parent1 != parent2) {
      boolean qualifier1 = parent1.getName().indexOf('-') != -1;
      boolean qualifier2 = parent2.getName().indexOf('-') != -1;
      if (qualifier1 != qualifier2) {
        return qualifier1 ? 1 : -1;
      }
    }

    return file1.getPath().compareTo(file2.getPath());
  } else if (file1 != null) {
    return -1;
  } else if (file2 != null) {
    return 1;
  }

  return 0;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:31,代码来源:AndroidResourceUtil.java

示例9: getInputFilter

@NotNull
@Override
public FileBasedIndex.InputFilter getInputFilter() {
  return new DefaultFileTypeSpecificInputFilter(StdFileTypes.XML) {
    @Override
    public boolean acceptInput(@NotNull final VirtualFile file) {
      return file.isInLocalFileSystem();
    }
  };
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:10,代码来源:AndroidValueResourcesIndex.java

示例10: MyInputFilter

public MyInputFilter() {
  super(StdFileTypes.XML);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:3,代码来源:JavaFxControllerClassIndex.java

示例11: selectConfigMatch

@NotNull
private ConfigMatch selectConfigMatch(@NotNull List<ConfigMatch> matches) {
  List<String> deviceIds = myManager.getStateManager().getProjectState().getDeviceIds();
  Map<String, Integer> idRank = Maps.newHashMapWithExpectedSize(deviceIds.size());
  int rank = 0;
  for (String id : deviceIds) {
    idRank.put(id, rank++);
  }

  // API 11-13: look for a x-large device
  Comparator<ConfigMatch> comparator = null;
  IAndroidTarget projectTarget = myManager.getProjectTarget();
  if (projectTarget != null) {
    int apiLevel = projectTarget.getVersion().getFeatureLevel();
    if (apiLevel >= 11 && apiLevel < 14) {
      // TODO: Maybe check the compatible-screen tag in the manifest to figure out
      // what kind of device should be used for display.
      comparator = new TabletConfigComparator(idRank);
    }
  }

  if (comparator == null) {
    // lets look for a high density device
    comparator = new PhoneConfigComparator(idRank);
  }

  Collections.sort(matches, comparator);

  // Look at the currently active editor to see if it's a layout editor, and if so,
  // look up its configuration and if the configuration is in our match list,
  // use it. This means we "preserve" the current configuration when you open
  // new layouts.
  // TODO: This is running too late for the layout preview; the new editor has
  // already taken over so getSelectedTextEditor() returns self. Perhaps we
  // need to fish in the open editors instead.

  //Editor activeEditor = ApplicationManager.getApplication().runReadAction(new Computable<Editor>() {
  //  @Override
  //  public Editor compute() {
  //    FileEditorManager editorManager = FileEditorManager.getInstance(myManager.getProject());
  //    return editorManager.getSelectedTextEditor();
  //  }
  //});

  // TODO: How do I redispatch without risking lock?
  //Editor activeEditor = AndroidUtils.getSelectedEditor(myManager.getProject());
  if (ApplicationManager.getApplication().isDispatchThread()) {
    FileEditorManager editorManager = FileEditorManager.getInstance(myManager.getProject());
    Editor activeEditor = editorManager.getSelectedTextEditor();
    if (activeEditor != null) {
      FileDocumentManager documentManager = FileDocumentManager.getInstance();
      VirtualFile file = documentManager.getFile(activeEditor.getDocument());
      if (file != null && !file.equals(myFile) && file.getFileType() == StdFileTypes.XML
          && ResourceHelper.getFolderType(myFile) == ResourceHelper.getFolderType(file)) {
        Configuration configuration = myManager.getConfiguration(file);
        FolderConfiguration fullConfig = configuration.getFullConfig();
        for (ConfigMatch match : matches) {
          if (fullConfig.equals(match.testConfig)) {
            return match;
          }
        }
      }
    }
  }

  // the list has been sorted so that the first item is the best config
  return matches.get(0);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:68,代码来源:ConfigurationMatcher.java

示例12: collectInformation

@Override
public State collectInformation(@NotNull PsiFile file) {
  final Module module = ModuleUtilCore.findModuleForPsiElement(file);
  if (module == null) {
    return null;
  }

  final AndroidFacet facet = AndroidFacet.getInstance(module);
  if (facet == null && !IntellijLintProject.hasAndroidModule(module.getProject())) {
    return null;
  }

  final VirtualFile vFile = file.getVirtualFile();
  if (vFile == null) {
    return null;
  }

  final FileType fileType = file.getFileType();

  if (fileType == StdFileTypes.XML) {
    if (facet == null || facet.getLocalResourceManager().getFileResourceType(file) == null &&
        !SdkConstants.ANDROID_MANIFEST_XML.equals(vFile.getName())) {
      return null;
    }
  }
  else if (fileType == FileTypes.PLAIN_TEXT) {
    if (!AndroidCommonUtils.PROGUARD_CFG_FILE_NAME.equals(file.getName()) &&
        !AndroidCompileUtil.OLD_PROGUARD_CFG_FILE_NAME.equals(file.getName())) {
      return null;
    }
  }
  else if (fileType == GroovyFileType.GROOVY_FILE_TYPE) {
    if (!SdkUtils.endsWithIgnoreCase(file.getName(), DOT_GRADLE)) {
      return null;
    }
    // Ensure that we're listening to the PSI structure for Gradle file edit notifications
    Project project = file.getProject();
    if (Projects.isGradleProject(project)) {
      PsiProjectListener.getListener(project);
    }
  }
  else if (fileType != StdFileTypes.JAVA && fileType != StdFileTypes.PROPERTIES) {
    return null;
  }

  final List<Issue> issues = getIssuesFromInspections(file.getProject(), file);
  if (issues.size() == 0) {
    return null;
  }
  return new State(module, vFile, file.getText(), issues);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:51,代码来源:AndroidLintExternalAnnotator.java

示例13: isTrueXml

private static boolean isTrueXml(FileType type) {
  return type == StdFileTypes.XHTML || type == StdFileTypes.JSPX || type == StdFileTypes.XML;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:3,代码来源:XmlZenCodingGeneratorImpl.java

示例14: isXslOrXsltFile

public static boolean isXslOrXsltFile(@Nullable PsiFile file) {
  return file != null && file.getFileType() == StdFileTypes.XML
      && (FileUtilRt.extensionEquals(file.getName(), "xsl") || FileUtilRt.extensionEquals(file.getName(), "xslt"));
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:4,代码来源:XslTextContextType.java

示例15: getFileType

@Override
@NotNull
protected FileType getFileType() {
  return StdFileTypes.XML;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:5,代码来源:CodeStyleXmlPanel.java


注:本文中的com.intellij.openapi.fileTypes.StdFileTypes.XML属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。