Skip to content
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

[NETBEANS-4368] Fix test file navigation dialog #2155

Merged
merged 1 commit into from Jun 12, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Expand Up @@ -21,6 +21,7 @@

import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
Expand Down Expand Up @@ -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> {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a note: I usually put the inner classes at the very end of the class (usually below //~ Inner classes comment). No need to change it in this PR, I just think it makes the code more readable (main class and then inner classes, not mixed).

@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() {
}

Expand Down Expand Up @@ -174,6 +183,7 @@ private static LocationResult findFile(PhpProject project, FileObject file, bool
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>() {
Expand Down
Expand Up @@ -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>
Expand Down
Expand Up @@ -133,7 +133,7 @@ private void initComponents() {

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
Expand All @@ -143,22 +143,20 @@ private void initComponents() {

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)
.addComponent(selectFileScrollPane, GroupLayout.DEFAULT_SIZE, 280, Short.MAX_VALUE)
.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

Expand Down