01: /*
02: * Copyright 2001-2006 C:1 Financial Services GmbH
03: *
04: * This software is free software; you can redistribute it and/or
05: * modify it under the terms of the GNU Lesser General Public
06: * License Version 2.1, as published by the Free Software Foundation.
07: *
08: * This software is distributed in the hope that it will be useful,
09: * but WITHOUT ANY WARRANTY; without even the implied warranty of
10: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11: * Lesser General Public License for more details.
12: *
13: * You should have received a copy of the GNU Lesser General Public
14: * License along with this library; if not, write to the Free Software
15: * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA
16: */
17:
18: package de.finix.contelligent.client.gui.explorer;
19:
20: import java.awt.event.ActionEvent;
21:
22: import javax.swing.AbstractAction;
23: import javax.swing.Action;
24: import javax.swing.JOptionPane;
25:
26: import de.finix.contelligent.client.base.ComponentFactory;
27: import de.finix.contelligent.client.gui.ContelligentAction;
28: import de.finix.contelligent.client.i18n.Resources;
29:
30: final public class CommitContextAction extends AbstractAction implements
31: ContelligentAction {
32: /**
33: *
34: */
35: private final ExplorerEditor editor;
36:
37: public CommitContextAction(ExplorerEditor editor) {
38: super ("commit_context_action", Resources.commitContextIcon);
39: this .editor = editor;
40: putValue(ROLLOVER_ICON, Resources.commitContextIconRollOver);
41: putValue(Action.SHORT_DESCRIPTION,
42: "commit_context_action_description");
43: putValue(TYPE, PUSH_ACTION);
44: putValue(ACTION_TYPE, SERVER_ACTION);
45: putValue(ACTION_GROUP, SERVER_GLOBAL_GROUP);
46: putValue(ACTION_POS, SERVER_GLOBAL_COMMIT);
47: putValue(MENU_TARGET, MENU);
48: }
49:
50: public void actionPerformed(ActionEvent e) {
51: if (!this .editor.openEditors()) {
52: if (JOptionPane.showConfirmDialog(this .editor.getParent(),
53: Resources.getLocalString("commit_context",
54: new String[] { ComponentFactory
55: .getInstance().getCurrentContext()
56: .getShortName() }), Resources
57: .getLocalString("commit_context_title"),
58: JOptionPane.OK_CANCEL_OPTION) == JOptionPane.OK_OPTION) {
59: ComponentFactory.getInstance().commitCurrentContext(
60: editor.getView().getEnvironment(),
61: this.editor.getParent());
62: }
63: }
64: }
65: }
|