Search in sources :

Example 1 with TestClassFilter

use of com.theoryinpractice.testng.model.TestClassFilter in project intellij-community by JetBrains.

the class GroupBrowser method showDialog.

@Nullable
@Override
protected String showDialog() {
    TestClassFilter filter;
    Module module = editor.getModuleSelector().getModule();
    if (module == null) {
        filter = new TestClassFilter(GlobalSearchScope.projectScope(getProject()), getProject(), false);
    } else {
        filter = new TestClassFilter(GlobalSearchScope.moduleScope(module), getProject(), false);
    }
    PsiClass[] classes = TestNGUtil.getAllTestClasses(filter, true);
    if (classes == null || classes.length == 0) {
        Messages.showMessageDialog(getField(), "No tests found in project", "Cannot Browse Groups", Messages.getInformationIcon());
        return null;
    } else {
        return GroupList.showDialog(classes, getField());
    }
}
Also used : PsiClass(com.intellij.psi.PsiClass) Module(com.intellij.openapi.module.Module) TestClassFilter(com.theoryinpractice.testng.model.TestClassFilter) Nullable(org.jetbrains.annotations.Nullable)

Example 2 with TestClassFilter

use of com.theoryinpractice.testng.model.TestClassFilter in project intellij-community by JetBrains.

the class TestClassBrowser method getFilter.

public ClassFilter.ClassFilterWithScope getFilter() throws MessageInfoException {
    TestNGConfiguration config = new TestNGConfiguration("<no-name>", getProject(), TestNGConfigurationType.getInstance().getConfigurationFactories()[0]);
    editor.applyEditorTo(config);
    GlobalSearchScope scope = getSearchScope(config.getModules());
    if (scope == null) {
        scope = GlobalSearchScope.allScope(getProject());
    }
    return new TestClassFilter(scope, getProject(), false);
}
Also used : GlobalSearchScope(com.intellij.psi.search.GlobalSearchScope) TestNGConfiguration(com.theoryinpractice.testng.configuration.TestNGConfiguration) TestClassFilter(com.theoryinpractice.testng.model.TestClassFilter)

Aggregations

TestClassFilter (com.theoryinpractice.testng.model.TestClassFilter)2 Module (com.intellij.openapi.module.Module)1 PsiClass (com.intellij.psi.PsiClass)1 GlobalSearchScope (com.intellij.psi.search.GlobalSearchScope)1 TestNGConfiguration (com.theoryinpractice.testng.configuration.TestNGConfiguration)1 Nullable (org.jetbrains.annotations.Nullable)1