-
Notifications
You must be signed in to change notification settings - Fork 865
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added code preview for “find usages” and related refactorings #7694
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
good idea! It causes some problems though atm. E.g java rename refactoring preview won't show as diff view now if the show-preview button was activated in the find usages window before.
I am also wondering if this is something which should be always enabled (no button), since i looked a bit around and no other window has a button to disable the diff view or preview right now. (checked bookmarks, refactoring and search windows)
(was curious if one of the language tests would be catching this, but everything is green)
Thank you! I was only testing the case with one open panel and missed the point that multiple panels can be open at the same time. I'll look into it.
I think that using the preview for find usages is not mandatory as for refactoring, and should be at the user's discretion. |
e709b4a
to
6f8b485
Compare
Great work, thx :) @troizet. I didn't look at the code, I just want to thank you. |
ide/refactoring.api/src/org/netbeans/modules/refactoring/spi/impl/PreviewManager.java
Outdated
Show resolved
Hide resolved
ide/refactoring.api/src/org/netbeans/modules/refactoring/spi/impl/RefactoringPanel.java
Outdated
Show resolved
Hide resolved
ide/refactoring.api/src/org/netbeans/modules/refactoring/spi/impl/RefactoringPanel.java
Outdated
Show resolved
Hide resolved
ide/refactoring.api/src/org/netbeans/modules/refactoring/spi/impl/RefactoringPanel.java
Outdated
Show resolved
Hide resolved
ide/refactoring.api/src/org/netbeans/modules/refactoring/spi/impl/RefactoringPanel.java
Outdated
Show resolved
Hide resolved
ide/refactoring.api/src/org/netbeans/modules/refactoring/spi/impl/RefactoringPanel.java
Outdated
Show resolved
Hide resolved
6f8b485
to
dc00ca3
Compare
Regarding the button, I still tend to believe that it is necessary. Maybe put this question on the mailing list for discussion? |
sure why not. My main point is consistency. A button like this should be on all comparable query-type windows which have a preview. You already mentioned you want to add it to search too, bookmarks window would need it too etc. The easier solution would be no button, since nothing has one atm (this would be also consistent). The code inspection window (not the refactoring window) has currently no preview, the panel on the right is used for the hint description. |
dc00ca3
to
c11b5cd
Compare
@mbien Removed the preview button. I will try to add it in another PR in all places where it is needed. |
I also made a PR for the search results #7779 |
ide/refactoring.api/src/org/netbeans/modules/refactoring/spi/impl/CheckNodeListener.java
Outdated
Show resolved
Hide resolved
ide/refactoring.api/src/org/netbeans/modules/refactoring/spi/impl/RefactoringPanel.java
Outdated
Show resolved
Hide resolved
ide/refactoring.api/src/org/netbeans/modules/refactoring/spi/impl/RefactoringPanel.java
Outdated
Show resolved
Hide resolved
c11b5cd
to
ec0ab03
Compare
ec0ab03
to
18c2f55
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks! works great.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks sane to me. The search result window might be a good candidate to be enhanced similarly, but that is not necessarily in scope.
@troizet One of the best, thanks |
Don't like this. Can it be disabled by the user? |
As far as I can see, I think you only have to move the slider away to hide the preview. But it will not keep this position for the next "find". But all tabs will keep the user slider position until close. |
I have to use
find usages
a lot and I really miss the ability to quickly view the contents of files.I have to open tabs in the main editor, which sometimes leads to a lot of unnecessary tabs.
Example of code preview for
find usages
:example_finud_usages_preview_2.mp4
An example of code preview for refactoring
safely delete
, which usesfind usages
functionality:example_refactoring_using_find_usages_preview_2.mp4
I borrowed the preview implementation from here:
netbeans/ide/editor.bookmarks/src/org/netbeans/modules/editor/bookmarks/ui/BookmarksView.java
Lines 536 to 563 in 6c6beed