com.intellij.openapi.fileTypes.UnknownFileType Java Examples

The following examples show how to use com.intellij.openapi.fileTypes.UnknownFileType. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: GotoFileAction.java    From consulo with Apache License 2.0 6 votes vote down vote up
/**
 * {@inheritDoc}
 */
@Override
public int compare(final FileType o1, final FileType o2) {
  if (o1 == o2) {
    return 0;
  }
  if (o1 == UnknownFileType.INSTANCE) {
    return 1;
  }
  if (o2 == UnknownFileType.INSTANCE) {
    return -1;
  }
  if (o1.isBinary() && !o2.isBinary()) {
    return 1;
  }
  if (!o1.isBinary() && o2.isBinary()) {
    return -1;
  }
  return o1.getName().compareToIgnoreCase(o2.getName());
}
 
Example #2
Source File: ErrorDiffTool.java    From consulo with Apache License 2.0 6 votes vote down vote up
@Nonnull
private JComponent createComponent(@Nonnull DiffRequest request) {
  if (request instanceof MessageDiffRequest) {
    // TODO: explain some of ErrorDiffRequest exceptions ?
    String message = ((MessageDiffRequest)request).getMessage();
    return DiffUtil.createMessagePanel(message);
  }
  if (request instanceof ComponentDiffRequest) {
    return ((ComponentDiffRequest)request).getComponent(myContext);
  }
  if (request instanceof ContentDiffRequest) {
    List<DiffContent> contents = ((ContentDiffRequest)request).getContents();
    for (final DiffContent content : contents) {
      if (content instanceof FileContent && UnknownFileType.INSTANCE == content.getContentType()) {
        final VirtualFile file = ((FileContent)content).getFile();

        UnknownFileTypeDiffRequest unknownFileTypeRequest = new UnknownFileTypeDiffRequest(file, myRequest.getTitle());
        return unknownFileTypeRequest.getComponent(myContext);
      }
    }
  }

  return DiffUtil.createMessagePanel("Can't show diff");
}
 
Example #3
Source File: ErrorDiffTool.java    From consulo with Apache License 2.0 6 votes vote down vote up
@RequiredUIAccess
@Nonnull
@Override
public ToolbarComponents init() {
  if (myRequest instanceof UnknownFileTypeDiffRequest) {
    String fileName = ((UnknownFileTypeDiffRequest)myRequest).getFileName();
    if (fileName != null && FileTypeManager.getInstance().getFileTypeByFileName(fileName) != UnknownFileType.INSTANCE) {
      // FileType was assigned elsewhere (ex: by other UnknownFileTypeDiffRequest). We should reload request.
      if (myContext instanceof DiffContextEx) {
        ApplicationManager.getApplication().invokeLater(new Runnable() {
          @Override
          public void run() {
            ((DiffContextEx)myContext).reloadDiffRequest();
          }
        }, ModalityState.current());
      }
    }
  }

  return new ToolbarComponents();
}
 
Example #4
Source File: DiffContentFactoryImpl.java    From consulo with Apache License 2.0 6 votes vote down vote up
@Nonnull
private static DocumentContent createImpl(@javax.annotation.Nullable Project project,
                                          @Nonnull String text,
                                          @Nullable FileType fileType,
                                          @Nullable String fileName,
                                          @Nullable VirtualFile highlightFile,
                                          @javax.annotation.Nullable Charset charset,
                                          @javax.annotation.Nullable Boolean bom,
                                          boolean respectLineSeparators,
                                          boolean readOnly) {
  if (UnknownFileType.INSTANCE == fileType) fileType = PlainTextFileType.INSTANCE;

  // TODO: detect invalid (different across the file) separators ?
  LineSeparator separator = respectLineSeparators ? StringUtil.detectSeparators(text) : null;
  String correctedContent = StringUtil.convertLineSeparators(text);

  Document document = createDocument(project, correctedContent, fileType, fileName, readOnly);
  DocumentContent content = new DocumentContentImpl(project, document, fileType, highlightFile, separator, charset, bom);

  if (fileName != null) content.putUserData(DiffUserDataKeysEx.FILE_NAME, fileName);

  return content;
}
 
