Bug 473991 - Problem with class loader in XWTWizardPage (edit)
diff --git a/org.eclipse.xwt.tests/META-INF/MANIFEST.MF b/org.eclipse.xwt.tests/META-INF/MANIFEST.MF
index 64bb520..74a1d80 100644
--- a/org.eclipse.xwt.tests/META-INF/MANIFEST.MF
+++ b/org.eclipse.xwt.tests/META-INF/MANIFEST.MF
@@ -19,7 +19,9 @@
com.ibm.icu;bundle-version="3.8.0",
org.eclipse.core.databinding.property;bundle-version="1.2.0",
org.eclipse.xwt.forms;bundle-version="0.9.1",
- org.eclipse.jface;bundle-version="3.8.101"
+ org.eclipse.jface;bundle-version="3.8.101",
+ org.eclipse.xwt.ui.workbench;bundle-version="1.1.0",
+ org.eclipse.ui.workbench
Bundle-ActivationPolicy: lazy
Bundle-RequiredExecutionEnvironment: J2SE-1.5
Export-Package: org.eclipse.xwt.tests,
diff --git a/org.eclipse.xwt.tests/src/org/eclipse/xwt/tests/wizard/Address.java b/org.eclipse.xwt.tests/src/org/eclipse/xwt/tests/wizard/Address.java
new file mode 100644
index 0000000..1e7e78a
--- /dev/null
+++ b/org.eclipse.xwt.tests/src/org/eclipse/xwt/tests/wizard/Address.java
@@ -0,0 +1,41 @@
+/*******************************************************************************
+ * Copyright (c) 2006, 2010 Soyatec (http://www.soyatec.com) and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Soyatec - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.xwt.tests.wizard;
+
+public class Address extends BeanObject {
+ private String street = "Place de France";
+ private String city = "Paris";
+
+ public Address() {
+
+ }
+
+ public String getStreet() {
+ return street;
+ }
+
+ public void setStreet(String street) {
+ String oldValue = this.street;
+ this.street = street;
+ changeSupport.firePropertyChange("street", oldValue, street);
+ }
+
+ public void setCity(String city) {
+ String oldValue = this.city;
+ this.city = city;
+ changeSupport.firePropertyChange("city", oldValue, city);
+ }
+
+ public String getCity() {
+ return city;
+ }
+
+}
diff --git a/org.eclipse.xwt.tests/src/org/eclipse/xwt/tests/wizard/AddressView.java b/org.eclipse.xwt.tests/src/org/eclipse/xwt/tests/wizard/AddressView.java
new file mode 100644
index 0000000..30534ef
--- /dev/null
+++ b/org.eclipse.xwt.tests/src/org/eclipse/xwt/tests/wizard/AddressView.java
@@ -0,0 +1,38 @@
+/*******************************************************************************
+ * Copyright (c) 2006, 2015 Soyatec (http://www.soyatec.com) and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Soyatec - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.xwt.tests.wizard;
+
+import java.net.URL;
+
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.xwt.XWT;
+
+/**
+ * @author
+ *
+ */
+public class AddressView extends Composite {
+ public AddressView(Composite parent, int style) {
+ super(parent, style);
+ }
+
+ public static void main(String[] args) {
+ URL url = AddressView.class.getResource("AddressView.xwt");
+
+ try {
+ XWT.open(url);
+ } catch (Exception e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ }
+}
\ No newline at end of file
diff --git a/org.eclipse.xwt.tests/src/org/eclipse/xwt/tests/wizard/AddressView.xwt b/org.eclipse.xwt.tests/src/org/eclipse/xwt/tests/wizard/AddressView.xwt
new file mode 100644
index 0000000..3662c87
--- /dev/null
+++ b/org.eclipse.xwt.tests/src/org/eclipse/xwt/tests/wizard/AddressView.xwt
@@ -0,0 +1,27 @@
+<Composite xmlns="http://www.eclipse.org/xwt/presentation"
+ xmlns:x="http://www.eclipse.org/xwt"
+ xmlns:c="clr-namespace:org.eclipse.xwt.tests.wizard"
+ xmlns:j="clr-namespace:java.lang"
+ x:Class="org.eclipse.xwt.tests.wizard.AddressView">
+
+ <Composite.layout>
+ <GridLayout numColumns="2" />
+ </Composite.layout>
+
+ <Label text="Street"/>
+ <Text x:Style="Border" text="{Binding path=street}">
+ <Text.layoutData>
+ <GridData grabExcessHorizontalSpace="true"
+ horizontalAlignment="GridData.FILL" widthHint="100"/>
+ </Text.layoutData>
+ </Text>
+
+ <Label text="City *"/>
+ <Text x:Style="Border" text="{Binding path=city,updateSourceTrigger=PropertyChanged,validationRule=c:NameValidator}">
+ <Text.layoutData>
+ <GridData grabExcessHorizontalSpace="true"
+ horizontalAlignment="GridData.FILL" widthHint="100"/>
+ </Text.layoutData>
+ </Text>
+
+</Composite>
\ No newline at end of file
diff --git a/org.eclipse.xwt.tests/src/org/eclipse/xwt/tests/wizard/BeanObject.java b/org.eclipse.xwt.tests/src/org/eclipse/xwt/tests/wizard/BeanObject.java
new file mode 100644
index 0000000..4e56c52
--- /dev/null
+++ b/org.eclipse.xwt.tests/src/org/eclipse/xwt/tests/wizard/BeanObject.java
@@ -0,0 +1,29 @@
+/*******************************************************************************
+ * Copyright (c) 2010 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.xwt.tests.wizard;
+
+import java.beans.PropertyChangeListener;
+import java.beans.PropertyChangeSupport;
+
+public class BeanObject {
+ protected PropertyChangeSupport changeSupport = new PropertyChangeSupport(
+ this);
+
+ public void addPropertyChangeListener(String propertyName,
+ PropertyChangeListener listener) {
+ changeSupport.addPropertyChangeListener(propertyName, listener);
+ }
+
+ public void removePropertyChangeListener(String propertyName,
+ PropertyChangeListener listener) {
+ changeSupport.removePropertyChangeListener(propertyName, listener);
+ }
+}
diff --git a/org.eclipse.xwt.tests/src/org/eclipse/xwt/tests/wizard/Company.java b/org.eclipse.xwt.tests/src/org/eclipse/xwt/tests/wizard/Company.java
new file mode 100644
index 0000000..1b23bed
--- /dev/null
+++ b/org.eclipse.xwt.tests/src/org/eclipse/xwt/tests/wizard/Company.java
@@ -0,0 +1,40 @@
+/*******************************************************************************
+ * Copyright (c) 2006, 2010 Soyatec (http://www.soyatec.com) and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Soyatec - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.xwt.tests.wizard;
+
+public class Company extends BeanObject {
+ private String name = "Soyatec";
+ private Person manager = new Person();
+
+ public Person getManager() {
+ return manager;
+ }
+
+ public void setManager(Person manager) {
+ Person oldValue = this.manager;
+ this.manager = manager;
+ changeSupport.firePropertyChange("manager", oldValue, manager);
+ }
+
+ public Company() {
+ manager.setName("Julien");
+ }
+
+ public void setName(String value) {
+ String oldValue = this.name;
+ this.name = value;
+ changeSupport.firePropertyChange("name", oldValue, value);
+ }
+
+ public String getName() {
+ return name;
+ }
+}
diff --git a/org.eclipse.xwt.tests/src/org/eclipse/xwt/tests/wizard/CompanyView.java b/org.eclipse.xwt.tests/src/org/eclipse/xwt/tests/wizard/CompanyView.java
new file mode 100644
index 0000000..1e03bba
--- /dev/null
+++ b/org.eclipse.xwt.tests/src/org/eclipse/xwt/tests/wizard/CompanyView.java
@@ -0,0 +1,34 @@
+/*******************************************************************************
+ * Copyright (c) 2010 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.xwt.tests.wizard;
+
+import java.net.URL;
+
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.xwt.XWT;
+
+public class CompanyView extends Composite {
+
+ public CompanyView(Composite parent, int style) {
+ super(parent, style);
+ // TODO Auto-generated constructor stub
+ }
+
+ public static void main(String[] args) {
+ URL url = CompanyView.class.getResource("CompanyView.xwt");
+ try {
+ XWT.open(url);
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+
+}
diff --git a/org.eclipse.xwt.tests/src/org/eclipse/xwt/tests/wizard/CompanyView.xwt b/org.eclipse.xwt.tests/src/org/eclipse/xwt/tests/wizard/CompanyView.xwt
new file mode 100644
index 0000000..81a3a3e
--- /dev/null
+++ b/org.eclipse.xwt.tests/src/org/eclipse/xwt/tests/wizard/CompanyView.xwt
@@ -0,0 +1,28 @@
+<Composite xmlns="http://www.eclipse.org/xwt/presentation"
+ xmlns:x="http://www.eclipse.org/xwt"
+ xmlns:c="clr-namespace:org.eclipse.xwt.tests.wizard"
+ xmlns:j="clr-namespace:java.lang"
+ x:Class="org.eclipse.xwt.tests.wizard.CompanyView">
+ <Composite.layout>
+ <GridLayout numColumns="4" />
+ </Composite.layout>
+ <Label text="Company name *"/>
+ <Text x:Style="Border" text="{Binding path=name,updateSourceTrigger=PropertyChanged,validationRule=c:NameValidator}">
+ <Text.layoutData>
+ <GridData grabExcessHorizontalSpace="true"
+ horizontalAlignment="GridData.Left" widthHint="100"/>
+ </Text.layoutData>
+ </Text>
+
+ <Group text="Manager">
+ <Group.layout>
+ <FillLayout/>
+ </Group.layout>
+ <c:PersonView dataContext="{Binding path=manager}"/>
+
+ <Group.layoutData>
+ <GridData grabExcessHorizontalSpace="true" horizontalSpan="4"
+ horizontalAlignment="GridData.FILL" widthHint="200"/>
+ </Group.layoutData>
+ </Group>
+ </Composite>
diff --git a/org.eclipse.xwt.tests/src/org/eclipse/xwt/tests/wizard/CompanyWizardPage.java b/org.eclipse.xwt.tests/src/org/eclipse/xwt/tests/wizard/CompanyWizardPage.java
new file mode 100644
index 0000000..a4817da
--- /dev/null
+++ b/org.eclipse.xwt.tests/src/org/eclipse/xwt/tests/wizard/CompanyWizardPage.java
@@ -0,0 +1,40 @@
+
+/*******************************************************************************
+ * Copyright (c) 2006, 2015 Soyatec (http://www.soyatec.com) and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Soyatec - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.xwt.tests.wizard;
+
+import java.net.URL;
+
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.xwt.ui.workbench.wizard.XWTWizardPage;
+
+/**
+ * @author El-Amine Ouraiba (amine.ouraiba@soyatec.com)
+ */
+
+public class CompanyWizardPage extends XWTWizardPage {
+
+ protected CompanyWizardPage(String pageName, String title,
+ ImageDescriptor titleImage, Object dataContext) {
+ super(pageName, title, titleImage, dataContext);
+ }
+
+ protected URL getContentURL() {
+ URL url = CompanyWizardPage.class.getResource("CompanyView.xwt");
+ return url;
+ }
+
+ public boolean canFlipToNextPage() {
+ return isPageComplete() && getNextPage() != null;
+ }
+
+}
\ No newline at end of file
diff --git a/org.eclipse.xwt.tests/src/org/eclipse/xwt/tests/wizard/EMailValidator.java b/org.eclipse.xwt.tests/src/org/eclipse/xwt/tests/wizard/EMailValidator.java
new file mode 100644
index 0000000..e830922
--- /dev/null
+++ b/org.eclipse.xwt.tests/src/org/eclipse/xwt/tests/wizard/EMailValidator.java
@@ -0,0 +1,58 @@
+/*******************************************************************************
+ * Copyright (c) 2006, 2015 Soyatec (http://www.soyatec.com) and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Soyatec - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.xwt.tests.wizard;
+
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+import org.eclipse.core.databinding.validation.ValidationStatus;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.xwt.validation.AbstractValidationRule;
+
+public class EMailValidator extends AbstractValidationRule {
+
+ private static final String EMAIL_PATTERN = "^[_A-Za-z0-9-\\+]+(\\.[_A-Za-z0-9-]+)*@"
+ + "[A-Za-z0-9-]+(\\.[A-Za-z0-9]+)*(\\.[A-Za-z]{2,})$";
+
+ private Pattern pattern;
+ private Matcher matcher;
+
+ public EMailValidator() {
+ pattern = Pattern.compile(EMAIL_PATTERN);
+ }
+
+ @Override
+ public Phase getPhase() {
+ return Phase.BeforeSet;
+ }
+
+ @Override
+ public Direction getBindingMode() {
+ return Direction.TargetToSource;
+ }
+
+ public IStatus validate(Object value) {
+ if (value == null || value.equals("")) {
+ return ValidationStatus.error("Email can not be empty.");
+ }
+ matcher = pattern.matcher(value.toString());
+ if (matcher.matches()) {
+ return ValidationStatus.ok();
+ }
+ return ValidationStatus.error("'" + value.toString()
+ + "' is not a validate email.");
+ }
+
+ public IStatus validateBack(Object value) {
+ return validate(value);
+ }
+
+}
diff --git a/org.eclipse.xwt.tests/src/org/eclipse/xwt/tests/wizard/MyWizard.java b/org.eclipse.xwt.tests/src/org/eclipse/xwt/tests/wizard/MyWizard.java
new file mode 100644
index 0000000..6fab653
--- /dev/null
+++ b/org.eclipse.xwt.tests/src/org/eclipse/xwt/tests/wizard/MyWizard.java
@@ -0,0 +1,69 @@
+/*******************************************************************************
+ * Copyright (c) 2006, 2015 Soyatec (http://www.soyatec.com) and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Soyatec - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.xwt.tests.wizard;
+
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.wizard.Wizard;
+import org.eclipse.ui.INewWizard;
+import org.eclipse.ui.IWorkbench;
+
+
+/**
+ * @author El-Amine Ouraiba (amine.ouraiba@soyatec.com)
+ */
+
+public class MyWizard extends Wizard implements INewWizard {
+
+ public PersonWizardPage pagePerson;
+ public CompanyWizardPage pageCompany;
+
+ Person dataContextPerson = new Person();
+ Company dataContextCompany = new Company();
+
+ public MyWizard() {
+ super();
+ setNeedsProgressMonitor(true);
+ dataContextCompany.setManager(dataContextPerson);
+ }
+
+ public String getWindowTitle() {
+ return "Company Wizard";
+ }
+
+ @Override
+ public void addPages() {
+
+ pagePerson = new PersonWizardPage("Person Page", "Enter information about Person", null, dataContextPerson);
+ addPage(pagePerson);
+
+ pageCompany = new CompanyWizardPage("Company Page", "Enter information about Company", null, dataContextCompany);
+ addPage(pageCompany);
+
+ }
+
+ @Override
+ public boolean performFinish() {
+ return true;
+ }
+
+ @Override
+ public void init(IWorkbench workbench, IStructuredSelection selection) {
+ // TODO Auto-generated method stub
+ }
+
+ public boolean canFinish(){
+ if (this.getContainer().getCurrentPage() == pagePerson)
+ return false;
+ if (pageCompany.isPageComplete()) return true;
+ return false;
+ }
+}
\ No newline at end of file
diff --git a/org.eclipse.xwt.tests/src/org/eclipse/xwt/tests/wizard/NameValidator.java b/org.eclipse.xwt.tests/src/org/eclipse/xwt/tests/wizard/NameValidator.java
new file mode 100644
index 0000000..31c93c3
--- /dev/null
+++ b/org.eclipse.xwt.tests/src/org/eclipse/xwt/tests/wizard/NameValidator.java
@@ -0,0 +1,65 @@
+/*******************************************************************************
+ * Copyright (c) 2006, 2015 Soyatec (http://www.soyatec.com) and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Soyatec - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.xwt.tests.wizard;
+
+import org.eclipse.core.databinding.validation.ValidationStatus;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.xwt.validation.AbstractValidationRule;
+
+public class NameValidator extends AbstractValidationRule {
+
+ public NameValidator() {
+ super();
+ }
+
+ @Override
+ public Phase getPhase() {
+ return Phase.BeforeSet;
+ }
+
+ @Override
+ public Direction getBindingMode() {
+ return Direction.Both;
+ }
+
+ public IStatus validate(Object value) {
+
+ if (value.equals(0) || value == null || value.toString().length() == 0 || value.equals("") ) {
+ return ValidationStatus.error("This field is mandatory. It must be specified");
+ }
+
+ if (value.toString().charAt(0) == '.') {
+ return ValidationStatus.error("This field must not begin with a '.'");
+
+ }
+
+ for (int i = 0; i < value.toString().length(); i++) {
+ char c = value.toString().charAt(i);
+ if ((c < 'A' || 'Z' < c) && (c < 'a' || 'z' < c) && (c < '0' || '9' < c) && c != '_' && c != '-') {
+ if (i == 0 || i == value.toString().length() - 1 || c != '.') {
+ return ValidationStatus.error("This field cannot contain ''" + c + "''");
+ }
+ }
+ }
+
+
+
+ ValidationStatus.info("Define data fields of a new person");
+
+ return ValidationStatus.ok();
+
+ }
+
+ public IStatus validateBack(Object value) {
+ return validate(value);
+ }
+
+}
diff --git a/org.eclipse.xwt.tests/src/org/eclipse/xwt/tests/wizard/Person.java b/org.eclipse.xwt.tests/src/org/eclipse/xwt/tests/wizard/Person.java
new file mode 100644
index 0000000..5791806
--- /dev/null
+++ b/org.eclipse.xwt.tests/src/org/eclipse/xwt/tests/wizard/Person.java
@@ -0,0 +1,76 @@
+/*******************************************************************************
+ * Copyright (c) 2006, 2010 Soyatec (http://www.soyatec.com) and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Soyatec - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.xwt.tests.wizard;
+
+public class Person extends BeanObject {
+ private String name = "toto";
+ private String email = "toto@soyatec.com";
+ private int age = 30;
+ private boolean maried = false;
+ private Address address;
+
+ public Person() {
+ address = new Address();
+ }
+
+ public void setName(String name) {
+ String oldValue = this.name;
+ this.name = name;
+ changeSupport.firePropertyChange("name", oldValue, name);
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setEmail(String email) {
+ String oldValue = this.email;
+ this.email = email;
+ changeSupport.firePropertyChange("email", oldValue, email);
+ }
+
+
+
+ public String getEmail() {
+ return email;
+ }
+
+ public int getAge() {
+ return age;
+ }
+
+ public void setAge(int age) {
+ int oldValue = this.age;
+ this.age = age;
+ changeSupport.firePropertyChange("age", oldValue, age);
+ }
+
+ public void setMaried(boolean maried) {
+ boolean oldValue = this.maried;
+ this.maried = maried;
+ changeSupport.firePropertyChange("maried", oldValue, maried);
+ }
+
+ public boolean isMaried() {
+ return maried;
+ }
+
+ public Address getAddress() {
+ return address;
+ }
+
+ public void setAddress(Address address) {
+ Address oldValue = this.address;
+ this.address = address;
+ changeSupport.firePropertyChange("address", oldValue, address);
+ }
+
+}
diff --git a/org.eclipse.xwt.tests/src/org/eclipse/xwt/tests/wizard/PersonView.java b/org.eclipse.xwt.tests/src/org/eclipse/xwt/tests/wizard/PersonView.java
new file mode 100644
index 0000000..32a8cad
--- /dev/null
+++ b/org.eclipse.xwt.tests/src/org/eclipse/xwt/tests/wizard/PersonView.java
@@ -0,0 +1,34 @@
+/*******************************************************************************
+ * Copyright (c) 2010 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.xwt.tests.wizard;
+
+import java.net.URL;
+
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.xwt.XWT;
+
+public class PersonView extends Composite {
+
+ public PersonView(Composite parent, int style) {
+ super(parent, style);
+ // TODO Auto-generated constructor stub
+ }
+
+
+ public static void main(String[] args) {
+ URL url = PersonView.class.getResource("PersonView.xwt");
+ try {
+ XWT.open(url);
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+}
diff --git a/org.eclipse.xwt.tests/src/org/eclipse/xwt/tests/wizard/PersonView.xwt b/org.eclipse.xwt.tests/src/org/eclipse/xwt/tests/wizard/PersonView.xwt
new file mode 100644
index 0000000..0473e24
--- /dev/null
+++ b/org.eclipse.xwt.tests/src/org/eclipse/xwt/tests/wizard/PersonView.xwt
@@ -0,0 +1,63 @@
+<Composite xmlns="http://www.eclipse.org/xwt/presentation"
+ xmlns:x="http://www.eclipse.org/xwt"
+ xmlns:c="clr-namespace:org.eclipse.xwt.tests.wizard"
+ xmlns:j="clr-namespace:java.lang"
+ x:Class="org.eclipse.xwt.tests.wizard.PersonView">
+ <Composite.layout>
+ <GridLayout numColumns="2" />
+ </Composite.layout>
+ <Label text="Name *"/>
+ <Text x:style="BORDER" x:name="Name">
+ <Text.text>
+ <Binding path="Name" updateSourceTrigger="PropertyChanged">
+ <Binding.validationRules>
+ <c:NameValidator/>
+ </Binding.validationRules>
+ </Binding>
+ </Text.text>
+ <Text.layoutData>
+ <GridData grabExcessHorizontalSpace="true"
+ horizontalAlignment="GridData.FILL" widthHint="100"/>
+ </Text.layoutData>
+ </Text>
+
+ <Label text="Maried"/>
+ <Button x:Style="CHECK" x:name="maried">
+ <Button.selection>
+ <Binding path="maried" updateSourceTrigger="PropertyChanged">
+ </Binding>
+ </Button.selection>
+ <Button.layoutData>
+ <GridData grabExcessHorizontalSpace="true"
+ horizontalAlignment="GridData.FILL" />
+ </Button.layoutData>
+ </Button>
+
+ <Label text="e-mail"/>
+ <Text x:Style="Border" text="{Binding path=email,updateSourceTrigger=PropertyChanged,validationRule=c:EMailValidator}">
+ <Text.layoutData>
+ <GridData grabExcessHorizontalSpace="true"
+ horizontalAlignment="GridData.FILL" widthHint="100"/>
+ </Text.layoutData>
+ </Text>
+
+ <Label text="Age"/>
+ <Text x:Style="Border" text="{Binding path=age}">
+ <Text.layoutData>
+ <GridData grabExcessHorizontalSpace="true"
+ horizontalAlignment="GridData.FILL" widthHint="100"/>
+ </Text.layoutData>
+ </Text>
+
+ <Group text="Address">
+ <Group.layout>
+ <FillLayout/>
+ </Group.layout>
+ <c:AddressView dataContext="{Binding path=address}"/>
+
+ <Group.layoutData>
+ <GridData grabExcessHorizontalSpace="true" horizontalSpan="4"
+ horizontalAlignment="GridData.FILL" widthHint="200"/>
+ </Group.layoutData>
+ </Group>
+</Composite>
diff --git a/org.eclipse.xwt.tests/src/org/eclipse/xwt/tests/wizard/PersonWizardPage.java b/org.eclipse.xwt.tests/src/org/eclipse/xwt/tests/wizard/PersonWizardPage.java
new file mode 100644
index 0000000..4151290
--- /dev/null
+++ b/org.eclipse.xwt.tests/src/org/eclipse/xwt/tests/wizard/PersonWizardPage.java
@@ -0,0 +1,43 @@
+
+/*******************************************************************************
+ * Copyright (c) 2006, 2015 Soyatec (http://www.soyatec.com) and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Soyatec - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.xwt.tests.wizard;
+
+import java.net.URL;
+
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.xwt.ui.workbench.wizard.XWTWizardPage;
+
+/**
+ * @author El-Amine Ouraiba (amine.ouraiba@soyatec.com)
+ */
+
+public class PersonWizardPage extends XWTWizardPage {
+
+ protected PersonWizardPage(String pageName, String title,
+ ImageDescriptor titleImage, Object dataContext) {
+ super(pageName, title, titleImage, dataContext);
+ }
+
+ protected URL getContentURL() {
+ URL url = PersonWizardPage.class.getResource("PersonView.xwt");
+ return url;
+ }
+
+ public boolean canFlipToNextPage() {
+ return isPageComplete() && getNextPage() != null;
+ }
+
+ public XWTWizardPage getNextPage(){
+ return ((MyWizard)getWizard()).pageCompany;
+ }
+}
\ No newline at end of file
diff --git a/org.eclipse.xwt.tests/src/org/eclipse/xwt/tests/wizard/WizarsLuncher.java b/org.eclipse.xwt.tests/src/org/eclipse/xwt/tests/wizard/WizarsLuncher.java
new file mode 100644
index 0000000..66bf902
--- /dev/null
+++ b/org.eclipse.xwt.tests/src/org/eclipse/xwt/tests/wizard/WizarsLuncher.java
@@ -0,0 +1,16 @@
+package org.eclipse.xwt.tests.wizard;
+
+import org.eclipse.jface.window.Window;
+import org.eclipse.jface.wizard.WizardDialog;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Shell;
+
+public class WizarsLuncher {
+
+ public static void main(String[] args) {
+ Composite parent = new Shell();
+ MyWizard wizard = new MyWizard();
+ WizardDialog wizardDialog = new WizardDialog(parent.getShell(), wizard);
+ wizardDialog.open() ;
+ }
+}
\ No newline at end of file
diff --git a/org.eclipse.xwt.ui.workbench/src/org/eclipse/xwt/ui/workbench/wizard/XWTWizardPage.java b/org.eclipse.xwt.ui.workbench/src/org/eclipse/xwt/ui/workbench/wizard/XWTWizardPage.java
index b311d2c..8104e02 100644
--- a/org.eclipse.xwt.ui.workbench/src/org/eclipse/xwt/ui/workbench/wizard/XWTWizardPage.java
+++ b/org.eclipse.xwt.ui.workbench/src/org/eclipse/xwt/ui/workbench/wizard/XWTWizardPage.java
@@ -85,7 +85,14 @@
validationStatus.addChangeListener(new IChangeListener() {
public void handleChange(ChangeEvent event) {
IStatus status = (IStatus) validationStatus.getValue();
- setMessage(status.getMessage(), status.getSeverity());
+ if (status.getSeverity() == IStatus.ERROR) {
+ setMessage(status.getMessage(),ERROR);
+ setPageComplete(false);
+ }
+ else {
+ setMessage(status.getMessage(),status.getSeverity());
+ setPageComplete(true);
+ }
}
});
@@ -155,7 +162,7 @@
}
protected ClassLoader getClassLoader() {
- return this.getClassLoader();
+ return Thread.currentThread().getContextClassLoader();
}
public Object getDataContext() {