Refactoring dialogs getting in the way

I've been thinking lately, I see a lot of dialogs when I'm editing code in
IDEA. It's because I use refactorings and intentions constantly. Almost every
refactoring has a dialog, and I usually choose the default options and press
Enter.

As quick and painless as this may seem, I think dialogs take me out of context,
they're just enough of a jolt to distract me, and stop me from thinking about
the code. Let's think of some other IDEA editor features - can you imagine
if you pressed Enter on a comment line and IDEA showed a dialog asking "do
you want to continue the comment on the next line? ". I consider
the "Rename local variable" dialog to be just as unnecessary.

I wonder if this is a problem for other people. I also wonder if some of
you have ideas about how to fix this.
The obvious fix is to remove the dialog, but there are definitely cases where
I need the dialog, to change a setting or something. So, my revised obvious
fix is to provide two hotkeys for each refactoring - one with the dialog,
and one without, using some predefined settings. For example, maybe the dialog
versions could be a series (as microsoft calls a "chord") CtrlShiftD, then
the original refactoring (like Shift+F6). However, there may be a better way.

Another idea would be to invoke the refactoring with default options, and
pop up a tool window "refactoring options" afterwards which, for example
with Introduce Variable, it would show a list of other references to the
extracted expression in the method, with buttons "Replace" and "Replace All."

Implementing this might require rethought of UI and workflow designed around
each refactoring, but I think the productivity payoff could be large, as
refactorings are thought of as simple editor actions like pressing Return
or Ctrl+X, not as processes which need to be set up and executed.

I'm considering implementing some of these as a plugin. I have 100 things
to do but if I have time I'd like to at least get one or two working, if
only as a demo to people who aren't sure if it would work.

I want to know what others think about these ideas. Maybe together we can
come up with a good plan for how to implement this.


29 comments
Comment actions Permalink

Keith,

Dialogs bug me too, but I can't see how to avoid them, in most cases.
Over time, many refactorings became richer => more options, more visual
feedback before confirmation.


I see 2 ways to ease the pain a little, but those 2 requests are more
than 2 years old, so I wouldn't place too much hope on them:


1/ A more powerful macro recorder, that remembers options choices.
Actually, I wish there were a real macro language, with simplified
access to the openAPI.
that would let you customize refactorings, and even compose - chain
- them.


2/ "MS-Excel F4-like feature : repeat last action."
http://www.jetbrains.net/jira/browse/IDEABKL-235

It repeats the previous action, with the same options. It would have to
work in "headless" mode, obviously, to skip the confirmation dialog.


Alain

0
Comment actions Permalink

On Tue, 03 May 2005 03:19:58 +0000, Keith Lea wrote:

I've been thinking lately, I see a lot of dialogs when I'm editing code in
IDEA. It's because I use refactorings and intentions constantly. Almost
every refactoring has a dialog, and I usually choose the default options
and press Enter.


I've been thinking of something similar lately, I'm changing a heap of
code over to using Spring's JDBCTemplate, which uses a RowMapper class,
IDEA -constantly- asks me if I want to import the Spring RowMapper, or the
one in the Swing APIs.

I've grown use to using the "automatically add unambiguous imports" option
( that is soo sweet ), and like that I'm prompted for the import here, but
after the 2nd of third time, it'd be great it IDEA "learnt" that I'm
always using Spring's class and -never- use the Swing one, so unless
otherwise, it should treated as unambiguous and just import.

Getting back to the refactoring thou - the recent discussion on in line
renaming and the Visual Basic flash anim could be a good way to reducing
some dialogs. "Move method" could just open a quick class browser ( aka
ctrl-n interface ) to select the class to move into.

It's still a "dialog", but its not a cumboursome heavyweight dialog.

0
Comment actions Permalink

IDEA -constantly- asks me if I want to import the
Spring RowMapper, or the
one in the Swing APIs.


Vote:

http://www.jetbrains.net/jira/browse/IDEABKL-2783

0
Comment actions Permalink

For Rename Refactoring, it would be nice if it allowed you to edit the name inline, similar to how Windows Explorer lets you edit filenames inline. In Windows Explorer, if you choose Rename on a selected filename, windows puts special brackets around the text and allows you to edit the name, and hit ENTER when you done.

That would work fine for IntelliJ also, except you also
need some way to access the options. You could have a little icon in the border that you would click to launch the full dialog in those cases where you need to adjust the options. Or as you suggested, you hit another keystroke to popup the full dialog.


This would work for Rename because 99% of the time, you don't need to see the options.

0
Comment actions Permalink

On Tue, 03 May 2005 16:19:10 +0400, Marcus Brito wrote:

http://www.jetbrains.net/jira/browse/IDEABKL-2783


voted :)

0
Comment actions Permalink

Alex wrote:

For Rename Refactoring, it would be nice if it allowed you to edit the name inline, similar to how Windows Explorer lets you edit filenames inline. In Windows Explorer, if you choose Rename on a selected filename, windows puts special brackets around the text and allows you to edit the name, and hit ENTER when you done.

That would work fine for IntelliJ also, except you also
need some way to access the options. You could have a little icon in the border that you would click to launch the full dialog in those cases where you need to adjust the options. Or as you suggested, you hit another keystroke to popup the full dialog.


This would work for Rename because 99% of the time, you don't need to see the options.


Just a thought, this feature could be activated by pressing the same key
combo twice. For example, Shift-F6 to inline-rename, Shift-F6 again to
popup-rename. Then it's just a matter of pressing F6 twice to get the
popup. If this feature were added, it should probably be off by default
to keep the same behaviour as before.

--
Rob Harwood
Software Developer
JetBrains Inc.
http://www.jetbrains.com
"Develop with pleasure!"

0
Comment actions Permalink

+1, good idea

Tom

0
Comment actions Permalink

+5

I guess this would work similarly to the active templates 'red box' method. Great idea.

0
Comment actions Permalink

+1 Good idea.

It would be nice if it worked the same way for other less used refactorings too, if they have a sensible default behaviour.

E.g. I find myself doing 'Pull members up' often, and although it doesn't have a default keyboard shortcut, I'd like to be able to create one and have it open the pop up dialog on the second press.

Although, some refactorings like that one have an instant action, and not just an edit field like in rename, so that would require either some pause while it waits for a possible second invocation, or some other approach.

-- Hans

0
Comment actions Permalink

On Tue, 10 May 2005 19:07:59 +0200, Rob Harwood (JetBrains) wrote:

Just a thought, this feature could be activated by pressing the same key
combo twice. For example, Shift-F6 to inline-rename, Shift-F6 again to
popup-rename. Then it's just a matter of pressing F6 twice to get the


+5 like this idea.

0
Comment actions Permalink


>

Just a thought, this feature could be activated by pressing the same
key combo twice. For example,



It could also be complemented by an auto-trigger-after-a-delay.
For example,
if delay=1000,
- shift-F6 => 'inline rename' is triggered
- after 1 second without a user action, the 'standard rename' dialog
pops-up.



Alain

0
Comment actions Permalink

-1

+5 for the hit-the-key-twice idea. I'd rather have to perform some explicit action to pop up the dialog.

0
Comment actions Permalink

That's an aweful idea. If you want to see a dialog, chances are you always want a dialog and the other way around. A checkbox in the popup:

Don't show this the next time around.

Or a section on Customizations that means the same.

0
Comment actions Permalink

Colin Fleming wrote:

>-1
>
>+5 for the hit-the-key-twice idea. I'd rather have to perform some explicit action to pop up the dialog.

>

Read again: it does not replace the double-key, it complements it.
If you don't want it, just set the delay to 3600 seconds.

Alain

0
Comment actions Permalink

Just a thought, this feature could be activated by
pressing the same key
combo twice. For example, Shift-F6 to inline-rename,
Shift-F6 again to
popup-rename. Then it's just a matter of pressing F6
twice to get the
popup. If this feature were added, it should probably
be off by default
to keep the same behaviour as before.


Great idea, but if this is not enabled by default it's going to be hard to notice (who reads help files anyway?) by a beginning user. How about change the default to be exactly what you just described, with a

Always show this dialog

Option for the old timers who can't stand this spiffy inline trend? An equivalent option somewhere on the settings pane would be nice too.

0
Comment actions Permalink

Marcus Brito wrote:

Always show this dialog

>

>


I'd prefer

1°/ adding a
: enable inline replace

option to the standard rename dialog,

== the current interface


and

2°/ adding an icon/button at the far right of the the inline rename
frame, that you'd reach with Tab, and that would open the current dialog.
Its tooltip would indicate that a second press on shift-F6 would display
the dialog.


Alain

0
Comment actions Permalink

Rob Harwood (JetBrains) wrote:

>

Just a thought, this feature could be activated by pressing the same
key combo twice. For example, Shift-F6 to inline-rename,




As I mapped the much-easier-to-type-with-one-hand - *1 -to
'Rename', I no longer use .
I guess pressing twice would work too. Would it?

Alain


0
Comment actions Permalink

Not in this case... you sometimes need the dialog if you need to
customize the way the refactoring is done, but if you want just the
default behaviour then you don't need it. This is akin to the CVS
dialogs which can be configured to be hidden by default, but you can
show the dialog by holding shift when invoking the action.

N.

Patrik Andersson wrote:

That's an aweful idea. If you want to see a dialog, chances are you always want a dialog and the other way around. A checkbox in the popup:

Don't show this the next time around.

Or a section on Customizations that means the same.

0
Comment actions Permalink

It's true that you can configure it to give the above behaviour, +1 then!

