use of com.intellij.openapi.actionSystem.DataContext in project intellij-community by JetBrains.
the class AssignShortcutAction method actionPerformed.
public void actionPerformed(@NotNull AnActionEvent e) {
final DataContext context = e.getDataContext();
String actionId = getGoalActionId(context);
if (actionId != null) {
new EditKeymapsDialog(MavenActionUtil.getProject(context), actionId).show();
}
}
use of com.intellij.openapi.actionSystem.DataContext in project intellij-community by JetBrains.
the class MavenProjectsAction method actionPerformed.
@Override
public void actionPerformed(@NotNull AnActionEvent e) {
final DataContext context = e.getDataContext();
final MavenProjectsManager projectsManager = MavenActionUtil.getProjectsManager(context);
if (projectsManager == null)
return;
perform(projectsManager, MavenActionUtil.getMavenProjects(context), e);
}
use of com.intellij.openapi.actionSystem.DataContext in project intellij-community by JetBrains.
the class RemoveManagedFilesAction method actionPerformed.
@Override
public void actionPerformed(@NotNull AnActionEvent e) {
final DataContext context = e.getDataContext();
MavenProjectsManager projectsManager = MavenActionUtil.getProjectsManager(context);
if (projectsManager == null)
return;
List<VirtualFile> selectedFiles = MavenActionUtil.getMavenProjectsFiles(context);
List<VirtualFile> removableFiles = new ArrayList<>();
for (VirtualFile pomXml : selectedFiles) {
if (projectsManager.isManagedFile(pomXml)) {
removableFiles.add(pomXml);
} else {
notifyUserIfNeeded(context, projectsManager, selectedFiles, pomXml);
}
}
projectsManager.removeManagedFiles(removableFiles);
}
use of com.intellij.openapi.actionSystem.DataContext in project intellij-community by JetBrains.
the class ToggleIgnoredProjectsAction method isAvailable.
@Override
protected boolean isAvailable(AnActionEvent e) {
if (!super.isAvailable(e))
return false;
final DataContext context = e.getDataContext();
MavenProjectsManager projectsManager = MavenActionUtil.getProjectsManager(context);
if (projectsManager == null)
return false;
List<MavenProject> projects = MavenActionUtil.getMavenProjects(context);
if (projects == null || projects.isEmpty())
return false;
int ignoredStatesCount = 0;
int ignoredCount = 0;
for (MavenProject each : projects) {
if (projectsManager.getIgnoredState(each)) {
ignoredStatesCount++;
}
if (projectsManager.isIgnored(each)) {
ignoredCount++;
}
}
return (ignoredCount == 0 || ignoredCount == projects.size()) && (ignoredStatesCount == 0 || ignoredStatesCount == projects.size());
}
use of com.intellij.openapi.actionSystem.DataContext in project intellij-community by JetBrains.
the class CreateListenerAction method actionPerformed.
protected void actionPerformed(final GuiEditor editor, final List<RadComponent> selection, final AnActionEvent e) {
final DefaultActionGroup actionGroup = prepareActionGroup(selection);
final JComponent selectedComponent = selection.get(0).getDelegee();
final DataContext context = DataManager.getInstance().getDataContext(selectedComponent);
final JBPopupFactory factory = JBPopupFactory.getInstance();
final ListPopup popup = factory.createActionGroupPopup(UIDesignerBundle.message("create.listener.title"), actionGroup, context, JBPopupFactory.ActionSelectionAid.NUMBERING, true);
FormEditingUtil.showPopupUnderComponent(popup, selection.get(0));
}
Aggregations