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

Java PostprocessReformattingAspect类代码示例

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

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



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

示例1: promptTypeArgs

import com.intellij.psi.impl.source.PostprocessReformattingAspect; //导入依赖的package包/类
public static boolean promptTypeArgs(InsertionContext context, int offset) {
  if (offset < 0) {
    return false;
  }

  OffsetKey key = context.trackOffset(offset, false);
  PostprocessReformattingAspect.getInstance(context.getProject()).doPostponedFormatting();
  offset = context.getOffset(key);
  if (offset < 0) {
    return false;
  }

  String open = escapeXmlIfNeeded(context, "<");
  context.getDocument().insertString(offset, open);
  context.getEditor().getCaretModel().moveToOffset(offset + open.length());
  context.getDocument().insertString(offset + open.length(), escapeXmlIfNeeded(context, ">"));
  context.setAddCompletionChar(false);
  return true;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:20,代码来源:JavaCompletionUtil.java


示例2: addImportForItem

import com.intellij.psi.impl.source.PostprocessReformattingAspect; //导入依赖的package包/类
public static void addImportForItem(InsertionContext context, PsiClass aClass) {
  if (aClass.getQualifiedName() == null) return;
  PsiFile file = context.getFile();

  int startOffset = context.getStartOffset();
  int tail = context.getTailOffset();
  int newTail = JavaCompletionUtil.insertClassReference(aClass, file, startOffset, tail);
  if (newTail > context.getDocument().getTextLength() || newTail < 0) {
    LOG.error(LogMessageEx.createEvent("Invalid offset after insertion ",
                                       "offset=" + newTail + "\n" +
                                       "start=" + startOffset + "\n" +
                                       "tail=" + tail + "\n" +
                                       "file.length=" + file.getTextLength() + "\n" +
                                       "document=" + context.getDocument() + "\n" +
                                       DebugUtil.currentStackTrace(),
                                       AttachmentFactory.createAttachment(context.getDocument())));
    return;

  }
  context.setTailOffset(newTail);
  JavaCompletionUtil.shortenReference(file, context.getStartOffset());
  PostprocessReformattingAspect.getInstance(context.getProject()).doPostponedFormatting();
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:24,代码来源:PsiTypeLookupItem.java


示例3: run

import com.intellij.psi.impl.source.PostprocessReformattingAspect; //导入依赖的package包/类
public static void run(@NotNull final Project project, final Editor editor, final ExtractMethodProcessor processor) {
  CommandProcessor.getInstance().executeCommand(project, new Runnable() {
    public void run() {
      PostprocessReformattingAspect.getInstance(project).postponeFormattingInside(new Runnable() {
        public void run() {
          try {
            final RefactoringEventData beforeData = new RefactoringEventData();
            beforeData.addElements(processor.myElements);
            project.getMessageBus().syncPublisher(RefactoringEventListener.REFACTORING_EVENT_TOPIC).refactoringStarted("refactoring.extract.method", beforeData);
            
            processor.doRefactoring();

            final RefactoringEventData data = new RefactoringEventData();
            data.addElement(processor.getExtractedMethod());
            project.getMessageBus().syncPublisher(RefactoringEventListener.REFACTORING_EVENT_TOPIC).refactoringDone("refactoring.extract.method", data);
          }
          catch (IncorrectOperationException e) {
            LOG.error(e);
          }
        }
      });
    }
  }, REFACTORING_NAME, null);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:25,代码来源:ExtractMethodHandler.java


示例4: doTest

import com.intellij.psi.impl.source.PostprocessReformattingAspect; //导入依赖的package包/类
private void doTest() {
  myFixture.configureByFile(getTestName(false) + ".java");
  CommandProcessor.getInstance().executeCommand(getProject(), new Runnable() {
    @Override
    public void run() {
      WriteCommandAction.runWriteCommandAction(null, new Runnable() {
        @Override
        public void run() {
          JavaCodeStyleManager.getInstance(getProject()).shortenClassReferences(myFixture.getFile());
          PostprocessReformattingAspect.getInstance(getProject()).doPostponedFormatting();
          PsiDocumentManager.getInstance(getProject()).commitAllDocuments();
        }
      });
    }
  }, "", "");
  myFixture.checkResultByFile(getTestName(false) + "_after.java");
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:18,代码来源:ShortenClassReferencesTest.java


示例5: doTest

import com.intellij.psi.impl.source.PostprocessReformattingAspect; //导入依赖的package包/类
private void doTest(String className) throws Exception {
  String rootBefore = getRoot() + "/before";
  PsiTestUtil.removeAllRoots(myModule, IdeaTestUtil.getMockJdk17());
  final VirtualFile rootDir = PsiTestUtil.createTestProjectStructure(myProject, myModule, rootBefore, myFilesToDelete);
  PsiClass classToInline = myJavaFacade.findClass(className, ProjectScope.getAllScope(myProject));
  assertEquals(null, InlineToAnonymousClassHandler.getCannotInlineMessage(classToInline));
  InlineToAnonymousClassProcessor processor = new InlineToAnonymousClassProcessor(myProject, 
                                                                                  classToInline,
                                                                                  null, false, false, false);
  UsageInfo[] usages = processor.findUsages();
  MultiMap<PsiElement,String> conflicts = processor.getConflicts(usages);
  assertEquals(0, conflicts.size());
  processor.run();

  String rootAfter = getRoot() + "/after";
  VirtualFile rootDir2 = LocalFileSystem.getInstance().findFileByPath(rootAfter.replace(File.separatorChar, '/'));
  myProject.getComponent(PostprocessReformattingAspect.class).doPostponedFormatting();
  PlatformTestUtil.assertDirectoriesEqual(rootDir2, rootDir);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:20,代码来源:InlineToAnonymousClassMultifileTest.java


示例6: doTest

import com.intellij.psi.impl.source.PostprocessReformattingAspect; //导入依赖的package包/类
private void doTest(String className, String methodName) throws Exception {
  String rootBefore = getRoot() + "/before";
  PsiTestUtil.removeAllRoots(myModule, IdeaTestUtil.getMockJdk17());
  final VirtualFile rootDir = PsiTestUtil.createTestProjectStructure(myProject, myModule, rootBefore, myFilesToDelete);
  PsiClass aClass = myJavaFacade.findClass(className, ProjectScope.getAllScope(myProject));
  assertTrue(aClass != null);
  PsiElement element = aClass.findMethodsByName(methodName, false)[0];
  assertTrue(element instanceof PsiMethod);
  PsiMethod method = (PsiMethod)element;
  final boolean condition = InlineMethodProcessor.checkBadReturns(method) && !InlineUtil.allUsagesAreTailCalls(method);
  assertFalse("Bad returns found", condition);

  InlineOptions options = new MockInlineMethodOptions();
  final InlineMethodProcessor processor = new InlineMethodProcessor(getProject(), method, null, myEditor, options.isInlineThisOnly());
  processor.run();

  String rootAfter = getRoot() + "/after";
  VirtualFile rootDir2 = LocalFileSystem.getInstance().findFileByPath(rootAfter.replace(File.separatorChar, '/'));
  myProject.getComponent(PostprocessReformattingAspect.class).doPostponedFormatting();
  PlatformTestUtil.assertDirectoriesEqual(rootDir2, rootDir);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:22,代码来源:InlineMethodMultifileTest.java


示例7: doMultifileTest

import com.intellij.psi.impl.source.PostprocessReformattingAspect; //导入依赖的package包/类
private void doMultifileTest() throws Exception {
  String root = JavaTestUtil.getJavaTestDataPath() + "/refactoring/copyClass/multifile/" + getTestName(true);
  String rootBefore = root + "/before";
  PsiTestUtil.removeAllRoots(myModule, IdeaTestUtil.getMockJdk17());
  VirtualFile rootDir = PsiTestUtil.createTestProjectStructure(myProject, myModule, rootBefore, myFilesToDelete);

  final HashMap<PsiFile, PsiClass[]> map = new HashMap<>();
  final VirtualFile sourceDir = rootDir.findChild("p1");
  for (VirtualFile file : sourceDir.getChildren()) {
    final PsiFile psiFile = myPsiManager.findFile(file);
    if (psiFile instanceof PsiJavaFile) {
      map.put(psiFile, ((PsiJavaFile)psiFile).getClasses());
    }
  }

  final VirtualFile targetVDir = rootDir.findChild("p2");
  CopyClassesHandler.doCopyClasses(map, null, myPsiManager.findDirectory(targetVDir), myProject);

  String rootAfter = root + "/after";
  VirtualFile rootDir2 = LocalFileSystem.getInstance().findFileByPath(rootAfter.replace(File.separatorChar, '/'));
  myProject.getComponent(PostprocessReformattingAspect.class).doPostponedFormatting();
  PlatformTestUtil.assertDirectoriesEqual(rootDir2, rootDir);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:24,代码来源:CopyClassTest.java


示例8: doPackageCopy

import com.intellij.psi.impl.source.PostprocessReformattingAspect; //导入依赖的package包/类
private void doPackageCopy() throws Exception {
  String root = JavaTestUtil.getJavaTestDataPath() + "/refactoring/copyClass/multifile/" + getTestName(true);
  String rootBefore = root + "/before";
  PsiTestUtil.removeAllRoots(myModule, IdeaTestUtil.getMockJdk17());
  VirtualFile rootDir = PsiTestUtil.createTestProjectStructure(myProject, myModule, rootBefore, myFilesToDelete);

  final VirtualFile targetVDir = rootDir.findChild("p2");
  final PsiDirectory sourceP1Dir = myPsiManager.findDirectory(rootDir.findChild("p1"));
  final PsiDirectory targetP2Dir = myPsiManager.findDirectory(targetVDir);
  new CopyClassesHandler().doCopy(new PsiElement[]{sourceP1Dir}, targetP2Dir);

  String rootAfter = root + "/after";
  VirtualFile rootDir2 = LocalFileSystem.getInstance().findFileByPath(rootAfter.replace(File.separatorChar, '/'));
  myProject.getComponent(PostprocessReformattingAspect.class).doPostponedFormatting();
  PlatformTestUtil.assertDirectoriesEqual(rootDir2, rootDir);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:17,代码来源:CopyClassTest.java


示例9: setupFileEditorAndDocument

import com.intellij.psi.impl.source.PostprocessReformattingAspect; //导入依赖的package包/类
@NotNull
private static Document setupFileEditorAndDocument(@NotNull String fileName, @NotNull String fileText) throws IOException {
  EncodingProjectManager.getInstance(getProject()).setEncoding(null, CharsetToolkit.UTF8_CHARSET);
  EncodingProjectManager.getInstance(ProjectManager.getInstance().getDefaultProject()).setEncoding(null, CharsetToolkit.UTF8_CHARSET);
  PostprocessReformattingAspect.getInstance(ourProject).doPostponedFormatting();
  deleteVFile();
  myVFile = getSourceRoot().createChildData(null, fileName);
  VfsUtil.saveText(myVFile, fileText);
  final FileDocumentManager manager = FileDocumentManager.getInstance();
  final Document document = manager.getDocument(myVFile);
  assertNotNull("Can't create document for '" + fileName + "'", document);
  manager.reloadFromDisk(document);
  document.insertString(0, " ");
  document.deleteString(0, 1);
  myFile = getPsiManager().findFile(myVFile);
  assertNotNull("Can't create PsiFile for '" + fileName + "'. Unknown file type most probably.", myFile);
  assertTrue(myFile.isPhysical());
  myEditor = createEditor(myVFile);
  myVFile.setCharset(CharsetToolkit.UTF8_CHARSET);

  PsiDocumentManager.getInstance(getProject()).commitAllDocuments();
  return document;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:24,代码来源:LightPlatformCodeInsightTestCase.java


示例10: checkResultByFile

import com.intellij.psi.impl.source.PostprocessReformattingAspect; //导入依赖的package包/类
/**
 * Validates that content of the editor as well as caret and selection matches one specified in data file that
 * should be formed with the same format as one used in configureByFile
 * @param message - this check specific message. Added to text, caret position, selection checking. May be null
 * @param filePath - relative path from %IDEA_INSTALLATION_HOME%/testData/
 * @param ignoreTrailingSpaces - whether trailing spaces in editor in data file should be stripped prior to comparing.
 */
protected void checkResultByFile(@Nullable String message, @TestDataFile @NotNull String filePath, final boolean ignoreTrailingSpaces) {
  bringRealEditorBack();

  getProject().getComponent(PostprocessReformattingAspect.class).doPostponedFormatting();
  if (ignoreTrailingSpaces) {
    final Editor editor = myEditor;
    TrailingSpacesStripper.stripIfNotCurrentLine(editor.getDocument(), false);
    EditorUtil.fillVirtualSpaceUntilCaret(editor);
  }

  PsiDocumentManager.getInstance(getProject()).commitAllDocuments();

  String fullPath = getTestDataPath() + filePath;

  File ioFile = new File(fullPath);

  assertTrue(getMessage("Cannot find file " + fullPath, message), ioFile.exists());
  String fileText = null;
  try {
    fileText = FileUtil.loadFile(ioFile, CharsetToolkit.UTF8_CHARSET);
  } catch (IOException e) {
    LOG.error(e);
  }
  checkResultByText(message, StringUtil.convertLineSeparators(fileText), ignoreTrailingSpaces, getTestDataPath() + "/" + filePath);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:33,代码来源:LightPlatformCodeInsightTestCase.java


示例11: handleInsert

import com.intellij.psi.impl.source.PostprocessReformattingAspect; //导入依赖的package包/类
@Override
public void handleInsert(InsertionContext context) {
  final LookupElement delegate = getDelegate();
  final TailType tailType = computeTailType(context);

  final LookupItem lookupItem = delegate.as(LookupItem.CLASS_CONDITION_KEY);
  if (lookupItem != null && tailType != null) {
    lookupItem.setTailType(TailType.UNKNOWN);
  }
  delegate.handleInsert(context);
  if (tailType != null && tailType.isApplicable(context)) {
    PostprocessReformattingAspect.getInstance(context.getProject()).doPostponedFormatting();
    int tailOffset = context.getTailOffset();
    if (tailOffset < 0) {
      throw new AssertionError("tailOffset < 0: delegate=" + getDelegate() + "; this=" + this + "; tail=" + tailType);
    }
    tailType.processTail(context.getEditor(), tailOffset);
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:20,代码来源:TailTypeDecorator.java


示例12: commitToOriginal

import com.intellij.psi.impl.source.PostprocessReformattingAspect; //导入依赖的package包/类
private void commitToOriginal(final DocumentEvent e) {
  VirtualFile origVirtualFile = PsiUtilCore.getVirtualFile(myNewFile.getContext());
  myCommittingToOriginal = true;
  try {
    if (origVirtualFile == null || !ReadonlyStatusHandler.getInstance(myProject).ensureFilesWritable(origVirtualFile).hasReadonlyFiles()) {
      PostprocessReformattingAspect.getInstance(myProject).disablePostprocessFormattingInside(new Runnable() {
        @Override
        public void run() {
          if (myAltFullRange != null) {
            altCommitToOriginal(e);
            return;
          }
          commitToOriginalInner();
        }
      });
      PsiDocumentManager.getInstance(myProject).doPostponedOperationsAndUnblockDocument(myOrigDocument);
    }
  }
  finally {
    myCommittingToOriginal = false;
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:23,代码来源:QuickEditHandler.java


示例13: invoke

import com.intellij.psi.impl.source.PostprocessReformattingAspect; //导入依赖的package包/类
@Override
public void invoke(@NotNull Project project, @NotNull final Editor editor, @NotNull PsiFile file) throws IncorrectOperationException {
  final PsiElement element = currentCommaElement(editor, file);
  if (element != null) {
    new WriteCommandAction(project, file) {
      protected void run(@NotNull Result result) throws Throwable {
        PostprocessReformattingAspect.getInstance(getProject()).disablePostprocessFormattingInside(new Runnable() {
          @Override
          public void run() {
            swapAtComma(editor, element);
          }
        });
      }
    }.execute();
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:17,代码来源:FlipCommaIntention.java


示例14: doTest

import com.intellij.psi.impl.source.PostprocessReformattingAspect; //导入依赖的package包/类
public void doTest() {
  myFixture.configureByFile(getTestName(false) + ".groovy");

  final int offset = myFixture.getEditor().getCaretModel().getOffset();
  final PsiElement atCaret = myFixture.getFile().findElementAt(offset);
  final GrRangeExpression range = PsiTreeUtil.getParentOfType(atCaret, GrRangeExpression.class);
  final GroovyRangeTypeCheckInspection inspection = new GroovyRangeTypeCheckInspection();

  final GroovyFix fix = inspection.buildFix(range);

  LocalQuickFix[] fixes = {fix};
  final ProblemDescriptor descriptor = InspectionManager.getInstance(getProject()).createProblemDescriptor(range, "bla-bla", false, fixes, ProblemHighlightType.WEAK_WARNING);
  WriteCommandAction.runWriteCommandAction(null, new Runnable() {
    @Override
    public void run() {
      fix.applyFix(myFixture.getProject(), descriptor);
      PostprocessReformattingAspect.getInstance(getProject()).doPostponedFormatting();
    }
  });


  myFixture.checkResultByFile(getTestName(false) + "_after.groovy");
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:24,代码来源:GroovyRangeTypeCheckTest.java


示例15: doTestImpl

import com.intellij.psi.impl.source.PostprocessReformattingAspect; //导入依赖的package包/类
private void doTestImpl(String filePath) {
    myFixture.configureByFile(filePath);
    int offset = myFixture.getEditor().getCaretModel().getOffset();
    final PsiFile file = myFixture.getFile();


    final ConvertParameterToMapEntryIntention intention = new ConvertParameterToMapEntryIntention();
    PsiElement element = file.findElementAt(offset);
    while (element != null && !(element instanceof GrReferenceExpression || element instanceof GrParameter)) {
      element = element.getParent();
    }
    Assert.assertNotNull(element);

    final PsiElementPredicate condition = intention.getElementPredicate();
    Assert.assertTrue(condition.satisfiedBy(element));

    // Launch it!
    intention.processIntention(element, myFixture.getProject(), myFixture.getEditor());
    PostprocessReformattingAspect.getInstance(getProject()).doPostponedFormatting();
    final String result = file.getText();
    //System.out.println(result);
    myFixture.checkResultByFile(filePath.replace(".groovy", ".test"), true);
//    String expected = getExpectedResult(filePath);
//    Assert.assertEquals(expected, result);
  }
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:26,代码来源:ParameterToMapEntryTest.java


示例16: doTest

import com.intellij.psi.impl.source.PostprocessReformattingAspect; //导入依赖的package包/类
private void doTest(String[] fileNames, String newDirName) {
  String testName = getTestName(true);
  final VirtualFile actualRoot = myFixture.copyDirectoryToProject(testName + "/before", "");

  performAction(fileNames, newDirName, VfsUtilCore.getRelativePath(actualRoot, myFixture.getTempDirFixture().getFile(""), '/'));

  final VirtualFile expectedRoot = LocalFileSystem.getInstance().findFileByPath(getTestDataPath() + getTestName(true) + "/after");
  //File expectedRoot = new File(getTestDataPath() + testName + "/after");
  getProject().getComponent(PostprocessReformattingAspect.class).doPostponedFormatting();

  VirtualFileManager.getInstance().syncRefresh();
  try {
    PlatformTestUtil.assertDirectoriesEqual(expectedRoot, actualRoot);
  }
  catch (IOException e) {
    throw new RuntimeException(e);
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:19,代码来源:GroovyMoveScriptTest.java


示例17: insertImportWhenNeeded

import com.intellij.psi.impl.source.PostprocessReformattingAspect; //导入依赖的package包/类
public static void insertImportWhenNeeded(XmlFile xmlFile,
                                          String shortName,
                                          String qualifiedName) {
  if (shortName != null && findPsiClass(shortName, xmlFile.getRootTag()) == null) {
    final XmlDocument document = xmlFile.getDocument();
    if (document != null) {
      final XmlProcessingInstruction processingInstruction = createSingleImportInstruction(qualifiedName, xmlFile.getProject());
      final XmlProlog prolog = document.getProlog();
      if (prolog != null) {
        prolog.add(processingInstruction);
      } else {
        document.addBefore(processingInstruction, document.getRootTag());
      }
      PostprocessReformattingAspect.getInstance(xmlFile.getProject()).doPostponedFormatting(xmlFile.getViewProvider());
    }
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:18,代码来源:JavaFxPsiUtil.java


示例18: doTest

import com.intellij.psi.impl.source.PostprocessReformattingAspect; //导入依赖的package包/类
protected void doTest(final PerformAction performAction, final String testName) throws Exception {
  String path = getTestDataPath() + getTestRoot() + testName;

  String pathBefore = path + "/before";
  final VirtualFile rootDir = PsiTestUtil.createTestProjectStructure(myProject, myModule, pathBefore, myFilesToDelete, false);
  prepareProject(rootDir);
  PsiDocumentManager.getInstance(myProject).commitAllDocuments();

  String pathAfter = path + "/after";
  final VirtualFile rootAfter = LocalFileSystem.getInstance().findFileByPath(pathAfter.replace(File.separatorChar, '/'));

  performAction.performAction(rootDir, rootAfter);
  ApplicationManager.getApplication().runWriteAction(new Runnable() {
    public void run() {
      myProject.getComponent(PostprocessReformattingAspect.class).doPostponedFormatting();
    }
  });

  FileDocumentManager.getInstance().saveAllDocuments();

  if (myDoCompare) {
    PlatformTestUtil.assertDirectoriesEqual(rootAfter, rootDir);
  }
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:25,代码来源:MultiFileTestCase.java


示例19: run

import com.intellij.psi.impl.source.PostprocessReformattingAspect; //导入依赖的package包/类
public static void run(@NotNull final Project project, final Editor editor, final ExtractMethodProcessor processor) {
  CommandProcessor.getInstance().executeCommand(project, new Runnable() {
    public void run() {
      PostprocessReformattingAspect.getInstance(project).postponeFormattingInside(new Runnable() {
        public void run() {
          try {
            processor.doRefactoring();
          }
          catch (IncorrectOperationException e) {
            LOG.error(e);
          }
        }
      });
    }
  }, REFACTORING_NAME, null);
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:17,代码来源:ExtractMethodHandler.java


示例20: doTest

import com.intellij.psi.impl.source.PostprocessReformattingAspect; //导入依赖的package包/类
private void doTest() {
  myFixture.configureByFile(getTestName(false) + ".java");
  CommandProcessor.getInstance().executeCommand(getProject(), new Runnable() {
    @Override
    public void run() {
      ApplicationManager.getApplication().runWriteAction(new Runnable() {
        @Override
        public void run() {
          JavaCodeStyleManager.getInstance(getProject()).shortenClassReferences(myFixture.getFile());
          PostprocessReformattingAspect.getInstance(getProject()).doPostponedFormatting();
          PsiDocumentManager.getInstance(getProject()).commitAllDocuments();
        }
      });
    }
  }, "", "");
  myFixture.checkResultByFile(getTestName(false) + "_after.java");
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:18,代码来源:ShortenClassReferencesTest.java



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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