use of com.intellij.psi.PsiClass in project intellij-community by JetBrains.
the class TestClassBrowser method init.
private void init(TreeClassChooser chooser) {
String s = getText();
PsiClass psiclass = findClass(s);
if (psiclass == null)
return;
com.intellij.psi.PsiDirectory psidirectory = psiclass.getContainingFile().getContainingDirectory();
if (psidirectory != null)
chooser.selectDirectory(psidirectory);
chooser.select(psiclass);
}
use of com.intellij.psi.PsiClass in project intellij-community by JetBrains.
the class TestNGTestGroup method fillTestObjects.
@Override
public void fillTestObjects(Map<PsiClass, Map<PsiMethod, List<String>>> classes) throws CantRunException {
final TestData data = myConfig.getPersistantData();
//for a group, we include all classes
final SourceScope sourceScope = data.getScope().getSourceScope(myConfig);
final TestClassFilter classFilter = new TestClassFilter(sourceScope != null ? sourceScope.getGlobalSearchScope() : GlobalSearchScope.allScope(myConfig.getProject()), myConfig.getProject(), true, true);
PsiClass[] testClasses = TestNGUtil.getAllTestClasses(classFilter, false);
if (testClasses != null) {
for (PsiClass c : testClasses) {
classes.put(c, new LinkedHashMap<>());
}
}
}
use of com.intellij.psi.PsiClass in project intellij-community by JetBrains.
the class DetectClassesToRunTest method doTestMethodConfiguration.
private void doTestMethodConfiguration(PsiClass aClass, PsiClass secondaryClass, PsiMethod configMethod, PsiMethod... expectedMethods) throws CantRunException {
final TestNGConfiguration configuration = new TestNGConfiguration("testOne", getProject(), TestNGConfigurationType.getInstance().getConfigurationFactories()[0]);
final TestData data = configuration.getPersistantData();
data.TEST_OBJECT = TestType.METHOD.getType();
data.METHOD_NAME = "testOne";
data.setScope(TestSearchScope.SINGLE_MODULE);
configuration.setModule(data.setMainClass(aClass));
final TestNGTestObject testObject = TestNGTestObject.fromConfig(configuration);
assertNotNull(testObject);
final LinkedHashMap<PsiClass, Map<PsiMethod, List<String>>> classes = new LinkedHashMap<>();
testObject.fillTestObjects(classes);
assertContainsElements(classes.keySet(), aClass);
final Map<PsiMethod, List<String>> methods = classes.get(aClass);
assertContainsElements(methods.keySet(), expectedMethods);
if (secondaryClass != null) {
final Map<PsiMethod, List<String>> configMethods = classes.get(secondaryClass);
assertTrue(configMethods != null);
assertTrue(configMethods.containsKey(configMethod));
}
}
use of com.intellij.psi.PsiClass in project intellij-community by JetBrains.
the class DetectClassesToRunTest method testOneMethodWithDependencies.
@Test
public void testOneMethodWithDependencies() throws Exception {
final PsiClass aClass = myFixture.addClass("package a; public class ATest {" + " @org.testng.annotations.Test\n" + " public void testTwo(){}\n " + " @org.testng.annotations.Test(dependsOnMethods=\"testTwo\")\n" + " public void testOne(){}\n" + "}");
doTestMethodConfiguration(aClass, aClass.getMethods());
}
use of com.intellij.psi.PsiClass in project intellij-community by JetBrains.
the class GroovyStubNotificationProvider method decorateStubFile.
private static EditorNotificationPanel decorateStubFile(final VirtualFile file, final Project project) {
final EditorNotificationPanel panel = new EditorNotificationPanel();
panel.setText("This stub is generated for Groovy class to make Groovy-Java cross-compilation possible");
panel.createActionLabel("Go to the Groovy class", () -> DumbService.getInstance(project).withAlternativeResolveEnabled(() -> {
final PsiClass original = findClassByStub(project, file);
if (original != null) {
original.navigate(true);
}
}));
panel.createActionLabel("Exclude from stub generation", () -> DumbService.getInstance(project).withAlternativeResolveEnabled(() -> {
final PsiClass psiClass = findClassByStub(project, file);
if (psiClass != null) {
ExcludeFromStubGenerationAction.doExcludeFromStubGeneration(psiClass.getContainingFile());
}
}));
return panel;
}
Aggregations