From ee2d70a6d6dfab94d1d5e44370728b1577a7714b Mon Sep 17 00:00:00 2001 From: "Maxim.Mossienko" Date: Sat, 8 May 2010 16:27:01 +0400 Subject: [PATCH] IDEA-54780 flex: "Copy Reference" action should work for references, not only definitions --- .../testFramework/EditorTestUtil.java | 20 ++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/platform/testFramework/src/com/intellij/testFramework/EditorTestUtil.java b/platform/testFramework/src/com/intellij/testFramework/EditorTestUtil.java index 64d6170f3ec8..6b3460961ece 100644 --- a/platform/testFramework/src/com/intellij/testFramework/EditorTestUtil.java +++ b/platform/testFramework/src/com/intellij/testFramework/EditorTestUtil.java @@ -16,11 +16,12 @@ package com.intellij.testFramework; import com.intellij.ide.DataManager; -import com.intellij.openapi.actionSystem.IdeActions; +import com.intellij.openapi.actionSystem.*; import com.intellij.openapi.editor.Editor; import com.intellij.openapi.editor.actionSystem.EditorActionHandler; import com.intellij.openapi.editor.actionSystem.EditorActionManager; import com.intellij.openapi.editor.actionSystem.TypedAction; +import junit.framework.Assert; /** * User: Maxim.Mossienko @@ -49,4 +50,21 @@ public class EditorTestUtil { action.actionPerformed(editor, c, DataManager.getInstance().getDataContext()); } } + + public static void performReferenceCopy(DataContext dataContext) { + ActionManager actionManager = ActionManager.getInstance(); + AnAction action = actionManager.getAction(IdeActions.ACTION_COPY_REFERENCE); + AnActionEvent + event = new AnActionEvent(null, dataContext, "", action.getTemplatePresentation(), + ActionManager.getInstance(), 0); + action.update(event); + Assert.assertTrue(event.getPresentation().isEnabled()); + action.actionPerformed(event); + } + + public static void performPaste(Editor editor) { + EditorActionManager actionManager = EditorActionManager.getInstance(); + EditorActionHandler actionHandler = actionManager.getActionHandler(IdeActions.ACTION_EDITOR_PASTE); + actionHandler.execute(editor, DataManager.getInstance().getDataContext()); + } }