1 package com.explosion.expfmodules.search;
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22 import java.awt.Dimension;
23 import java.awt.event.ActionEvent;
24 import java.util.HashMap;
25 import java.util.Map;
26
27 import javax.swing.JInternalFrame;
28
29 import com.explosion.expf.Application;
30 import com.explosion.expf.ExpActionListener;
31 import com.explosion.expf.ExpFrame;
32 import com.explosion.expfmodules.search.dialogs.ClassSearchJPanel;
33 import com.explosion.expfmodules.search.dialogs.SearchJPanel;
34 import com.explosion.utilities.preferences.groups.dialogs.PreferenceGroupsEditorDialog;
35
36 /***
37 * @author stephen
38 *
39 */
40 public class SearchListener implements ExpActionListener
41 {
42
43 private HashMap map;
44 private PreferenceGroupsEditorDialog connectionsDialog;
45 private PreferenceGroupsEditorDialog driversDialog;
46 private Dimension dialogDimension = new Dimension(300,250);
47
48 /***
49 * Constructor for TextEditorListener.
50 */
51 public SearchListener()
52 {
53 map = new HashMap();
54 map.put(SearchConstants.MENU_SEARCH_IN_FILES,SearchConstants.MENU_SEARCH_IN_FILES);
55 map.put(SearchConstants.MENU_REPLACE_IN_FILES,SearchConstants.MENU_REPLACE_IN_FILES);
56 map.put(SearchConstants.MENU_SEARCH_FOR_CLASSES,SearchConstants.MENU_SEARCH_FOR_CLASSES);
57 }
58
59 /***
60 * @see package com.explosion.expf.Interfaces.ExpActionListener#getListensFor()
61 */
62 public Map getListensFor()
63 {
64 return map;
65 }
66
67 /***
68 * @see java.awt.event.ActionListener#actionPerformed(ActionEvent)
69 */
70 public void actionPerformed(ActionEvent e)
71 {
72 try
73 {
74 if (e.getActionCommand().equals(SearchConstants.MENU_SEARCH_IN_FILES))
75 {
76 SearchJPanel searchPanel = new SearchJPanel(false);
77 ((ExpFrame) Application.getApplicationFrame()).createPaletteFrame(searchPanel, new Dimension(500,200), "Search in files",false);
78 JInternalFrame frame = ((ExpFrame) Application.getApplicationFrame()).getFrameWithComponent(searchPanel, ExpFrame.PALETTE_LAYER.intValue());
79 frame.pack();
80 }
81 else if (e.getActionCommand().equals(SearchConstants.MENU_REPLACE_IN_FILES))
82 {
83 SearchJPanel searchPanel = new SearchJPanel(true);
84 ((ExpFrame) Application.getApplicationFrame()).createPaletteFrame(searchPanel, new Dimension(500,200), "Search in files",false);
85 JInternalFrame frame = ((ExpFrame) Application.getApplicationFrame()).getFrameWithComponent(searchPanel, ExpFrame.PALETTE_LAYER.intValue());
86 frame.pack();
87 }
88 else if (e.getActionCommand().equals(SearchConstants.MENU_SEARCH_FOR_CLASSES))
89 {
90 ClassSearchJPanel searchPanel = new ClassSearchJPanel();
91 ((ExpFrame) Application.getApplicationFrame()).createPaletteFrame(searchPanel, new Dimension(500,200), "Search in files",false);
92 JInternalFrame frame = ((ExpFrame) Application.getApplicationFrame()).getFrameWithComponent(searchPanel, ExpFrame.PALETTE_LAYER.intValue());
93 frame.pack();
94 }
95 }
96 catch (Exception ex)
97 {
98 com.explosion.utilities.exception.ExceptionManagerFactory.getExceptionManager().manageException(ex, "Exception caught while responding to SimpleProcess Event." );
99 }
100
101 }
102
103 }