1818import the .bytecode .club .bytecodeviewer .BytecodeViewer ;
1919import the .bytecode .club .bytecodeviewer .gui .resourceviewer .viewer .ResourceViewer ;
2020import the .bytecode .club .bytecodeviewer .searching .BackgroundSearchThread ;
21- import the .bytecode .club .bytecodeviewer .searching .SearchResultNotifier ;
21+ import the .bytecode .club .bytecodeviewer .searching .LDCSearchTreeNodeResult ;
2222import the .bytecode .club .bytecodeviewer .translation .TranslatedStrings ;
2323import the .bytecode .club .bytecodeviewer .translation .TranslatedComponents ;
2424import the .bytecode .club .bytecodeviewer .translation .components .*;
4949 * @author WaterWolf
5050 * @since 09/29/2011
5151 */
52-
53- @ SuppressWarnings ("rawtypes" )
5452public class SearchBoxPane extends TranslatedVisibleComponent
5553{
5654 public static final SearchRadius [] SEARCH_RADII = SearchRadius .values ();
@@ -59,7 +57,7 @@ public class SearchBoxPane extends TranslatedVisibleComponent
5957 public final JCheckBox exact = new TranslatedJCheckBox ("Exact" , TranslatedComponents .EXACT );
6058 public final TranslatedDefaultMutableTreeNode treeRoot = new TranslatedDefaultMutableTreeNode ("Results" , TranslatedComponents .RESULTS );
6159 public final JTree tree ;
62- public final JComboBox typeBox ;
60+ public final JComboBox < SearchType > typeBox ;
6361
6462 public SearchType searchType = null ;
6563 public final JComboBox searchRadiusBox ;
@@ -91,13 +89,13 @@ public SearchBoxPane()
9189 for (final SearchType st : SEARCH_TYPES )
9290 model .addElement (st );
9391
94- typeBox = new JComboBox (model );
92+ typeBox = new JComboBox < SearchType > (model );
9593 final JPanel searchOptPanel = new JPanel ();
9694
9795 final ItemListener il = arg0 -> {
9896 searchOptPanel .removeAll ();
9997 searchType = (SearchType ) typeBox .getSelectedItem ();
100- searchOptPanel .add (Objects .requireNonNull (searchType ).details .getPanel ());
98+ searchOptPanel .add (Objects .requireNonNull (searchType ).panel .getPanel ());
10199
102100 searchOptPanel .revalidate ();
103101 searchOptPanel .repaint ();
@@ -138,18 +136,11 @@ public SearchBoxPane()
138136 if (selectionEvent .getPath ().getPathComponent (0 ).equals (TranslatedStrings .RESULTS ))
139137 return ;
140138
141- selectionEvent .getPath ().getPathComponent (1 );
142-
143- String path = selectionEvent .getPath ().getPathComponent (1 ).toString ();
144-
145- String containerName = path .split (">" , 2 )[0 ];
146- String className = path .split (">" , 2 )[1 ].split ("\\ ." )[0 ];
147- ResourceContainer container = BytecodeViewer .getFileContainer (containerName );
139+ LDCSearchTreeNodeResult result = (LDCSearchTreeNodeResult ) tree .getLastSelectedPathComponent ();
148140
149- final ClassNode fN = Objects .requireNonNull (container ).getClassNode (className );
150-
151- if (fN != null )
152- BytecodeViewer .viewer .workPane .addClassResource (container , className + ".class" );
141+ final String name = result .resourceWorkingName ;
142+
143+ BytecodeViewer .viewer .workPane .addClassResource (result .container , name );
153144 }
154145 catch (Exception e )
155146 {
@@ -166,7 +157,6 @@ public void search()
166157 treeRoot .removeAllChildren ();
167158 searchType = (SearchType ) typeBox .getSelectedItem ();
168159 final SearchRadius radius = (SearchRadius ) searchRadiusBox .getSelectedItem ();
169- final SearchResultNotifier srn = debug -> treeRoot .add (new DefaultMutableTreeNode (debug ));
170160
171161 if (radius == SearchRadius .All_Classes )
172162 {
@@ -175,7 +165,7 @@ public void search()
175165 BytecodeViewer .viewer .searchBoxPane .search .setEnabled (false );
176166 BytecodeViewer .viewer .searchBoxPane .search .setText ("Searching, please wait.." );
177167
178- performSearchThread = new PerformSearch (this , srn );
168+ performSearchThread = new PerformSearch (this );
179169 performSearchThread .start ();
180170 }
181171 else
@@ -188,7 +178,7 @@ else if (radius == SearchRadius.Current_Class)
188178 final ResourceViewer cv = BytecodeViewer .getActiveResource ();
189179
190180 if (cv != null )
191- searchType .details .search (cv .resource .container , cv .resource .getResourceClassNode (), srn , exact .isSelected ());
181+ searchType .panel .search (cv .resource .container , cv .resource .workingName , cv . resource . getResourceClassNode (), exact .isSelected ());
192182 }
193183 }
194184
0 commit comments