Package com.intellij.openapi.fileTypes

Examples of com.intellij.openapi.fileTypes.FileType


  @Nullable
  public static Icon getIcon(@NotNull ErlangFile file) {
    if (!file.isValid()) return null;
    VirtualFile virtualFile = file.getViewProvider().getVirtualFile();
    FileType fileType = virtualFile.getFileType();
    if (ErlangFileType.MODULE == fileType) {
      ErlangModule module = file.getModule();
      boolean isEunit = module != null && ErlangPsiImplUtil.isEunitTestFile(file);
      return isEunit ? ErlangIcons.EUNIT : getModuleType(file).icon;
    }
    return fileType.getIcon();
  }
View Full Code Here


  }

  public static FragmentContent fromRangeMarker(RangeMarker rangeMarker, Project project) {
    Document document = rangeMarker.getDocument();
    VirtualFile file = FileDocumentManager.getInstance().getFile(document);
    FileType type = FileTypeManager.getInstance().getFileTypeByFile(file);
    return new FragmentContent(new DocumentContent(project, document), new TextRange(rangeMarker.getStartOffset(), rangeMarker.getEndOffset()), project, type);
  }
View Full Code Here

   * @param text     text of content
   * @param fileName used to determine content type
   * @return
   */
  public static SimpleContent forFileContent(String text, String fileName) {
    FileType fileType;
    if (fileName != null) {
      fileType = FileTypeManager.getInstance().getFileTypeByFileName(fileName);
    }
    else {
      fileType = null;
View Full Code Here

    }

    public boolean contains(VirtualFile file) {
      if (!myScope.contains(file)) return false;

      final FileType fileType = FileTypeManager.getInstance().getFileTypeByFile(file);
      for (FileType otherFileType : myFileTypes) {
        if (fileType.equals(otherFileType)) return true;
      }

      return false;
    }
View Full Code Here

                                        final VirtualFile file) {
        // Apply indent options
        final String indentSize = Utils.configValueForKey(outPairs, indentSizeKey);
        final String tabWidth = Utils.configValueForKey(outPairs, tabWidthKey);
        final String indentStyle = Utils.configValueForKey(outPairs, indentStyleKey);
        final FileType fileType = file.getFileType();
        final Language language = fileType instanceof LanguageFileType ? ((LanguageFileType)fileType).getLanguage() :
            PlainTextLanguage.INSTANCE;
        final CommonCodeStyleSettings commonSettings = codeStyleSettings.getCommonSettings(language);
        final CommonCodeStyleSettings.IndentOptions indentOptions = commonSettings.getIndentOptions();
        applyIndentOptions(indentOptions, indentSize, tabWidth, indentStyle, file.getCanonicalPath());
View Full Code Here

TOP

Related Classes of com.intellij.openapi.fileTypes.FileType

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.