Example #5
Source File: NavigationUtil.java    From consulo with Apache License 2.0 6 votes vote down vote up
public static boolean openFileWithPsiElement(PsiElement element, boolean searchForOpen, boolean requestFocus) {
  boolean openAsNative = false;
  if (element instanceof PsiFile) {
    VirtualFile virtualFile = ((PsiFile)element).getVirtualFile();
    if (virtualFile != null) {
      openAsNative = virtualFile.getFileType() instanceof INativeFileType || virtualFile.getFileType() == UnknownFileType.INSTANCE;
    }
  }

  if (searchForOpen) {
    element.putUserData(FileEditorManager.USE_CURRENT_WINDOW, null);
  }
  else {
    element.putUserData(FileEditorManager.USE_CURRENT_WINDOW, true);
  }

  if (openAsNative || !activatePsiElementIfOpen(element, searchForOpen, requestFocus)) {
    final NavigationItem navigationItem = (NavigationItem)element;
    if (!navigationItem.canNavigate()) return false;
    navigationItem.navigate(requestFocus);
    return true;
  }

  element.putUserData(FileEditorManager.USE_CURRENT_WINDOW, null);
  return false;
}
 
Example #6
Source File: PathsVerifier.java    From consulo with Apache License 2.0 6 votes vote down vote up
private boolean isFileTypeOk(@Nonnull VirtualFile file) {
  FileType fileType = file.getFileType();
  if (fileType == UnknownFileType.INSTANCE) {
    fileType = FileTypeChooser.associateFileType(file.getName());
    if (fileType == null) {
      PatchApplier
              .showError(myProject, "Cannot apply content for " + file.getPresentableName() + " file from patch because its type not defined.",
                         true);
      return false;
    }
  }
  if (fileType.isBinary()) {
    PatchApplier.showError(myProject, "Cannot apply file " + file.getPresentableName() + " from patch because it is binary.", true);
    return false;
  }
  return true;
}
 
Example #7
Source File: PsiFileImplUtil.java    From consulo with Apache License 2.0 6 votes vote down vote up
@RequiredUIAccess
public static PsiFile setName(final PsiFile file, String newName) throws IncorrectOperationException {
  VirtualFile vFile = file.getViewProvider().getVirtualFile();
  PsiManagerImpl manager = (PsiManagerImpl)file.getManager();

  try{
    final FileType newFileType = FileTypeRegistry.getInstance().getFileTypeByFileName(newName);
    if (UnknownFileType.INSTANCE.equals(newFileType) || newFileType.isBinary()) {
      // before the file becomes unknown or a binary (thus, not openable in the editor), save it to prevent data loss
      final FileDocumentManager fdm = FileDocumentManager.getInstance();
      final Document doc = fdm.getCachedDocument(vFile);
      if (doc != null) {
        fdm.saveDocumentAsIs(doc);
      }
    }

    vFile.rename(manager, newName);
  }
  catch(IOException e){
    throw new IncorrectOperationException(e);
  }

  return file.getViewProvider().isPhysical() ? manager.findFile(vFile) : file;
}
 
Example #8
Source File: AssociateFileType.java    From consulo with Apache License 2.0 6 votes vote down vote up
@Override
public void update(AnActionEvent e) {
  Presentation presentation = e.getPresentation();
  VirtualFile file = e.getData(PlatformDataKeys.VIRTUAL_FILE);
  Project project = e.getData(CommonDataKeys.PROJECT);
  boolean haveSmthToDo;
  if (project == null || file == null || file.isDirectory()) {
    haveSmthToDo = false;
  }
  else {
    // the action should also be available for files which have been auto-detected as text or as a particular language (IDEA-79574)
    haveSmthToDo = FileTypeManager.getInstance().getFileTypeByFileName(file.getName()) == UnknownFileType.INSTANCE;
  }
  presentation.setVisible(haveSmthToDo || ActionPlaces.MAIN_MENU.equals(e.getPlace()));
  presentation.setEnabled(haveSmthToDo);
}
 
Example #9
Source File: ChooseByNameBase.java    From consulo with Apache License 2.0 5 votes vote down vote up
private static boolean isFileName(@Nonnull String name) {
  final int index = name.lastIndexOf('.');
  if (index > 0) {
    String ext = name.substring(index + 1);
    if (ext.contains(":")) {
      ext = ext.substring(0, ext.indexOf(':'));
    }
    if (FileTypeManagerEx.getInstanceEx().getFileTypeByExtension(ext) != UnknownFileType.INSTANCE) {
      return true;
    }
  }
  return false;
}
 
Example #10
Source File: TemplateLanguageStructureViewBuilder.java    From consulo with Apache License 2.0 5 votes vote down vote up
@Override
@Nonnull
public StructureViewModel createStructureViewModel(@Nullable Editor editor) {
  List<StructureViewComposite.StructureViewDescriptor> viewDescriptors = new ArrayList<>();
  PsiFile psiFile = ObjectUtils.notNull(PsiManager.getInstance(myProject).findFile(myVirtualFile));
  for (Language language : getLanguages(psiFile)) {
    StructureViewBuilder builder = getBuilder(psiFile, language);
    if (!(builder instanceof TreeBasedStructureViewBuilder)) continue;
    StructureViewModel model = ((TreeBasedStructureViewBuilder)builder).createStructureViewModel(editor);
    String title = language.getDisplayName();
    Image icon = ObjectUtils.notNull(LanguageUtil.getLanguageFileType(language), UnknownFileType.INSTANCE).getIcon();
    viewDescriptors.add(new StructureViewComposite.StructureViewDescriptor(title, model, icon));
  }
  return new StructureViewCompositeModel(psiFile, editor, viewDescriptors);
}
 
Example #11
Source File: IdeConsoleRootType.java    From consulo with Apache License 2.0 5 votes vote down vote up
@Nullable
@Override
public Image substituteIcon(@Nonnull Project project, @Nonnull VirtualFile file) {
  if (file.isDirectory()) return null;
  FileType fileType = FileTypeManager.getInstance().getFileTypeByFileName(file.getNameSequence());
  Image icon = fileType == UnknownFileType.INSTANCE || fileType == PlainTextFileType.INSTANCE ? AllIcons.Debugger.Console : ObjectUtils.notNull(fileType.getIcon(), AllIcons.Debugger.Console);
  return ImageEffects.layered(icon, AllIcons.Nodes.RunnableMark);
}
 
Example #12
Source File: DocumentationManager.java    From consulo with Apache License 2.0 5 votes vote down vote up
@Nullable
private static String generateFileDoc(@Nonnull PsiFile psiFile, boolean withUrl) {
  VirtualFile file = PsiUtilCore.getVirtualFile(psiFile);
  File ioFile = file == null || !file.isInLocalFileSystem() ? null : VfsUtilCore.virtualToIoFile(file);
  BasicFileAttributes attr = null;
  try {
    attr = ioFile == null ? null : Files.readAttributes(Paths.get(ioFile.toURI()), BasicFileAttributes.class);
  }
  catch (Exception ignored) {
  }
  if (attr == null) return null;
  FileType type = file.getFileType();
  String typeName = type == UnknownFileType.INSTANCE ? "Unknown" : type == PlainTextFileType.INSTANCE ? "Text" : type instanceof ArchiveFileType ? "Archive" : type.getId();
  String languageName = type.isBinary() ? "" : psiFile.getLanguage().getDisplayName();
  return (withUrl ? DocumentationMarkup.DEFINITION_START + file.getPresentableUrl() + DocumentationMarkup.DEFINITION_END + DocumentationMarkup.CONTENT_START : "") +
         getVcsStatus(psiFile.getProject(), file) +
         getScope(psiFile.getProject(), file) +
         "<p><span class='grayed'>Size:</span> " +
         StringUtil.formatFileSize(attr.size()) +
         "<p><span class='grayed'>Type:</span> " +
         typeName +
         (type.isBinary() || typeName.equals(languageName) ? "" : " (" + languageName + ")") +
         "<p><span class='grayed'>Modified:</span> " +
         DateFormatUtil.formatDateTime(attr.lastModifiedTime().toMillis()) +
         "<p><span class='grayed'>Created:</span> " +
         DateFormatUtil.formatDateTime(attr.creationTime().toMillis()) +
         (withUrl ? DocumentationMarkup.CONTENT_END : "");
}
 
Example #13
Source File: ChangeDiffRequestPresentable.java    From consulo with Apache License 2.0 5 votes vote down vote up
private boolean checkContentRevision(ContentRevision rev, final DiffChainContext context, final List<String> errSb) {
  if (rev == null) return true;
  if (rev.getFile().isDirectory()) return false;
  if (! hasContents(rev, errSb)) {
    return false;
  }
  final FileType type = rev.getFile().getFileType();
  if (! type.isBinary()) return true;
  if (type == UnknownFileType.INSTANCE) {
    final boolean associatedToText = checkAssociate(myProject, rev.getFile().getName(), context);
  }
  return true;
}
 
