Is it possilbe to add a custom dialog for Moving Files?
Answered
I am developing my own plugin and when I try to move a file, a dialog pops up.
Sometimes, the checkbox "Search for references" is deselected and I would like to have it selected every time a user of my plugin tries to move a certain file.
Do i need to create a custom MoveFilesOrDirectoriesDialog or is there a simpler way to implement this?
If I need to create a custom MoveFilesOrDirectoriesDialog, how do I use this class, since the MoveFilesOrDirectoriesUtil class is final and its methods cannot be edited?
Thank you in advance!
Please sign in to leave a comment.
"Search for references" is a user preference, why do you want to override user's possible preference to have it disabled?
I don't want to disable it, the user still has the option to deselect it. I would like to have it selected every time the dialog pops up.
Ok, but you would like to set it ENABLED always - even if user had previously deselected it which seems dubious practice. What is the ultimate goal of enabling it always?
The files that are being moved are referenced by other files, if the checkbox is disabled, these references are not being updated and then point to the wrong location. It makes little sense for our users to move the files (of our specific file type) without also updating the references to them. Basically, I would like a similar behaviour as to when moving Java files - the imports in other files are always also updated and there is no "Search for references" checkbox.
The same also applies to the "Rename" dialog, where sometimes the checkbox is not selected. If a user starts a rename from the reference and has the checkbox disabled, the file itself gets renamed but the reference (that the user just selected and started renaming on) stays unaffected. This has lead to several bug reports against our plugin, especially since the behaviour of the "Search for References" checkbox seems erratic, sometimes is checked, sometimes not - we haven't fully figured out the rules yet.
Please see https://plugins.jetbrains.com/docs/intellij/rename-refactoring.html#custom-rename-ui-and-workflow for customizing renaming (or processing of to-be-renamed elements) and
com.intellij.refactoring.move.MoveHandlerDelegateextension point for Move refactoring.