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


Java FileTypeManager类代码示例

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


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

示例1: projectOpened

import com.intellij.openapi.fileTypes.FileTypeManager; //导入依赖的package包/类
@Override
public void projectOpened() {
    try {
        WriteAction.run(new ThrowableRunnable<Throwable>() {
            @Override
            public void run() throws Throwable {
                String ignoredFiles = FileTypeManager.getInstance().getIgnoredFilesList();
                if (ignoredFiles.length() == 0) {
                    ignoredFiles = "*.dso";
                } else {
                    ignoredFiles = ignoredFiles + ";*.dso";
                }
                FileTypeManager.getInstance().setIgnoredFilesList(ignoredFiles);
            }
        });
    } catch (Throwable ignored) {

    }
}
 
开发者ID:CouleeApps,项目名称:TS-IJ,代码行数:20,代码来源:TSPluginComponent.java

示例2: setupConfigurationFromContext

import com.intellij.openapi.fileTypes.FileTypeManager; //导入依赖的package包/类
@Override
protected boolean setupConfigurationFromContext(TesterTestMethodRunConfiguration runConfiguration, ConfigurationContext context, Ref<PsiElement> ref) {
    PsiElement element = context.getPsiLocation();
    Method method = PhpPsiUtil.getParentByCondition(element, parent -> parent instanceof Method);

    if (method != null && isValid(method)) {
        VirtualFile file = method.getContainingFile().getVirtualFile();
        ref.set(method);

        if (!FileTypeManager.getInstance().isFileOfType(file, ScratchFileType.INSTANCE)) {
            VirtualFile root = ProjectRootManager.getInstance(element.getProject()).getFileIndex().getContentRootForFile(file);
            if (root == null) {
                return false;
            }
        }

        PhpScriptRunConfiguration.Settings settings = runConfiguration.getSettings();
        settings.setPath(file.getPresentableUrl());
        runConfiguration.setMethod(method);
        runConfiguration.setName(runConfiguration.suggestedName());
        return true;
    }

    return false;
}
 
开发者ID:jiripudil,项目名称:intellij-nette-tester,代码行数:26,代码来源:TesterTestMethodRunConfigurationProducer.java

示例3: jarModulesOutput

