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:
@@ -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();
|
||||
}
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
+5
-2
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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));
|
||||
|
||||
+2
-2
@@ -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<String> availableFavoritesLists = FavoritesManager.getInstance(project).getAvailableFavoritesListNames();
|
||||
availableFavoritesLists.remove(FavoritesTreeViewPanel.FAVORITES_LIST_NAME_DATA_KEY.getData(e.getDataContext()));
|
||||
if (availableFavoritesLists.isEmpty()) {
|
||||
|
||||
+7
-4
@@ -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();
|
||||
|
||||
@@ -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());
|
||||
|
||||
+3
-4
@@ -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);
|
||||
|
||||
+3
-5
@@ -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;
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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());
|
||||
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
@@ -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<GrTy
|
||||
|
||||
IdeView view = LangDataKeys.IDE_VIEW.getData(e.getDataContext());
|
||||
if (view == null) return;
|
||||
Project project = CommonDataKeys.PROJECT.getData(e.getDataContext());
|
||||
Project project = e.getProject();
|
||||
if (project == null) return;
|
||||
|
||||
ProjectFileIndex projectFileIndex = ProjectRootManager.getInstance(project).getFileIndex();
|
||||
|
||||
+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.
|
||||
@@ -18,7 +18,6 @@ package org.jetbrains.plugins.groovy.doc.actions;
|
||||
import com.intellij.ide.util.PackageChooserDialog;
|
||||
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.psi.PsiPackage;
|
||||
@@ -42,7 +41,7 @@ public class GroovyDocAddPackageAction extends AnAction implements DumbAware {
|
||||
|
||||
@Override
|
||||
public void actionPerformed(final AnActionEvent e) {
|
||||
final Project project = CommonDataKeys.PROJECT.getData(e.getDataContext());
|
||||
final Project project = e.getProject();
|
||||
|
||||
PackageChooserDialog chooser = new PackageChooserDialog("Choose packages", project);
|
||||
chooser.show();
|
||||
|
||||
Reference in New Issue
Block a user