• 如果您觉得本站非常有看点,那么赶紧使用Ctrl+D 收藏吧

Java EncodingManagerImpl类的典型用法和代码示例

java 1次浏览

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

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

示例1: testUsageViewDoesNotHoldPsiFilesOrDocuments

点赞 3

import com.intellij.openapi.vfs.encoding.EncodingManagerImpl; //导入依赖的package包/类
public void testUsageViewDoesNotHoldPsiFilesOrDocuments() throws Exception {
  PsiFile psiFile = myFixture.addFileToProject("X.java", "public class X{} //iuggjhfg");
  Usage[] usages = new Usage[100];
  for (int i = 0; i < usages.length; i++) {
    usages[i] = createUsage(psiFile,i);
  }

  UsageView usageView = UsageViewManager.getInstance(getProject()).createUsageView(UsageTarget.EMPTY_ARRAY, usages, new UsageViewPresentation(), null);

  Disposer.register(getTestRootDisposable(), usageView);

  ((EncodingManagerImpl)EncodingManager.getInstance()).clearDocumentQueue();
  FileDocumentManager.getInstance().saveAllDocuments();
  UIUtil.dispatchAllInvocationEvents();

  LeakHunter.checkLeak(usageView, PsiFileImpl.class);
  LeakHunter.checkLeak(usageView, Document.class);
}
 

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

示例2: createMockApplication

点赞 3

import com.intellij.openapi.vfs.encoding.EncodingManagerImpl; //导入依赖的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

示例3: createMockApplication

点赞 3

import com.intellij.openapi.vfs.encoding.EncodingManagerImpl; //导入依赖的package包/类
/**
 * For every #createMockApplication there needs to be a corresponding call to
 * #disposeMockApplication when the test is complete.
 */
public static Disposable createMockApplication() {
  Disposable parentDisposable = getParentDisposableForCleanup();

  final PluginMockApplication instance = new PluginMockApplication(parentDisposable);

  ApplicationManager.setApplication(
      instance,
      new Getter<FileTypeRegistry>() {
        @Override
        public FileTypeRegistry get() {
          return FileTypeManager.getInstance();
        }
      },
      parentDisposable);
  instance.registerService(EncodingManager.class, EncodingManagerImpl.class);
  return parentDisposable;
}
 

开发者ID:GoogleCloudPlatform,
项目名称:google-cloud-intellij,
代码行数:22,
代码来源:TestUtils.java

示例4: initApplication

点赞 3

import com.intellij.openapi.vfs.encoding.EncodingManagerImpl; //导入依赖的package包/类
public void initApplication() {
  //if (ApplicationManager.getApplication() instanceof MockApplicationEx) return;
  final MockApplicationEx instance = new MockApplicationEx(getTestRootDisposable());
  ApplicationManager.setApplication(instance,
                                    new Getter<FileTypeRegistry>() {
                                      @Override
                                      public FileTypeRegistry get() {
                                        return FileTypeManager.getInstance();
                                      }
                                    },
                                    new Getter<EncodingRegistry>() {
                                      @Override
                                      public EncodingRegistry get() {
                                        return EncodingManager.getInstance();
                                      }
                                    },
                                    getTestRootDisposable());
  getApplication().registerService(EncodingManager.class, EncodingManagerImpl.class);
}
 

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

示例5: testUsageViewDoesNotHoldPsiFilesOrDocuments

点赞 3

import com.intellij.openapi.vfs.encoding.EncodingManagerImpl; //导入依赖的package包/类
public void testUsageViewDoesNotHoldPsiFilesOrDocuments() throws Exception {
  PsiFile psiFile = createFile("X.java", "public class X{} //iuggjhfg");
  Usage[] usages = new Usage[100];
  for (int i = 0; i < usages.length; i++) {
    usages[i] = createUsage(psiFile,i);
  }

  UsageView usageView = UsageViewManager.getInstance(getProject()).createUsageView(UsageTarget.EMPTY_ARRAY, usages, new UsageViewPresentation(), null);

  Disposer.register(getTestRootDisposable(), usageView);

  ((EncodingManagerImpl)EncodingManager.getInstance()).clearDocumentQueue();
  FileDocumentManager.getInstance().saveAllDocuments();
  UIUtil.dispatchAllInvocationEvents();

  LeakHunter.checkLeak(usageView, PsiFileImpl.class);
  LeakHunter.checkLeak(usageView, Document.class);
}
 

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

