Fixed Search Tree Selection
The search box tree selection now functions the same as the resource list tree
This commit is contained in:
parent
f4c0e71475
commit
d95b9d0158
1 changed files with 19 additions and 13 deletions
|
@ -3,6 +3,8 @@ package the.bytecode.club.bytecodeviewer.gui.resourcesearch;
|
||||||
import java.awt.BorderLayout;
|
import java.awt.BorderLayout;
|
||||||
import java.awt.GridLayout;
|
import java.awt.GridLayout;
|
||||||
import java.awt.event.ItemListener;
|
import java.awt.event.ItemListener;
|
||||||
|
import java.awt.event.MouseAdapter;
|
||||||
|
import java.awt.event.MouseEvent;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
import javax.swing.DefaultComboBoxModel;
|
import javax.swing.DefaultComboBoxModel;
|
||||||
import javax.swing.JButton;
|
import javax.swing.JButton;
|
||||||
|
@ -129,22 +131,26 @@ public class SearchBoxPane extends TranslatedVisibleComponent
|
||||||
getContentPane().add(optionPanel, BorderLayout.NORTH);
|
getContentPane().add(optionPanel, BorderLayout.NORTH);
|
||||||
getContentPane().add(new JScrollPane(tree), BorderLayout.CENTER);
|
getContentPane().add(new JScrollPane(tree), BorderLayout.CENTER);
|
||||||
|
|
||||||
this.tree.addTreeSelectionListener(selectionEvent ->
|
tree.addMouseListener(new MouseAdapter()
|
||||||
{
|
{
|
||||||
try
|
@Override
|
||||||
|
public void mouseReleased(MouseEvent e)
|
||||||
{
|
{
|
||||||
if (selectionEvent.getPath().getPathComponent(0).equals(TranslatedStrings.RESULTS))
|
//TODO right-click context menu
|
||||||
return;
|
if (e.isMetaDown())
|
||||||
|
{
|
||||||
|
}
|
||||||
|
else if (e.getButton() == MouseEvent.BUTTON1)
|
||||||
|
{
|
||||||
|
if(!(tree.getLastSelectedPathComponent() instanceof LDCSearchTreeNodeResult))
|
||||||
|
return;
|
||||||
|
|
||||||
LDCSearchTreeNodeResult result = (LDCSearchTreeNodeResult) tree.getLastSelectedPathComponent();
|
LDCSearchTreeNodeResult result = (LDCSearchTreeNodeResult) tree.getLastSelectedPathComponent();
|
||||||
|
|
||||||
final String name = result.resourceWorkingName;
|
final String name = result.resourceWorkingName;
|
||||||
|
|
||||||
BytecodeViewer.viewer.workPane.addClassResource(result.container, name);
|
BytecodeViewer.viewer.workPane.addClassResource(result.container, name);
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
|
||||||
{
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue