Search in sources :

Example 16 with DataContext

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();
    }
}
Also used : EditKeymapsDialog(com.intellij.openapi.keymap.impl.ui.EditKeymapsDialog) DataContext(com.intellij.openapi.actionSystem.DataContext)

Example 17 with DataContext

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);
}
Also used : DataContext(com.intellij.openapi.actionSystem.DataContext) MavenProjectsManager(org.jetbrains.idea.maven.project.MavenProjectsManager)

Example 18 with DataContext

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);
}
Also used : VirtualFile(com.intellij.openapi.vfs.VirtualFile) DataContext(com.intellij.openapi.actionSystem.DataContext) MavenProjectsManager(org.jetbrains.idea.maven.project.MavenProjectsManager) ArrayList(java.util.ArrayList)

Example 19 with DataContext

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());
}
Also used : DataContext(com.intellij.openapi.actionSystem.DataContext) MavenProjectsManager(org.jetbrains.idea.maven.project.MavenProjectsManager) MavenProject(org.jetbrains.idea.maven.project.MavenProject)

Example 20 with DataContext

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));
}
Also used : DataContext(com.intellij.openapi.actionSystem.DataContext) JBPopupFactory(com.intellij.openapi.ui.popup.JBPopupFactory) ListPopup(com.intellij.openapi.ui.popup.ListPopup) DefaultActionGroup(com.intellij.openapi.actionSystem.DefaultActionGroup)

Aggregations

DataContext (com.intellij.openapi.actionSystem.DataContext)202 Project (com.intellij.openapi.project.Project)71 VirtualFile (com.intellij.openapi.vfs.VirtualFile)28 NotNull (org.jetbrains.annotations.NotNull)23 IpnbFileEditor (org.jetbrains.plugins.ipnb.editor.IpnbFileEditor)23 Editor (com.intellij.openapi.editor.Editor)21 Nullable (org.jetbrains.annotations.Nullable)21 FileEditor (com.intellij.openapi.fileEditor.FileEditor)20 PsiFile (com.intellij.psi.PsiFile)16 IpnbFilePanel (org.jetbrains.plugins.ipnb.editor.panels.IpnbFilePanel)16 Module (com.intellij.openapi.module.Module)13 PsiElement (com.intellij.psi.PsiElement)13 SimpleDataContext (com.intellij.openapi.actionSystem.impl.SimpleDataContext)11 DataManager (com.intellij.ide.DataManager)9 Presentation (com.intellij.openapi.actionSystem.Presentation)9 List (java.util.List)9 AnActionEvent (com.intellij.openapi.actionSystem.AnActionEvent)8 Consumer (com.intellij.util.Consumer)7 AnAction (com.intellij.openapi.actionSystem.AnAction)6 Transferable (java.awt.datatransfer.Transferable)6