• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java FileTypeManagerEx类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: testRegexpCharsAreNotTreatedAsSeparateWords

import com.intellij.openapi.fileTypes.ex.FileTypeManagerEx; //导入依赖的package包/类
public void testRegexpCharsAreNotTreatedAsSeparateWords() {
  FileType regExpFileType = FileTypeManagerEx.getInstanceEx().findFileTypeByName("RegExp");
  assertNotNull(regExpFileType);
  myFixture.configureByText(regExpFileType, "<caret>abc");
  myFixture.performEditorAction(IdeActions.ACTION_EDITOR_NEXT_WORD);
  myFixture.checkResult("abc<caret>");
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:8,代码来源:NextPrevWordTest.java


示例17: addAndRemoveFileType

import com.intellij.openapi.fileTypes.ex.FileTypeManagerEx; //导入依赖的package包/类
static void addAndRemoveFileType() {
  FileType foo = new FakeFileType() {
    @Override
    public boolean isMyFileType(@NotNull VirtualFile file) {
      return true;
    }

    @NotNull
    @Override
    public String getName() {
      return "foo";
    }

    @NotNull
    @Override
    public String getDescription() {
      return "";
    }
  };
  FileTypeIndex index = new FileTypeIndex(FileTypeManager.getInstance());
  int version = index.getVersion();

  try {
    FileTypeManagerEx.getInstanceEx().registerFileType(foo);
    assertNotSame(version, index.getVersion());
  }
  finally {
    FileTypeManagerEx.getInstanceEx().unregisterFileType(foo);
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:31,代码来源:FileTypeIndexTest.java


示例18: isFileName

import com.intellij.openapi.fileTypes.ex.FileTypeManagerEx; //导入依赖的package包/类
private static boolean isFileName(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;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:14,代码来源:ChooseByNameBase.java


示例19: register

import com.intellij.openapi.fileTypes.ex.FileTypeManagerEx; //导入依赖的package包/类
/**
 * Registers the given file type with IntelliJ IDEA.
 *
 * @param fileType The file type to register.
 */
public static void register(final IMetaborgFileType fileType) {
    FileTypeManagerEx.getInstanceEx().registerFileType(fileType);

    // Associate the file type with its file extensions.
    final FileTypeManager fileTypeManager = FileTypeManager.getInstance();
    for (final String ext : fileType.getExtensions()) {
        final FileNameMatcher matcher = new ExtensionFileNameMatcher(ext);
        fileTypeManager.associate(fileType, matcher);
    }
}
 
开发者ID:metaborg,项目名称:spoofax-intellij,代码行数:16,代码来源:FileTypeUtils.java


示例20: updateFileIcons

import com.intellij.openapi.fileTypes.ex.FileTypeManagerEx; //导入依赖的package包/类
public void updateFileIcons() {
  ApplicationManager.getApplication().runWriteAction(() -> {
    final FileTypeManagerEx instanceEx = FileTypeManagerEx.getInstanceEx();
    instanceEx.fireFileTypesChanged();
    ActionToolbarImpl.updateAllToolbarsImmediately();
  });
}
 
开发者ID:ChrisRM,项目名称:material-theme-jetbrains,代码行数:8,代码来源:MTThemeManager.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java StateMachine类代码示例发布时间:2022-05-22
下一篇:
Java KettleDatabaseRepositoryMeta类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap