You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@netbeans.apache.org by "mbien (via GitHub)" <gi...@apache.org> on 2024/12/23 22:14:34 UTC
[PR] Improve refactoring preview divider handling and tree navigation. [netbeans]
mbien opened a new pull request, #8089:
URL: https://github.com/apache/netbeans/pull/8089
- scroll only vertically on prev/next navigation
- reset divider only if left panel is below minimal size
fixes #8068
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org
For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists
Re: [PR] Improve refactoring preview divider handling and tree navigation. [netbeans]
Posted by "matthiasblaesing (via GitHub)" <gi...@apache.org>.
matthiasblaesing commented on code in PR #8089:
URL: https://github.com/apache/netbeans/pull/8089#discussion_r1897467961
##########
ide/refactoring.api/src/org/netbeans/modules/refactoring/spi/impl/RefactoringPanel.java:
##########
@@ -179,6 +181,11 @@ private void initialize() {
add(splitPane, BorderLayout.CENTER);
splitPane.setRightComponent(new JLabel(org.openide.util.NbBundle.getMessage(RefactoringPanel.class, "LBL_Preview_not_Available"), SwingConstants.CENTER));
splitPane.setBorder(null);
+ splitPane.addPropertyChangeListener(JSplitPane.DIVIDER_LOCATION_PROPERTY, evt -> {
+ if (evt.getNewValue() instanceof Integer pos && pos > MIN_DIVIDER_LOCATION) {
+ RefactoringPanel.dividerPosMemory = pos;
+ }
+ });
Review Comment:
Would it make sense to add the "minium width" logic also to `platform/api.search/src/org/netbeans/modules/search/ui/BasicSearchResultsPanel.java` and `platform/api.search/src/org/netbeans/modules/search/ui/BasicReplaceResultsPanel.java`? If I'm not mistaken there you can set the divider location to complete left and it will stay there.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org
For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists
Re: [PR] Improve refactoring preview divider handling and tree navigation. [netbeans]
Posted by "mbien (via GitHub)" <gi...@apache.org>.
mbien commented on PR #8089:
URL: https://github.com/apache/netbeans/pull/8089#issuecomment-2562005451
> Actually I don't really see a difference, but also no problem, so from my POV ok to go in if it helps
Try this:
- run find-usages on something which has many results (like `println()`)
- if the left view doesn't have a horizontal scrollbar yet, move the divider until you see one
- use next/prev button to navigate between results
NB <= 24 will move the horizontal scrollbar, with this PR applied the view is moved to the left and kept there on selection change.


I think allowing the tree to scroll horizontally on selection change is fine as default case for trees, but in this particular case it isn't very helpful. The tree is often shallow and the whole row is selectable, so locking it to the left makes sense I believe. (suggestion taken from the linked issue and mailing list)
> I would raise the question, whether it would be possible to persist the divider location into options as is done for search results.
The divider memory is a bit of an afterthought, I didn't implement it at first. The reason for this is because this is essentially management code for many different refactoring views. It would have to persist it on a per-view-type manner. I am also not sure if there is even a good default or initial value. I think it is very usecase dependent and might not make sense to persist.
However, if the user runs a refactoring preview with slider position X, the second time it is run might look good with the same position from before since it is probably the same codebase. So maybe in-memory persistence is good enough / potentially better anyway?
This might look patchy but the way it is implemented:
```java
if (splitPane.getDividerLocation() < MIN_DIVIDER_LOCATION) {
if (dividerPosMemory > MIN_DIVIDER_LOCATION) {
splitPane.setDividerLocation(dividerPosMemory);
} else {
splitPane.setDividerLocation(0.3);
}
}
```
means that the whole logic won't be active if the concrete view is setting a width via regular layout logic - this would already move the divider at this point and the whole thing is skipped.
But maybe I am overthinking this.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org
For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists
Re: [PR] Improve refactoring preview divider handling and tree navigation. [netbeans]
Posted by "matthiasblaesing (via GitHub)" <gi...@apache.org>.
matthiasblaesing commented on code in PR #8089:
URL: https://github.com/apache/netbeans/pull/8089#discussion_r1897472172
##########
ide/refactoring.api/src/org/netbeans/modules/refactoring/spi/impl/RefactoringPanel.java:
##########
@@ -179,6 +181,11 @@ private void initialize() {
add(splitPane, BorderLayout.CENTER);
splitPane.setRightComponent(new JLabel(org.openide.util.NbBundle.getMessage(RefactoringPanel.class, "LBL_Preview_not_Available"), SwingConstants.CENTER));
splitPane.setBorder(null);
+ splitPane.addPropertyChangeListener(JSplitPane.DIVIDER_LOCATION_PROPERTY, evt -> {
+ if (evt.getNewValue() instanceof Integer pos && pos > MIN_DIVIDER_LOCATION) {
+ RefactoringPanel.dividerPosMemory = pos;
+ }
+ });
Review Comment:
Ignore this, covered in #8088
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org
For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists
Re: [PR] Improve refactoring preview divider handling and tree navigation. [netbeans]
Posted by "mbien (via GitHub)" <gi...@apache.org>.
mbien merged PR #8089:
URL: https://github.com/apache/netbeans/pull/8089
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org
For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists