Revision: 3179
Author: mo.jeff
Date: Tue Dec 1 11:31:17 2009
Log: Added an new action that directs the user to the SQL Power website
where they can purchase user documentation from SQL Power.
http://code.google.com/p/power-architect/source/detail?r=3179
Added:
/trunk/src/ca/sqlpower/architect/swingui/action/UserGuideAction.java
Modified:
/trunk/src/ca/sqlpower/architect/swingui/ArchitectFrame.java
/trunk/src/ca/sqlpower/architect/swingui/action/messages.properties
=======================================
--- /dev/null
+++ /trunk/src/ca/sqlpower/architect/swingui/action/UserGuideAction.java
Tue Dec 1 11:31:17 2009
@@ -0,0 +1,79 @@
+/*
+ * Copyright (c) 2009, SQL Power Group Inc.
+ *
+ * This file is part of Power*Architect.
+ *
+ * Power*Architect is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Power*Architect is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+/**
+ *
+ */
+package ca.sqlpower.architect.swingui.action;
+
+import java.awt.Component;
+import java.awt.event.ActionEvent;
+import java.io.IOException;
+
+import javax.swing.AbstractAction;
+import javax.swing.JOptionPane;
+
+import ca.sqlpower.architect.swingui.ArchitectSwingSessionContext;
+import ca.sqlpower.architect.swingui.action.Messages;
+import ca.sqlpower.swingui.SPSUtils;
+import ca.sqlpower.util.BrowserUtil;
+
+/**
+ * An {...@link AbstractAction} that directs the user to how to obtain the
User
+ * Guide from SQL Power
+ */
+public class UserGuideAction extends AbstractAction {
+
+ /**
+ * The URL for the page where users can purchase User Documentation
+ */
+ public static final String USER_GUIDE_URL
= "http://www.sqlpower.ca/page/architect-userguide";
+
+ /**
+ * Parent component for the dialog that would be displayed
+ */
+ private final Component parent;
+
+ public UserGuideAction(Component parentComponent) {
+ super(Messages.getString("UserGuideAction.userGuide"),
+ SPSUtils.createIcon("help", "Help",
ArchitectSwingSessionContext.ICON_SIZE));
+ putValue(SHORT_DESCRIPTION,
Messages.getString("UserGuideAction.userGuide"));
+ this.parent = parentComponent;
+ }
+
+ public void actionPerformed(ActionEvent e) {
+ String[] options =
{Messages.getString("UserGuideAction.takeToWebsite"),
Messages.getString("UserGuideAction.close")}; //$NON-NLS-1$ //$NON-NLS-2$
+
+ int choice = JOptionPane.showOptionDialog(this.parent,
+ Messages.getString("UserGuideAction.message"),
//$NON-NLS-1$
+ Messages.getString("UserGuideAction.title"), //$NON-NLS-1$
+ JOptionPane.DEFAULT_OPTION,
+ JOptionPane.INFORMATION_MESSAGE,
+ null,
+ options, 0);
+ if (choice == 0) {
+ try {
+ BrowserUtil.launch(USER_GUIDE_URL);
+ } catch (IOException e1) {
+ throw new RuntimeException("Unexpected error in launch",
e1); //$NON-NLS-1$
+ }
+ }
+
+ }
+}
=======================================
--- /trunk/src/ca/sqlpower/architect/swingui/ArchitectFrame.java Tue Nov 10
15:02:09 2009
+++ /trunk/src/ca/sqlpower/architect/swingui/ArchitectFrame.java Tue Dec 1
11:31:17 2009
@@ -109,6 +109,7 @@
import ca.sqlpower.architect.swingui.action.SearchReplaceAction;
import ca.sqlpower.architect.swingui.action.SelectAllAction;
import ca.sqlpower.architect.swingui.action.UndoAction;
+import ca.sqlpower.architect.swingui.action.UserGuideAction;
import ca.sqlpower.architect.swingui.action.VisualMappingReportAction;
import ca.sqlpower.architect.swingui.action.ZoomAction;
import ca.sqlpower.architect.swingui.action.ZoomResetAction;
@@ -211,6 +212,8 @@
}
};
+ private Action userGuideAction = new UserGuideAction(this);
+
/**
* This constructor is used by the session implementation. To obtain an
* Architect Frame, you have to create an
@@ -451,7 +454,8 @@
projectBar.add(profileAction);
projectBar.setToolTipText(Messages.getString("ArchitectFrame.projectToolbarToolTip"));
//$NON-NLS-1$
projectBar.setName(Messages.getString("ArchitectFrame.projectToolbarName"));
//$NON-NLS-1$
-
+ projectBar.addSeparator();
+ projectBar.add(userGuideAction);
projectBar.setFocusable(false);
for (Component c : projectBar.getComponents()) {
c.setFocusable(false);
@@ -685,6 +689,7 @@
helpMenu.add(aboutAction);
helpMenu.addSeparator();
}
+ helpMenu.add(userGuideAction);
helpMenu.add(SPSUtils.forumAction);
helpMenu.addSeparator();
helpMenu.add(checkForUpdateAction);
=======================================
--- /trunk/src/ca/sqlpower/architect/swingui/action/messages.properties Wed
Aug 12 15:21:00 2009
+++ /trunk/src/ca/sqlpower/architect/swingui/action/messages.properties Tue
Dec 1 11:31:17 2009
@@ -201,6 +201,11 @@
SQLQueryAction.name=Universal SQL Access...
UndoAction.description=Undo
UndoAction.name=Undo
+UserGuideAction.userGuide=User Guide
+UserGuideAction.close=Close
+UserGuideAction.message=The Power*Architect User Guide can be purchased
from SQL Power's website
+UserGuideAction.takeToWebsite=Take me to the website
+UserGuideAction.title=Power*Architect User Guide
VisualMappingReportAction.closeOption=Close
VisualMappingReportAction.couldNotGenerateMappingDiagram=Couldn't generate
mapping diagram
VisualMappingReportAction.description=Visual Mapping Report