01: /*
02: * Licensed to the Apache Software Foundation (ASF) under one or more
03: * contributor license agreements. See the NOTICE file distributed with
04: * this work for additional information regarding copyright ownership.
05: * The ASF licenses this file to You under the Apache License, Version 2.0
06: * (the "License"); you may not use this file except in compliance with
07: * the License. You may obtain a copy of the License at
08: *
09: * 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:
21: import java.awt.event.ActionEvent;
22: import java.util.HashSet;
23: import java.util.Set;
24:
25: import org.apache.jmeter.gui.GuiPackage;
26: import org.apache.jmeter.gui.NamePanel;
27:
28: /**
29: * @author Michael Stover
30: * @version $Revision: 493779 $
31: */
32: public class EditCommand implements Command {
33: private static Set commands = new HashSet();
34: static {
35: commands.add(ActionNames.EDIT);
36: }
37:
38: public EditCommand() {
39: }
40:
41: public void doAction(ActionEvent e) {
42: GuiPackage guiPackage = GuiPackage.getInstance();
43: guiPackage.getMainFrame().setMainPanel(
44: (javax.swing.JComponent) guiPackage.getCurrentGui());
45: guiPackage.getMainFrame().setEditMenu(
46: guiPackage.getTreeListener().getCurrentNode()
47: .createPopupMenu());
48: // TODO: I believe the following code (to the end of the method) is
49: // obsolete,
50: // since NamePanel no longer seems to be the GUI for any component:
51: if (!(guiPackage.getCurrentGui() instanceof NamePanel)) {
52: guiPackage.getMainFrame().setFileLoadEnabled(true);
53: guiPackage.getMainFrame().setFileSaveEnabled(true);
54: } else {
55: guiPackage.getMainFrame().setFileLoadEnabled(false);
56: guiPackage.getMainFrame().setFileSaveEnabled(false);
57: }
58: }
59:
60: public Set getActionNames() {
61: return commands;
62: }
63: }
|