mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
simplify getting project from AnActionEvent
This commit is contained in:
@@ -53,7 +53,7 @@ public class ActionUtil {
|
||||
actionNames.add(s);
|
||||
}
|
||||
|
||||
final Project _project = CommonDataKeys.PROJECT.getData(event.getDataContext());
|
||||
final Project _project = event.getProject();
|
||||
if (_project != null && project == null) {
|
||||
project = _project;
|
||||
}
|
||||
@@ -102,7 +102,7 @@ public class ActionUtil {
|
||||
public static boolean performDumbAwareUpdate(@NotNull AnAction action, @NotNull AnActionEvent e, boolean beforeActionPerformed) {
|
||||
final Presentation presentation = e.getPresentation();
|
||||
final Boolean wasEnabledBefore = (Boolean)presentation.getClientProperty(WAS_ENABLED_BEFORE_DUMB);
|
||||
final boolean dumbMode = isDumbMode(CommonDataKeys.PROJECT.getData(e.getDataContext()));
|
||||
final boolean dumbMode = isDumbMode(e.getProject());
|
||||
if (wasEnabledBefore != null && !dumbMode) {
|
||||
presentation.putClientProperty(WAS_ENABLED_BEFORE_DUMB, null);
|
||||
presentation.setEnabled(wasEnabledBefore.booleanValue());
|
||||
@@ -166,7 +166,7 @@ public class ActionUtil {
|
||||
public static boolean lastUpdateAndCheckDumb(AnAction action, AnActionEvent e, boolean visibilityMatters) {
|
||||
performDumbAwareUpdate(action, e, true);
|
||||
|
||||
final Project project = CommonDataKeys.PROJECT.getData(e.getDataContext());
|
||||
final Project project = e.getProject();
|
||||
if (project != null && DumbService.getInstance(project).isDumb() && !action.isDumbAware()) {
|
||||
if (Boolean.FALSE.equals(e.getPresentation().getClientProperty(WOULD_BE_ENABLED_IF_NOT_DUMB_MODE))) {
|
||||
return false;
|
||||
|
||||
@@ -15,7 +15,10 @@
|
||||
*/
|
||||
package com.intellij.ide;
|
||||
|
||||
import com.intellij.openapi.actionSystem.*;
|
||||
import com.intellij.openapi.actionSystem.ActionPlaces;
|
||||
import com.intellij.openapi.actionSystem.AnAction;
|
||||
import com.intellij.openapi.actionSystem.AnActionEvent;
|
||||
import com.intellij.openapi.actionSystem.Presentation;
|
||||
import com.intellij.openapi.project.DumbAware;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.ui.Messages;
|
||||
@@ -53,7 +56,7 @@ public class ReopenProjectAction extends AnAction implements DumbAware {
|
||||
|| BitUtil.isSet(modifiers, InputEvent.SHIFT_MASK)
|
||||
|| e.getPlace() == ActionPlaces.WELCOME_SCREEN;
|
||||
|
||||
Project project = CommonDataKeys.PROJECT.getData(e.getDataContext());
|
||||
Project project = e.getProject();
|
||||
if (!new File(myProjectPath).exists()) {
|
||||
if (Messages.showDialog(project, "The path " + FileUtil.toSystemDependentName(myProjectPath) + " does not exist.\n" +
|
||||
"If it is on a removable or network drive, please make sure that the drive is connected.",
|
||||
|
||||
+2
-3
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2009 JetBrains s.r.o.
|
||||
* Copyright 2000-2016 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -21,7 +21,6 @@ import com.intellij.ide.actionMacro.ActionMacroManager;
|
||||
import com.intellij.openapi.actionSystem.ActionPlaces;
|
||||
import com.intellij.openapi.actionSystem.AnAction;
|
||||
import com.intellij.openapi.actionSystem.AnActionEvent;
|
||||
import com.intellij.openapi.actionSystem.CommonDataKeys;
|
||||
import com.intellij.openapi.project.DumbAware;
|
||||
|
||||
/**
|
||||
@@ -49,7 +48,7 @@ public class StartStopMacroRecordingAction extends AnAction implements DumbAware
|
||||
manager.startRecording(IdeBundle.message("macro.noname"));
|
||||
}
|
||||
else {
|
||||
ActionMacroManager.getInstance().stopRecording(CommonDataKeys.PROJECT.getData(e.getDataContext()));
|
||||
ActionMacroManager.getInstance().stopRecording(e.getProject());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
|
||||
/*
|
||||
* Copyright 2000-2009 JetBrains s.r.o.
|
||||
* Copyright 2000-2016 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -18,7 +18,6 @@ package com.intellij.ide.actions;
|
||||
|
||||
import com.intellij.openapi.actionSystem.AnAction;
|
||||
import com.intellij.openapi.actionSystem.AnActionEvent;
|
||||
import com.intellij.openapi.actionSystem.CommonDataKeys;
|
||||
import com.intellij.openapi.actionSystem.Presentation;
|
||||
import com.intellij.openapi.fileEditor.ex.IdeDocumentHistory;
|
||||
import com.intellij.openapi.project.DumbAware;
|
||||
@@ -26,14 +25,14 @@ import com.intellij.openapi.project.Project;
|
||||
|
||||
public class BackAction extends AnAction implements DumbAware {
|
||||
public void actionPerformed(AnActionEvent e) {
|
||||
Project project = CommonDataKeys.PROJECT.getData(e.getDataContext());
|
||||
Project project = e.getProject();
|
||||
if (project == null) return;
|
||||
IdeDocumentHistory.getInstance(project).back();
|
||||
}
|
||||
|
||||
public void update(AnActionEvent event){
|
||||
Presentation presentation = event.getPresentation();
|
||||
Project project = CommonDataKeys.PROJECT.getData(event.getDataContext());
|
||||
Project project = event.getProject();
|
||||
if (project == null || project.isDisposed()) {
|
||||
presentation.setEnabled(false);
|
||||
return;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2009 JetBrains s.r.o.
|
||||
* Copyright 2000-2016 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -16,7 +16,6 @@
|
||||
package com.intellij.ide.actions;
|
||||
|
||||
import com.intellij.openapi.actionSystem.AnActionEvent;
|
||||
import com.intellij.openapi.actionSystem.CommonDataKeys;
|
||||
import com.intellij.openapi.actionSystem.Presentation;
|
||||
import com.intellij.openapi.actionSystem.ToggleAction;
|
||||
import com.intellij.openapi.project.DumbAware;
|
||||
@@ -30,7 +29,7 @@ public abstract class BaseToolWindowToggleAction extends ToggleAction implements
|
||||
|
||||
@Override
|
||||
public final boolean isSelected(AnActionEvent e) {
|
||||
Project project = CommonDataKeys.PROJECT.getData(e.getDataContext());
|
||||
Project project = e.getProject();
|
||||
if (project == null || project.isDisposed()) {
|
||||
return false;
|
||||
}
|
||||
@@ -46,7 +45,7 @@ public abstract class BaseToolWindowToggleAction extends ToggleAction implements
|
||||
|
||||
@Override
|
||||
public final void setSelected(AnActionEvent e, boolean state) {
|
||||
Project project = CommonDataKeys.PROJECT.getData(e.getDataContext());
|
||||
Project project = e.getProject();
|
||||
if (project == null) {
|
||||
return;
|
||||
}
|
||||
@@ -67,7 +66,7 @@ public abstract class BaseToolWindowToggleAction extends ToggleAction implements
|
||||
public final void update(AnActionEvent e) {
|
||||
super.update(e);
|
||||
Presentation presentation = e.getPresentation();
|
||||
Project project = CommonDataKeys.PROJECT.getData(e.getDataContext());
|
||||
Project project = e.getProject();
|
||||
if (project == null) {
|
||||
presentation.setEnabled(false);
|
||||
return;
|
||||
|
||||
+2
-4
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2013 JetBrains s.r.o.
|
||||
* Copyright 2000-2016 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -16,8 +16,6 @@
|
||||
package com.intellij.ide.actions;
|
||||
|
||||
import com.intellij.openapi.actionSystem.AnActionEvent;
|
||||
import com.intellij.openapi.actionSystem.CommonDataKeys;
|
||||
import com.intellij.openapi.actionSystem.PlatformDataKeys;
|
||||
import com.intellij.openapi.fileEditor.ex.FileEditorManagerEx;
|
||||
import com.intellij.openapi.project.Project;
|
||||
|
||||
@@ -26,7 +24,7 @@ import com.intellij.openapi.project.Project;
|
||||
*/
|
||||
public final class ChangeSplitterOrientationAction extends SplitterActionBase {
|
||||
public void actionPerformed(final AnActionEvent event) {
|
||||
final Project project = CommonDataKeys.PROJECT.getData(event.getDataContext());
|
||||
final Project project = event.getProject();
|
||||
final FileEditorManagerEx fileEditorManager = FileEditorManagerEx.getInstanceEx(project);
|
||||
fileEditorManager.changeSplitterOrientation ();
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2015 JetBrains s.r.o.
|
||||
* Copyright 2000-2016 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -29,7 +29,7 @@ import com.intellij.projectImport.ProjectAttachProcessor;
|
||||
public class CloseProjectAction extends AnAction implements DumbAware {
|
||||
@Override
|
||||
public void actionPerformed(AnActionEvent e) {
|
||||
Project project = CommonDataKeys.PROJECT.getData(e.getDataContext());
|
||||
Project project = e.getProject();
|
||||
assert project != null;
|
||||
|
||||
ProjectUtil.closeAndDispose(project);
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
|
||||
/*
|
||||
* Copyright 2000-2009 JetBrains s.r.o.
|
||||
* Copyright 2000-2016 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -18,7 +18,6 @@ package com.intellij.ide.actions;
|
||||
|
||||
import com.intellij.openapi.actionSystem.AnAction;
|
||||
import com.intellij.openapi.actionSystem.AnActionEvent;
|
||||
import com.intellij.openapi.actionSystem.CommonDataKeys;
|
||||
import com.intellij.openapi.actionSystem.Presentation;
|
||||
import com.intellij.openapi.fileEditor.ex.IdeDocumentHistory;
|
||||
import com.intellij.openapi.project.DumbAware;
|
||||
@@ -26,14 +25,14 @@ import com.intellij.openapi.project.Project;
|
||||
|
||||
public class ForwardAction extends AnAction implements DumbAware {
|
||||
public void actionPerformed(AnActionEvent e) {
|
||||
Project project = CommonDataKeys.PROJECT.getData(e.getDataContext());
|
||||
Project project = e.getProject();
|
||||
if (project == null) return;
|
||||
IdeDocumentHistory.getInstance(project).forward();
|
||||
}
|
||||
|
||||
public void update(AnActionEvent event){
|
||||
Presentation presentation = event.getPresentation();
|
||||
Project project = CommonDataKeys.PROJECT.getData(event.getDataContext());
|
||||
Project project = event.getProject();
|
||||
if (project == null || project.isDisposed()) {
|
||||
presentation.setEnabled(false);
|
||||
return;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2009 JetBrains s.r.o.
|
||||
* Copyright 2000-2016 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -18,7 +18,6 @@ package com.intellij.ide.actions;
|
||||
import com.intellij.ide.IdeBundle;
|
||||
import com.intellij.openapi.actionSystem.AnAction;
|
||||
import com.intellij.openapi.actionSystem.AnActionEvent;
|
||||
import com.intellij.openapi.actionSystem.CommonDataKeys;
|
||||
import com.intellij.openapi.actionSystem.Presentation;
|
||||
import com.intellij.openapi.project.DumbAware;
|
||||
import com.intellij.openapi.project.Project;
|
||||
@@ -27,7 +26,7 @@ import com.intellij.openapi.wm.impl.DesktopLayout;
|
||||
|
||||
public class HideAllToolWindowsAction extends AnAction implements DumbAware {
|
||||
public void actionPerformed(AnActionEvent e) {
|
||||
Project project = CommonDataKeys.PROJECT.getData(e.getDataContext());
|
||||
Project project = e.getProject();
|
||||
if (project == null) {
|
||||
return;
|
||||
}
|
||||
@@ -70,7 +69,7 @@ public class HideAllToolWindowsAction extends AnAction implements DumbAware {
|
||||
|
||||
public void update(AnActionEvent event) {
|
||||
Presentation presentation = event.getPresentation();
|
||||
Project project = CommonDataKeys.PROJECT.getData(event.getDataContext());
|
||||
Project project = event.getProject();
|
||||
if (project == null) {
|
||||
presentation.setEnabled(false);
|
||||
return;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2009 JetBrains s.r.o.
|
||||
* Copyright 2000-2016 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -17,7 +17,6 @@ package com.intellij.ide.actions;
|
||||
|
||||
import com.intellij.openapi.actionSystem.AnAction;
|
||||
import com.intellij.openapi.actionSystem.AnActionEvent;
|
||||
import com.intellij.openapi.actionSystem.CommonDataKeys;
|
||||
import com.intellij.openapi.actionSystem.Presentation;
|
||||
import com.intellij.openapi.project.DumbAware;
|
||||
import com.intellij.openapi.project.Project;
|
||||
@@ -26,7 +25,7 @@ import com.intellij.openapi.wm.ex.ToolWindowManagerEx;
|
||||
public class HideSideWindowsAction extends AnAction implements DumbAware {
|
||||
|
||||
public void actionPerformed(AnActionEvent e) {
|
||||
Project project = CommonDataKeys.PROJECT.getData(e.getDataContext());
|
||||
Project project = e.getProject();
|
||||
if (project == null) {
|
||||
return;
|
||||
}
|
||||
@@ -43,7 +42,7 @@ public class HideSideWindowsAction extends AnAction implements DumbAware {
|
||||
|
||||
public void update(AnActionEvent event) {
|
||||
Presentation presentation = event.getPresentation();
|
||||
Project project = CommonDataKeys.PROJECT.getData(event.getDataContext());
|
||||
Project project = event.getProject();
|
||||
if (project == null) {
|
||||
presentation.setEnabled(false);
|
||||
return;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2009 JetBrains s.r.o.
|
||||
* Copyright 2000-2016 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -17,7 +17,6 @@ package com.intellij.ide.actions;
|
||||
|
||||
import com.intellij.openapi.actionSystem.AnAction;
|
||||
import com.intellij.openapi.actionSystem.AnActionEvent;
|
||||
import com.intellij.openapi.actionSystem.CommonDataKeys;
|
||||
import com.intellij.openapi.actionSystem.Presentation;
|
||||
import com.intellij.openapi.project.DumbAware;
|
||||
import com.intellij.openapi.project.Project;
|
||||
@@ -29,7 +28,7 @@ import org.jetbrains.annotations.Nullable;
|
||||
|
||||
public class HideToolWindowAction extends AnAction implements DumbAware {
|
||||
public void actionPerformed(AnActionEvent e) {
|
||||
Project project = CommonDataKeys.PROJECT.getData(e.getDataContext());
|
||||
Project project = e.getProject();
|
||||
if (project == null) {
|
||||
return;
|
||||
}
|
||||
@@ -52,7 +51,7 @@ public class HideToolWindowAction extends AnAction implements DumbAware {
|
||||
|
||||
public void update(AnActionEvent event) {
|
||||
Presentation presentation = event.getPresentation();
|
||||
Project project = CommonDataKeys.PROJECT.getData(event.getDataContext());
|
||||
Project project = event.getProject();
|
||||
if (project == null) {
|
||||
presentation.setEnabled(false);
|
||||
return;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2009 JetBrains s.r.o.
|
||||
* Copyright 2000-2016 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -17,12 +17,12 @@ package com.intellij.ide.actions;
|
||||
|
||||
import com.intellij.openapi.actionSystem.*;
|
||||
import com.intellij.openapi.fileEditor.ex.IdeDocumentHistory;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.project.DumbAware;
|
||||
import com.intellij.openapi.project.Project;
|
||||
|
||||
public class JumpToLastEditAction extends AnAction implements DumbAware {
|
||||
public void actionPerformed(AnActionEvent e) {
|
||||
Project project = CommonDataKeys.PROJECT.getData(e.getDataContext());
|
||||
Project project = e.getProject();
|
||||
if (project == null) return;
|
||||
IdeDocumentHistory.getInstance(project).navigatePreviousChange();
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
|
||||
/*
|
||||
* Copyright 2000-2009 JetBrains s.r.o.
|
||||
* Copyright 2000-2016 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -18,17 +18,15 @@ package com.intellij.ide.actions;
|
||||
|
||||
import com.intellij.openapi.actionSystem.AnAction;
|
||||
import com.intellij.openapi.actionSystem.AnActionEvent;
|
||||
import com.intellij.openapi.actionSystem.CommonDataKeys;
|
||||
import com.intellij.openapi.actionSystem.PlatformDataKeys;
|
||||
import com.intellij.openapi.actionSystem.Presentation;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.project.DumbAware;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.wm.ToolWindowManager;
|
||||
import com.intellij.openapi.wm.ex.ToolWindowManagerEx;
|
||||
|
||||
public class JumpToLastWindowAction extends AnAction implements DumbAware {
|
||||
public void actionPerformed(AnActionEvent e) {
|
||||
Project project = CommonDataKeys.PROJECT.getData(e.getDataContext());
|
||||
Project project = e.getProject();
|
||||
if (project == null) {
|
||||
return;
|
||||
}
|
||||
@@ -42,7 +40,7 @@ public class JumpToLastWindowAction extends AnAction implements DumbAware {
|
||||
|
||||
public void update(AnActionEvent event){
|
||||
Presentation presentation = event.getPresentation();
|
||||
Project project = CommonDataKeys.PROJECT.getData(event.getDataContext());
|
||||
Project project = event.getProject();
|
||||
if (project == null) {
|
||||
presentation.setEnabled(false);
|
||||
return;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2014 JetBrains s.r.o.
|
||||
* Copyright 2000-2016 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -23,7 +23,7 @@ import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public class JumpToNextEditAction extends AnAction implements DumbAware {
|
||||
public void actionPerformed(@NotNull AnActionEvent e) {
|
||||
Project project = CommonDataKeys.PROJECT.getData(e.getDataContext());
|
||||
Project project = e.getProject();
|
||||
if (project == null) return;
|
||||
IdeDocumentHistory.getInstance(project).navigateNextChange();
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2014 JetBrains s.r.o.
|
||||
* Copyright 2000-2016 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -17,7 +17,6 @@ package com.intellij.ide.actions;
|
||||
|
||||
import com.intellij.openapi.actionSystem.AnAction;
|
||||
import com.intellij.openapi.actionSystem.AnActionEvent;
|
||||
import com.intellij.openapi.actionSystem.CommonDataKeys;
|
||||
import com.intellij.openapi.actionSystem.Presentation;
|
||||
import com.intellij.openapi.project.DumbAware;
|
||||
import com.intellij.openapi.project.Project;
|
||||
@@ -37,7 +36,7 @@ public abstract class MacWindowActionBase extends AnAction implements DumbAware
|
||||
p.setVisible(SystemInfo.isMac);
|
||||
|
||||
if (SystemInfo.isMac) {
|
||||
Project project = CommonDataKeys.PROJECT.getData(e.getDataContext());
|
||||
Project project = e.getProject();
|
||||
if (project != null) {
|
||||
JFrame frame = WindowManager.getInstance().getFrame(project);
|
||||
if (frame != null) {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
|
||||
/*
|
||||
* Copyright 2000-2009 JetBrains s.r.o.
|
||||
* Copyright 2000-2016 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -19,7 +19,6 @@ package com.intellij.ide.actions;
|
||||
import com.intellij.ide.IdeBundle;
|
||||
import com.intellij.openapi.actionSystem.AnAction;
|
||||
import com.intellij.openapi.actionSystem.AnActionEvent;
|
||||
import com.intellij.openapi.actionSystem.CommonDataKeys;
|
||||
import com.intellij.openapi.actionSystem.Presentation;
|
||||
import com.intellij.openapi.command.CommandProcessor;
|
||||
import com.intellij.openapi.fileEditor.ex.FileEditorManagerEx;
|
||||
@@ -29,7 +28,7 @@ import com.intellij.openapi.wm.ToolWindowManager;
|
||||
|
||||
public class NextSplitAction extends AnAction implements DumbAware {
|
||||
public void actionPerformed(AnActionEvent e) {
|
||||
final Project project = CommonDataKeys.PROJECT.getData(e.getDataContext());
|
||||
final Project project = e.getProject();
|
||||
final CommandProcessor commandProcessor = CommandProcessor.getInstance();
|
||||
commandProcessor.executeCommand(
|
||||
project, () -> {
|
||||
@@ -40,7 +39,7 @@ public class NextSplitAction extends AnAction implements DumbAware {
|
||||
}
|
||||
|
||||
public void update(final AnActionEvent event){
|
||||
final Project project = CommonDataKeys.PROJECT.getData(event.getDataContext());
|
||||
final Project project = event.getProject();
|
||||
final Presentation presentation = event.getPresentation();
|
||||
if (project == null) {
|
||||
presentation.setEnabled(false);
|
||||
|
||||
+3
-3
@@ -1,6 +1,6 @@
|
||||
|
||||
/*
|
||||
* Copyright 2000-2009 JetBrains s.r.o.
|
||||
* Copyright 2000-2016 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -19,9 +19,9 @@ package com.intellij.ide.actions;
|
||||
import com.intellij.ide.IdeBundle;
|
||||
import com.intellij.ide.OccurenceNavigator;
|
||||
import com.intellij.openapi.actionSystem.*;
|
||||
import com.intellij.openapi.project.DumbAware;
|
||||
import com.intellij.openapi.project.IndexNotReadyException;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.project.DumbAware;
|
||||
import com.intellij.openapi.util.Condition;
|
||||
import com.intellij.openapi.wm.WindowManager;
|
||||
import com.intellij.openapi.wm.ex.ToolWindowManagerEx;
|
||||
@@ -38,7 +38,7 @@ import java.util.LinkedList;
|
||||
|
||||
abstract class OccurenceNavigatorActionBase extends AnAction implements DumbAware {
|
||||
public void actionPerformed(AnActionEvent e) {
|
||||
Project project = CommonDataKeys.PROJECT.getData(e.getDataContext());
|
||||
Project project = e.getProject();
|
||||
if (project == null) return;
|
||||
|
||||
OccurenceNavigator navigator = getNavigator(e.getDataContext());
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
|
||||
/*
|
||||
* Copyright 2000-2013 JetBrains s.r.o.
|
||||
* Copyright 2000-2016 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -17,16 +17,18 @@
|
||||
package com.intellij.ide.actions;
|
||||
|
||||
import com.intellij.ide.IdeBundle;
|
||||
import com.intellij.openapi.actionSystem.*;
|
||||
import com.intellij.openapi.actionSystem.AnAction;
|
||||
import com.intellij.openapi.actionSystem.AnActionEvent;
|
||||
import com.intellij.openapi.actionSystem.Presentation;
|
||||
import com.intellij.openapi.command.CommandProcessor;
|
||||
import com.intellij.openapi.fileEditor.ex.FileEditorManagerEx;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.project.DumbAware;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.wm.ToolWindowManager;
|
||||
|
||||
public class PrevSplitAction extends AnAction implements DumbAware {
|
||||
public void actionPerformed(AnActionEvent e) {
|
||||
final Project project = CommonDataKeys.PROJECT.getData(e.getDataContext());
|
||||
final Project project = e.getProject();
|
||||
final CommandProcessor commandProcessor = CommandProcessor.getInstance();
|
||||
commandProcessor.executeCommand(
|
||||
project, () -> {
|
||||
@@ -37,7 +39,7 @@ public class PrevSplitAction extends AnAction implements DumbAware {
|
||||
}
|
||||
|
||||
public void update(final AnActionEvent event){
|
||||
final Project project = CommonDataKeys.PROJECT.getData(event.getDataContext());
|
||||
final Project project = event.getProject();
|
||||
final Presentation presentation = event.getPresentation();
|
||||
if (project == null) {
|
||||
presentation.setEnabled(false);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2010 JetBrains s.r.o.
|
||||
* Copyright 2000-2016 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -18,7 +18,6 @@ package com.intellij.ide.actions;
|
||||
import com.intellij.openapi.actionSystem.ActionManager;
|
||||
import com.intellij.openapi.actionSystem.AnAction;
|
||||
import com.intellij.openapi.actionSystem.AnActionEvent;
|
||||
import com.intellij.openapi.actionSystem.CommonDataKeys;
|
||||
import com.intellij.openapi.project.DumbAware;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.project.ProjectManager;
|
||||
@@ -61,7 +60,7 @@ public abstract class ResizeToolWindowAction extends AnAction implements DumbAwa
|
||||
|
||||
@Override
|
||||
public final void update(AnActionEvent e) {
|
||||
Project project = CommonDataKeys.PROJECT.getData(e.getDataContext());
|
||||
Project project = e.getProject();
|
||||
if (project == null) {
|
||||
setDisabled(e);
|
||||
return;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2009 JetBrains s.r.o.
|
||||
* Copyright 2000-2016 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -17,7 +17,6 @@ package com.intellij.ide.actions;
|
||||
|
||||
import com.intellij.openapi.actionSystem.AnAction;
|
||||
import com.intellij.openapi.actionSystem.AnActionEvent;
|
||||
import com.intellij.openapi.actionSystem.CommonDataKeys;
|
||||
import com.intellij.openapi.actionSystem.Presentation;
|
||||
import com.intellij.openapi.project.DumbAware;
|
||||
import com.intellij.openapi.project.Project;
|
||||
@@ -30,7 +29,7 @@ import com.intellij.openapi.wm.impl.DesktopLayout;
|
||||
*/
|
||||
public final class RestoreDefaultLayoutAction extends AnAction implements DumbAware {
|
||||
public void actionPerformed(AnActionEvent e){
|
||||
Project project = CommonDataKeys.PROJECT.getData(e.getDataContext());
|
||||
Project project = e.getProject();
|
||||
if(project==null){
|
||||
return;
|
||||
}
|
||||
@@ -40,6 +39,6 @@ public final class RestoreDefaultLayoutAction extends AnAction implements DumbAw
|
||||
|
||||
public void update(AnActionEvent event){
|
||||
Presentation presentation = event.getPresentation();
|
||||
presentation.setEnabled(CommonDataKeys.PROJECT.getData(event.getDataContext()) != null);
|
||||
presentation.setEnabled(event.getProject() != null);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2012 JetBrains s.r.o.
|
||||
* Copyright 2000-2016 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -18,7 +18,6 @@ package com.intellij.ide.actions;
|
||||
import com.intellij.openapi.actionSystem.ActionManager;
|
||||
import com.intellij.openapi.actionSystem.AnAction;
|
||||
import com.intellij.openapi.actionSystem.AnActionEvent;
|
||||
import com.intellij.openapi.actionSystem.CommonDataKeys;
|
||||
import com.intellij.openapi.actionSystem.PlatformDataKeys;
|
||||
import com.intellij.openapi.project.DumbAware;
|
||||
import com.intellij.openapi.project.Project;
|
||||
@@ -63,7 +62,7 @@ public class ShowContentAction extends AnAction implements DumbAware {
|
||||
private ToolWindow getWindow(AnActionEvent event) {
|
||||
if (myWindow != null) return myWindow;
|
||||
|
||||
Project project = CommonDataKeys.PROJECT.getData(event.getDataContext());
|
||||
Project project = event.getProject();
|
||||
if (project == null) return null;
|
||||
|
||||
ToolWindowManager manager = ToolWindowManager.getInstance(project);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2014 JetBrains s.r.o.
|
||||
* Copyright 2000-2016 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -20,7 +20,6 @@ import com.intellij.icons.AllIcons;
|
||||
import com.intellij.openapi.actionSystem.ActionPlaces;
|
||||
import com.intellij.openapi.actionSystem.AnAction;
|
||||
import com.intellij.openapi.actionSystem.AnActionEvent;
|
||||
import com.intellij.openapi.actionSystem.CommonDataKeys;
|
||||
import com.intellij.openapi.application.ex.ApplicationManagerEx;
|
||||
import com.intellij.openapi.options.ShowSettingsUtil;
|
||||
import com.intellij.openapi.project.DumbAware;
|
||||
@@ -48,7 +47,7 @@ public class ShowSettingsAction extends AnAction implements DumbAware {
|
||||
}
|
||||
|
||||
public void actionPerformed(@NotNull AnActionEvent e) {
|
||||
Project project = CommonDataKeys.PROJECT.getData(e.getDataContext());
|
||||
Project project = e.getProject();
|
||||
if (project == null) {
|
||||
project = ProjectManager.getInstance().getDefaultProject();
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2014 JetBrains s.r.o.
|
||||
* Copyright 2000-2016 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -15,17 +15,20 @@
|
||||
*/
|
||||
package com.intellij.ide.actions;
|
||||
|
||||
import com.intellij.openapi.actionSystem.*;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.project.DumbAware;
|
||||
import com.intellij.openapi.actionSystem.ActionPlaces;
|
||||
import com.intellij.openapi.actionSystem.AnAction;
|
||||
import com.intellij.openapi.actionSystem.AnActionEvent;
|
||||
import com.intellij.openapi.actionSystem.Presentation;
|
||||
import com.intellij.openapi.fileEditor.ex.FileEditorManagerEx;
|
||||
import com.intellij.openapi.project.DumbAware;
|
||||
import com.intellij.openapi.project.Project;
|
||||
|
||||
/**
|
||||
* @author yole
|
||||
*/
|
||||
public abstract class SplitterActionBase extends AnAction implements DumbAware {
|
||||
public void update(final AnActionEvent event) {
|
||||
final Project project = CommonDataKeys.PROJECT.getData(event.getDataContext());
|
||||
final Project project = event.getProject();
|
||||
final Presentation presentation = event.getPresentation();
|
||||
boolean inContextMenu = ActionPlaces.isPopupPlace(event.getPlace());
|
||||
boolean enabled = project != null && isActionEnabled(project, inContextMenu);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2009 JetBrains s.r.o.
|
||||
* Copyright 2000-2016 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -17,7 +17,6 @@ package com.intellij.ide.actions;
|
||||
|
||||
import com.intellij.openapi.actionSystem.AnAction;
|
||||
import com.intellij.openapi.actionSystem.AnActionEvent;
|
||||
import com.intellij.openapi.actionSystem.CommonDataKeys;
|
||||
import com.intellij.openapi.actionSystem.Presentation;
|
||||
import com.intellij.openapi.project.DumbAware;
|
||||
import com.intellij.openapi.project.Project;
|
||||
@@ -30,7 +29,7 @@ import com.intellij.openapi.wm.impl.DesktopLayout;
|
||||
*/
|
||||
public class StoreDefaultLayoutAction extends AnAction implements DumbAware {
|
||||
public void actionPerformed(AnActionEvent e){
|
||||
Project project = CommonDataKeys.PROJECT.getData(e.getDataContext());
|
||||
Project project = e.getProject();
|
||||
if(project==null){
|
||||
return;
|
||||
}
|
||||
@@ -40,6 +39,6 @@ public class StoreDefaultLayoutAction extends AnAction implements DumbAware {
|
||||
|
||||
public void update(AnActionEvent event){
|
||||
Presentation presentation = event.getPresentation();
|
||||
presentation.setEnabled(CommonDataKeys.PROJECT.getData(event.getDataContext()) != null);
|
||||
presentation.setEnabled(event.getProject() != null);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -138,7 +138,7 @@ public class Switcher extends AnAction implements DumbAware {
|
||||
}
|
||||
|
||||
public void actionPerformed(@NotNull AnActionEvent e) {
|
||||
final Project project = CommonDataKeys.PROJECT.getData(e.getDataContext());
|
||||
final Project project = e.getProject();
|
||||
if (project == null) return;
|
||||
|
||||
boolean isNewSwitcher = false;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2009 JetBrains s.r.o.
|
||||
* Copyright 2000-2016 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -16,7 +16,6 @@
|
||||
package com.intellij.ide.actions;
|
||||
|
||||
import com.intellij.openapi.actionSystem.AnActionEvent;
|
||||
import com.intellij.openapi.actionSystem.CommonDataKeys;
|
||||
import com.intellij.openapi.actionSystem.Presentation;
|
||||
import com.intellij.openapi.actionSystem.ToggleAction;
|
||||
import com.intellij.openapi.project.DumbAware;
|
||||
@@ -28,7 +27,7 @@ import com.intellij.openapi.wm.ToolWindowType;
|
||||
public class ToggleDockModeAction extends ToggleAction implements DumbAware {
|
||||
|
||||
public boolean isSelected(AnActionEvent event){
|
||||
Project project = CommonDataKeys.PROJECT.getData(event.getDataContext());
|
||||
Project project = event.getProject();
|
||||
if (project == null) {
|
||||
return false;
|
||||
}
|
||||
@@ -41,7 +40,7 @@ public class ToggleDockModeAction extends ToggleAction implements DumbAware {
|
||||
}
|
||||
|
||||
public void setSelected(AnActionEvent event,boolean flag){
|
||||
Project project = CommonDataKeys.PROJECT.getData(event.getDataContext());
|
||||
Project project = event.getProject();
|
||||
if (project == null) {
|
||||
return;
|
||||
}
|
||||
@@ -62,7 +61,7 @@ public class ToggleDockModeAction extends ToggleAction implements DumbAware {
|
||||
public void update(AnActionEvent event){
|
||||
super.update(event);
|
||||
Presentation presentation = event.getPresentation();
|
||||
Project project = CommonDataKeys.PROJECT.getData(event.getDataContext());
|
||||
Project project = event.getProject();
|
||||
if (project == null) {
|
||||
presentation.setEnabled(false);
|
||||
return;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2009 JetBrains s.r.o.
|
||||
* Copyright 2000-2016 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -16,7 +16,6 @@
|
||||
package com.intellij.ide.actions;
|
||||
|
||||
import com.intellij.openapi.actionSystem.AnActionEvent;
|
||||
import com.intellij.openapi.actionSystem.CommonDataKeys;
|
||||
import com.intellij.openapi.actionSystem.Presentation;
|
||||
import com.intellij.openapi.actionSystem.ToggleAction;
|
||||
import com.intellij.openapi.project.DumbAware;
|
||||
@@ -29,7 +28,7 @@ import com.intellij.openapi.wm.ex.ToolWindowManagerEx;
|
||||
public class ToggleFloatingModeAction extends ToggleAction implements DumbAware {
|
||||
|
||||
public boolean isSelected(AnActionEvent event){
|
||||
Project project = CommonDataKeys.PROJECT.getData(event.getDataContext());
|
||||
Project project = event.getProject();
|
||||
if (project == null) {
|
||||
return false;
|
||||
}
|
||||
@@ -42,7 +41,7 @@ public class ToggleFloatingModeAction extends ToggleAction implements DumbAware
|
||||
}
|
||||
|
||||
public void setSelected(AnActionEvent event,boolean flag){
|
||||
Project project = CommonDataKeys.PROJECT.getData(event.getDataContext());
|
||||
Project project = event.getProject();
|
||||
if (project == null) {
|
||||
return;
|
||||
}
|
||||
@@ -63,7 +62,7 @@ public class ToggleFloatingModeAction extends ToggleAction implements DumbAware
|
||||
public void update(AnActionEvent event){
|
||||
super.update(event);
|
||||
Presentation presentation = event.getPresentation();
|
||||
Project project = CommonDataKeys.PROJECT.getData(event.getDataContext());
|
||||
Project project = event.getProject();
|
||||
if (project == null) {
|
||||
presentation.setEnabled(false);
|
||||
return;
|
||||
|
||||
+1
-1
@@ -76,7 +76,7 @@ public class ToggleReadOnlyAttributeAction extends AnAction implements DumbAware
|
||||
catch (IOException x) {
|
||||
Notifications.Bus.notify(
|
||||
new Notification(Notifications.SYSTEM_MESSAGES_GROUP_ID, CommonBundle.getErrorTitle(), x.getMessage(), NotificationType.ERROR),
|
||||
CommonDataKeys.PROJECT.getData(e.getDataContext()));
|
||||
e.getProject());
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2009 JetBrains s.r.o.
|
||||
* Copyright 2000-2016 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -16,7 +16,6 @@
|
||||
package com.intellij.ide.actions;
|
||||
|
||||
import com.intellij.openapi.actionSystem.AnActionEvent;
|
||||
import com.intellij.openapi.actionSystem.CommonDataKeys;
|
||||
import com.intellij.openapi.actionSystem.Presentation;
|
||||
import com.intellij.openapi.actionSystem.ToggleAction;
|
||||
import com.intellij.openapi.project.DumbAware;
|
||||
@@ -30,7 +29,7 @@ import com.intellij.openapi.wm.ex.ToolWindowManagerEx;
|
||||
public class ToggleWindowedModeAction extends ToggleAction implements DumbAware {
|
||||
|
||||
public boolean isSelected(AnActionEvent event) {
|
||||
Project project = CommonDataKeys.PROJECT.getData(event.getDataContext());
|
||||
Project project = event.getProject();
|
||||
if (project == null) {
|
||||
return false;
|
||||
}
|
||||
@@ -43,7 +42,7 @@ public class ToggleWindowedModeAction extends ToggleAction implements DumbAware
|
||||
}
|
||||
|
||||
public void setSelected(AnActionEvent event, boolean flag) {
|
||||
Project project = CommonDataKeys.PROJECT.getData(event.getDataContext());
|
||||
Project project = event.getProject();
|
||||
if (project == null) {
|
||||
return;
|
||||
}
|
||||
@@ -69,7 +68,7 @@ public class ToggleWindowedModeAction extends ToggleAction implements DumbAware
|
||||
presentation.setEnabledAndVisible(false);
|
||||
return;
|
||||
}
|
||||
Project project = CommonDataKeys.PROJECT.getData(event.getDataContext());
|
||||
Project project = event.getProject();
|
||||
if (project == null) {
|
||||
presentation.setEnabled(false);
|
||||
return;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2009 JetBrains s.r.o.
|
||||
* Copyright 2000-2016 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -15,7 +15,7 @@
|
||||
*/
|
||||
package com.intellij.ide.actions;
|
||||
|
||||
import com.intellij.openapi.actionSystem.*;
|
||||
import com.intellij.openapi.actionSystem.AnActionEvent;
|
||||
import com.intellij.openapi.fileEditor.ex.FileEditorManagerEx;
|
||||
import com.intellij.openapi.project.Project;
|
||||
|
||||
@@ -24,7 +24,7 @@ import com.intellij.openapi.project.Project;
|
||||
*/
|
||||
public class UnsplitAction extends SplitterActionBase {
|
||||
public void actionPerformed(final AnActionEvent event) {
|
||||
final Project project = CommonDataKeys.PROJECT.getData(event.getDataContext());
|
||||
final Project project = event.getProject();
|
||||
final FileEditorManagerEx fileEditorManager = FileEditorManagerEx.getInstanceEx(project);
|
||||
//VirtualFile file = fileEditorManager.getSelectedFiles()[0];
|
||||
fileEditorManager.unsplitWindow();
|
||||
|
||||
+2
-3
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2015 JetBrains s.r.o.
|
||||
* Copyright 2000-2016 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -17,7 +17,6 @@ package com.intellij.ide.errorTreeView.actions;
|
||||
|
||||
import com.intellij.openapi.actionSystem.AnAction;
|
||||
import com.intellij.openapi.actionSystem.AnActionEvent;
|
||||
import com.intellij.openapi.actionSystem.CommonDataKeys;
|
||||
import com.intellij.openapi.application.ApplicationManager;
|
||||
import com.intellij.openapi.application.ModalityState;
|
||||
import com.intellij.openapi.project.Project;
|
||||
@@ -43,7 +42,7 @@ public abstract class TestErrorViewAction extends AnAction{
|
||||
private int myMessageCount = 0;
|
||||
|
||||
public void actionPerformed(AnActionEvent e) {
|
||||
Project project = CommonDataKeys.PROJECT.getData(e.getDataContext());
|
||||
Project project = e.getProject();
|
||||
if (project == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2012 JetBrains s.r.o.
|
||||
* Copyright 2000-2016 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -18,7 +18,6 @@ package com.intellij.internal;
|
||||
|
||||
import com.intellij.openapi.actionSystem.AnAction;
|
||||
import com.intellij.openapi.actionSystem.AnActionEvent;
|
||||
import com.intellij.openapi.actionSystem.CommonDataKeys;
|
||||
import com.intellij.openapi.project.DumbAware;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.project.ProjectManager;
|
||||
@@ -30,7 +29,7 @@ import org.jetbrains.annotations.NotNull;
|
||||
public class ReloadProjectAction extends AnAction implements DumbAware {
|
||||
@Override
|
||||
public void actionPerformed(@NotNull AnActionEvent e) {
|
||||
Project project = CommonDataKeys.PROJECT.getData(e.getDataContext());
|
||||
Project project = e.getProject();
|
||||
if (project != null) {
|
||||
ProjectManager.getInstance().reloadProject(project);
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2014 JetBrains s.r.o.
|
||||
* Copyright 2000-2016 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -16,7 +16,6 @@
|
||||
package com.intellij.internal;
|
||||
|
||||
import com.intellij.openapi.actionSystem.AnActionEvent;
|
||||
import com.intellij.openapi.actionSystem.CommonDataKeys;
|
||||
import com.intellij.openapi.actionSystem.Presentation;
|
||||
import com.intellij.openapi.progress.ProgressIndicator;
|
||||
import com.intellij.openapi.project.DumbAwareAction;
|
||||
@@ -38,7 +37,7 @@ public class ToggleDumbModeAction extends DumbAwareAction {
|
||||
}
|
||||
else {
|
||||
myDumb = true;
|
||||
final Project project = CommonDataKeys.PROJECT.getData(e.getDataContext());
|
||||
final Project project = e.getProject();
|
||||
if (project == null) return;
|
||||
|
||||
DumbServiceImpl.getInstance(project).queueTask(new DumbModeTask() {
|
||||
@@ -56,7 +55,7 @@ public class ToggleDumbModeAction extends DumbAwareAction {
|
||||
@Override
|
||||
public void update(final AnActionEvent e) {
|
||||
final Presentation presentation = e.getPresentation();
|
||||
final Project project = CommonDataKeys.PROJECT.getData(e.getDataContext());
|
||||
final Project project = e.getProject();
|
||||
presentation.setEnabled(project != null && myDumb == DumbServiceImpl.getInstance(project).isDumb());
|
||||
if (myDumb) {
|
||||
presentation.setText("Exit Dumb Mode");
|
||||
|
||||
+2
-3
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2014 JetBrains s.r.o.
|
||||
* Copyright 2000-2016 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -20,7 +20,6 @@ import com.intellij.internal.statistic.connect.StatisticsResult;
|
||||
import com.intellij.internal.statistic.connect.StatisticsService;
|
||||
import com.intellij.openapi.actionSystem.AnAction;
|
||||
import com.intellij.openapi.actionSystem.AnActionEvent;
|
||||
import com.intellij.openapi.actionSystem.CommonDataKeys;
|
||||
import com.intellij.openapi.application.ApplicationManager;
|
||||
import com.intellij.openapi.application.ModalityState;
|
||||
import com.intellij.openapi.progress.ProgressIndicator;
|
||||
@@ -35,7 +34,7 @@ public class SendStatisticsAction extends AnAction {
|
||||
|
||||
@Override
|
||||
public void actionPerformed(@NotNull AnActionEvent e) {
|
||||
final Project project = CommonDataKeys.PROJECT.getData(e.getDataContext());
|
||||
final Project project = e.getProject();
|
||||
if (project == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
+2
-3
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2010 JetBrains s.r.o.
|
||||
* Copyright 2000-2016 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -17,7 +17,6 @@ package com.intellij.internal.validation;
|
||||
|
||||
import com.intellij.openapi.actionSystem.AnAction;
|
||||
import com.intellij.openapi.actionSystem.AnActionEvent;
|
||||
import com.intellij.openapi.actionSystem.CommonDataKeys;
|
||||
import com.intellij.openapi.project.Project;
|
||||
|
||||
/**
|
||||
@@ -26,7 +25,7 @@ import com.intellij.openapi.project.Project;
|
||||
public class TestDialogWithValidationAction extends AnAction {
|
||||
@Override
|
||||
public void actionPerformed(AnActionEvent e) {
|
||||
final Project project = CommonDataKeys.PROJECT.getData(e.getDataContext());
|
||||
final Project project = e.getProject();
|
||||
if (project != null) {
|
||||
new ValidationTest(project).show();
|
||||
}
|
||||
|
||||
+5
-3
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2014 JetBrains s.r.o.
|
||||
* Copyright 2000-2016 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -15,7 +15,9 @@
|
||||
*/
|
||||
package com.intellij.openapi.actionSystem.impl;
|
||||
|
||||
import com.intellij.openapi.actionSystem.*;
|
||||
import com.intellij.openapi.actionSystem.ActionStub;
|
||||
import com.intellij.openapi.actionSystem.AnAction;
|
||||
import com.intellij.openapi.actionSystem.AnActionEvent;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.project.ProjectType;
|
||||
import com.intellij.openapi.project.ProjectTypeService;
|
||||
@@ -68,7 +70,7 @@ public class ChameleonAction extends AnAction {
|
||||
|
||||
@Nullable
|
||||
private AnAction getAction(AnActionEvent e) {
|
||||
Project project = CommonDataKeys.PROJECT.getData(e.getDataContext());
|
||||
Project project = e.getProject();
|
||||
ProjectType projectType = ProjectTypeService.getProjectType(project);
|
||||
AnAction action = myActions.get(projectType);
|
||||
if (action == null) action = myActions.get(null);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2013 JetBrains s.r.o.
|
||||
* Copyright 2000-2016 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -15,7 +15,10 @@
|
||||
*/
|
||||
package com.intellij.openapi.diff.actions;
|
||||
|
||||
import com.intellij.openapi.actionSystem.*;
|
||||
import com.intellij.openapi.actionSystem.ActionGroup;
|
||||
import com.intellij.openapi.actionSystem.AnAction;
|
||||
import com.intellij.openapi.actionSystem.AnActionEvent;
|
||||
import com.intellij.openapi.actionSystem.Separator;
|
||||
import com.intellij.openapi.diff.DiffBundle;
|
||||
import com.intellij.openapi.diff.impl.DiffPanelImpl;
|
||||
import com.intellij.openapi.diff.impl.highlighting.FragmentSide;
|
||||
@@ -75,7 +78,7 @@ public class MergeActionGroup extends ActionGroup {
|
||||
|
||||
@Override
|
||||
public void actionPerformed(AnActionEvent e) {
|
||||
myOperation.perform(CommonDataKeys.PROJECT.getData(e.getDataContext()));
|
||||
myOperation.perform(e.getProject());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -37,7 +37,7 @@ public class ToggleShowIndentLinesGloballyAction extends ToggleAction implements
|
||||
if (editor != null && editor.getSettings().isIndentGuidesShown() != state) {
|
||||
editor.getSettings().setIndentGuidesShown(state);
|
||||
}
|
||||
Project project = CommonDataKeys.PROJECT.getData(e.getDataContext());
|
||||
Project project = e.getProject();
|
||||
if (project != null) {
|
||||
DaemonCodeAnalyzer.getInstance(project).restart();
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2015 JetBrains s.r.o.
|
||||
* Copyright 2000-2016 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -17,7 +17,6 @@ package com.intellij.ui.switcher;
|
||||
|
||||
import com.intellij.openapi.actionSystem.AnAction;
|
||||
import com.intellij.openapi.actionSystem.AnActionEvent;
|
||||
import com.intellij.openapi.actionSystem.CommonDataKeys;
|
||||
import com.intellij.openapi.project.DumbAware;
|
||||
import com.intellij.openapi.project.Project;
|
||||
|
||||
@@ -65,7 +64,7 @@ public abstract class SwitchAction extends AnAction implements DumbAware {
|
||||
}
|
||||
|
||||
private static SwitchManager getManager(AnActionEvent e) {
|
||||
Project project = CommonDataKeys.PROJECT.getData(e.getDataContext());
|
||||
Project project = e.getProject();
|
||||
return SwitchManager.getInstance(project);
|
||||
}
|
||||
|
||||
|
||||
+17
-3
@@ -1,3 +1,18 @@
|
||||
/*
|
||||
* Copyright 2000-2016 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.jetbrains.idea.maven.navigator.actions;
|
||||
|
||||
import com.intellij.execution.RunManager;
|
||||
@@ -5,7 +20,6 @@ import com.intellij.execution.RunnerAndConfigurationSettings;
|
||||
import com.intellij.execution.impl.EditConfigurationsDialog;
|
||||
import com.intellij.openapi.actionSystem.AnAction;
|
||||
import com.intellij.openapi.actionSystem.AnActionEvent;
|
||||
import com.intellij.openapi.actionSystem.CommonDataKeys;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.idea.maven.utils.MavenDataKeys;
|
||||
@@ -16,7 +30,7 @@ import org.jetbrains.idea.maven.utils.MavenDataKeys;
|
||||
public class EditMavenRunConfigurationAction extends AnAction {
|
||||
@Override
|
||||
public void actionPerformed(@NotNull AnActionEvent e) {
|
||||
Project project = CommonDataKeys.PROJECT.getData(e.getDataContext());
|
||||
Project project = e.getProject();
|
||||
RunnerAndConfigurationSettings settings = MavenDataKeys.RUN_CONFIGURATION.getData(e.getDataContext());
|
||||
|
||||
assert settings != null && project != null;
|
||||
@@ -29,7 +43,7 @@ public class EditMavenRunConfigurationAction extends AnAction {
|
||||
|
||||
@Override
|
||||
public void update(@NotNull AnActionEvent e) {
|
||||
Project project = CommonDataKeys.PROJECT.getData(e.getDataContext());
|
||||
Project project = e.getProject();
|
||||
RunnerAndConfigurationSettings settings = MavenDataKeys.RUN_CONFIGURATION.getData(e.getDataContext());
|
||||
|
||||
boolean enabled = settings != null && project != null;
|
||||
|
||||
+20
-2
@@ -1,8 +1,26 @@
|
||||
/*
|
||||
* Copyright 2000-2016 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.jetbrains.idea.maven.navigator.actions;
|
||||
|
||||
import com.intellij.execution.*;
|
||||
import com.intellij.execution.runners.ProgramRunner;
|
||||
import com.intellij.openapi.actionSystem.*;
|
||||
import com.intellij.openapi.actionSystem.AnAction;
|
||||
import com.intellij.openapi.actionSystem.AnActionEvent;
|
||||
import com.intellij.openapi.actionSystem.Constraints;
|
||||
import com.intellij.openapi.actionSystem.DefaultActionGroup;
|
||||
import com.intellij.openapi.project.DumbAware;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
@@ -21,7 +39,7 @@ public class MavenRunConfigurationMenu extends DefaultActionGroup implements Dum
|
||||
}
|
||||
}
|
||||
|
||||
final Project project = CommonDataKeys.PROJECT.getData(e.getDataContext());
|
||||
final Project project = e.getProject();
|
||||
|
||||
final RunnerAndConfigurationSettings settings = MavenDataKeys.RUN_CONFIGURATION.getData(e.getDataContext());
|
||||
|
||||
|
||||
+3
-4
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2013 JetBrains s.r.o.
|
||||
* Copyright 2000-2016 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -20,7 +20,6 @@ import com.intellij.execution.RunManagerEx;
|
||||
import com.intellij.execution.RunnerAndConfigurationSettings;
|
||||
import com.intellij.openapi.actionSystem.AnAction;
|
||||
import com.intellij.openapi.actionSystem.AnActionEvent;
|
||||
import com.intellij.openapi.actionSystem.CommonDataKeys;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.ui.Messages;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
@@ -32,7 +31,7 @@ import org.jetbrains.idea.maven.utils.MavenDataKeys;
|
||||
public class RemoveMavenRunConfigurationAction extends AnAction {
|
||||
@Override
|
||||
public void actionPerformed(@NotNull AnActionEvent e) {
|
||||
Project project = CommonDataKeys.PROJECT.getData(e.getDataContext());
|
||||
Project project = e.getProject();
|
||||
RunnerAndConfigurationSettings settings = MavenDataKeys.RUN_CONFIGURATION.getData(e.getDataContext());
|
||||
|
||||
assert settings != null && project != null;
|
||||
@@ -45,7 +44,7 @@ public class RemoveMavenRunConfigurationAction extends AnAction {
|
||||
|
||||
@Override
|
||||
public void update(@NotNull AnActionEvent e) {
|
||||
Project project = CommonDataKeys.PROJECT.getData(e.getDataContext());
|
||||
Project project = e.getProject();
|
||||
RunnerAndConfigurationSettings settings = MavenDataKeys.RUN_CONFIGURATION.getData(e.getDataContext());
|
||||
|
||||
boolean enabled = settings != null && project != null;
|
||||
|
||||
Reference in New Issue
Block a user