This is an automated email from the ASF dual-hosted git repository.

junichi11 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/netbeans.git


The following commit(s) were added to refs/heads/master by this push:
     new ec69f71  [NETBEANS-4368] Fix test file navigation dialog
     new 3e41cd0  Merge pull request #2155 from KacerCZ/netbeans-4368
ec69f71 is described below

commit ec69f71956aafc00b47e1b8483c5a0141074c5ca
Author: Tomas Prochazka <ka...@razdva.cz>
AuthorDate: Sat May 23 23:28:44 2020 +0200

    [NETBEANS-4368] Fix test file navigation dialog
    
    Fixes resizing of test file selection when navigating to test file.
    Files are sorted by path.
---
 .../modules/php/project/ui/actions/tests/GoToTest.java       | 10 ++++++++++
 .../php/project/ui/actions/tests/SelectFilePanel.form        |  6 +++---
 .../php/project/ui/actions/tests/SelectFilePanel.java        | 12 +++++-------
 3 files changed, 18 insertions(+), 10 deletions(-)

diff --git 
a/php/php.project/src/org/netbeans/modules/php/project/ui/actions/tests/GoToTest.java
 
b/php/php.project/src/org/netbeans/modules/php/project/ui/actions/tests/GoToTest.java
index 5e3be84..e5d80ca 100644
--- 
a/php/php.project/src/org/netbeans/modules/php/project/ui/actions/tests/GoToTest.java
+++ 
b/php/php.project/src/org/netbeans/modules/php/project/ui/actions/tests/GoToTest.java
@@ -21,6 +21,7 @@ package org.netbeans.modules.php.project.ui.actions.tests;
 
 import java.util.ArrayList;
 import java.util.Collections;
+import java.util.Comparator;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
@@ -54,6 +55,14 @@ public class GoToTest implements TestLocator {
     private static final Logger LOGGER = 
Logger.getLogger(GoToTest.class.getName());
     private static final RequestProcessor RP = new 
RequestProcessor(GoToTest.class.getName(), 2);
 
+    private static class FileObjectComparator implements 
Comparator<FileObject> {
+        @Override
+        public int compare(FileObject fo1, FileObject fo2) {
+            return fo1.getPath().compareTo(fo2.getPath());
+        }
+    }
+    static final Comparator<FileObject> FILE_OBJECT_COMAPARTOR = new 
FileObjectComparator();
+
     public GoToTest() {
     }
 
@@ -174,6 +183,7 @@ public class GoToTest implements TestLocator {
         for (Locations.Offset location : phpFiles.values()) {
             files.add(location.getFile());
         }
+        files.sort(FILE_OBJECT_COMAPARTOR);
         final List<FileObject> sourceRootsCopy = new 
CopyOnWriteArrayList<>(sourceRoots);
         final List<FileObject> filesCopy = new CopyOnWriteArrayList<>(files);
         FileObject selected = Mutex.EVENT.readAccess(new 
Mutex.Action<FileObject>() {
diff --git 
a/php/php.project/src/org/netbeans/modules/php/project/ui/actions/tests/SelectFilePanel.form
 
b/php/php.project/src/org/netbeans/modules/php/project/ui/actions/tests/SelectFilePanel.form
index f116427..3227174 100644
--- 
a/php/php.project/src/org/netbeans/modules/php/project/ui/actions/tests/SelectFilePanel.form
+++ 
b/php/php.project/src/org/netbeans/modules/php/project/ui/actions/tests/SelectFilePanel.form
@@ -50,10 +50,10 @@
     <DimensionLayout dim="1">
       <Group type="103" groupAlignment="0" attributes="0">
           <Group type="102" alignment="0" attributes="0">
-              <EmptySpace max="32767" attributes="0"/>
+              <EmptySpace min="-2" max="-2" attributes="0"/>
               <Component id="selectFileLabel" min="-2" max="-2" 
attributes="0"/>
-              <EmptySpace max="-2" attributes="0"/>
-              <Component id="selectFileScrollPane" min="-2" pref="85" max="-2" 
attributes="0"/>
+              <EmptySpace min="-2" max="-2" attributes="0"/>
+              <Component id="selectFileScrollPane" pref="85" max="32767" 
attributes="0"/>
           </Group>
       </Group>
     </DimensionLayout>
diff --git 
a/php/php.project/src/org/netbeans/modules/php/project/ui/actions/tests/SelectFilePanel.java
 
b/php/php.project/src/org/netbeans/modules/php/project/ui/actions/tests/SelectFilePanel.java
index 09208d2..c346399 100644
--- 
a/php/php.project/src/org/netbeans/modules/php/project/ui/actions/tests/SelectFilePanel.java
+++ 
b/php/php.project/src/org/netbeans/modules/php/project/ui/actions/tests/SelectFilePanel.java
@@ -133,7 +133,7 @@ public final class SelectFilePanel extends JPanel {
 
         selectFileLabel = new JLabel();
         selectFileScrollPane = new JScrollPane();
-        selectFileList = new JList<FileObject>();
+        selectFileList = new JList<>();
 
         selectFileLabel.setLabelFor(selectFileList);
         Mnemonics.setLocalizedText(selectFileLabel, 
NbBundle.getMessage(SelectFilePanel.class, 
"SelectFilePanel.selectFileLabel.text")); // NOI18N
@@ -143,8 +143,7 @@ public final class SelectFilePanel extends JPanel {
 
         GroupLayout layout = new GroupLayout(this);
         this.setLayout(layout);
-        layout.setHorizontalGroup(
-            layout.createParallelGroup(Alignment.LEADING)
+        layout.setHorizontalGroup(layout.createParallelGroup(Alignment.LEADING)
             .addGroup(layout.createSequentialGroup()
                 .addContainerGap()
                 .addGroup(layout.createParallelGroup(Alignment.LEADING)
@@ -152,13 +151,12 @@ public final class SelectFilePanel extends JPanel {
                     .addComponent(selectFileLabel))
                 .addContainerGap())
         );
-        layout.setVerticalGroup(
-            layout.createParallelGroup(Alignment.LEADING)
+        layout.setVerticalGroup(layout.createParallelGroup(Alignment.LEADING)
             .addGroup(layout.createSequentialGroup()
-                .addContainerGap(GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
+                .addContainerGap()
                 .addComponent(selectFileLabel)
                 .addPreferredGap(ComponentPlacement.RELATED)
-                .addComponent(selectFileScrollPane, 
GroupLayout.PREFERRED_SIZE, 85, GroupLayout.PREFERRED_SIZE))
+                .addComponent(selectFileScrollPane, GroupLayout.DEFAULT_SIZE, 
85, Short.MAX_VALUE))
         );
     }// </editor-fold>//GEN-END:initComponents
 


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@netbeans.apache.org
For additional commands, e-mail: commits-h...@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists

Reply via email to