Search in sources :

Example 16 with Module

use of com.intellij.openapi.module.Module in project intellij-community by JetBrains.

the class TestNGConfigurationType method isConfigurationByLocation.

public boolean isConfigurationByLocation(RunConfiguration runConfiguration, Location location) {
    TestNGConfiguration config = (TestNGConfiguration) runConfiguration;
    TestData testobject = config.getPersistantData();
    if (testobject == null)
        return false;
    else {
        final PsiElement element = location.getPsiElement();
        final TestNGTestObject testNGTestObject = TestNGTestObject.fromConfig(config);
        if (testNGTestObject != null && testNGTestObject.isConfiguredByElement(element)) {
            final Module configurationModule = config.getConfigurationModule().getModule();
            if (Comparing.equal(location.getModule(), configurationModule))
                return true;
            final Module predefinedModule = ((TestNGConfiguration) RunManagerEx.getInstanceEx(location.getProject()).getConfigurationTemplate(myFactory).getConfiguration()).getConfigurationModule().getModule();
            return Comparing.equal(predefinedModule, configurationModule);
        } else {
            return false;
        }
    }
}
Also used : TestData(com.theoryinpractice.testng.model.TestData) TestNGTestObject(com.theoryinpractice.testng.model.TestNGTestObject) Module(com.intellij.openapi.module.Module) PsiElement(com.intellij.psi.PsiElement)

Example 17 with Module

use of com.intellij.openapi.module.Module 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 18 with Module

use of com.intellij.openapi.module.Module in project intellij-community by JetBrains.

the class TestNGTestObject method getSearchScope.

@NotNull
protected GlobalSearchScope getSearchScope() {
    final TestData data = myConfig.getPersistantData();
    final Module module = myConfig.getConfigurationModule().getModule();
    if (data.TEST_OBJECT.equals(TestType.PACKAGE.getType())) {
        SourceScope scope = myConfig.getPersistantData().getScope().getSourceScope(myConfig);
        if (scope != null) {
            return scope.getGlobalSearchScope();
        }
    } else if (module != null) {
        return GlobalSearchScope.moduleWithDependenciesScope(module);
    }
    return GlobalSearchScope.projectScope(myConfig.getProject());
}
Also used : SourceScope(com.intellij.execution.testframework.SourceScope) Module(com.intellij.openapi.module.Module) NotNull(org.jetbrains.annotations.NotNull)

Example 19 with Module

use of com.intellij.openapi.module.Module in project intellij-community by JetBrains.

the class CCCreateCourseArchive method actionPerformed.

@Override
public void actionPerformed(@NotNull AnActionEvent e) {
    final Project project = e.getData(CommonDataKeys.PROJECT);
    final Module module = e.getData(LangDataKeys.MODULE);
    if (project == null || module == null) {
        return;
    }
    CreateCourseArchiveDialog dlg = new CreateCourseArchiveDialog(project, this);
    dlg.show();
    if (dlg.getExitCode() != DialogWrapper.OK_EXIT_CODE) {
        return;
    }
    createCourseArchive(project, module, myZipName, myLocationDir, true);
    EduUsagesCollector.createdCourseArchive();
}
Also used : Project(com.intellij.openapi.project.Project) CreateCourseArchiveDialog(com.jetbrains.edu.coursecreator.ui.CreateCourseArchiveDialog) Module(com.intellij.openapi.module.Module)

Example 20 with Module

use of com.intellij.openapi.module.Module in project intellij-community by JetBrains.

the class RunPythonConsoleAction method update.

@Override
public void update(final AnActionEvent e) {
    e.getPresentation().setVisible(true);
    e.getPresentation().setEnabled(false);
    final Project project = e.getData(CommonDataKeys.PROJECT);
    if (project != null) {
        Pair<Sdk, Module> sdkAndModule = PydevConsoleRunner.findPythonSdkAndModule(project, e.getData(LangDataKeys.MODULE));
        if (sdkAndModule.first != null) {
            e.getPresentation().setEnabled(true);
        }
    }
}
Also used : Project(com.intellij.openapi.project.Project) Sdk(com.intellij.openapi.projectRoots.Sdk) Module(com.intellij.openapi.module.Module)

Aggregations

Module (com.intellij.openapi.module.Module)1911 VirtualFile (com.intellij.openapi.vfs.VirtualFile)585 Project (com.intellij.openapi.project.Project)381 NotNull (org.jetbrains.annotations.NotNull)331 Nullable (org.jetbrains.annotations.Nullable)268 File (java.io.File)185 PsiFile (com.intellij.psi.PsiFile)147 AndroidFacet (org.jetbrains.android.facet.AndroidFacet)134 ArrayList (java.util.ArrayList)118 GlobalSearchScope (com.intellij.psi.search.GlobalSearchScope)112 Sdk (com.intellij.openapi.projectRoots.Sdk)95 PsiElement (com.intellij.psi.PsiElement)89 PsiDirectory (com.intellij.psi.PsiDirectory)77 ModuleManager (com.intellij.openapi.module.ModuleManager)65 PsiClass (com.intellij.psi.PsiClass)65 IOException (java.io.IOException)61 ModifiableRootModel (com.intellij.openapi.roots.ModifiableRootModel)57 ProjectFileIndex (com.intellij.openapi.roots.ProjectFileIndex)57 List (java.util.List)57 AndroidModuleModel (com.android.tools.idea.gradle.project.model.AndroidModuleModel)51