本文整理汇总了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);
}
示例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());
}
示例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();
}
示例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();
}
示例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());
}
}
}
示例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);
}
示例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)));
}
}
}
示例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);
}
}
示例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());
}
}
}
示例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();
}
示例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;
}
};
}
示例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();
}
}
示例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);
}
}
示例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);
}
}
示例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);
}