Example #14
Source File: VcsUtil.java    From consulo with Apache License 2.0 5 votes vote down vote up
/**
 * Collects all files which are located in the passed directory.
 *
 * @throws IllegalArgumentException if <code>dir</code> isn't a directory.
 */
public static void collectFiles(final VirtualFile dir,
                                final List<VirtualFile> files,
                                final boolean recursive,
                                final boolean addDirectories) {
  if (!dir.isDirectory()) {
    throw new IllegalArgumentException(VcsBundle.message("exception.text.file.should.be.directory", dir.getPresentableUrl()));
  }

  final FileTypeManager fileTypeManager = FileTypeManager.getInstance();
  VfsUtilCore.visitChildrenRecursively(dir, new VirtualFileVisitor() {
    @Override
    public boolean visitFile(@Nonnull VirtualFile file) {
      if (file.isDirectory()) {
        if (addDirectories) {
          files.add(file);
        }
        if (!recursive && !Comparing.equal(file, dir)) {
          return false;
        }
      }
      else if (fileTypeManager == null || file.getFileType() != UnknownFileType.INSTANCE) {
        files.add(file);
      }
      return true;
    }
  });
}
 
Example #15
Source File: FileReference.java    From consulo with Apache License 2.0 5 votes vote down vote up
@javax.annotation.Nullable
public String getNewFileTemplateName() {
  FileType fileType = FileTypeRegistry.getInstance().getFileTypeByFileName(myText);
  if (fileType != UnknownFileType.INSTANCE) {
    return fileType.getName() + " File." + fileType.getDefaultExtension();
  }
  return null;
}
 
Example #16
Source File: AutoScrollToSourceHandler.java    From consulo with Apache License 2.0 5 votes vote down vote up
protected void scrollToSource(final Component tree) {
  DataContext dataContext=DataManager.getInstance().getDataContext(tree);
  getReady(dataContext).doWhenDone(new Runnable() {
    @Override
    public void run() {
      DataContext context = DataManager.getInstance().getDataContext(tree);
      final VirtualFile vFile = context.getData(PlatformDataKeys.VIRTUAL_FILE);
      if (vFile != null) {
        // Attempt to navigate to the virtual file with unknown file type will show a modal dialog
        // asking to register some file type for this file. This behaviour is undesirable when autoscrolling.
        if (vFile.getFileType() == UnknownFileType.INSTANCE || vFile.getFileType() instanceof INativeFileType) return;

        //IDEA-84881 Don't autoscroll to very large files
        if (vFile.getLength() > PersistentFSConstants.getMaxIntellisenseFileSize()) return;
      }
      Navigatable[] navigatables = context.getData(PlatformDataKeys.NAVIGATABLE_ARRAY);
      if (navigatables != null) {
        if (navigatables.length > 1) {
          return;
        }
        for (Navigatable navigatable : navigatables) {
          // we are not going to open modal dialog during autoscrolling
          if (!navigatable.canNavigateToSource()) return;
        }
      }
      OpenSourceUtil.openSourcesFrom(context, false);
    }
  });
}
 
Example #17
Source File: DSFileTypeAssociator.java    From intellij-demandware with MIT License 5 votes vote down vote up
@Override
public void initComponent() {
    FileType javaScriptFileType = fileTypeManager.getFileTypeByExtension("js");
    if (!(javaScriptFileType instanceof UnknownFileType)) {
        fileTypeManager.associateExtension(javaScriptFileType, "ds");
    }
}
 
Example #18
Source File: CompareClipboardWithSelectionAction.java    From consulo with Apache License 2.0 5 votes vote down vote up
@Nullable
private static FileType getEditorFileType(@Nonnull AnActionEvent e) {
  DiffContent content = e.getData(DiffDataKeys.CURRENT_CONTENT);
  if (content != null && content.getContentType() != null) return content.getContentType();

  DiffRequest request = e.getData(DiffDataKeys.DIFF_REQUEST);
  if (request instanceof ContentDiffRequest) {
    for (DiffContent diffContent : ((ContentDiffRequest)request).getContents()) {
      FileType type = diffContent.getContentType();
      if (type != null && type != UnknownFileType.INSTANCE) return type;
    }
  }

  return null;
}
 
