mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
fix yellow code producing by CommonDataKeys
This commit is contained in:
@@ -365,7 +365,7 @@ final class ImageEditorUI extends JPanel implements DataProvider {
|
||||
return editor.getFile();
|
||||
} else if (PlatformDataKeys.VIRTUAL_FILE_ARRAY.is(dataId)) {
|
||||
return new VirtualFile[]{editor.getFile()};
|
||||
} else if (LangDataKeys.PSI_FILE.is(dataId)) {
|
||||
} else if (CommonDataKeys.PSI_FILE.is(dataId)) {
|
||||
return getData(CommonDataKeys.PSI_ELEMENT.getName());
|
||||
} else if (CommonDataKeys.PSI_ELEMENT.is(dataId)) {
|
||||
VirtualFile file = editor.getFile();
|
||||
|
||||
@@ -420,7 +420,7 @@ final class ThumbnailViewUI extends JPanel implements DataProvider, Disposable {
|
||||
return selectedFiles.length > 0 ? selectedFiles[0] : null;
|
||||
} else if (PlatformDataKeys.VIRTUAL_FILE_ARRAY.is(dataId)) {
|
||||
return getSelectedFiles();
|
||||
} else if (LangDataKeys.PSI_FILE.is(dataId)) {
|
||||
} else if (CommonDataKeys.PSI_FILE.is(dataId)) {
|
||||
return getData(CommonDataKeys.PSI_ELEMENT.getName());
|
||||
} else if (CommonDataKeys.PSI_ELEMENT.is(dataId)) {
|
||||
VirtualFile[] selectedFiles = getSelectedFiles();
|
||||
|
||||
@@ -32,7 +32,7 @@ public abstract class CompileActionBase extends AnAction implements DumbAware {
|
||||
return;
|
||||
}
|
||||
Editor editor = e.getData(CommonDataKeys.EDITOR);
|
||||
PsiFile file = e.getData(LangDataKeys.PSI_FILE);
|
||||
PsiFile file = e.getData(CommonDataKeys.PSI_FILE);
|
||||
if (file != null && editor != null && !DumbService.getInstance(project).isDumb()) {
|
||||
DaemonCodeAnalyzer.getInstance(project).autoImportReferenceAtCursor(editor, file); //let autoimport complete
|
||||
}
|
||||
|
||||
@@ -34,7 +34,7 @@ import com.intellij.psi.search.GlobalSearchScope;
|
||||
public class AnalysisScopeRule implements GetDataRule {
|
||||
@Override
|
||||
public Object getData(final DataProvider dataProvider) {
|
||||
final Object psiFile = dataProvider.getData(LangDataKeys.PSI_FILE.getName());
|
||||
final Object psiFile = dataProvider.getData(CommonDataKeys.PSI_FILE.getName());
|
||||
if (psiFile instanceof PsiJavaFile) {
|
||||
return new JavaAnalysisScope((PsiJavaFile)psiFile);
|
||||
}
|
||||
|
||||
@@ -45,7 +45,7 @@ public class ShowSiblingsAction extends ShowImplementationsAction {
|
||||
@Override
|
||||
public void performForContext(DataContext dataContext, final boolean invokedByShortcut) {
|
||||
final Project project = CommonDataKeys.PROJECT.getData(dataContext);
|
||||
final PsiFile file = LangDataKeys.PSI_FILE.getData(dataContext);
|
||||
final PsiFile file = CommonDataKeys.PSI_FILE.getData(dataContext);
|
||||
|
||||
if (project == null) return;
|
||||
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
package com.intellij.ide.macro;
|
||||
|
||||
import com.intellij.ide.IdeBundle;
|
||||
import com.intellij.openapi.actionSystem.CommonDataKeys;
|
||||
import com.intellij.openapi.actionSystem.DataContext;
|
||||
import com.intellij.openapi.actionSystem.LangDataKeys;
|
||||
import com.intellij.psi.PsiClass;
|
||||
@@ -44,7 +45,7 @@ public final class FileClassMacro extends Macro {
|
||||
//if (!(psiFile instanceof PsiJavaFile)) {
|
||||
// return null;
|
||||
//}
|
||||
final PsiFile javaFile = LangDataKeys.PSI_FILE.getData(dataContext);
|
||||
final PsiFile javaFile = CommonDataKeys.PSI_FILE.getData(dataContext);
|
||||
if (!(javaFile instanceof PsiJavaFile)) return null;
|
||||
PsiClass[] classes = ((PsiJavaFile) javaFile).getClasses();
|
||||
if (classes.length == 1) {
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
package com.intellij.ide.macro;
|
||||
|
||||
import com.intellij.ide.IdeBundle;
|
||||
import com.intellij.openapi.actionSystem.CommonDataKeys;
|
||||
import com.intellij.openapi.actionSystem.DataContext;
|
||||
import com.intellij.openapi.actionSystem.LangDataKeys;
|
||||
import com.intellij.psi.JavaDirectoryService;
|
||||
@@ -41,7 +42,7 @@ public final class FilePackageMacro extends Macro {
|
||||
|
||||
@Nullable
|
||||
static PsiPackage getFilePackage(DataContext dataContext) {
|
||||
PsiFile psiFile = LangDataKeys.PSI_FILE.getData(dataContext);
|
||||
PsiFile psiFile = CommonDataKeys.PSI_FILE.getData(dataContext);
|
||||
if (psiFile == null) return null;
|
||||
PsiDirectory containingDirectory = psiFile.getContainingDirectory();
|
||||
if (containingDirectory == null || !containingDirectory.isValid()) return null;
|
||||
|
||||
@@ -87,7 +87,7 @@ public class JavadocNavigationDelegate extends EditorNavigationDelegateAdapter {
|
||||
}
|
||||
|
||||
final Document document = editor.getDocument();
|
||||
PsiFile psiFile = LangDataKeys.PSI_FILE.getData(dataContext);
|
||||
PsiFile psiFile = CommonDataKeys.PSI_FILE.getData(dataContext);
|
||||
if (psiFile == null) {
|
||||
psiFile = PsiDocumentManager.getInstance(project).getPsiFile(document);
|
||||
}
|
||||
|
||||
@@ -30,7 +30,7 @@ public class RenameFileAction extends AnAction implements DumbAware {
|
||||
public static final String RENAME_FILE = "Rename File...";
|
||||
|
||||
public void actionPerformed(final AnActionEvent e) {
|
||||
final PsiFile file = e.getData(LangDataKeys.PSI_FILE);
|
||||
final PsiFile file = e.getData(CommonDataKeys.PSI_FILE);
|
||||
assert file != null;
|
||||
final VirtualFile virtualFile = file.getVirtualFile();
|
||||
assert virtualFile != null;
|
||||
@@ -40,7 +40,7 @@ public class RenameFileAction extends AnAction implements DumbAware {
|
||||
}
|
||||
|
||||
public void update(AnActionEvent e) {
|
||||
PsiFile file = e.getData(LangDataKeys.PSI_FILE);
|
||||
PsiFile file = e.getData(CommonDataKeys.PSI_FILE);
|
||||
Presentation presentation = e.getPresentation();
|
||||
boolean enabled = file instanceof PsiClassOwner && e.getPlace() != ActionPlaces.EDITOR_POPUP && e.getData(CommonDataKeys.PROJECT) != null;
|
||||
presentation.setEnabled(enabled);
|
||||
|
||||
@@ -61,7 +61,7 @@ public class ExtractMethodHandler implements RefactoringActionHandler {
|
||||
|
||||
public void invoke(@NotNull Project project, @NotNull PsiElement[] elements, DataContext dataContext) {
|
||||
if (dataContext != null) {
|
||||
final PsiFile file = LangDataKeys.PSI_FILE.getData(dataContext);
|
||||
final PsiFile file = CommonDataKeys.PSI_FILE.getData(dataContext);
|
||||
final Editor editor = CommonDataKeys.EDITOR.getData(dataContext);
|
||||
if (file != null && editor != null) {
|
||||
invokeOnElements(project, editor, file, elements);
|
||||
|
||||
@@ -33,7 +33,7 @@ public class RenameWrongRefHandler implements RenameHandler {
|
||||
|
||||
public final boolean isAvailableOnDataContext(final DataContext dataContext) {
|
||||
final Editor editor = CommonDataKeys.EDITOR.getData(dataContext);
|
||||
final PsiFile file = LangDataKeys.PSI_FILE.getData(dataContext);
|
||||
final PsiFile file = CommonDataKeys.PSI_FILE.getData(dataContext);
|
||||
final Project project = CommonDataKeys.PROJECT.getData(dataContext);
|
||||
if (editor == null || file == null || project == null) return false;
|
||||
return isAvailable(project, editor, file);
|
||||
|
||||
@@ -176,7 +176,7 @@ public class TempWithQueryHandler implements RefactoringActionHandler {
|
||||
public void invoke(@NotNull Project project, @NotNull PsiElement[] elements, DataContext dataContext) {
|
||||
if (elements.length == 1 && elements[0] instanceof PsiLocalVariable) {
|
||||
if (dataContext != null) {
|
||||
final PsiFile file = LangDataKeys.PSI_FILE.getData(dataContext);
|
||||
final PsiFile file = CommonDataKeys.PSI_FILE.getData(dataContext);
|
||||
final Editor editor = CommonDataKeys.EDITOR.getData(dataContext);
|
||||
if (file != null && editor != null) {
|
||||
invokeOnVariable(file, project, (PsiLocalVariable)elements[0], editor);
|
||||
|
||||
+1
-1
@@ -61,7 +61,7 @@ public class BaseGenerateTestSupportMethodAction extends BaseGenerateAction {
|
||||
public AnAction createEditTemplateAction(DataContext dataContext) {
|
||||
final Project project = CommonDataKeys.PROJECT.getData(dataContext);
|
||||
final Editor editor = CommonDataKeys.EDITOR.getData(dataContext);
|
||||
final PsiFile file = LangDataKeys.PSI_FILE.getData(dataContext);
|
||||
final PsiFile file = CommonDataKeys.PSI_FILE.getData(dataContext);
|
||||
final PsiClass targetClass = editor == null || file == null ? null : getTargetClass(editor, file);
|
||||
if (targetClass != null) {
|
||||
final List<TestFramework> frameworks = TestIntegrationUtils.findSuitableFrameworks(targetClass);
|
||||
|
||||
@@ -149,7 +149,7 @@ public abstract class BaseAnalysisAction extends AnAction {
|
||||
return analysisScope;
|
||||
}
|
||||
|
||||
final PsiFile psiFile = LangDataKeys.PSI_FILE.getData(dataContext);
|
||||
final PsiFile psiFile = CommonDataKeys.PSI_FILE.getData(dataContext);
|
||||
if (psiFile != null && psiFile.getManager().isInProject(psiFile)) {
|
||||
final VirtualFile file = psiFile.getVirtualFile();
|
||||
if (file != null && file.isValid() && file.getFileType() instanceof ArchiveFileType && acceptNonProjectDirectories()) {
|
||||
|
||||
+1
-1
@@ -45,7 +45,7 @@ public class RearrangeCodeAction extends AnAction {
|
||||
|
||||
@Override
|
||||
public void update(AnActionEvent e) {
|
||||
PsiFile file = LangDataKeys.PSI_FILE.getData(e.getDataContext());
|
||||
PsiFile file = CommonDataKeys.PSI_FILE.getData(e.getDataContext());
|
||||
boolean enabled = file != null && Rearranger.EXTENSION.forLanguage(file.getLanguage()) != null;
|
||||
e.getPresentation().setEnabled(enabled);
|
||||
}
|
||||
|
||||
@@ -53,7 +53,7 @@ public class ExportToHTMLAction extends AnAction {
|
||||
presentation.setEnabled(true);
|
||||
return;
|
||||
}
|
||||
PsiFile psiFile = LangDataKeys.PSI_FILE.getData(dataContext);
|
||||
PsiFile psiFile = CommonDataKeys.PSI_FILE.getData(dataContext);
|
||||
presentation.setEnabled(psiFile != null && psiFile.getContainingDirectory() != null);
|
||||
}
|
||||
|
||||
|
||||
@@ -57,7 +57,7 @@ class ExportToHTMLManager {
|
||||
if(psiElement instanceof PsiDirectory) {
|
||||
psiDirectory = (PsiDirectory)psiElement;
|
||||
}
|
||||
final PsiFile psiFile = LangDataKeys.PSI_FILE.getData(dataContext);
|
||||
final PsiFile psiFile = CommonDataKeys.PSI_FILE.getData(dataContext);
|
||||
Project project = CommonDataKeys.PROJECT.getData(dataContext);
|
||||
String shortFileName = null;
|
||||
String directoryName = null;
|
||||
|
||||
@@ -49,7 +49,7 @@ public class PrintAction extends AnAction implements DumbAware {
|
||||
return;
|
||||
}
|
||||
Editor editor = CommonDataKeys.EDITOR.getData(dataContext);
|
||||
PsiFile psiFile = LangDataKeys.PSI_FILE.getData(dataContext);
|
||||
PsiFile psiFile = CommonDataKeys.PSI_FILE.getData(dataContext);
|
||||
presentation.setEnabled(psiFile != null || editor != null);
|
||||
}
|
||||
|
||||
|
||||
@@ -59,7 +59,7 @@ class PrintManager {
|
||||
psiDirectory[0] = (PsiDirectory)psiElement;
|
||||
}
|
||||
|
||||
PsiFile psiFile = LangDataKeys.PSI_FILE.getData(dataContext);
|
||||
PsiFile psiFile = CommonDataKeys.PSI_FILE.getData(dataContext);
|
||||
String[] shortFileName = new String[1];
|
||||
String[] directoryName = new String[1];
|
||||
if (psiFile != null || psiDirectory[0] != null) {
|
||||
|
||||
@@ -22,6 +22,7 @@ package com.intellij.codeInsight.daemon.impl;
|
||||
|
||||
import com.intellij.openapi.actionSystem.AnAction;
|
||||
import com.intellij.openapi.actionSystem.AnActionEvent;
|
||||
import com.intellij.openapi.actionSystem.CommonDataKeys;
|
||||
import com.intellij.openapi.actionSystem.DataContext;
|
||||
import com.intellij.openapi.actionSystem.LangDataKeys;
|
||||
import com.intellij.openapi.ui.popup.JBPopupFactory;
|
||||
@@ -32,12 +33,12 @@ public class PopupHectorAction extends AnAction {
|
||||
@Override
|
||||
public void actionPerformed(final AnActionEvent e) {
|
||||
final DataContext dataContext = e.getDataContext();
|
||||
final PsiFile file = LangDataKeys.PSI_FILE.getData(dataContext);
|
||||
final PsiFile file = CommonDataKeys.PSI_FILE.getData(dataContext);
|
||||
new HectorComponent(file).showComponent(JBPopupFactory.getInstance().guessBestPopupLocation(dataContext));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update(final AnActionEvent e) {
|
||||
e.getPresentation().setEnabled(LangDataKeys.PSI_FILE.getData(e.getDataContext()) != null);
|
||||
e.getPresentation().setEnabled(CommonDataKeys.PSI_FILE.getData(e.getDataContext()) != null);
|
||||
}
|
||||
}
|
||||
+1
-1
@@ -64,7 +64,7 @@ public class FixDocCommentAction extends EditorAction {
|
||||
return;
|
||||
}
|
||||
|
||||
PsiFile psiFile = LangDataKeys.PSI_FILE.getData(dataContext);
|
||||
PsiFile psiFile = CommonDataKeys.PSI_FILE.getData(dataContext);
|
||||
if (psiFile == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
+2
-2
@@ -84,7 +84,7 @@ public class ShowImplementationsAction extends AnAction implements PopupAction {
|
||||
Editor editor = CommonDataKeys.EDITOR.getData(dataContext);
|
||||
|
||||
if (editor == null) {
|
||||
final PsiFile file = LangDataKeys.PSI_FILE.getData(dataContext);
|
||||
final PsiFile file = CommonDataKeys.PSI_FILE.getData(dataContext);
|
||||
if (file != null) {
|
||||
final FileEditor fileEditor = FileEditorManager.getInstance(file.getProject()).getSelectedEditor(file.getVirtualFile());
|
||||
if (fileEditor instanceof TextEditor) {
|
||||
@@ -97,7 +97,7 @@ public class ShowImplementationsAction extends AnAction implements PopupAction {
|
||||
|
||||
public void performForContext(DataContext dataContext, boolean invokedByShortcut) {
|
||||
final Project project = CommonDataKeys.PROJECT.getData(dataContext);
|
||||
PsiFile file = LangDataKeys.PSI_FILE.getData(dataContext);
|
||||
PsiFile file = CommonDataKeys.PSI_FILE.getData(dataContext);
|
||||
|
||||
if (project == null) return;
|
||||
|
||||
|
||||
+2
-2
@@ -55,7 +55,7 @@ public class SaveAsTemplateAction extends AnAction {
|
||||
public void actionPerformed(AnActionEvent e) {
|
||||
DataContext dataContext = e.getDataContext();
|
||||
final Editor editor = CommonDataKeys.EDITOR.getData(dataContext);
|
||||
PsiFile file = LangDataKeys.PSI_FILE.getData(dataContext);
|
||||
PsiFile file = CommonDataKeys.PSI_FILE.getData(dataContext);
|
||||
|
||||
final Project project = file.getProject();
|
||||
PsiDocumentManager.getInstance(project).commitAllDocuments();
|
||||
@@ -154,7 +154,7 @@ public class SaveAsTemplateAction extends AnAction {
|
||||
public void update(AnActionEvent e) {
|
||||
DataContext dataContext = e.getDataContext();
|
||||
Editor editor = CommonDataKeys.EDITOR.getData(dataContext);
|
||||
PsiFile file = LangDataKeys.PSI_FILE.getData(dataContext);
|
||||
PsiFile file = CommonDataKeys.PSI_FILE.getData(dataContext);
|
||||
|
||||
if (file == null || editor == null) {
|
||||
e.getPresentation().setEnabled(false);
|
||||
|
||||
+2
-2
@@ -36,7 +36,7 @@ public class CodeInspectionOnEditorAction extends AnAction {
|
||||
if (project == null){
|
||||
return;
|
||||
}
|
||||
PsiFile psiFile = LangDataKeys.PSI_FILE.getData(dataContext);
|
||||
PsiFile psiFile = CommonDataKeys.PSI_FILE.getData(dataContext);
|
||||
if (psiFile != null){
|
||||
analyze(project, psiFile);
|
||||
}
|
||||
@@ -58,7 +58,7 @@ public class CodeInspectionOnEditorAction extends AnAction {
|
||||
public void update(AnActionEvent e) {
|
||||
final DataContext dataContext = e.getDataContext();
|
||||
final Project project = CommonDataKeys.PROJECT.getData(dataContext);
|
||||
final PsiFile psiFile = LangDataKeys.PSI_FILE.getData(dataContext);
|
||||
final PsiFile psiFile = CommonDataKeys.PSI_FILE.getData(dataContext);
|
||||
e.getPresentation().setEnabled(project != null && psiFile != null && DaemonCodeAnalyzer.getInstance(project).isHighlightingAvailable(psiFile));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -62,7 +62,7 @@ public class RunInspectionAction extends GotoActionBase {
|
||||
PsiDocumentManager.getInstance(project).commitAllDocuments();
|
||||
|
||||
final PsiElement psiElement = CommonDataKeys.PSI_ELEMENT.getData(e.getDataContext());
|
||||
final PsiFile psiFile = LangDataKeys.PSI_FILE.getData(e.getDataContext());
|
||||
final PsiFile psiFile = CommonDataKeys.PSI_FILE.getData(e.getDataContext());
|
||||
final VirtualFile virtualFile = PlatformDataKeys.VIRTUAL_FILE.getData(e.getDataContext());
|
||||
|
||||
FeatureUsageTracker.getInstance().triggerFeatureUsed("navigation.goto.inspection");
|
||||
|
||||
@@ -64,7 +64,7 @@ public class ExternalJavaDocAction extends AnAction {
|
||||
}
|
||||
|
||||
|
||||
PsiFile context = LangDataKeys.PSI_FILE.getData(dataContext);
|
||||
PsiFile context = CommonDataKeys.PSI_FILE.getData(dataContext);
|
||||
Editor editor = CommonDataKeys.EDITOR.getData(dataContext);
|
||||
PsiElement originalElement = getOriginalElement(context, editor);
|
||||
DocumentationManager.storeOriginalElement(project, originalElement, element);
|
||||
@@ -113,7 +113,7 @@ public class ExternalJavaDocAction extends AnAction {
|
||||
DataContext dataContext = event.getDataContext();
|
||||
Editor editor = CommonDataKeys.EDITOR.getData(dataContext);
|
||||
final PsiElement element = CommonDataKeys.PSI_ELEMENT.getData(dataContext);
|
||||
final PsiElement originalElement = getOriginalElement(LangDataKeys.PSI_FILE.getData(dataContext), editor);
|
||||
final PsiElement originalElement = getOriginalElement(CommonDataKeys.PSI_FILE.getData(dataContext), editor);
|
||||
DocumentationManager.storeOriginalElement(CommonDataKeys.PROJECT.getData(dataContext), originalElement, element);
|
||||
final DocumentationProvider provider = DocumentationManager.getProviderFromElement(element);
|
||||
boolean enabled;
|
||||
|
||||
@@ -87,7 +87,7 @@ public abstract class GotoActionBase extends AnAction {
|
||||
|
||||
@Nullable
|
||||
public static PsiElement getPsiContext(final AnActionEvent e) {
|
||||
PsiFile file = e.getData(LangDataKeys.PSI_FILE);
|
||||
PsiFile file = e.getData(CommonDataKeys.PSI_FILE);
|
||||
if (file != null) return file;
|
||||
Project project = e.getData(PlatformDataKeys.PROJECT);
|
||||
return getPsiContext(project);
|
||||
|
||||
@@ -56,7 +56,7 @@ public class GotoRelatedFileAction extends AnAction {
|
||||
|
||||
DataContext context = e.getDataContext();
|
||||
Editor editor = CommonDataKeys.EDITOR.getData(context);
|
||||
PsiFile psiFile = LangDataKeys.PSI_FILE.getData(context);
|
||||
PsiFile psiFile = CommonDataKeys.PSI_FILE.getData(context);
|
||||
if (psiFile == null) return;
|
||||
|
||||
List<GotoRelatedItem> items = getItems(psiFile, editor, context);
|
||||
@@ -310,7 +310,7 @@ public class GotoRelatedFileAction extends AnAction {
|
||||
|
||||
@Override
|
||||
public void update(AnActionEvent e) {
|
||||
e.getPresentation().setEnabled(LangDataKeys.PSI_FILE.getData(e.getDataContext()) != null);
|
||||
e.getPresentation().setEnabled(CommonDataKeys.PSI_FILE.getData(e.getDataContext()) != null);
|
||||
}
|
||||
|
||||
private static Action createNumberAction(final int mnemonic,
|
||||
|
||||
@@ -37,7 +37,7 @@ public class NewElementToolbarAction extends NewElementAction {
|
||||
public void actionPerformed(AnActionEvent e) {
|
||||
if (e.getData(LangDataKeys.IDE_VIEW) == null) {
|
||||
final Project project = e.getData(CommonDataKeys.PROJECT);
|
||||
final PsiFileSystemItem psiFile = e.getData(LangDataKeys.PSI_FILE).getParent();
|
||||
final PsiFileSystemItem psiFile = e.getData(CommonDataKeys.PSI_FILE).getParent();
|
||||
ProjectViewImpl.getInstance(project).selectCB(psiFile, psiFile.getVirtualFile(), true).doWhenDone(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
@@ -55,7 +55,7 @@ public class NewElementToolbarAction extends NewElementAction {
|
||||
super.update(event);
|
||||
if (event.getData(LangDataKeys.IDE_VIEW) == null) {
|
||||
Project project = event.getData(CommonDataKeys.PROJECT);
|
||||
PsiFile psiFile = event.getData(LangDataKeys.PSI_FILE);
|
||||
PsiFile psiFile = event.getData(CommonDataKeys.PSI_FILE);
|
||||
if (project != null && psiFile != null) {
|
||||
final ToolWindow projectViewWindow = ToolWindowManager.getInstance(project).getToolWindow(ToolWindowId.PROJECT_VIEW);
|
||||
if (projectViewWindow.isVisible()) {
|
||||
|
||||
@@ -38,7 +38,7 @@ public class SaveFileAsTemplateAction extends AnAction{
|
||||
String nameWithoutExtension = file.getNameWithoutExtension();
|
||||
AllFileTemplatesConfigurable fileTemplateOptions = new AllFileTemplatesConfigurable();
|
||||
ConfigureTemplatesDialog dialog = new ConfigureTemplatesDialog(project, fileTemplateOptions);
|
||||
PsiFile psiFile = e.getData(LangDataKeys.PSI_FILE);
|
||||
PsiFile psiFile = e.getData(CommonDataKeys.PSI_FILE);
|
||||
for(SaveFileAsTemplateHandler handler: Extensions.getExtensions(SaveFileAsTemplateHandler.EP_NAME)) {
|
||||
String textFromHandler = handler.getTemplateText(psiFile, fileText, nameWithoutExtension);
|
||||
if (textFromHandler != null) {
|
||||
|
||||
+1
-1
@@ -121,7 +121,7 @@ public class AddToFavoritesAction extends AnAction {
|
||||
private static Object collectSelectedElements(final DataContext dataContext) {
|
||||
Object elements = retrieveData(null, CommonDataKeys.PSI_ELEMENT.getData(dataContext));
|
||||
elements = retrieveData(elements, LangDataKeys.PSI_ELEMENT_ARRAY.getData(dataContext));
|
||||
elements = retrieveData(elements, LangDataKeys.PSI_FILE.getData(dataContext));
|
||||
elements = retrieveData(elements, CommonDataKeys.PSI_FILE.getData(dataContext));
|
||||
elements = retrieveData(elements, ModuleGroup.ARRAY_DATA_KEY.getData(dataContext));
|
||||
elements = retrieveData(elements, LangDataKeys.MODULE_CONTEXT_ARRAY.getData(dataContext));
|
||||
elements = retrieveData(elements, LibraryGroupElement.ARRAY_DATA_KEY.getData(dataContext));
|
||||
|
||||
+1
-1
@@ -115,7 +115,7 @@ public abstract class BrowseHierarchyActionBase extends AnAction {
|
||||
|
||||
@Nullable
|
||||
private HierarchyProvider getProvider(final AnActionEvent e) {
|
||||
return findBestHierarchyProvider(myExtension, e.getData(LangDataKeys.PSI_FILE), e.getDataContext());
|
||||
return findBestHierarchyProvider(myExtension, e.getData(CommonDataKeys.PSI_FILE), e.getDataContext());
|
||||
}
|
||||
|
||||
@Nullable
|
||||
|
||||
@@ -87,7 +87,7 @@ public class VirtualFileArrayRule implements GetDataRule {
|
||||
|
||||
result = addFile(result, PlatformDataKeys.VIRTUAL_FILE.getData(dataProvider));
|
||||
|
||||
PsiFile psiFile = LangDataKeys.PSI_FILE.getData(dataProvider);
|
||||
PsiFile psiFile = CommonDataKeys.PSI_FILE.getData(dataProvider);
|
||||
if (psiFile != null) {
|
||||
result = addFile(result, psiFile.getVirtualFile());
|
||||
}
|
||||
|
||||
@@ -42,7 +42,7 @@ public class VirtualFileRule implements GetDataRule {
|
||||
return virtualFiles[0];
|
||||
}
|
||||
|
||||
PsiFile psiFile = LangDataKeys.PSI_FILE.getData(dataProvider);
|
||||
PsiFile psiFile = CommonDataKeys.PSI_FILE.getData(dataProvider);
|
||||
if (psiFile != null) {
|
||||
return psiFile.getVirtualFile();
|
||||
}
|
||||
|
||||
@@ -99,7 +99,7 @@ public class NavBarModel {
|
||||
|
||||
if (PlatformDataKeys.CONTEXT_COMPONENT.getData(dataContext) instanceof NavBarPanel) return;
|
||||
|
||||
PsiElement psiElement = LangDataKeys.PSI_FILE.getData(dataContext);
|
||||
PsiElement psiElement = CommonDataKeys.PSI_FILE.getData(dataContext);
|
||||
if (psiElement == null) {
|
||||
psiElement = CommonDataKeys.PSI_ELEMENT.getData(dataContext);
|
||||
}
|
||||
|
||||
@@ -82,7 +82,7 @@ public class DeleteHandler {
|
||||
elements = new PsiElement[]{(PsiElement)data};
|
||||
}
|
||||
else {
|
||||
final Object data1 = LangDataKeys.PSI_FILE.getData(dataContext);
|
||||
final Object data1 = CommonDataKeys.PSI_FILE.getData(dataContext);
|
||||
if (data1 != null) {
|
||||
elements = new PsiElement[]{(PsiFile)data1};
|
||||
}
|
||||
|
||||
@@ -246,7 +246,7 @@ public class ScopeChooserCombo extends ComboboxWithBrowseButton implements Dispo
|
||||
result.add(GlobalSearchScopes.openFilesScope(project));
|
||||
|
||||
if (dataContext != null) {
|
||||
PsiElement dataContextElement = LangDataKeys.PSI_FILE.getData(dataContext);
|
||||
PsiElement dataContextElement = CommonDataKeys.PSI_FILE.getData(dataContext);
|
||||
if (dataContextElement == null) {
|
||||
dataContextElement = CommonDataKeys.PSI_ELEMENT.getData(dataContext);
|
||||
}
|
||||
|
||||
+1
-1
@@ -141,6 +141,6 @@ public abstract class SelectionBasedPsiElementInternalAction<T extends PsiElemen
|
||||
|
||||
@Nullable
|
||||
private static PsiFile getPsiFile(@NotNull AnActionEvent e) {
|
||||
return LangDataKeys.PSI_FILE.getData(e.getDataContext());
|
||||
return CommonDataKeys.PSI_FILE.getData(e.getDataContext());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,7 +23,7 @@ public class PsiViewerForContextAction extends AnAction implements DumbAware {
|
||||
public void actionPerformed(AnActionEvent e) {
|
||||
|
||||
Editor editor = CommonDataKeys.EDITOR.getData(e.getDataContext());
|
||||
PsiFile currentFile = LangDataKeys.PSI_FILE.getData(e.getDataContext());
|
||||
PsiFile currentFile = CommonDataKeys.PSI_FILE.getData(e.getDataContext());
|
||||
new PsiViewerDialog(currentFile.getProject(), false, currentFile, editor).show();
|
||||
}
|
||||
|
||||
@@ -35,7 +35,7 @@ public class PsiViewerForContextAction extends AnAction implements DumbAware {
|
||||
return;
|
||||
}
|
||||
final Project project = PlatformDataKeys.PROJECT.getData(e.getDataContext());
|
||||
PsiFile currentFile = LangDataKeys.PSI_FILE.getData(e.getDataContext());
|
||||
PsiFile currentFile = CommonDataKeys.PSI_FILE.getData(e.getDataContext());
|
||||
e.getPresentation().setEnabled(project != null && currentFile != null);
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -51,7 +51,7 @@ public class ShowModuleDependenciesAction extends AnAction{
|
||||
panel = new ModulesDependenciesPanel(project, modules);
|
||||
scope = new AnalysisScope(modules);
|
||||
} else {
|
||||
final PsiElement element = LangDataKeys.PSI_FILE.getData(dataContext);
|
||||
final PsiElement element = CommonDataKeys.PSI_FILE.getData(dataContext);
|
||||
final Module module = element != null ? ModuleUtil.findModuleForPsiElement(element) : null;
|
||||
if (module != null && ModuleManager.getInstance(project).getModules().length > 1){
|
||||
MyModuleOrProjectScope dlg = new MyModuleOrProjectScope(module.getName());
|
||||
|
||||
+2
-1
@@ -17,6 +17,7 @@ package com.intellij.openapi.editor.actions;
|
||||
|
||||
import com.intellij.codeInsight.completion.NextPrevParameterAction;
|
||||
import com.intellij.codeInsight.lookup.LookupManager;
|
||||
import com.intellij.openapi.actionSystem.CommonDataKeys;
|
||||
import com.intellij.openapi.actionSystem.DataContext;
|
||||
import com.intellij.openapi.actionSystem.LangDataKeys;
|
||||
import com.intellij.openapi.editor.Editor;
|
||||
@@ -32,7 +33,7 @@ public class LangIndentSelectionAction extends IndentSelectionAction {
|
||||
if (!super.isEnabled(editor, dataContext)) return false;
|
||||
if (LookupManager.getActiveLookup(editor) != null) return false;
|
||||
|
||||
PsiFile psiFile = LangDataKeys.PSI_FILE.getData(dataContext);
|
||||
PsiFile psiFile = CommonDataKeys.PSI_FILE.getData(dataContext);
|
||||
if (psiFile != null && NextPrevParameterAction.hasSutablePolicy(editor, psiFile)) return false;
|
||||
|
||||
return true;
|
||||
|
||||
+1
-1
@@ -61,6 +61,6 @@ public class ToggleShowImportPopupsAction extends ToggleAction {
|
||||
@Nullable
|
||||
private static PsiFile getFile(AnActionEvent e) {
|
||||
Editor editor = e.getData(CommonDataKeys.EDITOR);
|
||||
return editor == null ? null : e.getData(LangDataKeys.PSI_FILE);
|
||||
return editor == null ? null : e.getData(CommonDataKeys.PSI_FILE);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -54,7 +54,7 @@ public abstract class ClassRefactoringHandlerBase implements RefactoringActionHa
|
||||
|
||||
@Override
|
||||
public void invoke(@NotNull Project project, @NotNull PsiElement[] elements, DataContext dataContext) {
|
||||
final PsiFile file = LangDataKeys.PSI_FILE.getData(dataContext);
|
||||
final PsiFile file = CommonDataKeys.PSI_FILE.getData(dataContext);
|
||||
final Editor editor = CommonDataKeys.EDITOR.getData(dataContext);
|
||||
showDialog(project, elements[0], editor, file, dataContext);
|
||||
}
|
||||
|
||||
+1
-1
@@ -66,7 +66,7 @@ public abstract class BasePlatformRefactoringAction extends BaseRefactoringActio
|
||||
protected final RefactoringActionHandler getHandler(@NotNull DataContext dataContext) {
|
||||
PsiElement element = null;
|
||||
Editor editor = CommonDataKeys.EDITOR.getData(dataContext);
|
||||
PsiFile file = LangDataKeys.PSI_FILE.getData(dataContext);
|
||||
PsiFile file = CommonDataKeys.PSI_FILE.getData(dataContext);
|
||||
if (editor != null && file != null) {
|
||||
element = getElementAtCaret(editor, file);
|
||||
if (element != null) {
|
||||
|
||||
@@ -143,7 +143,7 @@ public abstract class BaseRefactoringAction extends AnAction {
|
||||
}
|
||||
|
||||
Editor editor = e.getData(CommonDataKeys.EDITOR);
|
||||
PsiFile file = e.getData(LangDataKeys.PSI_FILE);
|
||||
PsiFile file = e.getData(CommonDataKeys.PSI_FILE);
|
||||
if (file != null) {
|
||||
if (file instanceof PsiCompiledElement || !isAvailableForFile(file)) {
|
||||
hideAction(e);
|
||||
|
||||
@@ -19,6 +19,7 @@ package com.intellij.refactoring.actions;
|
||||
import com.intellij.ide.TitledHandler;
|
||||
import com.intellij.lang.Language;
|
||||
import com.intellij.openapi.actionSystem.AnActionEvent;
|
||||
import com.intellij.openapi.actionSystem.CommonDataKeys;
|
||||
import com.intellij.openapi.actionSystem.DataContext;
|
||||
import com.intellij.openapi.actionSystem.LangDataKeys;
|
||||
import com.intellij.psi.PsiElement;
|
||||
@@ -66,7 +67,7 @@ public class ExtractIncludeAction extends BaseRefactoringAction {
|
||||
|
||||
@Override
|
||||
public RefactoringActionHandler getHandler(@NotNull DataContext dataContext) {
|
||||
PsiFile file = LangDataKeys.PSI_FILE.getData(dataContext);
|
||||
PsiFile file = CommonDataKeys.PSI_FILE.getData(dataContext);
|
||||
if (file == null) return null;
|
||||
return LanguageExtractInclude.INSTANCE.forLanguage(file.getViewProvider().getBaseLanguage());
|
||||
}
|
||||
|
||||
+1
-1
@@ -43,7 +43,7 @@ public class VariableInplaceRenameHandler implements RenameHandler {
|
||||
public final boolean isAvailableOnDataContext(final DataContext dataContext) {
|
||||
final PsiElement element = PsiElementRenameHandler.getElement(dataContext);
|
||||
final Editor editor = CommonDataKeys.EDITOR.getData(dataContext);
|
||||
final PsiFile file = LangDataKeys.PSI_FILE.getData(dataContext);
|
||||
final PsiFile file = CommonDataKeys.PSI_FILE.getData(dataContext);
|
||||
if (editor == null || file == null) return false;
|
||||
|
||||
if (ourPreventInlineRenameFlag.get() != null) {
|
||||
|
||||
@@ -17,6 +17,7 @@ package com.intellij.testIntegration;
|
||||
|
||||
import com.intellij.navigation.GotoRelatedItem;
|
||||
import com.intellij.navigation.GotoRelatedProvider;
|
||||
import com.intellij.openapi.actionSystem.CommonDataKeys;
|
||||
import com.intellij.openapi.actionSystem.DataContext;
|
||||
import com.intellij.openapi.actionSystem.LangDataKeys;
|
||||
import com.intellij.psi.PsiElement;
|
||||
@@ -33,7 +34,7 @@ public class GotoTestRelatedProvider extends GotoRelatedProvider {
|
||||
@NotNull
|
||||
@Override
|
||||
public List<? extends GotoRelatedItem> getItems(@NotNull DataContext context) {
|
||||
final PsiFile file = LangDataKeys.PSI_FILE.getData(context);
|
||||
final PsiFile file = CommonDataKeys.PSI_FILE.getData(context);
|
||||
List<PsiElement> result;
|
||||
final boolean isTest = TestFinderHelper.isTest(file);
|
||||
if (isTest) {
|
||||
|
||||
@@ -154,7 +154,7 @@ public interface DataConstants {
|
||||
/**
|
||||
* Returns {@link com.intellij.psi.PsiFile}
|
||||
*
|
||||
* @deprecated use {@link com.intellij.openapi.actionSystem.LangDataKeys.PSI_FILE} instead
|
||||
* @deprecated use {@link com.intellij.openapi.actionSystem.com.intellij.openapi.actionSystem.CommonDataKeys.PSI_FILE} instead
|
||||
*/
|
||||
@NonNls String PSI_FILE = "psi.File";
|
||||
|
||||
|
||||
+3
-3
@@ -471,10 +471,10 @@ public abstract class LightPlatformCodeInsightTestCase extends LightPlatformTest
|
||||
if (dataId.equals(AnActionEvent.injectedId(CommonDataKeys.EDITOR.getName()))) {
|
||||
return InjectedLanguageUtil.getEditorForInjectedLanguageNoCommit(getEditor(), getFile());
|
||||
}
|
||||
if (LangDataKeys.PSI_FILE.is(dataId)) {
|
||||
if (CommonDataKeys.PSI_FILE.is(dataId)) {
|
||||
return myFile;
|
||||
}
|
||||
if (dataId.equals(AnActionEvent.injectedId(LangDataKeys.PSI_FILE.getName()))) {
|
||||
if (dataId.equals(AnActionEvent.injectedId(CommonDataKeys.PSI_FILE.getName()))) {
|
||||
Editor editor = InjectedLanguageUtil.getEditorForInjectedLanguageNoCommit(getEditor(), getFile());
|
||||
return editor instanceof EditorWindow ? ((EditorWindow)editor).getInjectedFile() : getFile();
|
||||
}
|
||||
@@ -624,7 +624,7 @@ public abstract class LightPlatformCodeInsightTestCase extends LightPlatformTest
|
||||
if (CommonDataKeys.PROJECT.is(dataId)) {
|
||||
return getProject();
|
||||
}
|
||||
if (LangDataKeys.PSI_FILE.is(dataId)) {
|
||||
if (CommonDataKeys.PSI_FILE.is(dataId)) {
|
||||
return getFile();
|
||||
}
|
||||
if (CommonDataKeys.PSI_ELEMENT.is(dataId)) {
|
||||
|
||||
@@ -37,7 +37,7 @@ public class UsageTargetUtil {
|
||||
|
||||
public static UsageTarget[] findUsageTargets(DataProvider dataProvider) {
|
||||
Editor editor = CommonDataKeys.EDITOR.getData(dataProvider);
|
||||
PsiFile file = LangDataKeys.PSI_FILE.getData(dataProvider);
|
||||
PsiFile file = CommonDataKeys.PSI_FILE.getData(dataProvider);
|
||||
|
||||
List<UsageTarget> result = new ArrayList<UsageTarget>();
|
||||
if (file != null && editor != null) {
|
||||
|
||||
@@ -17,6 +17,7 @@ package com.intellij.lang.ant.refactoring;
|
||||
|
||||
import com.intellij.codeInsight.TargetElementUtilBase;
|
||||
import com.intellij.lang.ant.dom.AntDomFileDescription;
|
||||
import com.intellij.openapi.actionSystem.CommonDataKeys;
|
||||
import com.intellij.openapi.actionSystem.DataContext;
|
||||
import com.intellij.openapi.actionSystem.LangDataKeys;
|
||||
import com.intellij.openapi.editor.Editor;
|
||||
@@ -57,7 +58,7 @@ public final class AntRenameHandler extends PsiElementRenameHandler {
|
||||
|
||||
@Nullable
|
||||
private static PsiElement[] getElements(DataContext dataContext) {
|
||||
final PsiFile psiFile = LangDataKeys.PSI_FILE.getData(dataContext);
|
||||
final PsiFile psiFile = CommonDataKeys.PSI_FILE.getData(dataContext);
|
||||
if (!(psiFile instanceof XmlFile && AntDomFileDescription.isAntFile((XmlFile)psiFile))) {
|
||||
return null;
|
||||
}
|
||||
|
||||
+1
-1
@@ -51,7 +51,7 @@ public class GenerateCopyrightAction extends AnAction
|
||||
|
||||
@Nullable
|
||||
private static PsiFile getFile(DataContext context, Project project) {
|
||||
PsiFile file = LangDataKeys.PSI_FILE.getData(context);
|
||||
PsiFile file = CommonDataKeys.PSI_FILE.getData(context);
|
||||
if (file == null) {
|
||||
Editor editor = CommonDataKeys.EDITOR.getData(context);
|
||||
if (editor != null) {
|
||||
|
||||
@@ -108,7 +108,7 @@ public class GenerateComponentExternalizationAction extends AnAction {
|
||||
|
||||
PsiDocumentManager.getInstance(project).commitDocument(editor.getDocument());
|
||||
|
||||
PsiFile file = LangDataKeys.PSI_FILE.getData(context);
|
||||
PsiFile file = CommonDataKeys.PSI_FILE.getData(context);
|
||||
if (file == null) return null;
|
||||
|
||||
PsiClass contextClass = PsiTreeUtil.findElementOfClassAtOffset(file, editor.getCaretModel().getOffset(), PsiClass.class, false);
|
||||
|
||||
@@ -64,7 +64,7 @@ public class ShowSerializedXmlAction extends DumbAwareAction {
|
||||
|
||||
@Override
|
||||
public void update(AnActionEvent e) {
|
||||
e.getPresentation().setEnabled(getEventProject(e) != null && e.getData(LangDataKeys.PSI_FILE) != null
|
||||
e.getPresentation().setEnabled(getEventProject(e) != null && e.getData(CommonDataKeys.PSI_FILE) != null
|
||||
&& e.getData(CommonDataKeys.EDITOR) != null);
|
||||
}
|
||||
|
||||
@@ -131,7 +131,7 @@ public class ShowSerializedXmlAction extends DumbAwareAction {
|
||||
|
||||
@Nullable
|
||||
private static PsiClass getPsiClass(AnActionEvent e) {
|
||||
final PsiFile psiFile = e.getData(LangDataKeys.PSI_FILE);
|
||||
final PsiFile psiFile = e.getData(CommonDataKeys.PSI_FILE);
|
||||
final Editor editor = e.getData(CommonDataKeys.EDITOR);
|
||||
if (editor == null || psiFile == null) return null;
|
||||
final PsiElement element = psiFile.findElementAt(editor.getCaretModel().getOffset());
|
||||
|
||||
@@ -42,14 +42,14 @@ public class ShuffleNamesAction extends AnAction {
|
||||
@Override
|
||||
public void update(AnActionEvent e) {
|
||||
Editor editor = CommonDataKeys.EDITOR.getData(e.getDataContext());
|
||||
PsiFile file = LangDataKeys.PSI_FILE.getData(e.getDataContext());
|
||||
PsiFile file = CommonDataKeys.PSI_FILE.getData(e.getDataContext());
|
||||
e.getPresentation().setEnabled(editor != null && file != null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void actionPerformed(AnActionEvent e) {
|
||||
final Editor editor = CommonDataKeys.EDITOR.getData(e.getDataContext());
|
||||
PsiFile file = LangDataKeys.PSI_FILE.getData(e.getDataContext());
|
||||
PsiFile file = CommonDataKeys.PSI_FILE.getData(e.getDataContext());
|
||||
if (editor == null || file == null) return;
|
||||
final Project project = file.getProject();
|
||||
CommandProcessorEx commandProcessor = (CommandProcessorEx)CommandProcessorEx.getInstance();
|
||||
|
||||
@@ -51,14 +51,14 @@ public class ToggleHighlightingMarkupAction extends AnAction {
|
||||
@Override
|
||||
public void update(AnActionEvent e) {
|
||||
Editor editor = CommonDataKeys.EDITOR.getData(e.getDataContext());
|
||||
PsiFile file = LangDataKeys.PSI_FILE.getData(e.getDataContext());
|
||||
PsiFile file = CommonDataKeys.PSI_FILE.getData(e.getDataContext());
|
||||
e.getPresentation().setEnabled(editor != null && file != null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void actionPerformed(AnActionEvent e) {
|
||||
final Editor editor = CommonDataKeys.EDITOR.getData(e.getDataContext());
|
||||
PsiFile file = LangDataKeys.PSI_FILE.getData(e.getDataContext());
|
||||
PsiFile file = CommonDataKeys.PSI_FILE.getData(e.getDataContext());
|
||||
if (editor == null || file == null) return;
|
||||
final Project project = file.getProject();
|
||||
CommandProcessorEx commandProcessor = (CommandProcessorEx)CommandProcessorEx.getInstance();
|
||||
|
||||
+1
-1
@@ -157,7 +157,7 @@ public class GenerateToStringActionHandlerImpl extends EditorWriteActionHandler
|
||||
|
||||
@Nullable
|
||||
private static PsiClass getSubjectClass(Editor editor, DataContext dataContext) {
|
||||
PsiFile file = LangDataKeys.PSI_FILE.getData(dataContext);
|
||||
PsiFile file = CommonDataKeys.PSI_FILE.getData(dataContext);
|
||||
if (file == null) return null;
|
||||
|
||||
int offset = editor.getCaretModel().getOffset();
|
||||
|
||||
+1
-1
@@ -657,7 +657,7 @@ public class DynamicToolWindowWrapper {
|
||||
if (CommonDataKeys.PSI_ELEMENT.is(dataId)) {
|
||||
return getSelectedElement();
|
||||
}
|
||||
else if (LangDataKeys.PSI_FILE.is(dataId)) {
|
||||
else if (CommonDataKeys.PSI_FILE.is(dataId)) {
|
||||
final PsiElement element = getSelectedElement();
|
||||
|
||||
if (element == null) return null;
|
||||
|
||||
@@ -56,7 +56,7 @@ public class I18nizeAction extends AnAction {
|
||||
final Editor editor = getEditor(e);
|
||||
if (editor == null) return null;
|
||||
|
||||
PsiFile psiFile = e.getData(LangDataKeys.PSI_FILE);
|
||||
PsiFile psiFile = e.getData(CommonDataKeys.PSI_FILE);
|
||||
if (psiFile == null) return null;
|
||||
|
||||
TextRange range = JavaI18nUtil.getSelectedRange(editor, psiFile);
|
||||
@@ -144,7 +144,7 @@ public class I18nizeAction extends AnAction {
|
||||
final Editor editor = getEditor(e);
|
||||
final Project project = editor.getProject();
|
||||
assert project != null;
|
||||
final PsiFile psiFile = LangDataKeys.PSI_FILE.getData(e.getDataContext());
|
||||
final PsiFile psiFile = CommonDataKeys.PSI_FILE.getData(e.getDataContext());
|
||||
if (psiFile == null) return;
|
||||
final I18nQuickFixHandler handler = getHandler(e);
|
||||
if (handler == null) return;
|
||||
|
||||
+1
-1
@@ -58,6 +58,6 @@ public class MavenPropertyRenameHandler extends PsiElementRenameHandler {
|
||||
}
|
||||
|
||||
private static PsiElement findTarget(DataContext context) {
|
||||
return MavenTargetUtil.getRefactorTarget(CommonDataKeys.EDITOR.getData(context), LangDataKeys.PSI_FILE.getData(context));
|
||||
return MavenTargetUtil.getRefactorTarget(CommonDataKeys.EDITOR.getData(context), CommonDataKeys.PSI_FILE.getData(context));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -354,7 +354,7 @@ public abstract class MavenDomTestCase extends MavenImportingTestCase {
|
||||
private MapDataContext createDataContext(VirtualFile f) throws IOException {
|
||||
MapDataContext context = new MapDataContext();
|
||||
context.put(CommonDataKeys.EDITOR, getEditor(f));
|
||||
context.put(LangDataKeys.PSI_FILE, getTestPsiFile(f));
|
||||
context.put(CommonDataKeys.PSI_FILE, getTestPsiFile(f));
|
||||
context.put(CommonDataKeys.PSI_ELEMENT, TargetElementUtil.findTargetElement(getEditor(f),
|
||||
TargetElementUtilBase.REFERENCED_ELEMENT_ACCEPTED
|
||||
| TargetElementUtilBase.ELEMENT_NAME_ACCEPTED));
|
||||
|
||||
+2
-1
@@ -27,6 +27,7 @@ import com.intellij.execution.RunnerAndConfigurationSettings;
|
||||
import com.intellij.execution.actions.ConfigurationContext;
|
||||
import com.intellij.execution.configurations.ModuleBasedConfiguration;
|
||||
import com.intellij.execution.junit.JUnitUtil;
|
||||
import com.intellij.openapi.actionSystem.CommonDataKeys;
|
||||
import com.intellij.openapi.actionSystem.DataContext;
|
||||
import com.intellij.openapi.actionSystem.LangDataKeys;
|
||||
import com.intellij.openapi.module.Module;
|
||||
@@ -98,7 +99,7 @@ public class TestNGPatternConfigurationProducer extends TestNGConfigurationProdu
|
||||
}
|
||||
return elements;
|
||||
} else {
|
||||
final PsiFile file = LangDataKeys.PSI_FILE.getData(dataContext);
|
||||
final PsiFile file = CommonDataKeys.PSI_FILE.getData(dataContext);
|
||||
if (file instanceof PsiClassOwner) {
|
||||
for (PsiMember psiMember : collectTestMembers(((PsiClassOwner)file).getClasses())) {
|
||||
classes.add(((PsiClass)psiMember).getQualifiedName());
|
||||
|
||||
@@ -48,7 +48,7 @@ public class AddComponentAction extends AnAction {
|
||||
Project project = e.getData(CommonDataKeys.PROJECT);
|
||||
if (project == null) return;
|
||||
GroupItem groupItem = e.getData(GroupItem.DATA_KEY);
|
||||
PsiFile psiFile = e.getData(LangDataKeys.PSI_FILE);
|
||||
PsiFile psiFile = e.getData(CommonDataKeys.PSI_FILE);
|
||||
PsiElement elementToAdd = (psiFile != null) ? findElementToAdd(psiFile) : null;
|
||||
String className = "";
|
||||
if (elementToAdd instanceof PsiClass) {
|
||||
@@ -128,7 +128,7 @@ public class AddComponentAction extends AnAction {
|
||||
e.getPresentation().setEnabled(project != null && (groupItem == null || !groupItem.isReadOnly()));
|
||||
}
|
||||
else {
|
||||
PsiFile psiFile = e.getData(LangDataKeys.PSI_FILE);
|
||||
PsiFile psiFile = e.getData(CommonDataKeys.PSI_FILE);
|
||||
e.getPresentation().setVisible(psiFile != null && findElementToAdd(psiFile) != null);
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -274,7 +274,7 @@ public final class PropertyInspectorTable extends Table implements DataProvider{
|
||||
|
||||
return PropertyUtil.findPropertySetter(aClass, introspectedProperty.getName(), false, true);
|
||||
}
|
||||
else if (LangDataKeys.PSI_FILE.is(dataId) && myEditor != null) {
|
||||
else if (CommonDataKeys.PSI_FILE.is(dataId) && myEditor != null) {
|
||||
return PsiManager.getInstance(myEditor.getProject()).findFile(myEditor.getFile());
|
||||
}
|
||||
else if (GuiEditor.DATA_KEY.is(dataId)) {
|
||||
|
||||
+1
-1
@@ -81,6 +81,6 @@ public class AssociationsGroup extends ActionGroup {
|
||||
|
||||
@Nullable
|
||||
static PsiFile getPsiFile(@Nullable AnActionEvent e) {
|
||||
return e != null ? LangDataKeys.PSI_FILE.getData(e.getDataContext()) : null;
|
||||
return e != null ? CommonDataKeys.PSI_FILE.getData(e.getDataContext()) : null;
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -32,7 +32,7 @@ class ConfigureAssociationsAction extends AnAction {
|
||||
final Project project = CommonDataKeys.PROJECT.getData(e.getDataContext());
|
||||
if (project == null) return;
|
||||
|
||||
final PsiFile file = LangDataKeys.PSI_FILE.getData(e.getDataContext());
|
||||
final PsiFile file = CommonDataKeys.PSI_FILE.getData(e.getDataContext());
|
||||
FileAssociationsConfigurable.editAssociations(project, file);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -63,7 +63,7 @@ public final class SpellingPopupActionGroup extends ActionGroup {
|
||||
|
||||
@NotNull
|
||||
private static AnAction[] findActions(@NotNull AnActionEvent e) {
|
||||
PsiFile psiFile = e.getData(LangDataKeys.PSI_FILE);
|
||||
PsiFile psiFile = e.getData(CommonDataKeys.PSI_FILE);
|
||||
Project project = e.getData(LangDataKeys.PROJECT);
|
||||
Editor editor = e.getData(LangDataKeys.EDITOR);
|
||||
if (psiFile != null && project != null && editor != null) {
|
||||
@@ -124,7 +124,7 @@ public final class SpellingPopupActionGroup extends ActionGroup {
|
||||
}
|
||||
|
||||
public void actionPerformed(final AnActionEvent e) {
|
||||
final PsiFile psiFile = e.getData(LangDataKeys.PSI_FILE);
|
||||
final PsiFile psiFile = e.getData(CommonDataKeys.PSI_FILE);
|
||||
final Project project = e.getData(LangDataKeys.PROJECT);
|
||||
final Editor editor = e.getData(LangDataKeys.EDITOR);
|
||||
if (psiFile != null && project != null && editor != null) {
|
||||
|
||||
@@ -37,7 +37,7 @@ public class OpenFileInDefaultBrowserAction extends DumbAwareAction {
|
||||
@Override
|
||||
public void update(AnActionEvent e) {
|
||||
final DataContext dataContext = e.getDataContext();
|
||||
final PsiFile file = LangDataKeys.PSI_FILE.getData(dataContext);
|
||||
final PsiFile file = CommonDataKeys.PSI_FILE.getData(dataContext);
|
||||
final Presentation presentation = e.getPresentation();
|
||||
|
||||
if (file == null || file.getVirtualFile() == null) {
|
||||
@@ -99,7 +99,7 @@ public class OpenFileInDefaultBrowserAction extends DumbAwareAction {
|
||||
@Override
|
||||
public void actionPerformed(AnActionEvent e) {
|
||||
DataContext dataContext = e.getDataContext();
|
||||
PsiFile psiFile = LangDataKeys.PSI_FILE.getData(dataContext);
|
||||
PsiFile psiFile = CommonDataKeys.PSI_FILE.getData(dataContext);
|
||||
LOG.assertTrue(psiFile != null);
|
||||
InputEvent event = e.getInputEvent();
|
||||
doOpen(psiFile, event != null && event.isShiftDown());
|
||||
|
||||
@@ -50,7 +50,7 @@ public class ValidateXmlAction extends AnAction {
|
||||
}
|
||||
|
||||
public void actionPerformed(AnActionEvent e) {
|
||||
final PsiFile psiFile = LangDataKeys.PSI_FILE.getData(e.getDataContext());
|
||||
final PsiFile psiFile = CommonDataKeys.PSI_FILE.getData(e.getDataContext());
|
||||
if (psiFile != null) {
|
||||
doRunAction(psiFile);
|
||||
}
|
||||
@@ -90,7 +90,7 @@ public class ValidateXmlAction extends AnAction {
|
||||
super.update(event);
|
||||
|
||||
Presentation presentation = event.getPresentation();
|
||||
PsiElement psiElement = LangDataKeys.PSI_FILE.getData(event.getDataContext());
|
||||
PsiElement psiElement = CommonDataKeys.PSI_FILE.getData(event.getDataContext());
|
||||
|
||||
boolean flag = psiElement instanceof XmlFile;
|
||||
presentation.setVisible(flag);
|
||||
|
||||
@@ -110,7 +110,7 @@ public class XmlTagRenameHandler implements RenameHandler, TitledHandler {
|
||||
final Editor editor = getEditor(context);
|
||||
if (editor != null) {
|
||||
final int offset = editor.getCaretModel().getOffset();
|
||||
final PsiFile file = LangDataKeys.PSI_FILE.getData(context);
|
||||
final PsiFile file = CommonDataKeys.PSI_FILE.getData(context);
|
||||
if (file instanceof XmlFile) {
|
||||
return file.getViewProvider().findElementAt(offset);
|
||||
}
|
||||
|
||||
@@ -92,7 +92,7 @@ public class ValidateAction extends AnAction {
|
||||
}
|
||||
|
||||
private boolean actionPerformedImpl(AnActionEvent e) {
|
||||
final PsiFile file = e.getData(LangDataKeys.PSI_FILE);
|
||||
final PsiFile file = e.getData(CommonDataKeys.PSI_FILE);
|
||||
if (file == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user