1919import cn .enaium .joe .JavaOctetEditor ;
2020import cn .enaium .joe .dialog .SearchDialog ;
2121import cn .enaium .joe .gui .panel .search .ResultNode ;
22- import cn .enaium .joe .jar .Jar ;
22+ import cn .enaium .joe .task .SearchFieldTask ;
23+ import cn .enaium .joe .task .SearchMethodTask ;
2324import cn .enaium .joe .util .ASyncUtil ;
2425import cn .enaium .joe .util .LangUtil ;
26+ import cn .enaium .joe .util .MessageUtil ;
2527import cn .enaium .joe .util .StringUtil ;
2628import org .objectweb .asm .tree .*;
2729
2830import javax .swing .*;
2931import java .awt .*;
30- import java .util .Map ;
3132
3233/**
3334 * @author Enaium
@@ -46,24 +47,26 @@ public SearchMethodDialog() {
4647 add (new JLabel (LangUtil .i18n ("search.description" )));
4748 JTextField description = new JTextField ();
4849 add (description );
49- JCheckBox anInterface = new JCheckBox ("Interface" );
50+ JCheckBox anInterface = new JCheckBox (LangUtil . i18n ( "search.interface" ) );
5051 add (anInterface );
5152 add (new JButton (LangUtil .i18n ("button.search" )) {{
5253 addActionListener (e -> {
53- ASyncUtil .execute (() -> {
54- searchInstruction ((classNode , instruction ) -> {
55- if (instruction instanceof MethodInsnNode ) {
56- MethodInsnNode methodInsnNode = (MethodInsnNode ) instruction ;
57- if ((methodInsnNode .owner .contains (owner .getText ()) || StringUtil .isBlank (owner .getText ())) &&
58- (methodInsnNode .name .contains (name .getText ()) || StringUtil .isBlank (name .getText ())) &&
59- (methodInsnNode .desc .contains (description .getText ()) || StringUtil .isBlank (description .getText ())) &&
60- (methodInsnNode .itf && anInterface .isSelected () || !anInterface .isSelected ())
61- ) {
62- ((DefaultListModel <ResultNode >) resultPanel .getList ().getModel ()).addElement (new ResultNode (classNode , methodInsnNode .name + "#" + methodInsnNode .desc ));
54+
55+
56+ if (StringUtil .isBlank (owner .getText ()) && StringUtil .isBlank (name .getText ()) && StringUtil .isBlank (description .getText ()) && !anInterface .isSelected ()) {
57+ MessageUtil .warning ("Please input" );
58+ return ;
59+ }
60+
61+
62+ JavaOctetEditor .getInstance ().task
63+ .submit (new SearchMethodTask (JavaOctetEditor .getInstance ().jar , owner .getText (), name .getText (), description .getText (), anInterface .isSelected ()))
64+ .thenAccept (it -> {
65+ ((DefaultListModel <ResultNode >) resultList .getModel ()).clear ();
66+ for (ResultNode resultNode : it ) {
67+ ((DefaultListModel <ResultNode >) resultList .getModel ()).addElement (resultNode );
6368 }
64- }
65- });
66- });
69+ });
6770 });
6871 }});
6972 }}, BorderLayout .SOUTH );
0 commit comments