KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > jmeter > gui > action > EditCommand


1 // $Header: /home/cvs/jakarta-jmeter/src/core/org/apache/jmeter/gui/action/EditCommand.java,v 1.7 2004/02/20 02:20:47 jsalvata Exp $
2
/*
3  * Copyright 2001-2004 The Apache Software Foundation.
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  *
17 */

18
19 package org.apache.jmeter.gui.action;
20 import java.awt.event.ActionEvent JavaDoc;
21 import java.util.HashSet JavaDoc;
22 import java.util.Set JavaDoc;
23
24 import org.apache.jmeter.gui.GuiPackage;
25 import org.apache.jmeter.gui.NamePanel;
26
27 /**
28  * @author Michael Stover
29  * @version $Revision: 1.7 $
30  */

31 public class EditCommand implements Command
32 {
33     private static Set JavaDoc commands = new HashSet JavaDoc();
34     static
35     {
36         commands.add("edit");
37     }
38
39     public EditCommand()
40     {
41     }
42
43     public void doAction(ActionEvent JavaDoc e)
44     {
45         GuiPackage guiPackage = GuiPackage.getInstance();
46         guiPackage.getMainFrame().setMainPanel(
47             (javax.swing.JComponent JavaDoc) guiPackage.getCurrentGui());
48         guiPackage.getMainFrame().setEditMenu(guiPackage.getTreeListener()
49             .getCurrentNode().createPopupMenu());
50         // TODO: I believe the following code (to the end of the method) is obsolete,
51
// since NamePanel no longer seems to be the GUI for any component:
52
if (!(guiPackage.getCurrentGui() instanceof NamePanel))
53         {
54             guiPackage.getMainFrame().setFileLoadEnabled(true);
55             guiPackage.getMainFrame().setFileSaveEnabled(true);
56         }
57         else
58         {
59             guiPackage.getMainFrame().setFileLoadEnabled(false);
60             guiPackage.getMainFrame().setFileSaveEnabled(false);
61         }
62     }
63
64     public Set JavaDoc getActionNames()
65     {
66         return commands;
67     }
68 }
69
Popular Tags