com.intellij.psi.impl.source.PsiJavaFileImpl Java Examples
The following examples show how to use
com.intellij.psi.impl.source.PsiJavaFileImpl.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: PsiClassUtil.java From GsonFormat with Apache License 2.0 | 6 votes |
public static PsiDirectory getJavaSrc(PsiFile psiFile) { PsiDirectory psiDirectory = null; if (psiFile instanceof PsiJavaFileImpl) { String packageName = ((PsiJavaFileImpl) psiFile).getPackageName(); String[] arg = packageName.split("\\."); psiDirectory = psiFile.getContainingDirectory(); for (int i = 0; i < arg.length; i++) { psiDirectory = psiDirectory.getParent(); if (psiDirectory == null) { break; } } } return psiDirectory; }
Example #2
Source File: PerformanceTest.java From lombok-intellij-plugin with BSD 3-Clause "New" or "Revised" License | 5 votes |
public void testFieldDefaults() { final String testName = getTestName(true); loadToPsiFile("/performance/" + testName + "/lombok.config"); final PsiFile psiFile = loadToPsiFile("/performance/" + testName + "/HugeClass.java"); PlatformTestUtil.startPerformanceTest(getTestName(false), 500, () -> { type(' '); PsiDocumentManager.getInstance(getProject()).commitDocument(getEditor().getDocument()); ((PsiJavaFileImpl) psiFile).getClasses()[0].getFields()[0].hasModifierProperty(PsiModifier.FINAL); backspace(); PsiDocumentManager.getInstance(getProject()).commitDocument(getEditor().getDocument()); ((PsiJavaFileImpl) psiFile).getClasses()[0].getFields()[0].hasModifierProperty(PsiModifier.FINAL); }).assertTiming(); }