use of com.intellij.ide.IdeView in project intellij-community by JetBrains.
the class CreateFromTemplateGroup method canCreateFromTemplate.
static boolean canCreateFromTemplate(AnActionEvent e, FileTemplate template) {
if (e == null)
return false;
DataContext dataContext = e.getDataContext();
IdeView view = LangDataKeys.IDE_VIEW.getData(dataContext);
if (view == null)
return false;
PsiDirectory[] dirs = view.getDirectories();
if (dirs.length == 0)
return false;
return FileTemplateUtil.canCreateFromTemplate(dirs, template);
}
use of com.intellij.ide.IdeView in project intellij-community by JetBrains.
the class CCLessonMoveHandlerDelegate method canMove.
@Override
public boolean canMove(DataContext dataContext) {
if (CommonDataKeys.PSI_FILE.getData(dataContext) != null) {
return false;
}
IdeView view = LangDataKeys.IDE_VIEW.getData(dataContext);
if (view == null) {
return false;
}
PsiDirectory sourceDirectory = DirectoryChooserUtil.getOrChooseDirectory(view);
return CCUtils.isLessonDir(sourceDirectory);
}
use of com.intellij.ide.IdeView in project intellij-community by JetBrains.
the class NewGroovyClassAction method update.
@Override
public void update(AnActionEvent e) {
super.update(e);
Presentation presentation = e.getPresentation();
if (!presentation.isVisible())
return;
IdeView view = LangDataKeys.IDE_VIEW.getData(e.getDataContext());
if (view == null)
return;
Project project = e.getProject();
if (project == null)
return;
ProjectFileIndex projectFileIndex = ProjectRootManager.getInstance(project).getFileIndex();
for (PsiDirectory dir : view.getDirectories()) {
if (projectFileIndex.isInSourceContent(dir.getVirtualFile()) && checkPackageExists(dir)) {
for (GroovySourceFolderDetector detector : GroovySourceFolderDetector.EP_NAME.getExtensions()) {
if (detector.isGroovySourceFolder(dir)) {
presentation.setWeight(Presentation.HIGHER_WEIGHT);
break;
}
}
return;
}
}
}
use of com.intellij.ide.IdeView in project intellij-community by JetBrains.
the class CreateSnapShotAction method update.
@Override
public void update(AnActionEvent e) {
final Project project = e.getData(CommonDataKeys.PROJECT);
final IdeView view = e.getData(LangDataKeys.IDE_VIEW);
e.getPresentation().setVisible(project != null && view != null && hasDirectoryInPackage(project, view));
}
use of com.intellij.ide.IdeView in project intellij-community by JetBrains.
the class CCGetCourseFromStepic method actionPerformed.
@Override
public void actionPerformed(@NotNull AnActionEvent e) {
final IdeView view = e.getData(LangDataKeys.IDE_VIEW);
final Project project = e.getData(CommonDataKeys.PROJECT);
if (view == null || project == null) {
return;
}
final String courseId = Messages.showInputDialog("Please, enter course id", "Get Course From Stepik", null);
if (StringUtil.isNotEmpty(courseId)) {
ProgressManager.getInstance().run(new com.intellij.openapi.progress.Task.Modal(project, "Creating Course", true) {
@Override
public void run(@NotNull final ProgressIndicator indicator) {
createCourse(project, courseId);
}
});
}
}
Aggregations