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


Java FileTypeManagerEx类代码示例

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


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

示例1: testModifyFileTypes

import com.intellij.openapi.fileTypes.ex.FileTypeManagerEx; //导入依赖的package包/类
public void testModifyFileTypes() throws Exception {
  EventsTestListener listener = new EventsTestListener();
  myPsiManager.addPsiTreeChangeListener(listener,getTestRootDisposable());

  ApplicationManager.getApplication().runWriteAction(new Runnable() {
    @Override
    public void run() {
      ((FileTypeManagerEx)FileTypeManager.getInstance()).fireBeforeFileTypesChanged();
      ((FileTypeManagerEx)FileTypeManager.getInstance()).fireFileTypesChanged();
    }
  });


  String string = listener.getEventsString();
  String expected =
    "beforePropertyChange propFileTypes\n" +
    "propertyChanged propFileTypes\n";
  assertEquals(expected, string);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:20,代码来源:PsiEventsTest.java

示例2: testIgnoreOrder

import com.intellij.openapi.fileTypes.ex.FileTypeManagerEx; //导入依赖的package包/类
public void testIgnoreOrder() {
  final FileTypeManagerEx manager = FileTypeManagerEx.getInstanceEx();
  ApplicationManager.getApplication().runWriteAction(new Runnable() {
    @Override
    public void run() {
      manager.setIgnoredFilesList("a;b;");
    }
  });
  assertEquals("a;b;", manager.getIgnoredFilesList());
  ApplicationManager.getApplication().runWriteAction(new Runnable() {
    @Override
    public void run() {
      manager.setIgnoredFilesList("b;a;");
    }
  });
  assertEquals("b;a;", manager.getIgnoredFilesList());
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:18,代码来源:FileTypesTest.java

示例3: showUsages

import com.intellij.openapi.fileTypes.ex.FileTypeManagerEx; //导入依赖的package包/类
private static void showUsages(@NotNull JPanel panel, @Nullable TextDescriptor exampleUsage) {
  String text = "";
  FileType fileType = PlainTextFileType.INSTANCE;
  if (exampleUsage != null) {
    try {
      text = exampleUsage.getText();
      String name = exampleUsage.getFileName();
      FileTypeManagerEx fileTypeManager = FileTypeManagerEx.getInstanceEx();
      String extension = fileTypeManager.getExtension(name);
      fileType = fileTypeManager.getFileTypeByExtension(extension);
    }
    catch (IOException e) {
      LOG.error(e);
    }
  }

  ((ActionUsagePanel)panel.getComponent(0)).reset(text, fileType);
  panel.repaint();
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:20,代码来源:PostfixDescriptionPanel.java

示例4: FileTemplatesLoader

import com.intellij.openapi.fileTypes.ex.FileTypeManagerEx; //导入依赖的package包/类
public FileTemplatesLoader(@NotNull FileTypeManagerEx typeManager) {
  myTypeManager = typeManager;
  myDefaultTemplatesManager = new FTManager(FileTemplateManager.DEFAULT_TEMPLATES_CATEGORY, ROOT_DIR);
  myInternalTemplatesManager = new FTManager(FileTemplateManager.INTERNAL_TEMPLATES_CATEGORY, INTERNAL_DIR, true);
  myPatternsManager = new FTManager(FileTemplateManager.INCLUDES_TEMPLATES_CATEGORY, INCLUDES_DIR);
  myCodeTemplatesManager = new FTManager(FileTemplateManager.CODE_TEMPLATES_CATEGORY, CODE_TEMPLATES_DIR);
  myJ2eeTemplatesManager = new FTManager(FileTemplateManager.J2EE_TEMPLATES_CATEGORY, J2EE_TEMPLATES_DIR);
  myAllManagers = new FTManager[]{
    myDefaultTemplatesManager,
    myInternalTemplatesManager,
    myPatternsManager,
    myCodeTemplatesManager,
    myJ2eeTemplatesManager};

  myDirToManagerMap.put("", myDefaultTemplatesManager);
  myDirToManagerMap.put(INTERNAL_DIR + "/", myInternalTemplatesManager);
  myDirToManagerMap.put(INCLUDES_DIR + "/", myPatternsManager);
  myDirToManagerMap.put(CODE_TEMPLATES_DIR + "/", myCodeTemplatesManager);
  myDirToManagerMap.put(J2EE_TEMPLATES_DIR + "/", myJ2eeTemplatesManager);

  loadDefaultTemplates();
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:23,代码来源:FileTemplatesLoader.java

示例5: buildDialog

import com.intellij.openapi.fileTypes.ex.FileTypeManagerEx; //导入依赖的package包/类
@Override
protected void buildDialog(Project project, PsiDirectory directory, CreateFileFromTemplateDialog.Builder builder) {
  builder
    .setTitle(GroovyBundle.message("newclass.dlg.title"))
    .addKind("Class", JetgroovyIcons.Groovy.Class, GroovyTemplates.GROOVY_CLASS)
    .addKind("Interface", JetgroovyIcons.Groovy.Interface, GroovyTemplates.GROOVY_INTERFACE);

  if (GroovyConfigUtils.getInstance().isVersionAtLeast(directory, GroovyConfigUtils.GROOVY2_3, true)) {
    builder.addKind("Trait", JetgroovyIcons.Groovy.Trait, GroovyTemplates.GROOVY_TRAIT);
  }

  builder
    .addKind("Enum", JetgroovyIcons.Groovy.Enum, GroovyTemplates.GROOVY_ENUM)
    .addKind("Annotation", JetgroovyIcons.Groovy.AnnotationType, GroovyTemplates.GROOVY_ANNOTATION);

  for (FileTemplate template : FileTemplateManager.getInstance(project).getAllTemplates()) {
    FileType fileType = FileTypeManagerEx.getInstanceEx().getFileTypeByExtension(template.getExtension());
    if (fileType.equals(GroovyFileType.GROOVY_FILE_TYPE) && JavaDirectoryService.getInstance().getPackage(directory) != null) {
      builder.addKind(template.getName(), JetgroovyIcons.Groovy.Class, template.getName());
    }
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:23,代码来源:NewGroovyClassAction.java

示例6: testModifyFileTypes

import com.intellij.openapi.fileTypes.ex.FileTypeManagerEx; //导入依赖的package包/类
public void testModifyFileTypes() throws Exception {
  FileManager fileManager = myPsiManager.getFileManager();
  EventsTestListener listener = new EventsTestListener();
  myPsiManager.addPsiTreeChangeListener(listener,getTestRootDisposable());

  ApplicationManager.getApplication().runWriteAction(new Runnable() {
    @Override
    public void run() {
      ((FileTypeManagerEx)FileTypeManager.getInstance()).fireBeforeFileTypesChanged();
      ((FileTypeManagerEx)FileTypeManager.getInstance()).fireFileTypesChanged();
    }
  });


  String string = listener.getEventsString();
  String expected =
    "beforePropertyChange\n" +
    "propertyChanged\n";
  assertEquals(expected, string);
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:21,代码来源:PsiEventsTest.java

示例7: FileTemplateManagerImpl

import com.intellij.openapi.fileTypes.ex.FileTypeManagerEx; //导入依赖的package包/类
public FileTemplateManagerImpl(@NotNull FileTypeManagerEx typeManager, ProjectManager pm /*need this to ensure disposal of the service _after_ project manager*/) {
  myTypeManager = typeManager;
  myTemplateSettings = ExportableFileTemplateSettings.getInstance();
  assert myTemplateSettings != null : "Can not instantiate " + ExportableFileTemplateSettings.class.getName();

  myInternalTemplatesManager = myTemplateSettings.getInternalTemplatesManager();
  myDefaultTemplatesManager = myTemplateSettings.getDefaultTemplatesManager();
  myPatternsManager = myTemplateSettings.getPatternsManager();
  myCodeTemplatesManager = myTemplateSettings.getCodeTemplatesManager();
  myJ2eeTemplatesManager = myTemplateSettings.getJ2eeTemplatesManager();
  myAllManagers = myTemplateSettings.getAllManagers();

  if (ApplicationManager.getApplication().isUnitTestMode()) {
    for (String tname : Arrays.asList("Class", "AnnotationType", "Enum", "Interface")) {
      for (FileTemplate template : myInternalTemplatesManager.getAllTemplates(true)) {
        if (tname.equals(template.getName())) {
          myInternalTemplatesManager.removeTemplate(((FileTemplateBase)template).getQualifiedName());
          break;
        }
      }
      final FileTemplateBase template = myInternalTemplatesManager.addTemplate(tname, "java");
      template.setText(normalizeText(getTestClassTemplateText(tname)));
    }
  }

}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:27,代码来源:FileTemplateManagerImpl.java

示例8: FileTemplatesLoader

import com.intellij.openapi.fileTypes.ex.FileTypeManagerEx; //导入依赖的package包/类
public FileTemplatesLoader(@NotNull FileTypeManagerEx typeManager) {
  myTypeManager = typeManager;
  myDefaultTemplatesManager = new FTManager(FileTemplateManager.DEFAULT_TEMPLATES_CATEGORY, ROOT_DIR);
  myInternalTemplatesManager = new FTManager(FileTemplateManager.INTERNAL_TEMPLATES_CATEGORY, INTERNAL_DIR, true);
  myPatternsManager = new FTManager(FileTemplateManager.INCLUDES_TEMPLATES_CATEGORY, INCLUDES_DIR);
  myCodeTemplatesManager = new FTManager(FileTemplateManager.CODE_TEMPLATES_CATEGORY, CODETEMPLATES_DIR);
  myJ2eeTemplatesManager = new FTManager(FileTemplateManager.J2EE_TEMPLATES_CATEGORY, J2EE_TEMPLATES_DIR);
  myAllManagers = new FTManager[]{
    myDefaultTemplatesManager,
    myInternalTemplatesManager,
    myPatternsManager,
    myCodeTemplatesManager,
    myJ2eeTemplatesManager};

  myDirToManagerMap.put("", myDefaultTemplatesManager);
  myDirToManagerMap.put(INTERNAL_DIR + "/", myInternalTemplatesManager);
  myDirToManagerMap.put(INCLUDES_DIR + "/", myPatternsManager);
  myDirToManagerMap.put(CODETEMPLATES_DIR + "/", myCodeTemplatesManager);
  myDirToManagerMap.put(J2EE_TEMPLATES_DIR + "/", myJ2eeTemplatesManager);

  loadDefaultTemplates();
  for (FTManager child : myAllManagers) {
    loadCustomizedContent(child);
  }
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:26,代码来源:FileTemplatesLoader.java

示例9: buildDialog

import com.intellij.openapi.fileTypes.ex.FileTypeManagerEx; //导入依赖的package包/类
@Override
protected void buildDialog(Project project, PsiDirectory directory, CreateFileFromTemplateDialog.Builder builder) {
  builder
    .setTitle(GroovyBundle.message("newclass.dlg.title"))
    .addKind("Class", JetgroovyIcons.Groovy.Class, GroovyTemplates.GROOVY_CLASS)
    .addKind("Interface", JetgroovyIcons.Groovy.Interface, GroovyTemplates.GROOVY_INTERFACE)
    .addKind("Enum", JetgroovyIcons.Groovy.Enum, GroovyTemplates.GROOVY_ENUM)
    .addKind("Annotation", JetgroovyIcons.Groovy.AnnotationType, GroovyTemplates.GROOVY_ANNOTATION);

  for (FileTemplate template : FileTemplateManager.getInstance().getAllTemplates()) {
    FileType fileType = FileTypeManagerEx.getInstanceEx().getFileTypeByExtension(template.getExtension());
    if (fileType.equals(GroovyFileType.GROOVY_FILE_TYPE) && JavaDirectoryService.getInstance().getPackage(directory) != null) {
      builder.addKind(template.getName(), JetgroovyIcons.Groovy.Class, template.getName());
    }
  }
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:17,代码来源:NewGroovyClassAction.java

示例10: showUsages

import com.intellij.openapi.fileTypes.ex.FileTypeManagerEx; //导入依赖的package包/类
private static void showUsages(@Nonnull JPanel panel, @Nullable TextDescriptor exampleUsage) {
  String text = "";
  FileType fileType = PlainTextFileType.INSTANCE;
  if (exampleUsage != null) {
    try {
      text = exampleUsage.getText();
      String name = exampleUsage.getFileName();
      FileTypeManagerEx fileTypeManager = FileTypeManagerEx.getInstanceEx();
      String extension = fileTypeManager.getExtension(name);
      fileType = fileTypeManager.getFileTypeByExtension(extension);
    }
    catch (IOException e) {
      LOG.error(e);
    }
  }

  ((ActionUsagePanel)panel.getComponent(0)).reset(text, fileType);
  panel.repaint();
}
 
开发者ID:consulo,项目名称:consulo,代码行数:20,代码来源:PostfixDescriptionPanel.java

示例11: FileTemplateManagerImpl

import com.intellij.openapi.fileTypes.ex.FileTypeManagerEx; //导入依赖的package包/类
public FileTemplateManagerImpl(@Nonnull FileTypeManagerEx typeManager, FileTemplateSettings projectSettings, ExportableFileTemplateSettings defaultSettings,
                               /*need this to ensure disposal of the service _after_ project manager*/
                               @SuppressWarnings("UnusedParameters") ProjectManager pm, final Project project) {
  myTypeManager = typeManager;
  myProjectSettings = projectSettings;
  myDefaultSettings = defaultSettings;
  myProject = project;

  myProjectScheme = project.isDefault() ? null : new FileTemplatesScheme("Project") {
    @Nonnull
    @Override
    public String getTemplatesDir() {
      return FileUtilRt.toSystemDependentName(StorageUtil.getStoreDir(project) + "/" + TEMPLATES_DIR);
    }

    @Nonnull
    @Override
    public Project getProject() {
      return project;
    }
  };
}
 
开发者ID:consulo,项目名称:consulo,代码行数:23,代码来源:FileTemplateManagerImpl.java

示例12: FileTemplatesLoader

import com.intellij.openapi.fileTypes.ex.FileTypeManagerEx; //导入依赖的package包/类
protected FileTemplatesLoader(@Nonnull FileTypeManagerEx typeManager, @Nullable Project project) {
  myTypeManager = typeManager;
  File configDir = project == null || project.isDefault()
                   ? new File(PathManager.getConfigPath(), TEMPLATES_DIR)
                   : new File(UriUtil.trimTrailingSlashes(StorageUtil.getStoreDir(project) + "/" + TEMPLATES_DIR));
  myDefaultTemplatesManager = new FTManager(FileTemplateManager.DEFAULT_TEMPLATES_CATEGORY, configDir);
  myInternalTemplatesManager = new FTManager(FileTemplateManager.INTERNAL_TEMPLATES_CATEGORY, new File(configDir, INTERNAL_DIR), true);
  myPatternsManager = new FTManager(FileTemplateManager.INCLUDES_TEMPLATES_CATEGORY, new File(configDir, INCLUDES_DIR));
  myCodeTemplatesManager = new FTManager(FileTemplateManager.CODE_TEMPLATES_CATEGORY, new File(configDir, CODE_TEMPLATES_DIR));
  myJ2eeTemplatesManager = new FTManager(FileTemplateManager.J2EE_TEMPLATES_CATEGORY, new File(configDir, J2EE_TEMPLATES_DIR));
  myAllManagers = new FTManager[]{myDefaultTemplatesManager, myInternalTemplatesManager, myPatternsManager, myCodeTemplatesManager, myJ2eeTemplatesManager};

  myDirToManagerMap.put("", myDefaultTemplatesManager);
  myDirToManagerMap.put(INTERNAL_DIR + "/", myInternalTemplatesManager);
  myDirToManagerMap.put(INCLUDES_DIR + "/", myPatternsManager);
  myDirToManagerMap.put(CODE_TEMPLATES_DIR + "/", myCodeTemplatesManager);
  myDirToManagerMap.put(J2EE_TEMPLATES_DIR + "/", myJ2eeTemplatesManager);

  loadDefaultTemplates();
  for (FTManager manager : myAllManagers) {
    manager.loadCustomizedContent();
  }
}
 
开发者ID:consulo,项目名称:consulo,代码行数:24,代码来源:FileTemplatesLoader.java

示例13: testPlainTextSubstitution

import com.intellij.openapi.fileTypes.ex.FileTypeManagerEx; //导入依赖的package包/类
public void testPlainTextSubstitution() throws IOException {
  FileTypeManagerEx.getInstanceEx().registerFileType(MockLanguageFileType.INSTANCE, "xxx");
  try {
    configureFromFileText("a.xxx", "aaa a<caret>");
    complete();
    checkResultByText("aaa aaa<caret>");
  }
  finally {
    FileTypeManagerEx.getInstanceEx().unregisterFileType(MockLanguageFileType.INSTANCE);

  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:13,代码来源:CustomFileTypeCompletionTest.java

示例14: testChangeIgnoreList

import com.intellij.openapi.fileTypes.ex.FileTypeManagerEx; //导入依赖的package包/类
public void testChangeIgnoreList() throws Exception {
  VirtualFile newDir = createChildDirectory(myModule1Dir, "newDir");

  assertInProject(newDir);

  final FileTypeManagerEx fileTypeManager = (FileTypeManagerEx)FileTypeManager.getInstance();
  final String list = fileTypeManager.getIgnoredFilesList();
  final String list1 = list + ";" + "newDir";
  try {
    ApplicationManager.getApplication().runWriteAction(new Runnable() {
      @Override
      public void run() {
        fileTypeManager.setIgnoredFilesList(list1);
      }
    });
    assertNotInProject(newDir);
  }
  finally {
    ApplicationManager.getApplication().runWriteAction(new Runnable() {
      @Override
      public void run() {
        fileTypeManager.setIgnoredFilesList(list);
      }
    });
    assertInProject(newDir);
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:28,代码来源:DirectoryIndexTest.java

示例15: setUp

import com.intellij.openapi.fileTypes.ex.FileTypeManagerEx; //导入依赖的package包/类
@Override
protected void setUp() throws Exception {
  super.setUp();
  myFileTypeManager = (FileTypeManagerImpl)FileTypeManagerEx.getInstanceEx();
  myOldIgnoredFilesList = myFileTypeManager.getIgnoredFilesList();
  FileTypeManagerImpl.reDetectAsync(true);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:8,代码来源:FileTypesTest.java


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