From e7f4e37d8a86e9007b1145de551c867dce506aa4 Mon Sep 17 00:00:00 2001 From: Konstantin Bulenkov Date: Tue, 24 May 2016 02:10:03 +0200 Subject: [PATCH] simplify getting project from AnActionEvent --- .../ide/actions/ShowStructureSettingsAction.java | 5 ++--- .../intellij/internal/ExpressionStatisticsAction.java | 4 ++-- .../intellij/refactoring/actions/MigrateAction.java | 8 +++----- .../src/com/intellij/unscramble/UnscrambleAction.java | 4 ++-- .../intellij/ide/actions/EditFileTemplatesAction.java | 6 ++---- .../com/intellij/ide/actions/NewElementAction.java | 4 ++-- .../ide/actions/QuickChangeCodeStyleSchemeAction.java | 7 +++++-- .../intellij/ide/actions/TogglePopupHintsAction.java | 2 +- .../actions/SendToFavoritesGroup.java | 4 ++-- .../actions/CreateFromTemplateGroup.java | 11 +++++++---- .../ide/hierarchy/HierarchyBrowserBaseEx.java | 5 ++--- .../ActivateNavigationBarAction.java | 7 +++---- .../projectView/actions/ChangeProjectViewAction.java | 8 +++----- .../internal/DumpConfigurationTypesAction.java | 5 ++--- .../com/intellij/internal/LoadAllContentsAction.java | 5 ++--- .../com/intellij/tools/ScanSourceCommentsAction.java | 5 ++--- .../intellij/unscramble/AnalyzeStacktraceAction.java | 5 ++--- .../plugins/groovy/actions/NewGroovyClassAction.java | 9 ++++++--- .../groovy/doc/actions/GroovyDocAddPackageAction.java | 5 ++--- 19 files changed, 52 insertions(+), 57 deletions(-) diff --git a/java/idea-ui/src/com/intellij/ide/actions/ShowStructureSettingsAction.java b/java/idea-ui/src/com/intellij/ide/actions/ShowStructureSettingsAction.java index 025608265e1e..2a0de25cb312 100644 --- a/java/idea-ui/src/com/intellij/ide/actions/ShowStructureSettingsAction.java +++ b/java/idea-ui/src/com/intellij/ide/actions/ShowStructureSettingsAction.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.options.ex.SingleConfigurableEditor; import com.intellij.openapi.options.newEditor.SettingsDialog; import com.intellij.openapi.project.DumbAware; @@ -29,7 +28,7 @@ import org.jetbrains.annotations.NotNull; public class ShowStructureSettingsAction extends AnAction implements DumbAware { @Override public void actionPerformed(AnActionEvent e) { - Project project = CommonDataKeys.PROJECT.getData(e.getDataContext()); + Project project = e.getProject(); if (project == null) { project = ProjectManager.getInstance().getDefaultProject(); } diff --git a/java/java-impl/src/com/intellij/internal/ExpressionStatisticsAction.java b/java/java-impl/src/com/intellij/internal/ExpressionStatisticsAction.java index 646ed542cd58..0b4e7836f9bc 100644 --- a/java/java-impl/src/com/intellij/internal/ExpressionStatisticsAction.java +++ b/java/java-impl/src/com/intellij/internal/ExpressionStatisticsAction.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. @@ -40,7 +40,7 @@ import java.util.List; public class ExpressionStatisticsAction extends AnAction { @Override public void actionPerformed(AnActionEvent e) { - final Project project = CommonDataKeys.PROJECT.getData(e.getDataContext()); + final Project project = e.getProject(); assert project != null; final Data topLevelData = new Data(); diff --git a/java/java-impl/src/com/intellij/refactoring/actions/MigrateAction.java b/java/java-impl/src/com/intellij/refactoring/actions/MigrateAction.java index c0ff04d4c55f..07b454bfd8e7 100644 --- a/java/java-impl/src/com/intellij/refactoring/actions/MigrateAction.java +++ b/java/java-impl/src/com/intellij/refactoring/actions/MigrateAction.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,21 +18,19 @@ package com.intellij.refactoring.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.refactoring.RefactoringManager; public class MigrateAction extends AnAction { public void actionPerformed(AnActionEvent e) { - Project project = CommonDataKeys.PROJECT.getData(e.getDataContext()); + Project project = e.getProject(); RefactoringManager.getInstance(project).getMigrateManager().showMigrationDialog(); } public void update(AnActionEvent event){ Presentation presentation = event.getPresentation(); - Project project = CommonDataKeys.PROJECT.getData(event.getDataContext()); + Project project = event.getProject(); presentation.setEnabled(project != null); } } diff --git a/java/java-impl/src/com/intellij/unscramble/UnscrambleAction.java b/java/java-impl/src/com/intellij/unscramble/UnscrambleAction.java index 0edb064c4299..ed3a0fe8c1a5 100644 --- a/java/java-impl/src/com/intellij/unscramble/UnscrambleAction.java +++ b/java/java-impl/src/com/intellij/unscramble/UnscrambleAction.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. @@ -63,7 +63,7 @@ public final class UnscrambleAction extends AnAction implements DumbAware { public void update(AnActionEvent event) { final Presentation presentation = event.getPresentation(); - final Project project = CommonDataKeys.PROJECT.getData(event.getDataContext()); + final Project project = event.getProject(); presentation.setEnabled(project != null); } } diff --git a/platform/lang-impl/src/com/intellij/ide/actions/EditFileTemplatesAction.java b/platform/lang-impl/src/com/intellij/ide/actions/EditFileTemplatesAction.java index b5aaa5460973..b82c4d003b28 100644 --- a/platform/lang-impl/src/com/intellij/ide/actions/EditFileTemplatesAction.java +++ b/platform/lang-impl/src/com/intellij/ide/actions/EditFileTemplatesAction.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. @@ -19,8 +19,6 @@ package com.intellij.ide.actions; import com.intellij.ide.fileTemplates.ui.ConfigureTemplatesDialog; import com.intellij.openapi.actionSystem.AnAction; import com.intellij.openapi.actionSystem.AnActionEvent; -import com.intellij.openapi.actionSystem.CommonDataKeys; -import com.intellij.openapi.actionSystem.PlatformDataKeys; public class EditFileTemplatesAction extends AnAction{ public EditFileTemplatesAction(String text) { @@ -29,7 +27,7 @@ public class EditFileTemplatesAction extends AnAction{ @Override public void actionPerformed(AnActionEvent e){ - ConfigureTemplatesDialog dialog = new ConfigureTemplatesDialog(CommonDataKeys.PROJECT.getData(e.getDataContext())); + ConfigureTemplatesDialog dialog = new ConfigureTemplatesDialog(e.getProject()); dialog.show(); } } diff --git a/platform/lang-impl/src/com/intellij/ide/actions/NewElementAction.java b/platform/lang-impl/src/com/intellij/ide/actions/NewElementAction.java index 51358e3569f9..8e5722cacaf6 100644 --- a/platform/lang-impl/src/com/intellij/ide/actions/NewElementAction.java +++ b/platform/lang-impl/src/com/intellij/ide/actions/NewElementAction.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. @@ -85,7 +85,7 @@ public class NewElementAction extends AnAction implements DumbAware, PopupActio @Override public void update(AnActionEvent 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/lang-impl/src/com/intellij/ide/actions/QuickChangeCodeStyleSchemeAction.java b/platform/lang-impl/src/com/intellij/ide/actions/QuickChangeCodeStyleSchemeAction.java index 1bd25660d996..f8e9e1792fa0 100644 --- a/platform/lang-impl/src/com/intellij/ide/actions/QuickChangeCodeStyleSchemeAction.java +++ b/platform/lang-impl/src/com/intellij/ide/actions/QuickChangeCodeStyleSchemeAction.java @@ -15,7 +15,10 @@ */ package com.intellij.ide.actions; -import com.intellij.openapi.actionSystem.*; +import com.intellij.openapi.actionSystem.AnAction; +import com.intellij.openapi.actionSystem.AnActionEvent; +import com.intellij.openapi.actionSystem.DataContext; +import com.intellij.openapi.actionSystem.DefaultActionGroup; import com.intellij.openapi.editor.EditorFactory; import com.intellij.openapi.project.DumbAwareAction; import com.intellij.openapi.project.Project; @@ -77,6 +80,6 @@ public class QuickChangeCodeStyleSchemeAction extends QuickSwitchSchemeAction { @Override public void update(@NotNull AnActionEvent e) { super.update(e); - e.getPresentation().setEnabled(CommonDataKeys.PROJECT.getData(e.getDataContext()) != null); + e.getPresentation().setEnabled(e.getProject() != null); } } diff --git a/platform/lang-impl/src/com/intellij/ide/actions/TogglePopupHintsAction.java b/platform/lang-impl/src/com/intellij/ide/actions/TogglePopupHintsAction.java index a731d901b635..33cc96bd8bc7 100644 --- a/platform/lang-impl/src/com/intellij/ide/actions/TogglePopupHintsAction.java +++ b/platform/lang-impl/src/com/intellij/ide/actions/TogglePopupHintsAction.java @@ -56,7 +56,7 @@ public class TogglePopupHintsAction extends AnAction{ public void actionPerformed(AnActionEvent e){ PsiFile psiFile=getTargetFile(e.getDataContext()); LOG.assertTrue(psiFile!=null); - Project project = CommonDataKeys.PROJECT.getData(e.getDataContext()); + Project project = e.getProject(); LOG.assertTrue(project!=null); DaemonCodeAnalyzer codeAnalyzer = DaemonCodeAnalyzer.getInstance(project); codeAnalyzer.setImportHintsEnabled(psiFile,!codeAnalyzer.isImportHintsEnabled(psiFile)); diff --git a/platform/lang-impl/src/com/intellij/ide/favoritesTreeView/actions/SendToFavoritesGroup.java b/platform/lang-impl/src/com/intellij/ide/favoritesTreeView/actions/SendToFavoritesGroup.java index ac563cf3f7ed..22fe9867174f 100644 --- a/platform/lang-impl/src/com/intellij/ide/favoritesTreeView/actions/SendToFavoritesGroup.java +++ b/platform/lang-impl/src/com/intellij/ide/favoritesTreeView/actions/SendToFavoritesGroup.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. @@ -40,7 +40,7 @@ public class SendToFavoritesGroup extends ActionGroup implements DumbAware { if (e == null) { return EMPTY_ARRAY; } - final Project project = CommonDataKeys.PROJECT.getData(e.getDataContext()); + final Project project = e.getProject(); final List availableFavoritesLists = FavoritesManager.getInstance(project).getAvailableFavoritesListNames(); availableFavoritesLists.remove(FavoritesTreeViewPanel.FAVORITES_LIST_NAME_DATA_KEY.getData(e.getDataContext())); if (availableFavoritesLists.isEmpty()) { diff --git a/platform/lang-impl/src/com/intellij/ide/fileTemplates/actions/CreateFromTemplateGroup.java b/platform/lang-impl/src/com/intellij/ide/fileTemplates/actions/CreateFromTemplateGroup.java index 5850e939c398..da2b1ab145e5 100644 --- a/platform/lang-impl/src/com/intellij/ide/fileTemplates/actions/CreateFromTemplateGroup.java +++ b/platform/lang-impl/src/com/intellij/ide/fileTemplates/actions/CreateFromTemplateGroup.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. @@ -33,7 +33,10 @@ import com.intellij.psi.PsiDirectory; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; -import java.util.*; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collection; +import java.util.List; public class CreateFromTemplateGroup extends ActionGroup implements DumbAware { @@ -41,7 +44,7 @@ public class CreateFromTemplateGroup extends ActionGroup implements DumbAware { public 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) { FileTemplate[] allTemplates = FileTemplateManager.getInstance(project).getAllTemplates(); for (FileTemplate template : allTemplates) { @@ -58,7 +61,7 @@ public class CreateFromTemplateGroup extends ActionGroup implements DumbAware { @NotNull public AnAction[] getChildren(@Nullable AnActionEvent e){ if (e == null) return EMPTY_ARRAY; - Project project = CommonDataKeys.PROJECT.getData(e.getDataContext()); + Project project = e.getProject(); if (project == null || project.isDisposed()) return EMPTY_ARRAY; FileTemplateManager manager = FileTemplateManager.getInstance(project); FileTemplate[] templates = manager.getAllTemplates(); diff --git a/platform/lang-impl/src/com/intellij/ide/hierarchy/HierarchyBrowserBaseEx.java b/platform/lang-impl/src/com/intellij/ide/hierarchy/HierarchyBrowserBaseEx.java index 0c09f5bf5986..ef8abfa90ef7 100644 --- a/platform/lang-impl/src/com/intellij/ide/hierarchy/HierarchyBrowserBaseEx.java +++ b/platform/lang-impl/src/com/intellij/ide/hierarchy/HierarchyBrowserBaseEx.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. @@ -28,7 +28,6 @@ import com.intellij.ide.projectView.impl.ProjectViewTree; import com.intellij.ide.util.scopeChooser.EditScopesDialog; import com.intellij.ide.util.treeView.NodeDescriptor; import com.intellij.lang.LanguageExtension; -import com.intellij.openapi.Disposable; import com.intellij.openapi.actionSystem.*; import com.intellij.openapi.actionSystem.ex.ComboBoxAction; import com.intellij.openapi.application.ApplicationManager; @@ -633,7 +632,7 @@ public abstract class HierarchyBrowserBaseEx extends HierarchyBrowserBase implem @Override public final void update(final AnActionEvent e) { final Presentation presentation = e.getPresentation(); - final Project project = CommonDataKeys.PROJECT.getData(e.getDataContext()); + final Project project = e.getProject(); if (project == null) return; presentation.setEnabled(isEnabled()); presentation.setText(getCurrentScopeType()); diff --git a/platform/lang-impl/src/com/intellij/ide/navigationToolbar/ActivateNavigationBarAction.java b/platform/lang-impl/src/com/intellij/ide/navigationToolbar/ActivateNavigationBarAction.java index 869fd1800e3e..bf8b14aa636c 100644 --- a/platform/lang-impl/src/com/intellij/ide/navigationToolbar/ActivateNavigationBarAction.java +++ b/platform/lang-impl/src/com/intellij/ide/navigationToolbar/ActivateNavigationBarAction.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. @@ -18,7 +18,6 @@ package com.intellij.ide.navigationToolbar; import com.intellij.ide.ui.UISettings; 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.wm.ex.WindowManagerEx; @@ -35,7 +34,7 @@ import javax.swing.*; public class ActivateNavigationBarAction extends AnAction implements DumbAware { @Override public void actionPerformed(@NotNull AnActionEvent e) { - final Project project = CommonDataKeys.PROJECT.getData(e.getDataContext()); + final Project project = e.getProject(); if (project != null && UISettings.getInstance().SHOW_NAVIGATION_BAR) { final IdeFrameImpl frame = WindowManagerEx.getInstanceEx().getFrame(project); final IdeRootPane ideRootPane = (IdeRootPane)frame.getRootPane(); @@ -49,7 +48,7 @@ public class ActivateNavigationBarAction extends AnAction implements DumbAware { @Override public void update(@NotNull AnActionEvent e) { - final Project project = CommonDataKeys.PROJECT.getData(e.getDataContext()); + final Project project = e.getProject(); UISettings settings = UISettings.getInstance(); final boolean enabled = project != null && settings.SHOW_NAVIGATION_BAR && !settings.PRESENTATION_MODE; e.getPresentation().setEnabled(enabled); diff --git a/platform/lang-impl/src/com/intellij/ide/projectView/actions/ChangeProjectViewAction.java b/platform/lang-impl/src/com/intellij/ide/projectView/actions/ChangeProjectViewAction.java index 2b50107eab26..8586392ad443 100644 --- a/platform/lang-impl/src/com/intellij/ide/projectView/actions/ChangeProjectViewAction.java +++ b/platform/lang-impl/src/com/intellij/ide/projectView/actions/ChangeProjectViewAction.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. @@ -19,8 +19,6 @@ package com.intellij.ide.projectView.actions; import com.intellij.ide.projectView.ProjectView; 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.wm.ToolWindowId; @@ -29,7 +27,7 @@ import com.intellij.openapi.wm.ToolWindowManager; public final class ChangeProjectViewAction extends AnAction { @Override public void actionPerformed(AnActionEvent e) { - Project project = CommonDataKeys.PROJECT.getData(e.getDataContext()); + Project project = e.getProject(); if (project == null) { return; } @@ -40,7 +38,7 @@ public final class ChangeProjectViewAction extends AnAction { @Override 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/lang-impl/src/com/intellij/internal/DumpConfigurationTypesAction.java b/platform/lang-impl/src/com/intellij/internal/DumpConfigurationTypesAction.java index fc616f8511f5..0b08ea3cd2cb 100644 --- a/platform/lang-impl/src/com/intellij/internal/DumpConfigurationTypesAction.java +++ b/platform/lang-impl/src/com/intellij/internal/DumpConfigurationTypesAction.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. @@ -25,7 +25,6 @@ import com.intellij.execution.configurations.ConfigurationType; 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; @@ -36,7 +35,7 @@ public class DumpConfigurationTypesAction extends AnAction implements DumbAware @Override public void actionPerformed(AnActionEvent e) { - final Project project = CommonDataKeys.PROJECT.getData(e.getDataContext()); + final Project project = e.getProject(); final ConfigurationType[] factories = RunManager.getInstance(project).getConfigurationFactories(); for (ConfigurationType factory : factories) { diff --git a/platform/lang-impl/src/com/intellij/internal/LoadAllContentsAction.java b/platform/lang-impl/src/com/intellij/internal/LoadAllContentsAction.java index 1530faecb949..a329596375a1 100644 --- a/platform/lang-impl/src/com/intellij/internal/LoadAllContentsAction.java +++ b/platform/lang-impl/src/com/intellij/internal/LoadAllContentsAction.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. @@ -23,7 +23,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.actionSystem.PlatformDataKeys; import com.intellij.openapi.application.ex.ApplicationManagerEx; import com.intellij.openapi.diagnostic.Logger; import com.intellij.openapi.progress.ProgressManager; @@ -54,7 +53,7 @@ public class LoadAllContentsAction extends AnAction implements DumbAware { @Override public void actionPerformed(AnActionEvent e) { - final Project project = CommonDataKeys.PROJECT.getData(e.getDataContext()); + final Project project = e.getProject(); String m = "Started loading content"; LOG.info(m); System.out.println(m); diff --git a/platform/lang-impl/src/com/intellij/tools/ScanSourceCommentsAction.java b/platform/lang-impl/src/com/intellij/tools/ScanSourceCommentsAction.java index abfbee9b4af5..c4a6b9ab2744 100644 --- a/platform/lang-impl/src/com/intellij/tools/ScanSourceCommentsAction.java +++ b/platform/lang-impl/src/com/intellij/tools/ScanSourceCommentsAction.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. @@ -21,7 +21,6 @@ package com.intellij.tools; 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.diagnostic.Logger; import com.intellij.openapi.fileTypes.LanguageFileType; @@ -49,7 +48,7 @@ public class ScanSourceCommentsAction extends AnAction { @Override public void actionPerformed(AnActionEvent e) { - final Project p = CommonDataKeys.PROJECT.getData(e.getDataContext()); + final Project p = e.getProject(); final String file = Messages.showInputDialog(p, "Enter path to the file comments will be extracted to", "Comments File Path", Messages.getQuestionIcon()); diff --git a/platform/lang-impl/src/com/intellij/unscramble/AnalyzeStacktraceAction.java b/platform/lang-impl/src/com/intellij/unscramble/AnalyzeStacktraceAction.java index 9b0692d98fe2..2eec36a0d1aa 100644 --- a/platform/lang-impl/src/com/intellij/unscramble/AnalyzeStacktraceAction.java +++ b/platform/lang-impl/src/com/intellij/unscramble/AnalyzeStacktraceAction.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. @@ -19,7 +19,6 @@ package com.intellij.unscramble; 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; @@ -32,7 +31,7 @@ import com.intellij.openapi.project.Project; public class AnalyzeStacktraceAction extends AnAction implements DumbAware { @Override public void actionPerformed(AnActionEvent e) { - Project project = CommonDataKeys.PROJECT.getData(e.getDataContext()); + Project project = e.getProject(); AnalyzeStacktraceDialog dialog = new AnalyzeStacktraceDialog(project); dialog.show(); } diff --git a/plugins/groovy/src/org/jetbrains/plugins/groovy/actions/NewGroovyClassAction.java b/plugins/groovy/src/org/jetbrains/plugins/groovy/actions/NewGroovyClassAction.java index 5e64ac85952e..5ea9b1bcd4ba 100644 --- a/plugins/groovy/src/org/jetbrains/plugins/groovy/actions/NewGroovyClassAction.java +++ b/plugins/groovy/src/org/jetbrains/plugins/groovy/actions/NewGroovyClassAction.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. @@ -21,7 +21,10 @@ import com.intellij.ide.actions.CreateFileFromTemplateDialog; import com.intellij.ide.actions.JavaCreateTemplateInPackageAction; import com.intellij.ide.fileTemplates.FileTemplate; import com.intellij.ide.fileTemplates.FileTemplateManager; -import com.intellij.openapi.actionSystem.*; +import com.intellij.openapi.actionSystem.AnActionEvent; +import com.intellij.openapi.actionSystem.DataContext; +import com.intellij.openapi.actionSystem.LangDataKeys; +import com.intellij.openapi.actionSystem.Presentation; import com.intellij.openapi.fileTypes.FileType; import com.intellij.openapi.fileTypes.ex.FileTypeManagerEx; import com.intellij.openapi.project.DumbAware; @@ -96,7 +99,7 @@ public class NewGroovyClassAction extends JavaCreateTemplateInPackageAction