[Esbox-commits] r1521 - trunk/org.maemo.esbox.scratchbox.sb1/src/org/maemo/esbox/internal/scratchbox/sb1/ui/wizard/nokiabin
fabricioepa at garage.maemo.org
fabricioepa at garage.maemo.org
Mon May 4 17:04:48 EEST 2009
Author: fabricioepa
Date: 2009-05-04 17:04:36 +0300 (Mon, 04 May 2009)
New Revision: 1521
Modified:
trunk/org.maemo.esbox.scratchbox.sb1/src/org/maemo/esbox/internal/scratchbox/sb1/ui/wizard/nokiabin/FremantleLicenseAgreementPage.java
trunk/org.maemo.esbox.scratchbox.sb1/src/org/maemo/esbox/internal/scratchbox/sb1/ui/wizard/nokiabin/SDKTargetSelectionPage.java
Log:
Fixing BUG#4004 - Changing Fremantle License agreement page
Modified: trunk/org.maemo.esbox.scratchbox.sb1/src/org/maemo/esbox/internal/scratchbox/sb1/ui/wizard/nokiabin/FremantleLicenseAgreementPage.java
===================================================================
--- trunk/org.maemo.esbox.scratchbox.sb1/src/org/maemo/esbox/internal/scratchbox/sb1/ui/wizard/nokiabin/FremantleLicenseAgreementPage.java 2009-05-04 13:56:47 UTC (rev 1520)
+++ trunk/org.maemo.esbox.scratchbox.sb1/src/org/maemo/esbox/internal/scratchbox/sb1/ui/wizard/nokiabin/FremantleLicenseAgreementPage.java 2009-05-04 14:04:36 UTC (rev 1521)
@@ -11,20 +11,27 @@
*******************************************************************************/
package org.maemo.esbox.internal.scratchbox.sb1.ui.wizard.nokiabin;
+import java.text.MessageFormat;
import java.util.HashSet;
import java.util.Set;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
+import org.eclipse.jface.layout.GridDataFactory;
import org.eclipse.jface.wizard.IWizardPage;
import org.eclipse.jface.wizard.WizardPage;
import org.eclipse.swt.SWT;
-import org.eclipse.swt.SWTError;
-import org.eclipse.swt.browser.Browser;
-import org.eclipse.swt.browser.ProgressEvent;
-import org.eclipse.swt.browser.ProgressListener;
+import org.eclipse.swt.events.ModifyEvent;
+import org.eclipse.swt.events.ModifyListener;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.events.SelectionListener;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.program.Program;
import org.eclipse.swt.widgets.Composite;
-import org.maemo.esbox.internal.scratchbox.sb1.Activator;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Link;
+import org.eclipse.swt.widgets.Text;
import org.maemo.esbox.internal.scratchbox.sb1.ui.process.ValidateNokiaBinariesInstallation;
/**
@@ -32,26 +39,19 @@
*/
public class FremantleLicenseAgreementPage extends WizardPage {
- private Browser browser;
- /**
- * The confirmation message
- */
- private static final String ACCEPTED_TOKEN = "End User License Agreement Accepted";
- private static final Pattern ACCEPTED_PATTERN = Pattern.compile(ACCEPTED_TOKEN);
/**
* Maemo repository url token
*/
- private static final String REPO_TOKEN = "<CODE>deb.*nokia-binaries</CODE>";
+ private static final String REPO_TOKEN = "deb\\s+http://repository\\.maemo\\.org/\\s+fremantle/(.*)\\s+nokia\\-binaries";
/**
* Maemo repository URL pattern
*/
private static final Pattern REPO_PATTERN = Pattern.compile(REPO_TOKEN);
- private String repoURL;
-
+ private Text fRepository;
private WizardPage next;
@@ -61,7 +61,7 @@
protected FremantleLicenseAgreementPage(NokiaBinariesInstallWizard wizard) {
super("fremantle_license_agreement");
setTitle("License Agreement");
- setDescription("End User License Agreement from... http://tablets-dev.nokia.com/eula/index.php");
+ setDescription("End User License Agreement PAge");
setPageComplete(false);
setWizard(wizard);
this.next = new FremantleWorkPage(wizard);
@@ -78,30 +78,54 @@
/*
* see @WizardPage.createControl(Composite)
*/
- public void createControl(Composite parentComposite) {
- try {
- browser = new Browser(parentComposite, SWT.FILL);
- browser.setUrl("http://tablets-dev.nokia.com/eula/index.php");
- browser.addProgressListener(new ProgressListener(){
- public void changed(ProgressEvent event) {
- validatePage();
- }
- public void completed(ProgressEvent event) {
- retrieveToken();
- validatePage();
- }
-
- });
-
- setControl(browser);
- } catch (SWTError e) {
- setPageComplete(false);
- String msg = "Could not instantiate Web Browser to show License Agreement";
- setErrorMessage(msg);
- Activator
- .getErrorLogger().logAndShowError(msg,e);
- return;
- }
+ public void createControl(Composite parent) {
+ Composite composite = new Composite(parent, SWT.NONE);
+ composite.setLayout(new GridLayout(2, true));
+ GridDataFactory.fillDefaults().grab(true, false).applyTo(composite);
+ setControl(composite);
+
+
+ Link link = new Link(composite, SWT.NONE);
+ final String url = "http://tablets-dev.nokia.com/eula/index.php";
+ String msg = MessageFormat
+ .format(
+ "Inorder to obtain Nokia-closed binaries, you are required to accept The End User\n" +
+ "License Agreement. Visit <a href=\"''{0}''\"> {0} </a> to do so.\n" +
+ "Upon acceptance, you are given a specific \"Token\" to access the Nokia binaries\nrepository."+
+ " Please note that such obtained token may not be re-distributed or \ndisclosed. Along with the"
+ +" token, you are also given a repository url.\nPlease, paste the url here:",url);
+ link
+ .setText(msg);
+
+ link.addSelectionListener(new SelectionListener(){
+
+ public void widgetDefaultSelected(SelectionEvent e) {
+ }
+
+ public void widgetSelected(SelectionEvent e) {
+ Program.launch(url);
+ }}
+ );
+
+
+ GridDataFactory.fillDefaults().span(2,0).grab(true, false).applyTo(link);
+
+ fRepository = new Text(composite, SWT.BORDER);
+ fRepository.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+ fRepository.addModifyListener(new ModifyListener(){
+ public void modifyText(ModifyEvent e) {
+ validatePage();
+ }});
+ GridDataFactory.fillDefaults().span(2,0).grab(true, false).applyTo(fRepository);
+
+ Label lb= new Label(composite, SWT.NONE);
+ lb.setText("The the wizard will automatically add the url to your /etc/apt/sources.list in scratchbox.");
+ GridData data = new GridData(GridData.FILL_HORIZONTAL
+ | GridData.GRAB_HORIZONTAL);
+ data.horizontalSpan = 2;
+ data.widthHint = 150;
+ lb.setLayoutData(data);
+
}
@@ -118,13 +142,13 @@
* @return
*/
public String getRepositoryURL(){
- return this.repoURL;
+ return fRepository !=null? fRepository.getText() : null;
}
public boolean validatePage() {
- if (repoURL == null || repoURL.length() == 0) {
+ if (!validateURL()) {
setErrorMessage("You must accept the End User License Agreement from " +
- "http://tablets-dev.nokia.com/eula/index.php to retrieve a nokia token code.");
+ "http://tablets-dev.nokia.com/eula/index.php to retrieve a valid nokia repository url.");
setMessage(null);
return false;
}
@@ -141,40 +165,27 @@
}
- private void retrieveToken() {
- try {
- String response = browser.getText();
- Matcher matcher = ACCEPTED_PATTERN.matcher(response);
- if (matcher.find()) {
- // It means the TOKEN was received
- matcher = REPO_PATTERN.matcher(response);
+ private boolean validateURL() {
+ String repoURL = fRepository.getText();
+
+ if(repoURL == null || repoURL.length() == 0) return false;
+
+ // It means the TOKEN was received
+ Matcher matcher = REPO_PATTERN.matcher(repoURL);
- if (matcher.find()) {
- repoURL = matcher.group();
- }
-
- // Remove tag <CODE></CODE>
- repoURL = Pattern.compile("(<CODE>|</CODE>)",
- Pattern.CASE_INSENSITIVE).matcher(repoURL)
- .replaceAll("");
+ if (!matcher.find())
+ return false;
- //Debian Repository of Nokia binaries
- getWizard().putParamter("repoURL", repoURL);
-
- //Packages to install
- Set<String> meta_packages = new HashSet<String>();
- meta_packages.add(ValidateNokiaBinariesInstallation.FREMANTLE_NOKIABIN_PKG);
- getWizard().putParamter("packages", meta_packages);
-
- setPageComplete(true);
- }
+ //Debian Repository of Nokia binaries
+ getWizard().putParamter("repoURL", repoURL);
-
- } catch (Exception e) {
- String msg = "Could not retrieve nokia TOKEN. Please contact support team.";
- setErrorMessage(msg);
- Activator.getErrorLogger().logAndShowError(msg , e);
- }
+ //Packages to install
+ Set<String> meta_packages = new HashSet<String>();
+ meta_packages.add(ValidateNokiaBinariesInstallation.FREMANTLE_NOKIABIN_PKG);
+ getWizard().putParamter("packages", meta_packages);
+ setPageComplete(true);
+
+ return true;
}
}
\ No newline at end of file
Modified: trunk/org.maemo.esbox.scratchbox.sb1/src/org/maemo/esbox/internal/scratchbox/sb1/ui/wizard/nokiabin/SDKTargetSelectionPage.java
===================================================================
--- trunk/org.maemo.esbox.scratchbox.sb1/src/org/maemo/esbox/internal/scratchbox/sb1/ui/wizard/nokiabin/SDKTargetSelectionPage.java 2009-05-04 13:56:47 UTC (rev 1520)
+++ trunk/org.maemo.esbox.scratchbox.sb1/src/org/maemo/esbox/internal/scratchbox/sb1/ui/wizard/nokiabin/SDKTargetSelectionPage.java 2009-05-04 14:04:36 UTC (rev 1521)
@@ -263,6 +263,7 @@
private void updateUI() {
targetFilter.sdkname = fmaemoSDKCombo.getText();
targetTree.refresh(true);
+ targetTree.expandAll();
}
public boolean validatePage() {
More information about the Esbox-commits
mailing list