diff --git a/platform/platform-api/src/com/intellij/openapi/actionSystem/ex/ActionUtil.java b/platform/platform-api/src/com/intellij/openapi/actionSystem/ex/ActionUtil.java index d4bae6056d62..c2029184e88e 100644 --- a/platform/platform-api/src/com/intellij/openapi/actionSystem/ex/ActionUtil.java +++ b/platform/platform-api/src/com/intellij/openapi/actionSystem/ex/ActionUtil.java @@ -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; diff --git a/platform/platform-impl/src/com/intellij/ide/ReopenProjectAction.java b/platform/platform-impl/src/com/intellij/ide/ReopenProjectAction.java index 0b61b606ffcd..289b57d01052 100644 --- a/platform/platform-impl/src/com/intellij/ide/ReopenProjectAction.java +++ b/platform/platform-impl/src/com/intellij/ide/ReopenProjectAction.java @@ -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.", diff --git a/platform/platform-impl/src/com/intellij/ide/actionMacro/actions/StartStopMacroRecordingAction.java b/platform/platform-impl/src/com/intellij/ide/actionMacro/actions/StartStopMacroRecordingAction.java index 5b2c5414e845..b7786c489d66 100644 --- a/platform/platform-impl/src/com/intellij/ide/actionMacro/actions/StartStopMacroRecordingAction.java +++ b/platform/platform-impl/src/com/intellij/ide/actionMacro/actions/StartStopMacroRecordingAction.java @@ -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()); } } } diff --git a/platform/platform-impl/src/com/intellij/ide/actions/BackAction.java b/platform/platform-impl/src/com/intellij/ide/actions/BackAction.java index e8d4f12696f1..2c86e35a1ff4 100644 --- a/platform/platform-impl/src/com/intellij/ide/actions/BackAction.java +++ b/platform/platform-impl/src/com/intellij/ide/actions/BackAction.java @@ -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; diff --git a/platform/platform-impl/src/com/intellij/ide/actions/BaseToolWindowToggleAction.java b/platform/platform-impl/src/com/intellij/ide/actions/BaseToolWindowToggleAction.java index ba8bf77d07d2..a9d846786926 100644 --- a/platform/platform-impl/src/com/intellij/ide/actions/BaseToolWindowToggleAction.java +++ b/platform/platform-impl/src/com/intellij/ide/actions/BaseToolWindowToggleAction.java @@ -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; diff --git a/platform/platform-impl/src/com/intellij/ide/actions/ChangeSplitterOrientationAction.java b/platform/platform-impl/src/com/intellij/ide/actions/ChangeSplitterOrientationAction.java index 1afbedab7910..84294a0e5495 100644 --- a/platform/platform-impl/src/com/intellij/ide/actions/ChangeSplitterOrientationAction.java +++ b/platform/platform-impl/src/com/intellij/ide/actions/ChangeSplitterOrientationAction.java @@ -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 (); } diff --git a/platform/platform-impl/src/com/intellij/ide/actions/CloseProjectAction.java b/platform/platform-impl/src/com/intellij/ide/actions/CloseProjectAction.java index 6739bdeedce9..91a11c8b042f 100644 --- a/platform/platform-impl/src/com/intellij/ide/actions/CloseProjectAction.java +++ b/platform/platform-impl/src/com/intellij/ide/actions/CloseProjectAction.java @@ -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); diff --git a/platform/platform-impl/src/com/intellij/ide/actions/ForwardAction.java b/platform/platform-impl/src/com/intellij/ide/actions/ForwardAction.java index 30dc9ef96d45..7a91390e4d36 100644 --- a/platform/platform-impl/src/com/intellij/ide/actions/ForwardAction.java +++ b/platform/platform-impl/src/com/intellij/ide/actions/ForwardAction.java @@ -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; diff --git a/platform/platform-impl/src/com/intellij/ide/actions/HideAllToolWindowsAction.java b/platform/platform-impl/src/com/intellij/ide/actions/HideAllToolWindowsAction.java index 3b28e0534bb7..3c25ff206da9 100644 --- a/platform/platform-impl/src/com/intellij/ide/actions/HideAllToolWindowsAction.java +++ b/platform/platform-impl/src/com/intellij/ide/actions/HideAllToolWindowsAction.java @@ -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; diff --git a/platform/platform-impl/src/com/intellij/ide/actions/HideSideWindowsAction.java b/platform/platform-impl/src/com/intellij/ide/actions/HideSideWindowsAction.java index c4917de28979..03e9ad6eb294 100644 --- a/platform/platform-impl/src/com/intellij/ide/actions/HideSideWindowsAction.java +++ b/platform/platform-impl/src/com/intellij/ide/actions/HideSideWindowsAction.java @@ -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; diff --git a/platform/platform-impl/src/com/intellij/ide/actions/HideToolWindowAction.java b/platform/platform-impl/src/com/intellij/ide/actions/HideToolWindowAction.java index 7c97094065dc..0e6bade01593 100644 --- a/platform/platform-impl/src/com/intellij/ide/actions/HideToolWindowAction.java +++ b/platform/platform-impl/src/com/intellij/ide/actions/HideToolWindowAction.java @@ -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; diff --git a/platform/platform-impl/src/com/intellij/ide/actions/JumpToLastEditAction.java b/platform/platform-impl/src/com/intellij/ide/actions/JumpToLastEditAction.java index 2eb782154b7c..3f77cde853a7 100644 --- a/platform/platform-impl/src/com/intellij/ide/actions/JumpToLastEditAction.java +++ b/platform/platform-impl/src/com/intellij/ide/actions/JumpToLastEditAction.java @@ -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(); } diff --git a/platform/platform-impl/src/com/intellij/ide/actions/JumpToLastWindowAction.java b/platform/platform-impl/src/com/intellij/ide/actions/JumpToLastWindowAction.java index 7271eaa8b833..cb970350f022 100644 --- a/platform/platform-impl/src/com/intellij/ide/actions/JumpToLastWindowAction.java +++ b/platform/platform-impl/src/com/intellij/ide/actions/JumpToLastWindowAction.java @@ -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; diff --git a/platform/platform-impl/src/com/intellij/ide/actions/JumpToNextEditAction.java b/platform/platform-impl/src/com/intellij/ide/actions/JumpToNextEditAction.java index 5890b4757cdb..5947cadb4650 100644 --- a/platform/platform-impl/src/com/intellij/ide/actions/JumpToNextEditAction.java +++ b/platform/platform-impl/src/com/intellij/ide/actions/JumpToNextEditAction.java @@ -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(); } diff --git a/platform/platform-impl/src/com/intellij/ide/actions/MacWindowActionBase.java b/platform/platform-impl/src/com/intellij/ide/actions/MacWindowActionBase.java index feb0aea6f550..7d58b59922cf 100644 --- a/platform/platform-impl/src/com/intellij/ide/actions/MacWindowActionBase.java +++ b/platform/platform-impl/src/com/intellij/ide/actions/MacWindowActionBase.java @@ -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) { diff --git a/platform/platform-impl/src/com/intellij/ide/actions/NextSplitAction.java b/platform/platform-impl/src/com/intellij/ide/actions/NextSplitAction.java index 1175bf3a3577..3f4479d7c559 100644 --- a/platform/platform-impl/src/com/intellij/ide/actions/NextSplitAction.java +++ b/platform/platform-impl/src/com/intellij/ide/actions/NextSplitAction.java @@ -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); diff --git a/platform/platform-impl/src/com/intellij/ide/actions/OccurenceNavigatorActionBase.java b/platform/platform-impl/src/com/intellij/ide/actions/OccurenceNavigatorActionBase.java index 76afa941b493..5042bd11b751 100644 --- a/platform/platform-impl/src/com/intellij/ide/actions/OccurenceNavigatorActionBase.java +++ b/platform/platform-impl/src/com/intellij/ide/actions/OccurenceNavigatorActionBase.java @@ -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()); diff --git a/platform/platform-impl/src/com/intellij/ide/actions/PrevSplitAction.java b/platform/platform-impl/src/com/intellij/ide/actions/PrevSplitAction.java index a7058f9ebe94..6fbc10c28497 100644 --- a/platform/platform-impl/src/com/intellij/ide/actions/PrevSplitAction.java +++ b/platform/platform-impl/src/com/intellij/ide/actions/PrevSplitAction.java @@ -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); diff --git a/platform/platform-impl/src/com/intellij/ide/actions/ResizeToolWindowAction.java b/platform/platform-impl/src/com/intellij/ide/actions/ResizeToolWindowAction.java index f0b43e3737ae..86b3b97a3f6d 100644 --- a/platform/platform-impl/src/com/intellij/ide/actions/ResizeToolWindowAction.java +++ b/platform/platform-impl/src/com/intellij/ide/actions/ResizeToolWindowAction.java @@ -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; diff --git a/platform/platform-impl/src/com/intellij/ide/actions/RestoreDefaultLayoutAction.java b/platform/platform-impl/src/com/intellij/ide/actions/RestoreDefaultLayoutAction.java index d3cdd88fbe19..be2c1ac342d6 100644 --- a/platform/platform-impl/src/com/intellij/ide/actions/RestoreDefaultLayoutAction.java +++ b/platform/platform-impl/src/com/intellij/ide/actions/RestoreDefaultLayoutAction.java @@ -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); } } diff --git a/platform/platform-impl/src/com/intellij/ide/actions/ShowContentAction.java b/platform/platform-impl/src/com/intellij/ide/actions/ShowContentAction.java index 60b4902e6b79..a847ca5b7c49 100644 --- a/platform/platform-impl/src/com/intellij/ide/actions/ShowContentAction.java +++ b/platform/platform-impl/src/com/intellij/ide/actions/ShowContentAction.java @@ -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); diff --git a/platform/platform-impl/src/com/intellij/ide/actions/ShowSettingsAction.java b/platform/platform-impl/src/com/intellij/ide/actions/ShowSettingsAction.java index 8f03f05b5fc4..604efeee4884 100644 --- a/platform/platform-impl/src/com/intellij/ide/actions/ShowSettingsAction.java +++ b/platform/platform-impl/src/com/intellij/ide/actions/ShowSettingsAction.java @@ -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(); } diff --git a/platform/platform-impl/src/com/intellij/ide/actions/SplitterActionBase.java b/platform/platform-impl/src/com/intellij/ide/actions/SplitterActionBase.java index dde5a5c898dd..8099d825de50 100644 --- a/platform/platform-impl/src/com/intellij/ide/actions/SplitterActionBase.java +++ b/platform/platform-impl/src/com/intellij/ide/actions/SplitterActionBase.java @@ -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); diff --git a/platform/platform-impl/src/com/intellij/ide/actions/StoreDefaultLayoutAction.java b/platform/platform-impl/src/com/intellij/ide/actions/StoreDefaultLayoutAction.java index 8a0067d3e877..d5cda6d4452c 100644 --- a/platform/platform-impl/src/com/intellij/ide/actions/StoreDefaultLayoutAction.java +++ b/platform/platform-impl/src/com/intellij/ide/actions/StoreDefaultLayoutAction.java @@ -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); } } diff --git a/platform/platform-impl/src/com/intellij/ide/actions/Switcher.java b/platform/platform-impl/src/com/intellij/ide/actions/Switcher.java index 3b17b14136a8..7da62e972bc4 100644 --- a/platform/platform-impl/src/com/intellij/ide/actions/Switcher.java +++ b/platform/platform-impl/src/com/intellij/ide/actions/Switcher.java @@ -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; diff --git a/platform/platform-impl/src/com/intellij/ide/actions/ToggleDockModeAction.java b/platform/platform-impl/src/com/intellij/ide/actions/ToggleDockModeAction.java index 75b646bd3e72..292a44812af6 100644 --- a/platform/platform-impl/src/com/intellij/ide/actions/ToggleDockModeAction.java +++ b/platform/platform-impl/src/com/intellij/ide/actions/ToggleDockModeAction.java @@ -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; diff --git a/platform/platform-impl/src/com/intellij/ide/actions/ToggleFloatingModeAction.java b/platform/platform-impl/src/com/intellij/ide/actions/ToggleFloatingModeAction.java index ce7ac4a2faf4..da96f40e67f7 100644 --- a/platform/platform-impl/src/com/intellij/ide/actions/ToggleFloatingModeAction.java +++ b/platform/platform-impl/src/com/intellij/ide/actions/ToggleFloatingModeAction.java @@ -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; diff --git a/platform/platform-impl/src/com/intellij/ide/actions/ToggleReadOnlyAttributeAction.java b/platform/platform-impl/src/com/intellij/ide/actions/ToggleReadOnlyAttributeAction.java index a8c9bb016f74..62e24661255a 100644 --- a/platform/platform-impl/src/com/intellij/ide/actions/ToggleReadOnlyAttributeAction.java +++ b/platform/platform-impl/src/com/intellij/ide/actions/ToggleReadOnlyAttributeAction.java @@ -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()); } }); } diff --git a/platform/platform-impl/src/com/intellij/ide/actions/ToggleWindowedModeAction.java b/platform/platform-impl/src/com/intellij/ide/actions/ToggleWindowedModeAction.java index b346f88c99a0..dddc78e553e0 100644 --- a/platform/platform-impl/src/com/intellij/ide/actions/ToggleWindowedModeAction.java +++ b/platform/platform-impl/src/com/intellij/ide/actions/ToggleWindowedModeAction.java @@ -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; diff --git a/platform/platform-impl/src/com/intellij/ide/actions/UnsplitAction.java b/platform/platform-impl/src/com/intellij/ide/actions/UnsplitAction.java index 3c4c8b536bab..da4afebea293 100644 --- a/platform/platform-impl/src/com/intellij/ide/actions/UnsplitAction.java +++ b/platform/platform-impl/src/com/intellij/ide/actions/UnsplitAction.java @@ -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(); diff --git a/platform/platform-impl/src/com/intellij/ide/errorTreeView/actions/TestErrorViewAction.java b/platform/platform-impl/src/com/intellij/ide/errorTreeView/actions/TestErrorViewAction.java index 0c56f54d833c..aa3c6c26cc7c 100644 --- a/platform/platform-impl/src/com/intellij/ide/errorTreeView/actions/TestErrorViewAction.java +++ b/platform/platform-impl/src/com/intellij/ide/errorTreeView/actions/TestErrorViewAction.java @@ -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; } diff --git a/platform/platform-impl/src/com/intellij/internal/ReloadProjectAction.java b/platform/platform-impl/src/com/intellij/internal/ReloadProjectAction.java index 3cbd861ff06c..18f526be2a79 100644 --- a/platform/platform-impl/src/com/intellij/internal/ReloadProjectAction.java +++ b/platform/platform-impl/src/com/intellij/internal/ReloadProjectAction.java @@ -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); } diff --git a/platform/platform-impl/src/com/intellij/internal/ToggleDumbModeAction.java b/platform/platform-impl/src/com/intellij/internal/ToggleDumbModeAction.java index 9a6886ccfd28..4c858d8ed96a 100644 --- a/platform/platform-impl/src/com/intellij/internal/ToggleDumbModeAction.java +++ b/platform/platform-impl/src/com/intellij/internal/ToggleDumbModeAction.java @@ -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"); diff --git a/platform/platform-impl/src/com/intellij/internal/statistic/tmp/SendStatisticsAction.java b/platform/platform-impl/src/com/intellij/internal/statistic/tmp/SendStatisticsAction.java index 068731eaa6d5..0b61d2794c4e 100755 --- a/platform/platform-impl/src/com/intellij/internal/statistic/tmp/SendStatisticsAction.java +++ b/platform/platform-impl/src/com/intellij/internal/statistic/tmp/SendStatisticsAction.java @@ -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; } diff --git a/platform/platform-impl/src/com/intellij/internal/validation/TestDialogWithValidationAction.java b/platform/platform-impl/src/com/intellij/internal/validation/TestDialogWithValidationAction.java index 4ba624d87d5d..69cd27d7de77 100644 --- a/platform/platform-impl/src/com/intellij/internal/validation/TestDialogWithValidationAction.java +++ b/platform/platform-impl/src/com/intellij/internal/validation/TestDialogWithValidationAction.java @@ -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(); } diff --git a/platform/platform-impl/src/com/intellij/openapi/actionSystem/impl/ChameleonAction.java b/platform/platform-impl/src/com/intellij/openapi/actionSystem/impl/ChameleonAction.java index f4e92f7eae02..8a6e03107bda 100644 --- a/platform/platform-impl/src/com/intellij/openapi/actionSystem/impl/ChameleonAction.java +++ b/platform/platform-impl/src/com/intellij/openapi/actionSystem/impl/ChameleonAction.java @@ -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); diff --git a/platform/platform-impl/src/com/intellij/openapi/diff/actions/MergeActionGroup.java b/platform/platform-impl/src/com/intellij/openapi/diff/actions/MergeActionGroup.java index 908238373d23..0676c9d6fd34 100644 --- a/platform/platform-impl/src/com/intellij/openapi/diff/actions/MergeActionGroup.java +++ b/platform/platform-impl/src/com/intellij/openapi/diff/actions/MergeActionGroup.java @@ -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()); } } } diff --git a/platform/platform-impl/src/com/intellij/openapi/editor/actions/ToggleShowIndentLinesGloballyAction.java b/platform/platform-impl/src/com/intellij/openapi/editor/actions/ToggleShowIndentLinesGloballyAction.java index 9a8f270f26e3..4ef16919557d 100644 --- a/platform/platform-impl/src/com/intellij/openapi/editor/actions/ToggleShowIndentLinesGloballyAction.java +++ b/platform/platform-impl/src/com/intellij/openapi/editor/actions/ToggleShowIndentLinesGloballyAction.java @@ -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(); } diff --git a/platform/platform-impl/src/com/intellij/ui/switcher/SwitchAction.java b/platform/platform-impl/src/com/intellij/ui/switcher/SwitchAction.java index 5aa13d39c0e6..32192f6b67c0 100644 --- a/platform/platform-impl/src/com/intellij/ui/switcher/SwitchAction.java +++ b/platform/platform-impl/src/com/intellij/ui/switcher/SwitchAction.java @@ -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); } diff --git a/plugins/maven/src/main/java/org/jetbrains/idea/maven/navigator/actions/EditMavenRunConfigurationAction.java b/plugins/maven/src/main/java/org/jetbrains/idea/maven/navigator/actions/EditMavenRunConfigurationAction.java index 0ea7fc5dab71..9f1e4b0ab8fd 100644 --- a/plugins/maven/src/main/java/org/jetbrains/idea/maven/navigator/actions/EditMavenRunConfigurationAction.java +++ b/plugins/maven/src/main/java/org/jetbrains/idea/maven/navigator/actions/EditMavenRunConfigurationAction.java @@ -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; diff --git a/plugins/maven/src/main/java/org/jetbrains/idea/maven/navigator/actions/MavenRunConfigurationMenu.java b/plugins/maven/src/main/java/org/jetbrains/idea/maven/navigator/actions/MavenRunConfigurationMenu.java index eb5c22f642b3..47653f54633d 100644 --- a/plugins/maven/src/main/java/org/jetbrains/idea/maven/navigator/actions/MavenRunConfigurationMenu.java +++ b/plugins/maven/src/main/java/org/jetbrains/idea/maven/navigator/actions/MavenRunConfigurationMenu.java @@ -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()); diff --git a/plugins/maven/src/main/java/org/jetbrains/idea/maven/navigator/actions/RemoveMavenRunConfigurationAction.java b/plugins/maven/src/main/java/org/jetbrains/idea/maven/navigator/actions/RemoveMavenRunConfigurationAction.java index f28c101fe204..aa658255cc0f 100644 --- a/plugins/maven/src/main/java/org/jetbrains/idea/maven/navigator/actions/RemoveMavenRunConfigurationAction.java +++ b/plugins/maven/src/main/java/org/jetbrains/idea/maven/navigator/actions/RemoveMavenRunConfigurationAction.java @@ -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;