import com.intellij.openapi.fileTypes.FileTypeManager; //导入依赖的package包/类
private static File jarModulesOutput(@NotNull Set<Module> modules, @Nullable Manifest manifest, final @Nullable String pluginXmlPath) throws IOException {
  File jarFile = FileUtil.createTempFile(TEMP_PREFIX, JAR_EXTENSION);
  jarFile.deleteOnExit();
  ZipOutputStream jarPlugin = null;
  try {
    BufferedOutputStream out = new BufferedOutputStream(new FileOutputStream(jarFile));
    jarPlugin = manifest != null ? new JarOutputStream(out, manifest) : new JarOutputStream(out);
    final ProgressIndicator progressIndicator = ProgressManager.getInstance().getProgressIndicator();
    final Set<String> writtenItemRelativePaths = new HashSet<String>();
    for (Module module : modules) {
      final VirtualFile compilerOutputPath = CompilerModuleExtension.getInstance(module).getCompilerOutputPath();
      if (compilerOutputPath == null) continue; //pre-condition: output dirs for all modules are up-to-date
      ZipUtil.addDirToZipRecursively(jarPlugin, jarFile, new File(compilerOutputPath.getPath()), "",
                                     createFilter(progressIndicator, FileTypeManager.getInstance()), writtenItemRelativePaths);
    }
    if (pluginXmlPath != null) {
      ZipUtil.addFileToZip(jarPlugin, new File(pluginXmlPath), "/META-INF/plugin.xml", writtenItemRelativePaths,
                           createFilter(progressIndicator, null));
    }
  }
  finally {
    if (jarPlugin != null) jarPlugin.close();
  }
  return jarFile;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:26,代码来源:PrepareToDeployAction.java

示例4: testDoNotFilterButCopyBigFiles

import com.intellij.openapi.fileTypes.FileTypeManager; //导入依赖的package包/类
public void testDoNotFilterButCopyBigFiles() throws Exception {
  assertEquals(FileTypeManager.getInstance().getFileTypeByFileName("file.xyz"), FileTypes.UNKNOWN);

  new WriteAction() {
    @Override
    protected void run(@NotNull Result result) throws Throwable {
      createProjectSubFile("resources/file.xyz").setBinaryContent(new byte[1024 * 1024 * 20]);
    }
  }.execute().throwException();

  importProject("<groupId>test</groupId>" +
                "<artifactId>project</artifactId>" +
                "<version>1</version>" +

                "<build>" +
                "  <resources>" +
                "    <resource>" +
                "      <directory>resources</directory>" +
                "      <filtering>true</filtering>" +
                "    </resource>" +
                "  </resources>" +
                "</build>");
  compileModules("project");

  assertNotNull(myProjectPom.getParent().findFileByRelativePath("target/classes/file.xyz"));
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:27,代码来源:ResourceFilteringTest.java

示例5: testModuleInIgnoredDir

import com.intellij.openapi.fileTypes.FileTypeManager; //导入依赖的package包/类
public void testModuleInIgnoredDir() throws IOException {
  final VirtualFile ignored = createChildDirectory(myRootVFile, "RCS");
  assertTrue(FileTypeManager.getInstance().isFileIgnored(ignored));
  
  new WriteCommandAction.Simple(getProject()) {
    @Override
    protected void run() throws Throwable {
      ModuleManager moduleManager = ModuleManager.getInstance(myProject);
      ModifiableModuleModel model = moduleManager.getModifiableModel();
      model.disposeModule(myModule);
      model.disposeModule(myModule2);
      model.disposeModule(myModule3);
      model.commit();
      Module module = moduleManager.newModule(myRootVFile.getPath() + "/newModule.iml", StdModuleTypes.JAVA.getId());
      PsiTestUtil.addContentRoot(module, ignored);
      checkInfo(ignored, module, false, false, null, null);
    }
  }.execute().throwException();
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:20,代码来源:DirectoryIndexTest.java

示例6: testClassUnderIgnoredFolder

import com.intellij.openapi.fileTypes.FileTypeManager; //导入依赖的package包/类
public void testClassUnderIgnoredFolder() {
  ApplicationManager.getApplication().runWriteAction(new Runnable() {
    public void run() {
      PsiClass psiClass = myJavaFacade.findClass("p.A", GlobalSearchScope.allScope(myProject));
      assertEquals("p.A", psiClass.getQualifiedName());

      assertTrue(psiClass.isValid());

      FileTypeManager fileTypeManager = FileTypeManager.getInstance();
      String ignoredFilesList = fileTypeManager.getIgnoredFilesList();
      fileTypeManager.setIgnoredFilesList(ignoredFilesList + ";p");
      try {
        assertFalse(psiClass.isValid());
      }
      finally {
        fileTypeManager.setIgnoredFilesList(ignoredFilesList);
      }

      psiClass = myJavaFacade.findClass("p.A");
      assertTrue(psiClass.isValid());
    }
  });
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:24,代码来源:FindClassTest.java

示例7: initTest

import com.intellij.openapi.fileTypes.FileTypeManager; //导入依赖的package包/类
@Override
protected void initTest(Container applicationServices, Container projectServices) {
  applicationServices.register(FileTypeManager.class, new MockFileTypeManager());
  applicationServices.register(
      FileDocumentManager.class, new MockFileDocumentManagerImpl(null, null));
  applicationServices.register(VirtualFileManager.class, mock(VirtualFileManager.class));
  applicationServices.register(BlazeBuildService.class, new BlazeBuildService());
  projectServices.register(ProjectScopeBuilder.class, new ProjectScopeBuilderImpl(project));
  projectServices.register(ProjectViewManager.class, new MockProjectViewManager());
  projectServices.register(
      BlazeProjectDataManager.class, new BlazeProjectDataManagerImpl(project));

  BlazeImportSettingsManager manager = new BlazeImportSettingsManager();
  manager.setImportSettings(new BlazeImportSettings("", "", "", "", BuildSystem.Blaze));
  projectServices.register(BlazeImportSettingsManager.class, manager);

  facade =
      new MockJavaPsiFacade(
          project,
          new MockPsiManager(project),
          ImmutableList.of("com.google.example.Modified", "com.google.example.NotModified"));

  projectServices.register(JavaPsiFacade.class, facade);
  module = new MockModule(() -> {});
  model = new BlazeAndroidModel(project, module, null, mock(SourceProvider.class), null, "", 0);
}
 
开发者ID:bazelbuild,项目名称:intellij,代码行数:27,代码来源:BlazeAndroidModelTest.java

示例8: init

import com.intellij.openapi.fileTypes.FileTypeManager; //导入依赖的package包/类
@NotNull
@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();
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:21,代码来源:ErrorDiffTool.java

示例9: isVersioned

import com.intellij.openapi.fileTypes.FileTypeManager; //导入依赖的package包/类
public boolean isVersioned(@NotNull VirtualFile f, boolean shouldBeInContent) {
  if (!f.isInLocalFileSystem()) return false;

  if (!f.isDirectory() && StringUtil.endsWith(f.getNameSequence(), ".class")) return false;

  Project[] openProjects = ProjectManager.getInstance().getOpenProjects();
  boolean isInContent = false;
  for (Project each : openProjects) {
    if (each.isDefault()) continue;
    if (!each.isInitialized()) continue;
    if (Comparing.equal(each.getWorkspaceFile(), f)) return false;
    ProjectFileIndex index = ProjectRootManager.getInstance(each).getFileIndex();
    
    if (index.isExcluded(f)) return false;
    isInContent |= index.isInContent(f);
  }
  if (shouldBeInContent && !isInContent) return false;
  
  // optimisation: FileTypeManager.isFileIgnored(f) already checked inside ProjectFileIndex.isIgnored()
  return openProjects.length != 0 || !FileTypeManager.getInstance().isFileIgnored(f);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:22,代码来源:IdeaGateway.java

示例10: testFoldingRegions

import com.intellij.openapi.fileTypes.FileTypeManager; //导入依赖的package包/类
private void testFoldingRegions(@NotNull String verificationFileName, boolean doCheckCollapseStatus) {
  String expectedContent;
  try {
    expectedContent = FileUtil.loadFile(new File(verificationFileName));
  }
  catch (IOException e) {
    throw new RuntimeException(e);
  }
  Assert.assertNotNull(expectedContent);

  expectedContent = StringUtil.replace(expectedContent, "\r", "");
  final String cleanContent = expectedContent.replaceAll(START_FOLD, "").replaceAll(END_FOLD, "");

  configureByText(FileTypeManager.getInstance().getFileTypeByFileName(verificationFileName), cleanContent);
  final String actual = getFoldingDescription(doCheckCollapseStatus);

  Assert.assertEquals(expectedContent, actual);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:19,代码来源:CodeInsightTestFixtureImpl.java

示例11: setUpProject

import com.intellij.openapi.fileTypes.FileTypeManager; //导入依赖的package包/类
private void setUpProject() throws IOException {
  File tempDirectory = FileUtil.createTempDirectory(myName, "");
  PlatformTestCase.synchronizeTempDirVfs(LocalFileSystem.getInstance().refreshAndFindFileByIoFile(tempDirectory));
  myFilesToDelete.add(tempDirectory);

  String projectPath = FileUtil.toSystemIndependentName(tempDirectory.getPath()) + "/" + myName + ProjectFileType.DOT_DEFAULT_EXTENSION;
  ByteArrayOutputStream buffer = new ByteArrayOutputStream();
  new Throwable(projectPath).printStackTrace(new PrintStream(buffer));
  myProject = PlatformTestCase.createProject(projectPath, buffer.toString());

  EdtTestUtil.runInEdtAndWait(new ThrowableRunnable<Throwable>() {
    @SuppressWarnings("TestOnlyProblems")
    @Override
    public void run() throws Throwable {
      ProjectManagerEx.getInstanceEx().openTestProject(myProject);

      for (ModuleFixtureBuilder moduleFixtureBuilder : myModuleFixtureBuilders) {
        moduleFixtureBuilder.getFixture().setUp();
      }

      LightPlatformTestCase.clearUncommittedDocuments(myProject);
      ((FileTypeManagerImpl)FileTypeManager.getInstance()).drainReDetectQueue();
    }
  });
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:26,代码来源:HeavyIdeaTestFixtureImpl.java

示例12: forIoFile

import com.intellij.openapi.fileTypes.FileTypeManager; //导入依赖的package包/类
@NotNull
@Override
public CellAppearanceEx forIoFile(@NotNull final File file) {
  final String absolutePath = file.getAbsolutePath();
  if (!file.exists()) {
    return forInvalidUrl(absolutePath);
  }

  if (file.isDirectory()) {
    return SimpleTextCellAppearance.regular(absolutePath, PlatformIcons.FOLDER_ICON);
  }

  final String name = file.getName();
  final FileType fileType = FileTypeManager.getInstance().getFileTypeByFileName(name);
  final File parent = file.getParentFile();
  final CompositeAppearance appearance = CompositeAppearance.textComment(name, parent.getAbsolutePath());
  appearance.setIcon(fileType.getIcon());
  return appearance;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:20,代码来源:FileAppearanceServiceImpl.java

示例13: checkInput

import com.intellij.openapi.fileTypes.FileTypeManager; //导入依赖的package包/类
@Override
public boolean checkInput(String inputString) {
  boolean firstToken = true;
  for (String token : StringUtil.tokenize(inputString, "\\/")) {
    if (firstToken) {
      final VirtualFile child = myDirectory.findChild(token);
      if (child != null) {
        myErrorText = "A " + (child.isDirectory() ? "folder" : "file") +
                      " with name '" + token + "' already exists";
        return false;
      }
    }
    firstToken = false;
    if (token.equals(".") || token.equals("..")) {
      myErrorText = "Can't create a folder with name '" + token + "'";
      return false;
    }
    if (FileTypeManager.getInstance().isFileIgnored(token)) {
      myErrorText = "Trying to create a folder with an ignored name, the result will not be visible";
      return true;
    }
  }
  myErrorText = null;
  return !inputString.isEmpty();
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:26,代码来源:NewFolderAction.java

示例14: createMockApplication

import com.intellij.openapi.fileTypes.FileTypeManager; //导入依赖的package包/类
public static void createMockApplication(Disposable parentDisposable) {
  final BlazeMockApplication instance = new BlazeMockApplication(parentDisposable);

  // If there was no previous application,
  // ApplicationManager leaves the MockApplication in place, which can break future tests.
  Application oldApplication = ApplicationManager.getApplication();
  if (oldApplication == null) {
    Disposer.register(
        parentDisposable,
        () -> {
          new ApplicationManager() {
            {
              ourApplication = null;
            }
          };
        });
  }

  ApplicationManager.setApplication(instance, FileTypeManager::getInstance, parentDisposable);
  instance.registerService(EncodingManager.class, EncodingManagerImpl.class);
}
 
开发者ID:bazelbuild,项目名称:intellij,代码行数:22,代码来源:TestUtils.java

示例15: renderFileName

import com.intellij.openapi.fileTypes.FileTypeManager; //导入依赖的package包/类
private void renderFileName(String path, final FileStatus fileStatus, final String movedMessage) {
  path = path.replace('/', File.separatorChar);
  int pos = path.lastIndexOf(File.separatorChar);
  String fileName;
  String directory;
  if (pos >= 0) {
    directory = path.substring(0, pos).replace(File.separatorChar, File.separatorChar);
    fileName = path.substring(pos+1);
  }
  else {
    directory = "<project root>";
    fileName = path;
  }
  append(fileName, new SimpleTextAttributes(SimpleTextAttributes.STYLE_PLAIN, fileStatus.getColor()));
  if (movedMessage != null) {
    append(movedMessage, SimpleTextAttributes.REGULAR_ATTRIBUTES);
  }
  append(spaceAndThinSpace() + directory, SimpleTextAttributes.GRAYED_ATTRIBUTES);
  setIcon(FileTypeManager.getInstance().getFileTypeByFileName(fileName).getIcon());
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:21,代码来源:ShelvedChangesViewManager.java


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