Author: DartPeng
Date: 2008-10-16 05:28:22 -0400 (Thu, 16 Oct 2008)
New Revision: 10871
Added:
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/ui/IStructuredDataCreationWizard.java
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/ui/wizards/ISmooksDataCreationAddtionWizard.java
Removed:
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/ui/IStrucutredDataCreationWizard.java
Modified:
trunk/smooks/plugins/org.jboss.tools.smooks.javabean/src/org/jboss/tools/smooks/javabean/analyzer/JavaBeanAnalyzer.java
trunk/smooks/plugins/org.jboss.tools.smooks.javabean/src/org/jboss/tools/smooks/javabean/ui/JavaBeanConfigWizardPage.java
trunk/smooks/plugins/org.jboss.tools.smooks.javabean/src/org/jboss/tools/smooks/javabean/ui/NewJavaBeanStrucutredDataWizard.java
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/ui/BaseViewerInitor.java
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/ui/IViewerInitor.java
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/ui/StructuredDataCreationWizardDailog.java
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/ui/ViewerInitorStore.java
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/ui/editors/SmooksGraphicalFormPage.java
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/ui/editors/TypeIDSelectionWizardPage.java
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/ui/wizards/SmooksConfigFileNewWizard.java
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/ui/wizards/TransformDataWizardSelectionPage.java
trunk/smooks/plugins/org.jboss.tools.smooks.xml/src/org/jboss/tools/smooks/xml/AbstractFileSelectionWizardPage.java
trunk/smooks/plugins/org.jboss.tools.smooks.xml/src/org/jboss/tools/smooks/xml/AbstractStructuredDdataWizard.java
Log:
JBIDE-2837
1.Modify the SmooksNewConfigFileWizard file , make it can add addition wizard page and
show them.
2.Make the TypeID Selection page can load the Wizard instance by the typeID selected by
user.
3.check some bugs
Modified:
trunk/smooks/plugins/org.jboss.tools.smooks.javabean/src/org/jboss/tools/smooks/javabean/analyzer/JavaBeanAnalyzer.java
===================================================================
---
trunk/smooks/plugins/org.jboss.tools.smooks.javabean/src/org/jboss/tools/smooks/javabean/analyzer/JavaBeanAnalyzer.java 2008-10-16
08:37:41 UTC (rev 10870)
+++
trunk/smooks/plugins/org.jboss.tools.smooks.javabean/src/org/jboss/tools/smooks/javabean/analyzer/JavaBeanAnalyzer.java 2008-10-16
09:28:22 UTC (rev 10871)
@@ -648,7 +648,9 @@
buildSourceInputProperties(listType, model, false, isError,
current, classLoader);
}
- return model;
+ List list = new ArrayList();
+ if(model != null) list.add(model);
+ return list;
}
public Object buildSourceInputObjects(GraphInformations graphInfo,
@@ -719,7 +721,9 @@
setSelectorIsUsed(rootClassName);
buildChildrenOfTargetInputModel(listType, rootModel, false,
rootIsError, current, loader);
- return rootModel;
+ List list = new ArrayList();
+ list.add(rootModel);
+ return list;
}
protected void buildChildrenOfTargetInputModel(
Modified:
trunk/smooks/plugins/org.jboss.tools.smooks.javabean/src/org/jboss/tools/smooks/javabean/ui/JavaBeanConfigWizardPage.java
===================================================================
---
trunk/smooks/plugins/org.jboss.tools.smooks.javabean/src/org/jboss/tools/smooks/javabean/ui/JavaBeanConfigWizardPage.java 2008-10-16
08:37:41 UTC (rev 10870)
+++
trunk/smooks/plugins/org.jboss.tools.smooks.javabean/src/org/jboss/tools/smooks/javabean/ui/JavaBeanConfigWizardPage.java 2008-10-16
09:28:22 UTC (rev 10871)
@@ -11,29 +11,24 @@
package org.jboss.tools.smooks.javabean.ui;
import org.eclipse.jdt.core.IJavaProject;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.viewers.StructuredSelection;
import org.eclipse.jface.viewers.TreeViewer;
-import org.eclipse.jface.wizard.IWizard;
import org.eclipse.jface.wizard.IWizardNode;
import org.eclipse.jface.wizard.IWizardPage;
-import org.eclipse.jface.wizard.WizardSelectionPage;
+import org.eclipse.jface.wizard.WizardPage;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.events.SelectionListener;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Text;
-import org.eclipse.ui.INewWizard;
import org.jboss.tools.smooks.javabean.model.JavaBeanModel;
-import org.jboss.tools.smooks.ui.IStrucutredDataCreationWizard;
/**
* @author Dart Peng
*
* @CreateTime Jul 21, 2008
*/
-public class JavaBeanConfigWizardPage extends WizardSelectionPage implements
+public class JavaBeanConfigWizardPage extends WizardPage implements
SelectionListener {
TreeViewer treeViewer;
@@ -58,38 +53,6 @@
setDescription("Select the JavaBean class");
}
- public void activeNextWizardNode(IWizardNode node){
- setSelectedNode(node);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.jface.wizard.WizardSelectionPage#getNextPage()
- */
- public IWizardPage getNextPage() {
- if (this.getSelectedNode() == null) {
- return null;
- }
-
- boolean isCreated = getSelectedNode().isContentCreated();
-
- IWizard wizard = getSelectedNode().getWizard();
-
- if (wizard == null) {
- setSelectedNode(null);
- return null;
- }
- if (!isCreated) {
- if (wizard instanceof INewWizard) {
- StructuredSelection selection = new StructuredSelection(project);
- ((INewWizard) wizard).init(null, selection);
- }
- wizard.addPages();
- }
- return wizard.getStartingPage();
- }
-
protected void initilize() {
}
Modified:
trunk/smooks/plugins/org.jboss.tools.smooks.javabean/src/org/jboss/tools/smooks/javabean/ui/NewJavaBeanStrucutredDataWizard.java
===================================================================
---
trunk/smooks/plugins/org.jboss.tools.smooks.javabean/src/org/jboss/tools/smooks/javabean/ui/NewJavaBeanStrucutredDataWizard.java 2008-10-16
08:37:41 UTC (rev 10870)
+++
trunk/smooks/plugins/org.jboss.tools.smooks.javabean/src/org/jboss/tools/smooks/javabean/ui/NewJavaBeanStrucutredDataWizard.java 2008-10-16
09:28:22 UTC (rev 10871)
@@ -20,7 +20,6 @@
import org.eclipse.jdt.core.JavaCore;
import org.eclipse.jdt.internal.core.JavaProject;
import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.wizard.IWizardNode;
import org.eclipse.jface.wizard.Wizard;
import org.eclipse.ui.IEditorInput;
import org.eclipse.ui.IEditorSite;
@@ -28,17 +27,16 @@
import org.eclipse.ui.INewWizard;
import org.eclipse.ui.IWorkbench;
import org.jboss.tools.smooks.javabean.JavaBeanActivator;
-import org.jboss.tools.smooks.ui.IStrucutredDataCreationWizard;
+import org.jboss.tools.smooks.ui.IStructuredDataCreationWizard;
/**
* @author Dart Peng
* @Date Aug 5, 2008
*/
-public class NewJavaBeanStrucutredDataWizard extends Wizard implements
IStrucutredDataCreationWizard,INewWizard{
+public class NewJavaBeanStrucutredDataWizard extends Wizard implements
IStructuredDataCreationWizard,INewWizard{
JavaBeanConfigWizardPage page = null;
IJavaProject project = null;
Object result = null;
- IWizardNode wizard;
Properties properties = new Properties();
/* (non-Javadoc)
* @see org.eclipse.jface.wizard.Wizard#addPages()
@@ -48,9 +46,6 @@
super.addPages();
if(page == null){
page = new JavaBeanConfigWizardPage(project);
- if(this.wizard != null){
- page.activeNextWizardNode(wizard);
- }
this.addPage(page);
}
}
@@ -102,12 +97,4 @@
}
}
}
-
- public void setNextDataCreationWizardNode(IWizardNode wizard) {
- this.wizard = wizard;
- if(page != null){
- page.activeNextWizardNode(this.wizard);
- }
- }
-
}
Modified:
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/ui/BaseViewerInitor.java
===================================================================
---
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/ui/BaseViewerInitor.java 2008-10-16
08:37:41 UTC (rev 10870)
+++
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/ui/BaseViewerInitor.java 2008-10-16
09:28:22 UTC (rev 10871)
@@ -63,9 +63,9 @@
/**
* @return the structuredDataLoadWizard
*/
- public IStrucutredDataCreationWizard getStructuredDataLoadWizard() {
+ public IStructuredDataCreationWizard getStructuredDataLoadWizard() {
try {
- return ((IStrucutredDataCreationWizard) configurationElement
+ return ((IStructuredDataCreationWizard) configurationElement
.createExecutableExtension(SmooksExtensionPointConstants.EXTENTION_POINT_ATTRIBUTE_CREATION_WIZARD));
} catch (CoreException e) {
e.printStackTrace();
Copied:
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/ui/IStructuredDataCreationWizard.java
(from rev 10820,
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/ui/IStrucutredDataCreationWizard.java)
===================================================================
---
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/ui/IStructuredDataCreationWizard.java
(rev 0)
+++
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/ui/IStructuredDataCreationWizard.java 2008-10-16
09:28:22 UTC (rev 10871)
@@ -0,0 +1,34 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is 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:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.smooks.ui;
+
+import java.util.Properties;
+
+import org.eclipse.jface.wizard.IWizard;
+import org.eclipse.jface.wizard.IWizardNode;
+import org.eclipse.ui.IEditorInput;
+import org.eclipse.ui.IEditorSite;
+
+/**
+ * @author Dart Peng
+ * @Date Aug 5, 2008
+ */
+public interface IStructuredDataCreationWizard extends IWizard {
+
+ public Object getTreeViewerInputContents();
+
+ public void init(IEditorSite site, IEditorInput input);
+
+ public String getInputDataTypeID();
+
+ public Properties getProperties();
+
+}
Property changes on:
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/ui/IStructuredDataCreationWizard.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Deleted:
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/ui/IStrucutredDataCreationWizard.java
===================================================================
---
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/ui/IStrucutredDataCreationWizard.java 2008-10-16
08:37:41 UTC (rev 10870)
+++
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/ui/IStrucutredDataCreationWizard.java 2008-10-16
09:28:22 UTC (rev 10871)
@@ -1,36 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008 Red Hat, Inc.
- * Distributed under license by Red Hat, Inc. All rights reserved.
- * This program is 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:
- * Red Hat, Inc. - initial API and implementation
- ******************************************************************************/
-package org.jboss.tools.smooks.ui;
-
-import java.util.Properties;
-
-import org.eclipse.jface.wizard.IWizard;
-import org.eclipse.jface.wizard.IWizardNode;
-import org.eclipse.ui.IEditorInput;
-import org.eclipse.ui.IEditorSite;
-
-/**
- * @author Dart Peng
- * @Date Aug 5, 2008
- */
-public interface IStrucutredDataCreationWizard extends IWizard {
-
- public Object getTreeViewerInputContents();
-
- public void init(IEditorSite site, IEditorInput input);
-
- public String getInputDataTypeID();
-
- public Properties getProperties();
-
- public void setNextDataCreationWizardNode(IWizardNode wizardNode);
-
-}
Modified:
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/ui/IViewerInitor.java
===================================================================
---
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/ui/IViewerInitor.java 2008-10-16
08:37:41 UTC (rev 10870)
+++
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/ui/IViewerInitor.java 2008-10-16
09:28:22 UTC (rev 10871)
@@ -25,7 +25,7 @@
String getTypeID();
- IStrucutredDataCreationWizard getStructuredDataLoadWizard();
+ IStructuredDataCreationWizard getStructuredDataLoadWizard();
String getName();
Modified:
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/ui/StructuredDataCreationWizardDailog.java
===================================================================
---
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/ui/StructuredDataCreationWizardDailog.java 2008-10-16
08:37:41 UTC (rev 10870)
+++
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/ui/StructuredDataCreationWizardDailog.java 2008-10-16
09:28:22 UTC (rev 10871)
@@ -25,10 +25,10 @@
super(parentShell, newWizard);
}
- public IStrucutredDataCreationWizard getCurrentCreationWizard(){
+ public IStructuredDataCreationWizard getCurrentCreationWizard(){
IWizard w = getWizard();
- if(w != null && w instanceof IStrucutredDataCreationWizard){
- return (IStrucutredDataCreationWizard)w;
+ if(w != null && w instanceof IStructuredDataCreationWizard){
+ return (IStructuredDataCreationWizard)w;
}
return null;
}
Modified:
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/ui/ViewerInitorStore.java
===================================================================
---
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/ui/ViewerInitorStore.java 2008-10-16
08:37:41 UTC (rev 10870)
+++
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/ui/ViewerInitorStore.java 2008-10-16
09:28:22 UTC (rev 10871)
@@ -43,7 +43,7 @@
return null;
}
- public IStrucutredDataCreationWizard getStructuredDataCreationWizard(String typeID) {
+ public IStructuredDataCreationWizard getStructuredDataCreationWizard(String typeID) {
if (this.getInitorMap() == null)
return null;
IViewerInitor initor = this.getInitorMap().get(typeID);
Modified:
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/ui/editors/SmooksGraphicalFormPage.java
===================================================================
---
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/ui/editors/SmooksGraphicalFormPage.java 2008-10-16
08:37:41 UTC (rev 10870)
+++
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/ui/editors/SmooksGraphicalFormPage.java 2008-10-16
09:28:22 UTC (rev 10871)
@@ -112,7 +112,7 @@
import org.jboss.tools.smooks.model.SmooksFactory;
import org.jboss.tools.smooks.model.SmooksResourceListType;
import org.jboss.tools.smooks.model.util.SmooksModelConstants;
-import org.jboss.tools.smooks.ui.IStrucutredDataCreationWizard;
+import org.jboss.tools.smooks.ui.IStructuredDataCreationWizard;
import org.jboss.tools.smooks.ui.IViewerInitor;
import org.jboss.tools.smooks.ui.StructuredDataCreationWizardDailog;
import org.jboss.tools.smooks.ui.gef.editparts.SmooksEditPartFactory;
@@ -454,9 +454,7 @@
protected void initTargetTreeViewer() {
if (this.targetTreeViewerInputModel != null) {
- List arrayList = new ArrayList();
- arrayList.add(targetTreeViewerInputModel);
- targetViewer.setInput(arrayList);
+ targetViewer.setInput(targetTreeViewerInputModel);
}
}
@@ -476,9 +474,7 @@
protected void initSourceTreeViewer() {
if (this.sourceTreeViewerInputModel != null) {
- List arrayList = new ArrayList();
- arrayList.add(sourceTreeViewerInputModel);
- sourceViewer.setInput(arrayList);
+ sourceViewer.setInput(sourceTreeViewerInputModel);
}
}
@@ -993,7 +989,7 @@
StructuredDataCreationWizardDailog dialog = new StructuredDataCreationWizardDailog(
getEditorSite().getShell(), wizard);
if (dialog.open() == WizardDialog.OK) {
- IStrucutredDataCreationWizard cw = dialog
+ IStructuredDataCreationWizard cw = dialog
.getCurrentCreationWizard();
this.getSmooksConfigurationFileGenerateContext().addProperties(
cw.getProperties());
Modified:
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/ui/editors/TypeIDSelectionWizardPage.java
===================================================================
---
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/ui/editors/TypeIDSelectionWizardPage.java 2008-10-16
08:37:41 UTC (rev 10870)
+++
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/ui/editors/TypeIDSelectionWizardPage.java 2008-10-16
09:28:22 UTC (rev 10871)
@@ -25,7 +25,9 @@
import org.eclipse.jface.viewers.LabelProvider;
import org.eclipse.jface.viewers.Viewer;
import org.eclipse.jface.wizard.IWizard;
+import org.eclipse.jface.wizard.IWizardContainer;
import org.eclipse.jface.wizard.IWizardNode;
+import org.eclipse.jface.wizard.IWizardPage;
import org.eclipse.jface.wizard.WizardPage;
import org.eclipse.swt.SWT;
import org.eclipse.swt.graphics.Image;
@@ -40,10 +42,11 @@
import org.eclipse.ui.forms.widgets.Hyperlink;
import org.jboss.tools.smooks.analyzer.AnalyzerFactory;
import org.jboss.tools.smooks.analyzer.DataTypeID;
-import org.jboss.tools.smooks.ui.IStrucutredDataCreationWizard;
+import org.jboss.tools.smooks.ui.IStructuredDataCreationWizard;
import org.jboss.tools.smooks.ui.IViewerInitor;
import org.jboss.tools.smooks.ui.StructuredDataCreationWizardDailog;
import org.jboss.tools.smooks.ui.ViewerInitorStore;
+import org.jboss.tools.smooks.ui.wizards.ISmooksDataCreationAddtionWizard;
import org.jboss.tools.smooks.ui.wizards.TransformSelectWizardNode;
/**
@@ -51,15 +54,9 @@
* Date : Sep 5, 2008
*/
public class TypeIDSelectionWizardPage extends WizardPage {
- /**
- * @deprecated
- */
- protected IStrucutredDataCreationWizard sourceWizard;
+ protected IWizard sourceDataCreationWizard;
- /**
- * @deprecated
- */
- protected IStrucutredDataCreationWizard targetWizard;
+ protected IWizard targetDataCreationWizard;
private Object sourceTreeViewerInputContents;
@@ -70,6 +67,8 @@
private List sourceList;
private String sourceID = null;
private String targetID = null;
+ private String oldSourceID = null;
+ private String oldTargetID = null;
private IStructuredSelection selection;
private boolean showDataSelectPage = false;
@@ -106,6 +105,91 @@
this.showDataSelectPage = showDataSelectPage;
}
+ @Override
+ public boolean canFlipToNextPage() {
+ if (this.getSourceID() != null || getTargetID() != null) {
+ return true;
+ }
+ return false;
+ }
+
+ @Override
+ public IWizardPage getNextPage() {
+ String sourceID = this.getSourceID();
+ String targetID = this.getTargetID();
+ IStructuredDataCreationWizard sourceWizard = null;
+ IStructuredDataCreationWizard targetWizard = null;
+ IWizard rootWizard = getWizard();
+ ISmooksDataCreationAddtionWizard wizard = (ISmooksDataCreationAddtionWizard)
rootWizard;
+ if (sourceID == null) {
+ wizard.clearSourceWizardPages();
+ }
+ if (targetID == null) {
+ wizard.clearTargetWizardPages();
+ }
+ if (sourceID != null && (!sourceID.equals(oldSourceID))) {
+ sourceWizard = ViewerInitorStore.getInstance()
+ .getStructuredDataCreationWizard(sourceID);
+ oldSourceID = sourceID;
+ }
+ if (targetID != null && (!targetID.equals(oldTargetID))) {
+ targetWizard = ViewerInitorStore.getInstance()
+ .getStructuredDataCreationWizard(targetID);
+ oldTargetID = targetID;
+ }
+ if (!wizardIsCreated(sourceWizard) && sourceWizard != null) {
+ if (sourceWizard instanceof INewWizard) {
+ ((INewWizard) sourceWizard).init(null, selection);
+ }
+ sourceWizard.addPages();
+ }
+ if (!wizardIsCreated(targetWizard) && targetWizard != null) {
+ if (targetWizard instanceof INewWizard) {
+ ((INewWizard) targetWizard).init(null, selection);
+ }
+ targetWizard.addPages();
+ }
+ addDataCreationPages(sourceWizard, targetWizard);
+ return super.getNextPage();
+ }
+
+ private void addDataCreationPages(IWizard sourceWizard, IWizard targetWizard) {
+ IWizard rootWizard = getWizard();
+ if (rootWizard instanceof ISmooksDataCreationAddtionWizard) {
+ ISmooksDataCreationAddtionWizard wizard = (ISmooksDataCreationAddtionWizard)
rootWizard;
+ if (sourceWizard != null) {
+ wizard.clearSourceWizardPages();
+ IWizardPage[] pages = sourceWizard.getPages();
+ for (int i = 0; i < pages.length; i++) {
+ IWizardPage p = pages[i];
+ wizard.addSourceWizardPage(p);
+ p.setWizard(rootWizard);
+ }
+ }
+
+ if (targetWizard != null) {
+ wizard.clearTargetWizardPages();
+ IWizardPage[] pages = targetWizard.getPages();
+ for (int i = 0; i < pages.length; i++) {
+ IWizardPage p = pages[i];
+ wizard.addTargetWizardPage(p);
+ p.setWizard(rootWizard);
+ }
+ }
+ }
+ sourceDataCreationWizard = sourceWizard;
+ targetDataCreationWizard = targetWizard;
+ }
+
+ private boolean wizardIsCreated(IWizard wizard) {
+ if (wizard == null)
+ return false;
+ if (wizard.getPageCount() <= 0) {
+ return false;
+ }
+ return true;
+ }
+
/*
* (non-Javadoc)
*
@@ -151,6 +235,8 @@
}
});
+ // TODO don't show this
+ sourceDataLink.setVisible(false);
targetDataLink = new Hyperlink(mainComposite, SWT.NONE);
targetDataLink.setText("Target Model Select:Empty");
targetDataLink.addHyperlinkListener(new IHyperlinkListener() {
@@ -168,6 +254,8 @@
}
});
+ // TODO don't show this
+ targetDataLink.setVisible(false);
this.setControl(mainComposite);
}
@@ -183,7 +271,7 @@
IWizardNode wn = getSourceWizard(dataID);
// setSelectedNode(wn);
IWizard sw = wn.getWizard();
- if (sw instanceof IStrucutredDataCreationWizard) {
+ if (sw instanceof IStructuredDataCreationWizard) {
// ((IStrucutredDataCreationWizard)sw).i
}
if (sw instanceof INewWizard) {
@@ -269,7 +357,7 @@
IViewerInitor viewerInitor = (IViewerInitor) iterator.next();
if (viewerInitor.getTypeID().equals(id)) {
TransformSelectWizardNode wn = new TransformSelectWizardNode();
- IStrucutredDataCreationWizard wizard = viewerInitor
+ IStructuredDataCreationWizard wizard = viewerInitor
.getStructuredDataLoadWizard();
if (wizard == null)
return null;
@@ -309,6 +397,10 @@
String targetID = getDataTypeID(target);
setTargetID(targetID);
}
+ IWizardContainer container = getContainer();
+ if (container != null) {
+ container.updateButtons();
+ }
}
});
@@ -360,22 +452,7 @@
}
- public IStrucutredDataCreationWizard getSourceWizard() {
- return sourceWizard;
- }
- public void setSourceWizard(IStrucutredDataCreationWizard sourceWizard) {
- this.sourceWizard = sourceWizard;
- }
-
- public IStrucutredDataCreationWizard getTargetWizard() {
- return targetWizard;
- }
-
- public void setTargetWizard(IStrucutredDataCreationWizard targetWizard) {
- this.targetWizard = targetWizard;
- }
-
public Object getSourceTreeViewerInputContents() {
return sourceTreeViewerInputContents;
}
@@ -393,4 +470,12 @@
Object targetTreeViewerInputContents) {
this.targetTreeViewerInputContents = targetTreeViewerInputContents;
}
+
+ public IWizard getSourceDataCreationWizard() {
+ return sourceDataCreationWizard;
+ }
+
+ public IWizard getTargetDataCreationWizard() {
+ return targetDataCreationWizard;
+ }
}
Added:
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/ui/wizards/ISmooksDataCreationAddtionWizard.java
===================================================================
---
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/ui/wizards/ISmooksDataCreationAddtionWizard.java
(rev 0)
+++
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/ui/wizards/ISmooksDataCreationAddtionWizard.java 2008-10-16
09:28:22 UTC (rev 10871)
@@ -0,0 +1,26 @@
+/**
+ *
+ */
+package org.jboss.tools.smooks.ui.wizards;
+
+import org.eclipse.jface.wizard.IWizardPage;
+
+/**
+ * @author dart
+ *
+ */
+public interface ISmooksDataCreationAddtionWizard {
+
+ public void addSourceWizardPage(IWizardPage page);
+
+ public void removeSourceWIzardPage(IWizardPage page);
+
+ public void clearSourceWizardPages();
+
+ public void addTargetWizardPage(IWizardPage page);
+
+ public void removeTargetWIzardPage(IWizardPage page);
+
+ public void clearTargetWizardPages();
+
+}
Property changes on:
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/ui/wizards/ISmooksDataCreationAddtionWizard.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified:
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/ui/wizards/SmooksConfigFileNewWizard.java
===================================================================
---
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/ui/wizards/SmooksConfigFileNewWizard.java 2008-10-16
08:37:41 UTC (rev 10870)
+++
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/ui/wizards/SmooksConfigFileNewWizard.java 2008-10-16
09:28:22 UTC (rev 10871)
@@ -4,6 +4,7 @@
import java.io.IOException;
import java.io.InputStream;
import java.lang.reflect.InvocationTargetException;
+import java.util.ArrayList;
import java.util.List;
import org.eclipse.core.resources.IFile;
@@ -14,6 +15,8 @@
import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.jface.operation.IRunnableWithProgress;
import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.wizard.IWizard;
+import org.eclipse.jface.wizard.IWizardPage;
import org.eclipse.jface.wizard.Wizard;
import org.eclipse.ui.INewWizard;
import org.eclipse.ui.IWorkbench;
@@ -22,6 +25,7 @@
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.ide.IDE;
import org.jboss.tools.smooks.graphical.util.GraphicalInformationSaver;
+import org.jboss.tools.smooks.ui.IStructuredDataCreationWizard;
import org.jboss.tools.smooks.ui.editors.SmooksFileEditorInput;
import org.jboss.tools.smooks.ui.editors.SmooksFormEditor;
import org.jboss.tools.smooks.ui.editors.TypeIDSelectionWizardPage;
@@ -35,10 +39,15 @@
* the same extension, it will be able to open it.
*/
-public class SmooksConfigFileNewWizard extends Wizard implements INewWizard {
+public class SmooksConfigFileNewWizard extends Wizard implements INewWizard,
+ ISmooksDataCreationAddtionWizard {
private SmooksConfigFileNewWizardPage page;
private TypeIDSelectionWizardPage typeIDPage;
+ private List<IWizardPage> sourceCreationPages = new
ArrayList<IWizardPage>();
+
+ private List<IWizardPage> targetCreationPages = new
ArrayList<IWizardPage>();
+
private IStructuredSelection selection;
private IWorkbench workbench;
@@ -131,22 +140,39 @@
try {
SmooksFileEditorInput input = new SmooksFileEditorInput(
file);
- Object sourceObj = typeIDPage.getSourceTreeViewerInputContents();
- if(sourceObj instanceof List){
- if(!((List)sourceObj).isEmpty()){
- sourceObj = ((List)sourceObj).get(0);
- }
+ IWizard sourceWizard = typeIDPage
+ .getSourceDataCreationWizard();
+ IWizard targetWizard = typeIDPage
+ .getTargetDataCreationWizard();
+ if (sourceWizard != null) {
+ sourceWizard.performFinish();
}
- input.setSourceTreeViewerInputContents(sourceObj);
-
- Object targetObj = typeIDPage.getSourceTreeViewerInputContents();
- if(targetObj instanceof List){
- if(!((List)targetObj).isEmpty()){
- targetObj = ((List)targetObj).get(0);
- }
+ if (targetWizard != null) {
+ targetWizard.performFinish();
}
- input.setTargetTreeViewerInputContents(targetObj);
+ if (sourceWizard instanceof IStructuredDataCreationWizard) {
+ Object sourceObj = ((IStructuredDataCreationWizard) sourceWizard)
+ .getTreeViewerInputContents();
+// if (sourceObj instanceof List) {
+// if (!((List) sourceObj).isEmpty()) {
+// sourceObj = ((List) sourceObj).get(0);
+// }
+// }
+ input.setSourceTreeViewerInputContents(sourceObj);
+ }
+ if (targetWizard instanceof IStructuredDataCreationWizard) {
+ Object targetObj = ((IStructuredDataCreationWizard) targetWizard)
+ .getTreeViewerInputContents();
+// if (targetObj instanceof List) {
+// if (!((List) targetObj).isEmpty()) {
+// targetObj = ((List) targetObj).get(0);
+// }
+// }
+ input.setTargetTreeViewerInputContents(targetObj);
+
+ }
+
IDE.openEditor(page, input, SmooksFormEditor.EDITOR_ID,
true);// openEditor(page, file, true);
} catch (PartInitException e) {
@@ -184,4 +210,92 @@
public void setSelection(IStructuredSelection selection) {
this.selection = selection;
}
+
+ public void addSourceWizardPage(IWizardPage page) {
+ sourceCreationPages.add(page);
+ page.setTitle("Source Data Selection Page");
+ }
+
+ public void addTargetWizardPage(IWizardPage page) {
+ targetCreationPages.add(page);
+ page.setTitle("Target Data Selection Page");
+ }
+
+ public void clearSourceWizardPages() {
+ // for (Iterator iterator = sourceCreationPages.iterator();
+ // iterator.hasNext();) {
+ // IWizardPage page = (IWizardPage) iterator.next();
+ // if(page != null){
+ // page.dispose();
+ // }
+ // }
+ sourceCreationPages.clear();
+ }
+
+ private IWizardPage getSourceCreationPage(IWizardPage page) {
+ if (page == typeIDPage) {
+ if (sourceCreationPages.isEmpty())
+ return null;
+ return (IWizardPage) sourceCreationPages.get(0);
+ }
+ if (sourceCreationPages.contains(page)) {
+ int i = sourceCreationPages.indexOf(page);
+ if ((i + 1) >= sourceCreationPages.size()) {
+ return null;
+ }
+ return (IWizardPage) sourceCreationPages.get(i + 1);
+ }
+ return null;
+ }
+
+ private IWizardPage getTargetCreationPage(IWizardPage page) {
+ if (page == typeIDPage) {
+ if (targetCreationPages.isEmpty())
+ return null;
+ return (IWizardPage) targetCreationPages.get(0);
+ }
+ if (targetCreationPages.contains(page)) {
+ int i = targetCreationPages.indexOf(page);
+ if ((i + 1) >= targetCreationPages.size()) {
+ return null;
+ }
+ return (IWizardPage) targetCreationPages.get(i + 1);
+ }
+ if (sourceCreationPages.contains(page)) {
+ if (sourceCreationPages.get(sourceCreationPages.size() - 1) == page) {
+ return (IWizardPage) targetCreationPages.get(0);
+ }
+ }
+ return null;
+ }
+
+ @Override
+ public IWizardPage getNextPage(IWizardPage page) {
+ IWizardPage p = getSourceCreationPage(page);
+ if (p != null)
+ return p;
+ p = getTargetCreationPage(page);
+ if (p != null)
+ return p;
+ return super.getNextPage(page);
+ }
+
+ public void clearTargetWizardPages() {
+ // for (Iterator iterator = sourceCreationPages.iterator();
+ // iterator.hasNext();) {
+ // IWizardPage page = (IWizardPage) iterator.next();
+ // if(page != null){
+ // page.dispose();
+ // }
+ // }
+ targetCreationPages.clear();
+ }
+
+ public void removeSourceWIzardPage(IWizardPage page) {
+ sourceCreationPages.remove(page);
+ }
+
+ public void removeTargetWIzardPage(IWizardPage page) {
+ targetCreationPages.remove(page);
+ }
}
\ No newline at end of file
Modified:
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/ui/wizards/TransformDataWizardSelectionPage.java
===================================================================
---
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/ui/wizards/TransformDataWizardSelectionPage.java 2008-10-16
08:37:41 UTC (rev 10870)
+++
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/ui/wizards/TransformDataWizardSelectionPage.java 2008-10-16
09:28:22 UTC (rev 10871)
@@ -35,7 +35,7 @@
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Label;
-import org.jboss.tools.smooks.ui.IStrucutredDataCreationWizard;
+import org.jboss.tools.smooks.ui.IStructuredDataCreationWizard;
import org.jboss.tools.smooks.ui.IViewerInitor;
import org.jboss.tools.smooks.ui.ViewerInitorStore;
@@ -89,7 +89,7 @@
String des = ((TransformSelectWizardNode)node).getDescription();
desLabel.setText(des);
}
- IStrucutredDataCreationWizard wizard = (IStrucutredDataCreationWizard) node
+ IStructuredDataCreationWizard wizard = (IStructuredDataCreationWizard) node
.getWizard();
TransformDataSelectionWizard pw = (TransformDataSelectionWizard) getWizard();
wizard.init(pw.getSite(), pw.getInput());
@@ -141,7 +141,7 @@
for (Iterator iterator = viewers.iterator(); iterator.hasNext();) {
IViewerInitor viewerInitor = (IViewerInitor) iterator.next();
TransformSelectWizardNode wn = new TransformSelectWizardNode();
- IStrucutredDataCreationWizard wizard = viewerInitor
+ IStructuredDataCreationWizard wizard = viewerInitor
.getStructuredDataLoadWizard();
if (wizard == null)
continue;
Modified:
trunk/smooks/plugins/org.jboss.tools.smooks.xml/src/org/jboss/tools/smooks/xml/AbstractFileSelectionWizardPage.java
===================================================================
---
trunk/smooks/plugins/org.jboss.tools.smooks.xml/src/org/jboss/tools/smooks/xml/AbstractFileSelectionWizardPage.java 2008-10-16
08:37:41 UTC (rev 10870)
+++
trunk/smooks/plugins/org.jboss.tools.smooks.xml/src/org/jboss/tools/smooks/xml/AbstractFileSelectionWizardPage.java 2008-10-16
09:28:22 UTC (rev 10871)
@@ -7,14 +7,13 @@
import java.util.Collections;
import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.emf.common.ui.dialogs.WorkspaceResourceDialog;
import org.eclipse.jface.viewers.CheckboxTableViewer;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.wizard.IWizard;
import org.eclipse.jface.wizard.IWizardNode;
import org.eclipse.jface.wizard.IWizardPage;
-import org.eclipse.jface.wizard.WizardSelectionPage;
+import org.eclipse.jface.wizard.WizardPage;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.ModifyEvent;
import org.eclipse.swt.events.ModifyListener;
@@ -35,7 +34,7 @@
*
* @author Dart Peng Date : 2008-8-13
*/
-public abstract class AbstractFileSelectionWizardPage extends WizardSelectionPage
+public abstract class AbstractFileSelectionWizardPage extends WizardPage
implements SelectionListener {
protected IStructuredSelection selection;
protected Object returnObject = null;
@@ -66,33 +65,6 @@
/*
* (non-Javadoc)
*
- * @see org.eclipse.jface.wizard.WizardSelectionPage#getNextPage()
- */
- public IWizardPage getNextPage() {
- if (this.getSelectedNode() == null) {
- return null;
- }
-
- boolean isCreated = getSelectedNode().isContentCreated();
-
- IWizard wizard = getSelectedNode().getWizard();
-
- if (wizard == null) {
- setSelectedNode(null);
- return null;
- }
- if (!isCreated) {
- if (wizard instanceof INewWizard) {
- ((INewWizard) wizard).init(null, getSelection());
- }
- wizard.addPages();
- }
- return wizard.getStartingPage();
- }
-
- /*
- * (non-Javadoc)
- *
* @see
org.eclipse.jface.dialogs.IDialogPage#createControl(org.eclipse.swt.widgets.Composite)
*/
public void createControl(Composite parent) {
@@ -262,10 +234,6 @@
return xsdComposite;
}
-
- public void activeNextWizardNode(IWizardNode node){
- setSelectedNode(node);
- }
abstract protected Object loadedTheObject(String path) throws Exception;
Modified:
trunk/smooks/plugins/org.jboss.tools.smooks.xml/src/org/jboss/tools/smooks/xml/AbstractStructuredDdataWizard.java
===================================================================
---
trunk/smooks/plugins/org.jboss.tools.smooks.xml/src/org/jboss/tools/smooks/xml/AbstractStructuredDdataWizard.java 2008-10-16
08:37:41 UTC (rev 10870)
+++
trunk/smooks/plugins/org.jboss.tools.smooks.xml/src/org/jboss/tools/smooks/xml/AbstractStructuredDdataWizard.java 2008-10-16
09:28:22 UTC (rev 10871)
@@ -10,14 +10,14 @@
import org.eclipse.ui.IEditorSite;
import org.eclipse.ui.INewWizard;
import org.eclipse.ui.IWorkbench;
-import org.jboss.tools.smooks.ui.IStrucutredDataCreationWizard;
+import org.jboss.tools.smooks.ui.IStructuredDataCreationWizard;
/**
* @author Dart
*
*/
public abstract class AbstractStructuredDdataWizard extends Wizard implements
- IStrucutredDataCreationWizard ,INewWizard{
+ IStructuredDataCreationWizard ,INewWizard{
protected IWorkbench workbench;
protected IStructuredSelection selection;
@@ -37,7 +37,6 @@
if(page == null){
page = createAbstractFileSelectionWizardPage();
page.setSelection(this.selection);
- page.activeNextWizardNode(strucutredDataCreationWizardNode);
}
this.addPage(page);
}
@@ -61,12 +60,6 @@
public void init(IEditorSite site, IEditorInput input) {
}
- public void setNextDataCreationWizardNode(IWizardNode wizardNode) {
- strucutredDataCreationWizardNode = wizardNode;
- if(page != null){
- page.activeNextWizardNode(strucutredDataCreationWizardNode);
- }
- }
public void init(IWorkbench workbench, IStructuredSelection selection) {
this.workbench = workbench;