Package com.intellij.openapi.fileTypes

Examples of com.intellij.openapi.fileTypes.FileType


  @NotNull @Override public String getTextFor(Scratch scratch) {
    return scratch.fullNameWithMnemonics;
  }

  @Override public Icon getIconFor(Scratch scratch) {
    FileType fileType = fileTypeManager.getFileTypeByExtension(scratch.extension);
    return fileType.getIcon();
  }
View Full Code Here


      CompositeAppearance appearance = CompositeAppearance.single(absolutePath);
      appearance.setIcon(FOLDER_ICON);
      return appearance;
    }
    String name = file.getName();
    FileType fileType = FileTypeManager.getInstance().getFileTypeByFileName(name);
    File parent = file.getParentFile();
    CompositeAppearance appearance = CompositeAppearance.textComment(name, parent.getAbsolutePath());
    appearance.setIcon(fileType.getIcon());
    return appearance;
  }
View Full Code Here

        if (o instanceof Element) {
          final Element additionalIndentElement = (Element)o;
          final String fileTypeId = additionalIndentElement.getAttributeValue(FILETYPE);

          if (fileTypeId != null) {
            FileType target = FileTypeManager.getInstance().getFileTypeByExtension(fileTypeId);

            final IndentOptions options = new IndentOptions();
            options.readExternal(additionalIndentElement);
            registerAdditionalIndentOptions(target, options);
          }
View Full Code Here

  }

  public TextChunk[] extractChunks() {
    final int lineStartOffset = myDocument.getLineStartOffset(myLineNumber);
    final int lineEndOffset = lineStartOffset < myDocument.getTextLength() ? myDocument.getLineEndOffset(myLineNumber):0;
    final FileType fileType = myElement.getContainingFile().getFileType();
    SyntaxHighlighter highlighter = fileType.getHighlighter(myElement.getProject(), myElement.getContainingFile().getVirtualFile());
    if (highlighter == null) {
      highlighter = new PlainSyntaxHighlighter();
    }
    return createTextChunks(myDocument.getCharsSequence(), highlighter, lineStartOffset, lineEndOffset);
  }
View Full Code Here

    return result;
  }

  private void checkSourcePositionFileType(final SourcePosition classPosition) throws NoDataException {
    final FileType fileType = classPosition.getFile().getFileType();
    if(!myFileTypes.contains(fileType)) {
      throw new NoDataException();
    }
  }
View Full Code Here

    Icon icon = providersIcon == null ? file.getIcon() : providersIcon;

    if (project != null) {
      final ProjectFileIndex projectFileIndex = ProjectRootManager.getInstance(project).getFileIndex();
      final boolean isUnderSource = projectFileIndex.isJavaSourceFile(file);
      FileType fileType = FileTypeManager.getInstance().getFileTypeByFile(file);
      if (fileType == StdFileTypes.JAVA) {
        if (!isUnderSource) {
          icon = Icons.JAVA_OUTSIDE_SOURCE_ICON;
        }
        else {
View Full Code Here

    }
    return false;
  }

  private boolean navigateInEditor(Project project, boolean focusEditor) {
    FileType type = FileTypeManager.getInstance().getKnownFileTypeOrAssociate(myFile);
    if (type == null || myFile == null || !myFile.isValid()) return false;

    if (navigateInRequestedEditor()) return true;
    if (navigateInAnyFileEditor(project, focusEditor)) return true;
View Full Code Here

        String fileName = Messages.showInputDialog(project, "File name (without extension)", String.format("Create %s Service", extension), Symfony2Icons.SYMFONY);
        if(fileName == null || StringUtils.isBlank(fileName)) {
            return;
        }

        FileType fileType = templatePath.endsWith(".yml") ? YAMLFileType.YML : XmlFileType.INSTANCE ;

        if(!fileName.endsWith("." + extension)) {
            fileName = fileName.concat("." + extension);
        }
View Full Code Here

  private static void insertMatchedBinaryBraces(Project project, Editor editor, PsiFile file) {
    if (!(file instanceof ErlangFile)) return;

    PsiDocumentManager.getInstance(project).commitAllDocuments();

    FileType fileType = file.getFileType();
    int offset = editor.getCaretModel().getOffset();
    HighlighterIterator iterator = ((EditorEx) editor).getHighlighter().createIterator(offset);
    boolean atEndOfDocument = offset == editor.getDocument().getTextLength();

    if (!atEndOfDocument) iterator.retreat();
View Full Code Here

  public static boolean isConsole(@NotNull PsiFile file) {
    return file.getOriginalFile().getUserData(ErlangPsiImplUtil.ERLANG_CONSOLE) != null;
  }

  public static boolean isApplicationConfigFileType(@NotNull PsiFile file) {
    FileType fileType = file.getViewProvider().getVirtualFile().getFileType();
    return fileType == ErlangFileType.APP || fileType == ErlangFileType.TERMS ||
      ApplicationManager.getApplication().isUnitTestMode() && (fileType.getDefaultExtension().equals("app") || fileType.getDefaultExtension().equals("config"));
  }
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.