[Aprog]
[aprog.git] / Aprog / src / net / sourceforge / aprog / af / ShowAboutDialogAction.java
blobc98f07c5b18695c3d3964a655b5fed57a8c7f18f
1 /*
2 * The MIT License
3 *
4 * Copyright 2010 Codist Monk.
5 *
6 * Permission is hereby granted, free of charge, to any person obtaining a copy
7 * of this software and associated documentation files (the "Software"), to deal
8 * in the Software without restriction, including without limitation the rights
9 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 * copies of the Software, and to permit persons to whom the Software is
11 * furnished to do so, subject to the following conditions:
13 * The above copyright notice and this permission notice shall be included in
14 * all copies or substantial portions of the Software.
16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22 * THE SOFTWARE.
25 package net.sourceforge.aprog.af;
27 import static net.sourceforge.aprog.i18n.Messages.*;
28 import static net.sourceforge.aprog.af.AFConstants.Variables.*;
30 import java.awt.Component;
32 import javax.swing.JOptionPane;
34 import net.sourceforge.aprog.context.Context;
35 import net.sourceforge.aprog.swing.SwingTools;
37 /**
39 * @author codistmonk (creation 2010-09-24)
41 public final class ShowAboutDialogAction extends AbstractAFAction {
43 /**
45 * @param context
46 * <br>Not null
47 * <br>Shared
48 * <br>Input-output
50 public ShowAboutDialogAction(final Context context) {
51 super(context, ACTIONS_SHOW_ABOUT_DIALOG);
54 @Override
55 public final void perform() {
56 final Context context = this.getContext();
57 final String iconPath = context.get(APPLICATION_ICON_PATH);
59 SwingTools.setImagesBase("");
61 JOptionPane.showMessageDialog(
62 (Component) context.get(MAIN_FRAME),
63 context.get(APPLICATION_NAME) + "\n" +
64 context.get(APPLICATION_VERSION) + "\n" +
65 context.get(APPLICATION_COPYRIGHT),
66 translate("About {0}", context.get(APPLICATION_NAME)),
67 JOptionPane.INFORMATION_MESSAGE,
68 iconPath == null ? null : SwingTools.getIcon(context.get(APPLICATION_ICON_PATH).toString()));