use of com.intellij.openapi.module.Module in project intellij-community by JetBrains.
the class GroovyHotSwapper method patchJavaParameters.
@Override
public void patchJavaParameters(Executor executor, RunProfile configuration, JavaParameters javaParameters) {
ApplicationManager.getApplication().assertReadAccessAllowed();
if (!executor.getId().equals(DefaultDebugExecutor.EXECUTOR_ID)) {
return;
}
if (!GroovyDebuggerSettings.getInstance().ENABLE_GROOVY_HOTSWAP) {
return;
}
if (hasSpringLoadedReloader(javaParameters)) {
return;
}
if (!(configuration instanceof RunConfiguration)) {
return;
}
final Project project = ((RunConfiguration) configuration).getProject();
if (project == null) {
return;
}
if (!LanguageLevelProjectExtension.getInstance(project).getLanguageLevel().isAtLeast(LanguageLevel.JDK_1_5)) {
return;
}
if (configuration instanceof ModuleBasedConfiguration) {
final Module module = ((ModuleBasedConfiguration) configuration).getConfigurationModule().getModule();
if (module != null) {
final LanguageLevel level = LanguageLevelModuleExtensionImpl.getInstance(module).getLanguageLevel();
if (level != null && !level.isAtLeast(LanguageLevel.JDK_1_5)) {
return;
}
}
}
Sdk jdk = javaParameters.getJdk();
if (jdk != null) {
String vendor = JdkUtil.getJdkMainAttribute(jdk, Attributes.Name.IMPLEMENTATION_VENDOR);
if (vendor != null && vendor.contains("IBM")) {
LOG.info("Due to IBM JDK peculiarities (IDEA-59070) we don't add Groovy agent when running applications under it");
return;
}
}
if (!project.isDefault() && containsGroovyClasses(project)) {
final String agentPath = handleSpacesInPath(getAgentJarPath());
if (agentPath != null) {
javaParameters.getVMParametersList().add("-javaagent:" + agentPath);
}
}
}
use of com.intellij.openapi.module.Module in project intellij-community by JetBrains.
the class GroovyAntCustomCompilerProvider method hasCustomCompile.
/**
* {@inheritDoc}
*/
@Override
public boolean hasCustomCompile(ModuleChunk chunk) {
for (Module m : chunk.getModules()) {
if (LibrariesUtil.hasGroovySdk(m)) {
final Set<String> scriptExtensions = GroovyFileTypeLoader.getCustomGroovyScriptExtensions();
final ContentIterator groovyFileSearcher = new ContentIterator() {
@Override
public boolean processFile(VirtualFile fileOrDir) {
ProgressManager.checkCanceled();
if (isCompilableGroovyFile(fileOrDir, scriptExtensions)) {
return false;
}
return true;
}
};
final ModuleRootManager rootManager = ModuleRootManager.getInstance(m);
final ModuleFileIndex fileIndex = rootManager.getFileIndex();
for (VirtualFile file : rootManager.getSourceRoots(JavaModuleSourceRootTypes.SOURCES)) {
if (!fileIndex.iterateContentUnderDirectory(file, groovyFileSearcher)) {
return true;
}
}
}
}
return false;
}
use of com.intellij.openapi.module.Module in project intellij-community by JetBrains.
the class GroovyConsoleStateService method loadState.
@Override
public void loadState(MyState state) {
synchronized (myFileModuleMap) {
myFileModuleMap.clear();
for (Entry entry : state.list) {
final VirtualFile file = myFileManager.findFileByUrl(entry.url);
final Module module = myModuleManager.findModuleByName(entry.moduleName);
if (file != null) {
myFileModuleMap.put(file, Pair.create(module, entry.title));
}
}
}
}
use of com.intellij.openapi.module.Module in project intellij-community by JetBrains.
the class GrNewConsoleAction method getModule.
@Nullable
protected Module getModule(AnActionEvent e) {
final Project project = e.getProject();
if (project == null)
return null;
final VirtualFile file = CommonDataKeys.VIRTUAL_FILE.getData(e.getDataContext());
if (file != null) {
final Module moduleForFile = ModuleUtilCore.findModuleForFile(file, project);
if (moduleForFile != null)
return moduleForFile;
}
final List<Module> modules = ModuleChooserUtil.filterGroovyCompatibleModules(Arrays.asList(ModuleManager.getInstance(project).getModules()), APPLICABLE_MODULE);
return modules.isEmpty() ? null : modules.get(0);
}
use of com.intellij.openapi.module.Module in project intellij-community by JetBrains.
the class GrNewConsoleAction method actionPerformed.
@Override
public void actionPerformed(AnActionEvent e) {
final Project project = e.getProject();
final Module module = getModule(e);
if (project == null || module == null)
return;
final VirtualFile contentFile = ConsoleHistoryController.getContentFile(GroovyConsoleRootType.getInstance(), GroovyConsoleRootType.CONTENT_ID, ScratchFileService.Option.create_new_always);
assert contentFile != null;
GroovyConsole.createConsole(project, contentFile, module);
FileEditorManager.getInstance(project).openFile(contentFile, true);
}
Aggregations