View Javadoc

1   package com.explosion.expfmodules.search;
2   
3   /* =============================================================================
4    *       
5    *     Copyright 2004 Stephen Cowx
6    *
7    *     Licensed under the Apache License, Version 2.0 (the "License");
8    *     you may not use this file except in compliance with the License.
9    *     You may obtain a copy of the License at
10   *
11   *     http://www.apache.org/licenses/LICENSE-2.0
12   *
13   *     Unless required by applicable law or agreed to in writing, software
14   *     distributed under the License is distributed on an "AS IS" BASIS,
15   *     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16   *     See the License for the specific language governing permissions and
17   *     limitations under the License.
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 }