use of org.jetbrains.annotations.Nullable 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 org.jetbrains.annotations.Nullable in project intellij-community by JetBrains.
the class CreateParameterForFieldIntention method findFieldCandidates.
@Nullable
private static List<GrField> findFieldCandidates(PsiElement element) {
final GrMethod constructor = PsiTreeUtil.getParentOfType(element, GrMethod.class);
if (constructor == null || !constructor.isConstructor())
return null;
if (constructor.getBlock() == null)
return null;
if (PsiTreeUtil.isAncestor(constructor.getBlock(), element, false)) {
return null;
}
final PsiClass clazz = constructor.getContainingClass();
if (!(clazz instanceof GrTypeDefinition))
return null;
return findCandidatesCached(constructor, (GrTypeDefinition) clazz);
}
use of org.jetbrains.annotations.Nullable in project intellij-community by JetBrains.
the class HgUtil method getRepositoryForFile.
@Nullable
public static HgRepository getRepositoryForFile(@NotNull Project project, @Nullable VirtualFile file) {
if (file == null || project.isDisposed())
return null;
HgRepositoryManager repositoryManager = getRepositoryManager(project);
VirtualFile root = getHgRootOrNull(project, file);
return repositoryManager.getRepositoryForRoot(root);
}
use of org.jetbrains.annotations.Nullable in project intellij-community by JetBrains.
the class MavenAnnotationProcessorConfigurer method getRelativeAnnotationProcessorDirectory.
@Nullable
private static String getRelativeAnnotationProcessorDirectory(MavenProject mavenProject, boolean isTest) {
String annotationProcessorDirectory = mavenProject.getAnnotationProcessorDirectory(isTest);
File annotationProcessorDirectoryFile = new File(annotationProcessorDirectory);
if (!annotationProcessorDirectoryFile.isAbsolute()) {
return annotationProcessorDirectory;
}
String absoluteProjectDirectory = mavenProject.getDirectory();
return FileUtil.getRelativePath(new File(absoluteProjectDirectory), annotationProcessorDirectoryFile);
}
use of org.jetbrains.annotations.Nullable in project intellij-community by JetBrains.
the class MavenProjectModelModifier method addModuleDependency.
@Nullable
@Override
public Promise<Void> addModuleDependency(@NotNull Module from, @NotNull Module to, @NotNull final DependencyScope scope) {
final MavenProject toProject = myProjectsManager.findProject(to);
if (toProject == null)
return null;
MavenId mavenId = toProject.getMavenId();
return addDependency(Collections.singletonList(from), mavenId, scope);
}
Aggregations