geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tki...@apache.org
Subject svn commit: r678960 - in /geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.ui/src/main/java/org/apache/geronimo/st/ui/internal: ConfirmInstallDialog.java GeronimoRuntimeWizardFragment.java Messages.java Messages.properties
Date Wed, 23 Jul 2008 00:52:13 GMT
Author: tkirby
Date: Tue Jul 22 17:52:12 2008
New Revision: 678960

URL: http://svn.apache.org/viewvc?rev=678960&view=rev
Log:
GERONIMODEVTOOLS-416 Add click-through license screen to Download and Install path

Modified:
    geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.ui/src/main/java/org/apache/geronimo/st/ui/internal/ConfirmInstallDialog.java
    geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.ui/src/main/java/org/apache/geronimo/st/ui/internal/GeronimoRuntimeWizardFragment.java
    geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.ui/src/main/java/org/apache/geronimo/st/ui/internal/Messages.java
    geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.ui/src/main/java/org/apache/geronimo/st/ui/internal/Messages.properties

Modified: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.ui/src/main/java/org/apache/geronimo/st/ui/internal/ConfirmInstallDialog.java
URL: http://svn.apache.org/viewvc/geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.ui/src/main/java/org/apache/geronimo/st/ui/internal/ConfirmInstallDialog.java?rev=678960&r1=678959&r2=678960&view=diff
==============================================================================
--- geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.ui/src/main/java/org/apache/geronimo/st/ui/internal/ConfirmInstallDialog.java
(original)
+++ geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.ui/src/main/java/org/apache/geronimo/st/ui/internal/ConfirmInstallDialog.java
Tue Jul 22 17:52:12 2008
@@ -18,27 +18,66 @@
 
 import org.eclipse.jface.dialogs.Dialog;
 import org.eclipse.jface.dialogs.IDialogConstants;
