use of com.intellij.openapi.project.Project in project intellij-community by JetBrains.
the class CCCreateCourseArchive method update.
@Override
public void update(@NotNull AnActionEvent e) {
Presentation presentation = e.getPresentation();
Project project = e.getProject();
presentation.setEnabledAndVisible(project != null && CCUtils.isCourseCreator(project));
}
use of com.intellij.openapi.project.Project in project intellij-community by JetBrains.
the class CCCreateStudyItemActionBase method update.
@Override
public void update(@NotNull AnActionEvent event) {
final Presentation presentation = event.getPresentation();
presentation.setEnabledAndVisible(false);
final Project project = event.getData(CommonDataKeys.PROJECT);
final IdeView view = event.getData(LangDataKeys.IDE_VIEW);
if (project == null || view == null) {
return;
}
if (!StudyUtils.isStudyProject(project) || !CCUtils.isCourseCreator(project)) {
return;
}
final PsiDirectory[] directories = view.getDirectories();
if (directories.length == 0) {
return;
}
final PsiDirectory sourceDirectory = DirectoryChooserUtil.getOrChooseDirectory(view);
final Course course = StudyTaskManager.getInstance(project).getCourse();
if (course == null || sourceDirectory == null) {
return;
}
if (!isAddedAsLast(sourceDirectory, project, course) && getThresholdItem(course, sourceDirectory) == null) {
return;
}
if (CommonDataKeys.PSI_FILE.getData(event.getDataContext()) != null) {
return;
}
presentation.setEnabledAndVisible(true);
}
use of com.intellij.openapi.project.Project in project intellij-community by JetBrains.
the class CCCreateStudyItemActionBase method actionPerformed.
@Override
public void actionPerformed(AnActionEvent e) {
final IdeView view = e.getData(LangDataKeys.IDE_VIEW);
final Project project = e.getProject();
if (view == null || project == null) {
return;
}
final PsiDirectory directory = DirectoryChooserUtil.getOrChooseDirectory(view);
if (directory == null)
return;
final Course course = StudyTaskManager.getInstance(project).getCourse();
if (course == null) {
return;
}
createItem(view, project, directory, course);
}
use of com.intellij.openapi.project.Project in project intellij-community by JetBrains.
the class PyOpenDebugConsoleAction method update.
@Override
public void update(final AnActionEvent e) {
e.getPresentation().setVisible(false);
e.getPresentation().setEnabled(true);
final Project project = e.getData(CommonDataKeys.PROJECT);
if (project != null) {
e.getPresentation().setVisible(getConsoles(project).size() > 0);
}
}
use of com.intellij.openapi.project.Project 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);
}
}
}
Aggregations