示例6: initApplication

点赞 2

import com.intellij.openapi.vfs.encoding.EncodingManagerImpl; //导入依赖的package包/类
public void initApplication() {
  //if (ApplicationManager.getApplication() instanceof MockApplicationEx) return;
  final MockApplicationEx instance = new MockApplicationEx(getTestRootDisposable());
  ApplicationManager.setApplication(instance,
                                    new Getter<FileTypeRegistry>() {
                                      @Override
                                      public FileTypeRegistry get() {
                                        return FileTypeManager.getInstance();
                                      }
                                    },
                                    getTestRootDisposable());
  getApplication().registerService(EncodingManager.class, EncodingManagerImpl.class);
}
 

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

示例7: doTearDown

点赞 2

import com.intellij.openapi.vfs.encoding.EncodingManagerImpl; //导入依赖的package包/类
public static void doTearDown(@Nonnull final Project project, ApplicationStarter application, boolean checkForEditors) throws Exception {
  CodeStyleSettingsManager.getInstance(project).dropTemporarySettings();
  checkAllTimersAreDisposed();
  UsefulTestCase.doPostponedFormatting(project);

  LookupManager lookupManager = LookupManager.getInstance(project);
  if (lookupManager != null) {
    lookupManager.hideActiveLookup();
  }
  ((StartupManagerImpl)StartupManager.getInstance(project)).prepareForNextTest();
  InspectionProfileManager.getInstance().deleteProfile(PROFILE);
  assertNotNull("Application components damaged", ProjectManager.getInstance());

  new WriteCommandAction.Simple(project) {
    @Override
    @RequiredWriteAction
    protected void run() throws Throwable {
      if (ourSourceRoot != null) {
        try {
          final VirtualFile[] children = ourSourceRoot.getChildren();
          for (VirtualFile child : children) {
            child.delete(this);
          }
        }
        catch (IOException e) {
          //noinspection CallToPrintStackTrace
          e.printStackTrace();
        }
      }
      EncodingManager encodingManager = EncodingManager.getInstance();
      if (encodingManager instanceof EncodingManagerImpl) ((EncodingManagerImpl)encodingManager).clearDocumentQueue();

      FileDocumentManager manager = FileDocumentManager.getInstance();

      ApplicationManager.getApplication().runWriteAction(EmptyRunnable.getInstance()); // Flush postponed formatting if any.
      manager.saveAllDocuments();
      if (manager instanceof FileDocumentManagerImpl) {
        ((FileDocumentManagerImpl)manager).dropAllUnsavedDocuments();
      }
    }
  }.execute().throwException();

  assertFalse(PsiManager.getInstance(project).isDisposed());
  if (!ourAssertionsInTestDetected) {
    if (IdeaLogger.ourErrorsOccurred != null) {
      throw IdeaLogger.ourErrorsOccurred;
    }
  }
  PsiDocumentManagerImpl documentManager = clearUncommittedDocuments(project);
  ((HintManagerImpl)HintManager.getInstance()).cleanup();

  UIUtil.invokeAndWaitIfNeeded(new Runnable() {
    @Override
    public void run() {
      ((UndoManagerImpl)UndoManager.getGlobalInstance()).dropHistoryInTests();
      ((UndoManagerImpl)UndoManager.getInstance(project)).dropHistoryInTests();

      UIUtil.dispatchAllInvocationEvents();
    }
  });

  TemplateDataLanguageMappings.getInstance(project).cleanupForNextTest();

  ProjectManagerEx.getInstanceEx().closeTestProject(project);
  //application.setDataProvider(null);
  ourTestCase = null;
  ((PsiManagerImpl)PsiManager.getInstance(project)).cleanupForNextTest();

  CompletionProgressIndicator.cleanupForNextTest();

  if (checkForEditors) {
    checkEditorsReleased();
  }
  if (isLight(project)) {
    // mark temporarily as disposed so that rogue component trying to access it will fail
    ((ProjectImpl)project).setTemporarilyDisposed(true);
    documentManager.clearUncommittedDocuments();
  }
}
 

开发者ID:consulo,
项目名称:consulo,
代码行数:80,
代码来源:LightPlatformTestCase.java


版权声明:本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系管理员进行删除。
喜欢 (0)