Example #19
Source File: PlatformTestUtil.java    From consulo with Apache License 2.0 5 votes vote down vote up
public static void assertFilesEqual(VirtualFile fileAfter, VirtualFile fileBefore) throws IOException {
  try {
    assertJarFilesEqual(VfsUtilCore.virtualToIoFile(fileAfter), VfsUtilCore.virtualToIoFile(fileBefore));
  }
  catch (IOException e) {
    FileDocumentManager manager = FileDocumentManager.getInstance();

    Document docBefore = manager.getDocument(fileBefore);
    boolean canLoadBeforeText = !fileBefore.getFileType().isBinary() || fileBefore.getFileType() == UnknownFileType.INSTANCE;
    String textB = docBefore != null
                   ? docBefore.getText()
                   : !canLoadBeforeText
                     ? null
                     : LoadTextUtil.getTextByBinaryPresentation(fileBefore.contentsToByteArray(false), fileBefore).toString();

    Document docAfter = manager.getDocument(fileAfter);
    boolean canLoadAfterText = !fileBefore.getFileType().isBinary() || fileBefore.getFileType() == UnknownFileType.INSTANCE;
    String textA = docAfter != null
                   ? docAfter.getText()
                   : !canLoadAfterText
                     ? null
                     : LoadTextUtil.getTextByBinaryPresentation(fileAfter.contentsToByteArray(false), fileAfter).toString();

    if (textA != null && textB != null) {
      assertEquals(fileAfter.getPath(), textA, textB);
    }
    else {
      Assert.assertArrayEquals(fileAfter.getPath(), fileAfter.contentsToByteArray(), fileBefore.contentsToByteArray());
    }
  }
}
 
Example #20
Source File: DiffManagerTest.java    From consulo with Apache License 2.0 4 votes vote down vote up
public void addContent() {
  addContent(new BinaryContent(ArrayUtil.EMPTY_BYTE_ARRAY, null, UnknownFileType.INSTANCE), "");
}
 
Example #21
Source File: CmtFileType.java    From reasonml-idea-plugin with MIT License 4 votes vote down vote up
@Nullable
@Override
public Icon getIcon() {
    return UnknownFileType.INSTANCE.getIcon();
}
 
Example #22
Source File: FileTemplateUtil.java    From consulo with Apache License 2.0 4 votes vote down vote up
public static boolean canCreateFromTemplate(PsiDirectory[] dirs, FileTemplate template) {
  FileType fileType = FileTypeManagerEx.getInstanceEx().getFileTypeByExtension(template.getExtension());
  if (fileType.equals(UnknownFileType.INSTANCE)) return false;
  CreateFromTemplateHandler handler = findHandler(template);
  return handler.canCreate(dirs);
}
 
Example #23
Source File: CreateDirectoryOrPackageHandler.java    From consulo with Apache License 2.0 4 votes vote down vote up
@Nullable
public static FileType findFileTypeBoundToName(String name) {
  FileType fileType = FileTypeManager.getInstance().getFileTypeByFileName(name);
  return fileType instanceof UnknownFileType ? null : fileType;
}
 
Example #24
Source File: UnknownFileTypeDiffRequest.java    From consulo with Apache License 2.0 4 votes vote down vote up
public UnknownFileTypeDiffRequest(@Nonnull String fileName, @Nullable String title) {
  boolean knownFileType = FileTypeManager.getInstance().getFileTypeByFileName(fileName) != UnknownFileType.INSTANCE;
  myFileName = knownFileType ? null : fileName;
  myTitle = title;
}
 
Example #25
Source File: LightFileTypeRegistry.java    From consulo with Apache License 2.0 4 votes vote down vote up
public LightFileTypeRegistry() {
  myAllFileTypes.add(UnknownFileType.INSTANCE);
}
 
Example #26
Source File: LightFileTypeRegistry.java    From consulo with Apache License 2.0 4 votes vote down vote up
@Nonnull
@Override
public FileType getFileTypeByExtension(@NonNls @Nonnull String extension) {
  final FileType result = myExtensionsMap.get(extension);
  return result == null ? UnknownFileType.INSTANCE : result;
}
 
Example #27
Source File: DesktopEditorWindow.java    From consulo with Apache License 2.0 4 votes vote down vote up
/**
 * @return icon which represents file's type and modification status
 */
@Nullable
private consulo.ui.image.Image getFileIcon(@Nonnull final VirtualFile file) {
  if (!file.isValid()) {
    return UnknownFileType.INSTANCE.getIcon();
  }

  final Image baseIcon = VfsIconUtil.getIcon(file, Iconable.ICON_FLAG_READ_STATUS, getManager().getProject());

  int count = 1;

  final Image pinIcon;
  final DesktopEditorComposite composite = findFileComposite(file);
  if (composite != null && composite.isPinned()) {
    count++;
    pinIcon = AllIcons.Nodes.TabPin;
  }
  else {
    pinIcon = null;
  }

  // FIXME [VISTALL] not supported for now
  Icon modifiedIcon = null;
  //UISettings settings = UISettings.getInstance();
  //if (settings.getMarkModifiedTabsWithAsterisk() || !settings.getHideTabsIfNeed()) {
  //  modifiedIcon = settings.getMarkModifiedTabsWithAsterisk() && composite != null && composite.isModified() ? MODIFIED_ICON : GAP_ICON;
  //  count++;
  //}
  //else {
  //  modifiedIcon = null;
  //}
  //
  //if (count == 1) return baseIcon;

  if(pinIcon != null && modifiedIcon == null) {
    return ImageEffects.layered(baseIcon, pinIcon);
  }

  // FIXME [VISTALL] not supported for now
  //int i = 0;
  //final LayeredIcon result = new LayeredIcon(count);
  //int xShift = !settings.getHideTabsIfNeed() ? 4 : 0;
  //result.setIcon(baseIcon, i++, xShift, 0);
  //if (pinIcon != null) result.setIcon(pinIcon, i++, xShift, 0);
  //if (modifiedIcon != null) result.setIcon(modifiedIcon, i++);
  //
  //return JBUI.scale(result);
  return baseIcon;
}
 
Example #28
Source File: TextFilePatchInProgress.java    From consulo with Apache License 2.0 4 votes vote down vote up
@Nonnull
@Override
public DiffRequestProducer getDiffRequestProducers(final Project project, final PatchReader patchReader) {
  final PatchChange change = getChange();
  final FilePatch patch = getPatch();
  final String path = patch.getBeforeName() == null ? patch.getAfterName() : patch.getBeforeName();
  final Getter<CharSequence> baseContentGetter = new Getter<CharSequence>() {
    @Override
    public CharSequence get() {
      return patchReader.getBaseRevision(project, path);
    }
  };
  return new DiffRequestProducer() {
    @Nonnull
    @Override
    public DiffRequest process(@Nonnull UserDataHolder context, @Nonnull ProgressIndicator indicator)
            throws DiffRequestProducerException, ProcessCanceledException {
      if (myCurrentBase != null && myCurrentBase.getFileType() == UnknownFileType.INSTANCE) {
        return new UnknownFileTypeDiffRequest(myCurrentBase, getName());
      }

      if (isConflictingChange()) {
        final VirtualFile file = getCurrentBase();

        Getter<ApplyPatchForBaseRevisionTexts> getter = new Getter<ApplyPatchForBaseRevisionTexts>() {
          @Override
          public ApplyPatchForBaseRevisionTexts get() {
            return ApplyPatchForBaseRevisionTexts.create(project, file, VcsUtil.getFilePath(file), getPatch(), baseContentGetter);
          }
        };

        String afterTitle = getPatch().getAfterVersionId();
        if (afterTitle == null) afterTitle = "Patched Version";
        return PatchDiffRequestFactory.createConflictDiffRequest(project, file, getPatch(), afterTitle, getter, getName(), context, indicator);
      }
      else {
        return PatchDiffRequestFactory.createDiffRequest(project, change, getName(), context, indicator);
      }
    }

    @Nonnull
    @Override
    public String getName() {
      final File ioCurrentBase = getIoCurrentBase();
      return ioCurrentBase == null ? getCurrentPath() : ioCurrentBase.getPath();
    }
  };
}
 
Example #29
Source File: FileContent.java    From consulo with Apache License 2.0 4 votes vote down vote up
private static boolean isUnknown(@Nonnull FileType type) {
  return type.equals(UnknownFileType.INSTANCE);
}
 
Example #30
Source File: CoreFileTypeRegistry.java    From consulo with Apache License 2.0 4 votes vote down vote up
@Nonnull
@Override
public FileType getFileTypeByExtension(@NonNls @Nonnull String extension) {
  final FileType result = myExtensionsMap.get(extension);
  return result == null ? UnknownFileType.INSTANCE : result;
}