protected static Editor createEditor(@NotNull VirtualFile file) {
    PsiDocumentManager.getInstance(getProject()).commitAllDocuments();
    Editor editor =
        FileEditorManager.getInstance(getProject())
            .openTextEditor(new OpenFileDescriptor(getProject(), file, 0), false);
    DaemonCodeAnalyzer.getInstance(getProject()).restart();

    ((EditorImpl) editor).setCaretActive();
    return editor;
  }
コード例 #2
0
  public void testProtectSwf() throws Exception {
    configureByFiles((String) null);
    VirtualFile vFile =
        LocalFileSystem.getInstance()
            .findFileByPath(getTestDataPath() + getBasePath() + "/" + getTestName(false) + ".swf");
    myEditor =
        FileEditorManager.getInstance(myProject)
            .openTextEditor(new OpenFileDescriptor(myProject, vFile, 0), false);
    PsiDocumentManager.getInstance(getProject()).commitAllDocuments();

    myFile = myPsiManager.findFile(vFile);
    ((EditorImpl) myEditor).setCaretActive();
    assertFalse(
        FileDocumentManager.getInstance().requestWriting(myEditor.getDocument(), myProject));
  }
コード例 #3
0
  @JSTestOptions({JSTestOption.WithFlexFacet, JSTestOption.WithLineMarkers})
  public void testLineMarkersInSwf() throws Exception {
    myAfterCommitRunnable =
        () ->
            FlexTestUtils.addLibrary(
                myModule,
                "lib",
                getTestDataPath() + getBasePath() + "/",
                getTestName(false) + ".swc",
                null,
                null);
    configureByFiles((String) null);
    VirtualFile vFile =
        LocalFileSystem.getInstance()
            .findFileByPath(getTestDataPath() + getBasePath() + "/" + getTestName(false) + ".swc");
    vFile = JarFileSystem.getInstance().getJarRootForLocalFile(vFile).findChild("library.swf");
    myEditor =
        FileEditorManager.getInstance(myProject)
            .openTextEditor(new OpenFileDescriptor(myProject, vFile, 0), false);
    PsiDocumentManager.getInstance(getProject()).commitAllDocuments();

    myFile = myPsiManager.findFile(vFile);
    ((EditorImpl) myEditor).setCaretActive();

    vFile =
        LocalFileSystem.getInstance()
            .findFileByPath(getTestDataPath() + getBasePath() + "/" + getTestName(false) + ".as");
    myFile = myPsiManager.findFile(vFile);
    checkHighlighting(
        new ExpectedHighlightingData(
            new DocumentImpl(StreamUtil.convertSeparators(VfsUtil.loadText(vFile))),
            false,
            false,
            true,
            myFile));
  }