How to invoke refactoring dialog (not refactoring itself)?

I want to simulate like the user just selected a certain element and pressed F6.
I can see how to create the dialog, and I can see how to invoke move
refactoring, but I don't feel comfortable writing the code between the two
myself. I would also like to avoid manually selecting the desired items to be
moved in the tree. Is there some way to do this easily, or some suggested not so
easy way?

1 comment
Comment actions Permalink

Hello Keith,

KL> I want to simulate like the user just selected a certain element and
KL> pressed F6. I can see how to create the dialog, and I can see how to
KL> invoke move refactoring, but I don't feel comfortable writing the
KL> code between the two myself. I would also like to avoid manually
KL> selecting the desired items to be moved in the tree. Is there some
KL> way to do this easily, or some suggested not so easy way?

The RefactoringActionHandler interface encapsulates the entire refactoring
process - the dialog, the refactoring itself and everything in between. To
invoke the Move refactoring, you need to call RefactoringActionHandlerFactory.createMoveHandler()
and then call invoke() on the returned RefactoringActionHandler.

--
Dmitry Jemerov
Software Developer
JetBrains, Inc.
http://www.jetbrains.com
"Develop with pleasure!"


0

Please sign in to leave a comment.