I don't tend to like things that happen after a delay like that, but if I can turn it off and it's useful for other people, then I'm for it.

0
Comment actions Permalink

my 2 cents /pennies worth. I would like to have a non modal interface where it I edited the name of a variable class etc that there would be some sort of smart pop up offering to apply the refactorings etc the same goes for moving classes fields etc please see the attached very crude preview


regards
gary



Attachment(s):
refactor-mockup.png
0
Comment actions Permalink

From your mockup, it looks like you expect that everytime you edit the name of something, then this popup should show up.

What I was suggesting above is that that you still have to initiate the rename by pressing a keystroke, e.g. ALT+R (or whatever you have Rename bount to), and then the editor would switch into a special mode. It would work similar to how you can rename a filename inline in windows explorer, if you are familiar with that.

Attached is a modified mockup showing what I mean. Here, we are renaming "test8" to something else. To enter rename mode, the cursor needs to on "test8", then I invoke "Rename" refactoring, and then "test8" is put into a special inline editor. "test8" is hilighted, so that you can immediately start typing to overwrite the name. When you are done, press ENTER and the name will be saved and the name change will be propagated everywhere.

Your suggestion seems even simpler because you do away with the special editing mode altogether, but that might be trickier to implement because it has to detect when you done typing the name and handle special cases like pasting the name, and that popup might show up when you don't want it. If it could be done, that that would be really nice and make doing renames almost transparent!

0
Comment actions Permalink

I'd like all the modal dialogs for refactorings to go away and be replaced by non-modal ones. Introduce a Refactorings-toolwindow and put the dialog in there. Modal dialogs are mondo annoying, often I want to go back and forth between the NewNameInput-field and the Find-pane.

0
Comment actions Permalink

it could be that the pop upe appears when you start typing and will siappear when you start another activity i.e. it would scroll with the screen for example and disappear once you started typing somewhere else.....

0
Comment actions Permalink

Alain Ravet wrote:

As I mapped the much-easier-to-type-with-one-hand - *1 -to
'Rename', I no longer use .
I guess pressing twice would work too. Would it?


That would make sense to me.

--
Rob Harwood
Software Developer
JetBrains Inc.
http://www.jetbrains.com
"Develop with pleasure!"

0
Comment actions Permalink

Alain Ravet wrote:

Marcus Brito wrote:

>> Always show this dialog


I'd prefer

1°/ adding a
: enable inline replace

option to the standard rename dialog,

== the current interface


+1. I was going to suggest that too.

2°/ adding an icon/button at the far right of the the inline rename
frame, that you'd reach with Tab, and that would open the current dialog.
Its tooltip would indicate that a second press on shift-F6 would display
the dialog.


I'm not sure about reaching it with Tab, since I would expect Tab to
jump out of the red box like live templates. How about making it work
like the light-bulb for inspection settings (Alt-Enter, select Open
Rename Dialog from a popup list (preselected), Enter).

--
Rob Harwood
Software Developer
JetBrains Inc.
http://www.jetbrains.com
"Develop with pleasure!"

0
Comment actions Permalink

Rob

>> 2°/ adding an icon/button at the far right of the the inline rename
>> frame, that you'd reach with Tab, and that would open the current
>> dialog.
>> Its tooltip would indicate that a second press on shift-F6 would
>> display the dialog.
>
>

I'm not sure about reaching it with Tab, since I would expect Tab to
jump out of the red box like live templates. How about making it work
like the light-bulb for inspection settings (Alt-Enter, select Open
Rename Dialog from a popup list (preselected), Enter).

>


We need a hint, when renaming-in-place, that there is another way - the
rename dialog -, and that this way has a shortcut - a second Shift-F6.
That's why I suggested adding an icon/button, with a tooltip. It's not
really bad if it cannot be reached without the mouse. It may even be
better, as you suggested for Tab to work.


About 'Alt-Enter', I would rather suggest 'Shift-Enter', because of the
way this shortcut already works in the Move dialog (it clicks the button
after the text field, and opens a second dialog).

Alain

0
Comment actions Permalink

This is how ReSharper works today, and I'm not sure it's much better. Maybe it's because ReSharper doesn't do it quite right. The biggest issue I have is that I like to press ESC to dismiss name suggestions, which actually cancels the whole operation.

Also, how would you handle Preview? Now, you can aggue that renaming a variable is common and simple enough operation where you can get away without preview. Still, sometime with more complex code it's good to see what's going to change.

0
Comment actions Permalink

Hey guys. I've filed request http://www.jetbrains.net/jira/browse/IDEA-2003
for this functionality. It's been marked WONTFIX but I think with the support
and ideas that you guys have shown in this thread, it could be implemented.

You should vote for the issue and comment on it if you want the feature to
be implemented.


0
Comment actions Permalink

you can't vote for a won't fix

regards
gary

0

Please sign in to leave a comment.