@@ -107,6 +107,9 @@ public class RefactoringPanel extends JPanel implements FiltersManagerImpl.Filte
107107 private Action callback = null ;
108108
109109 private static final int MAX_ROWS = 50 ;
110+ private static final int MIN_DIVIDER_LOCATION = 250 ;
111+ /* last user modified divider position shared between all instances */
112+ private static int dividerPosMemory = -1 ;
110113
111114 private transient JToggleButton logicalViewButton = null ;
112115 private transient JToggleButton physicalViewButton = null ;
@@ -125,7 +128,6 @@ public class RefactoringPanel extends JPanel implements FiltersManagerImpl.Filte
125128 private FiltersManagerImpl filtersManager ;
126129 private JComponent filterBar ;
127130 private JPanel toolbars ;
128-
129131
130132 static Image PACKAGE_BADGE = ImageUtilities .loadImage ( "org/netbeans/spi/java/project/support/ui/packageBadge.gif" ); // NOI18N
131133
@@ -179,6 +181,11 @@ private void initialize() {
179181 add (splitPane , BorderLayout .CENTER );
180182 splitPane .setRightComponent (new JLabel (org .openide .util .NbBundle .getMessage (RefactoringPanel .class , "LBL_Preview_not_Available" ), SwingConstants .CENTER ));
181183 splitPane .setBorder (null );
184+ splitPane .addPropertyChangeListener (JSplitPane .DIVIDER_LOCATION_PROPERTY , evt -> {
185+ if (evt .getNewValue () instanceof Integer pos && pos > MIN_DIVIDER_LOCATION ) {
186+ RefactoringPanel .dividerPosMemory = pos ;
187+ }
188+ });
182189 // add panel with buttons
183190 JButton [] buttons = getButtons ();
184191 // there will be at least one button on panel
@@ -706,7 +713,6 @@ private void refresh(final boolean showParametersPanel) {
706713 if (currentView == GRAPHICAL ) {
707714 assert ui instanceof RefactoringCustomUI ;
708715 assert customComponent != null ;
709- RefactoringCustomUI cui = (RefactoringCustomUI ) ui ;
710716 this .left .remove (scrollPane );
711717 this .left .add (customComponent , BorderLayout .CENTER );
712718 UI .setComponentForRefactoringPreview (null );
@@ -738,7 +744,7 @@ public void run() {
738744 final Map <Object , CheckNode > nodes = new HashMap <Object , CheckNode >();
739745
740746 if (isQuery && showParametersPanel ) {
741- setupInstantTree (root , showParametersPanel );
747+ setupInstantTree (root );
742748 }
743749
744750 if (!isQuery ) {
@@ -897,8 +903,7 @@ private void setupTree(final CheckNode root, final boolean showParametersPanel,
897903 @ Override
898904 public void run () {
899905 createTree (root );
900-
901- splitPane .setDividerLocation (0.3 );
906+ initDivider ();
902907 expandTreeIfNeeded (showParametersPanel , size );
903908
904909 tree .setSelectionRow (0 );
@@ -910,6 +915,16 @@ public void run() {
910915 });
911916 }
912917
918+ private void initDivider () {
919+ if (splitPane .getDividerLocation () < MIN_DIVIDER_LOCATION ) {
920+ if (dividerPosMemory > MIN_DIVIDER_LOCATION ) {
921+ splitPane .setDividerLocation (dividerPosMemory );
922+ } else {
923+ splitPane .setDividerLocation (0.3 );
924+ }
925+ }
926+ }
927+
913928 private void expandTreeIfNeeded (boolean showParametersPanel , int size ) {
914929 if (showParametersPanel ) {
915930 if (size < MAX_ROWS ) {
@@ -1005,14 +1020,14 @@ private void createTree(TreeNode root) throws MissingResourceException {
10051020 });
10061021 }
10071022
1008- private void setupInstantTree (final CheckNode root , final boolean showParametersPanel ) {
1023+ private void setupInstantTree (final CheckNode root ) {
10091024 SwingUtilities .invokeLater (new Runnable () {
10101025
10111026 @ Override
10121027 public void run () {
10131028 createTree (root );
10141029 tree .setSelectionRow (0 );
1015- splitPane . setDividerLocation ( 0.3 );
1030+ initDivider ( );
10161031 if (refactorButton != null ) {
10171032 refactorButton .requestFocusInWindow ();
10181033 } else if (tree != null ) {
@@ -1213,30 +1228,6 @@ private void stopSearch() {
12131228 cancelRequest .set (true );
12141229 ui .getRefactoring ().cancelRequest ();
12151230 }
1216-
1217- private static String normalize (String input ) {
1218- int size = input .length ();
1219- char [] c = new char [size ];
1220- input .getChars (0 , size , c , 0 );
1221- boolean wb = false ;
1222- int pos = 0 ;
1223- char [] nc = new char [size ];
1224-
1225- for (int i = 0 ; i < size ; i ++) {
1226- if (Character .isWhitespace (c [i ])) {
1227- if (!wb ) {
1228- nc [pos ++] = ' ' ;
1229-
1230- wb = true ;
1231- }
1232- }
1233- else {
1234- nc [pos ++] = c [i ];
1235- wb = false ;
1236- }
1237- }
1238- return new String (nc , 0 , pos );
1239- }
12401231
12411232 /** Processes returned problems from refactoring operations and notifies
12421233 * user (in case of non-fatal problems gives user a chance to continue or cancel).
0 commit comments