+import org.eclipse.jface.dialogs.MessageDialog;
 import org.eclipse.osgi.util.NLS;
 import org.eclipse.swt.SWT;
 import org.eclipse.swt.layout.GridData;
 import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
 import org.eclipse.swt.widgets.Composite;
 import org.eclipse.swt.widgets.Control;
 import org.eclipse.swt.widgets.Label;
 import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swt.widgets.Text;
 
 /**
  * @version $Rev$ $Date$
  */
 public class ConfirmInstallDialog extends Dialog {
 
-    private String installPath = null;
-    private String runtimeName = null;
+    private String installPath;
+    private String runtimeName;
+    private Button acceptLicense;
+    private Button rejectLicense;
+    private String license;
+    private Shell parentShell;
 
-    public ConfirmInstallDialog(Shell parentShell, String runtimeName, String installPath)
{
+    public ConfirmInstallDialog(Shell parentShell, String runtimeName, String installPath,
String license) {
         super(parentShell);
+        this.parentShell = parentShell;
         this.installPath = installPath;
         this.runtimeName = runtimeName;
+        this.license = license;
+    }
+
+    public boolean licenseAccepted() {
+        return acceptLicense.getSelection();
+    }
+
+    /**
+     * allows the dialog to be resizable.
+     */
+    @Override
+    protected boolean isResizable() {
+        return true;
+    }
+
+    /**
+     * I wanted to disable the OK button until the license was accepted, but
+     * doing that prevented the dialog from even popping up! :-( So, I have this
+     * hokey extra confirmation dialog. :-(
+     */
+    @Override
+    protected void okPressed() {
+        if (licenseAccepted()) {
+            super.okPressed();
+        } else {
+            boolean confirmLicenseRejectionDialog = MessageDialog.openConfirm(parentShell,
"Confirm license rejected",
+                    Messages.confirmLicenseRejection);
+            if (confirmLicenseRejectionDialog) {
+                super.cancelPressed();
+            }
+        }
     }
 
     /*
@@ -71,8 +110,29 @@
         composite.setLayout(layout);
         composite.setLayoutData(new GridData(GridData.FILL_BOTH));
         composite.setFont(parent.getFont());
+        Label licenseAgreementLabel = new Label(composite, SWT.WRAP);
+        licenseAgreementLabel.setText(Messages.licenseAgreement);
+
+        Text licenseText = new Text(composite, SWT.MULTI | SWT.READ_ONLY | SWT.V_SCROLL |
SWT.H_SCROLL | SWT.WRAP
+                | SWT.BORDER);
+        licenseText.setText(license);
+        licenseText.setEditable(false);
+        GridData gridData = new GridData(GridData.FILL_BOTH);
+        gridData.heightHint = 500;
+        gridData.widthHint = 600;
+        licenseText.setLayoutData(gridData);
+
+        acceptLicense = new Button(composite, SWT.RADIO);
+        acceptLicense.setSelection(false);
+        acceptLicense.setText(Messages.acceptLicenseAgreement);
+
+        rejectLicense = new Button(composite, SWT.RADIO);
+        rejectLicense.setSelection(true);
+        rejectLicense.setText(Messages.rejectLicenseAgreement);
+
         Label label = new Label(composite, SWT.WRAP);
         label.setText(NLS.bind(Messages.installMessage, new String[] { runtimeName, installPath
}));
+
         GridData data = new GridData();
         data.widthHint = 400;
         label.setLayoutData(data);

Modified: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.ui/src/main/java/org/apache/geronimo/st/ui/internal/GeronimoRuntimeWizardFragment.java
URL: http://svn.apache.org/viewvc/geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.ui/src/main/java/org/apache/geronimo/st/ui/internal/GeronimoRuntimeWizardFragment.java?rev=678960&r1=678959&r2=678960&view=diff
==============================================================================
--- geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.ui/src/main/java/org/apache/geronimo/st/ui/internal/GeronimoRuntimeWizardFragment.java
(original)
+++ geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.ui/src/main/java/org/apache/geronimo/st/ui/internal/GeronimoRuntimeWizardFragment.java
Tue Jul 22 17:52:12 2008
@@ -193,24 +193,47 @@
             String runtimeName = getRuntimeName();
             install.setToolTipText(Messages.bind(Messages.tooltipInstall, getRuntimeName()));
             install.addSelectionListener(new SelectionAdapter() {
+                private String license;
+
                 public void widgetSelected(SelectionEvent se) {
                     if (installDir != null && isValidLocation()) {
                         Shell shell = installDir.getShell();
+
+                        final IInstallableRuntime installable = tomcat.getSelection() ? gWithTomcat
: gWithJetty;
+                        final Path installPath = new Path(installDir.getText());
+                        
+                        license = null;
+                        
+                        IRunnableWithProgress runnable = new IRunnableWithProgress() {
+                            public void run(IProgressMonitor monitor) throws InvocationTargetException,
+                                    InterruptedException {
+                                try {
+                                    license = installable.getLicense(monitor);
+                                } catch (CoreException e) {
+                                    Trace.trace(Trace.SEVERE, "Error installing runtime",
e);
+                                }
+                            }
+                        };
+
+                        try {
+                            getWizard().run(true, false, runnable);
+                        } catch (InterruptedException e) {
+                            e.printStackTrace();
+                        } catch (InvocationTargetException e) {
+                            e.printStackTrace();
+                        } catch (Exception e) {
+                            Trace.trace(Trace.SEVERE, "Error installing runtime", e);
+                        }
+                        
                         ConfirmInstallDialog dialog = new ConfirmInstallDialog(shell, getRuntimeName(),
installDir
-                                .getText());
+                                .getText(), license);
                         dialog.open();
                         if (dialog.getReturnCode() == IDialogConstants.OK_ID) {
 
-                            final IInstallableRuntime installable = tomcat.getSelection()
? gWithTomcat : gWithJetty;
-                            final Path installPath = new Path(installDir.getText());
-                            IRunnableWithProgress runnable = new IRunnableWithProgress()
{
+                            runnable = new IRunnableWithProgress() {
                                 public void run(IProgressMonitor monitor) throws InvocationTargetException,
                                         InterruptedException {
                                     try {
-                                        // String license =
-                                        // installable.getLicense(monitor);
-                                        // Trace.trace(Trace.INFO, "license = "
-                                        // + license);
                                         installable.install(installPath, monitor);
                                     } catch (CoreException e) {
                                         Trace.trace(Trace.SEVERE, "Error installing runtime",
e);

Modified: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.ui/src/main/java/org/apache/geronimo/st/ui/internal/Messages.java
URL: http://svn.apache.org/viewvc/geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.ui/src/main/java/org/apache/geronimo/st/ui/internal/Messages.java?rev=678960&r1=678959&r2=678960&view=diff
==============================================================================
--- geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.ui/src/main/java/org/apache/geronimo/st/ui/internal/Messages.java
(original)
+++ geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.ui/src/main/java/org/apache/geronimo/st/ui/internal/Messages.java
Tue Jul 22 17:52:12 2008
@@ -310,4 +310,12 @@
     public static String ejb;
     public static String java;
     public static String web;
+
+    public static String licenseAgreement;
+
+    public static String acceptLicenseAgreement;
+
+    public static String rejectLicenseAgreement;
+
+    public static String confirmLicenseRejection;
 }

Modified: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.ui/src/main/java/org/apache/geronimo/st/ui/internal/Messages.properties
URL: http://svn.apache.org/viewvc/geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.ui/src/main/java/org/apache/geronimo/st/ui/internal/Messages.properties?rev=678960&r1=678959&r2=678960&view=diff
==============================================================================
--- geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.ui/src/main/java/org/apache/geronimo/st/ui/internal/Messages.properties
(original)
+++ geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.ui/src/main/java/org/apache/geronimo/st/ui/internal/Messages.properties
Tue Jul 22 17:52:12 2008
@@ -254,7 +254,11 @@
 install=Download and Install
 jvmWarning={0} is currently only certified on a 1.5 JVM. Use of any other version is not
currently supported.
 installTitle=Install Confirmation
-installMessage=Install {0} to {1} ?
+installMessage=\nInstall {0} to {1} ?
+licenseAgreement=License Agreement:
+acceptLicenseAgreement=I accept the terms in the above license agreement.
+rejectLicenseAgreement=I do not accept the terms in the above license agreement.
+confirmLicenseRejection "Download and Install" will not continue unless you accept the license.\nDo
you really not accept the license?
 tooltipLoc=A location of an existing {0} installation or a path to install to.
 tooltipInstall=Downloads the selected {0} distribution and installs it to the specified location.
 tooltipJetty=Selects the Jetty distribution of Geronimo to install.



Mime
View raw message