Author: DartPeng
Date: 2008-10-13 04:01:29 -0400 (Mon, 13 Oct 2008)
New Revision: 10784
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/NewJavaBeanStrucutredDataWizard.java
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/editors/SmooksFileEditorInput.java
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/ui/editors/SmooksFormEditor.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/TypeIDSelectionWizard.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/TransformSelectWizardNode.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
trunk/smooks/plugins/org.jboss.tools.smooks.xml/src/org/jboss/tools/smooks/xml/ui/XMLStructuredDataWizard.java
trunk/smooks/plugins/org.jboss.tools.smooks.xml/src/org/jboss/tools/smooks/xml/ui/XMLStructuredDataWizardPage.java
trunk/smooks/plugins/org.jboss.tools.smooks.xml/src/org/jboss/tools/smooks/xsd/ui/XSDStructuredDataWizard.java
Log:
JBIDE-2837
Change the new wizard codes, but ... something seams that can't run well...
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-11
15:42:39 UTC (rev 10783)
+++
trunk/smooks/plugins/org.jboss.tools.smooks.javabean/src/org/jboss/tools/smooks/javabean/ui/JavaBeanConfigWizardPage.java 2008-10-13
08:01:29 UTC (rev 10784)
@@ -11,25 +11,31 @@
package org.jboss.tools.smooks.javabean.ui;
import org.eclipse.jdt.core.IJavaProject;
-import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.StructuredSelection;
import org.eclipse.jface.viewers.TreeViewer;
-import org.eclipse.jface.wizard.WizardPage;
+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.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 WizardPage implements
+public class JavaBeanConfigWizardPage extends WizardSelectionPage implements
SelectionListener {
-
+
TreeViewer treeViewer;
Text classText = null;
@@ -47,8 +53,41 @@
public JavaBeanConfigWizardPage(IJavaProject selection) {
super("beansearchwizardpage");
this.project = selection;
+ setPageComplete(true);
}
+
+ 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() {
}
@@ -109,13 +148,14 @@
if (project == null) {
error = "Please select a Java project.";
}
+ setPageComplete(error == null);
this.setErrorMessage(error);
}
- public JavaBeanConfigWizardPage(String pageName, String title,
- ImageDescriptor titleImage) {
- super(pageName, title, titleImage);
- }
+// public JavaBeanConfigWizardPage(String pageName, String title,
+// ImageDescriptor titleImage) {
+// super(pageName, title, titleImage);
+// }
public JavaBeanConfigWizardPage(String pageName) {
super(pageName);
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-11
15:42:39 UTC (rev 10783)
+++
trunk/smooks/plugins/org.jboss.tools.smooks.javabean/src/org/jboss/tools/smooks/javabean/ui/NewJavaBeanStrucutredDataWizard.java 2008-10-13
08:01:29 UTC (rev 10784)
@@ -15,12 +15,18 @@
import java.util.Properties;
import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IResource;
import org.eclipse.jdt.core.IJavaProject;
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;
import org.eclipse.ui.IFileEditorInput;
+import org.eclipse.ui.INewWizard;
+import org.eclipse.ui.IWorkbench;
import org.jboss.tools.smooks.javabean.JavaBeanActivator;
import org.jboss.tools.smooks.ui.IStrucutredDataCreationWizard;
@@ -28,11 +34,11 @@
* @author Dart Peng
* @Date Aug 5, 2008
*/
-public class NewJavaBeanStrucutredDataWizard extends Wizard implements
IStrucutredDataCreationWizard{
+public class NewJavaBeanStrucutredDataWizard extends Wizard implements
IStrucutredDataCreationWizard,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()
@@ -42,6 +48,9 @@
super.addPages();
if(page == null){
page = new JavaBeanConfigWizardPage(project);
+ if(this.wizard != null){
+ page.activeNextWizardNode(wizard);
+ }
this.addPage(page);
}
}
@@ -81,4 +90,24 @@
return this.properties;
}
+ public void init(IWorkbench workbench, IStructuredSelection selection) {
+ if(selection != null){
+ Object obj = selection.getFirstElement();
+ if(obj instanceof JavaProject){
+ this.project = (JavaProject)obj;
+ }
+ if(obj instanceof IResource){
+ IProject project = ((IResource)obj).getProject();
+ this.project = JavaCore.create(project);
+ }
+ }
+ }
+
+ 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/IStrucutredDataCreationWizard.java
===================================================================
---
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/ui/IStrucutredDataCreationWizard.java 2008-10-11
15:42:39 UTC (rev 10783)
+++
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/ui/IStrucutredDataCreationWizard.java 2008-10-13
08:01:29 UTC (rev 10784)
@@ -13,6 +13,7 @@
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;
@@ -30,4 +31,6 @@
public Properties getProperties();
+ public void setNextDataCreationWizardNode(IWizardNode wizardNode);
+
}
Modified:
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/ui/editors/SmooksFileEditorInput.java
===================================================================
---
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/ui/editors/SmooksFileEditorInput.java 2008-10-11
15:42:39 UTC (rev 10783)
+++
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/ui/editors/SmooksFileEditorInput.java 2008-10-13
08:01:29 UTC (rev 10784)
@@ -27,6 +27,26 @@
private List targetModel = new ArrayList();
+ private Object sourceRoot = null;
+
+ private Object targetRoot = null;
+
+ public Object getSourceTreeViewerInputContents() {
+ return sourceRoot;
+ }
+
+ public void setSourceTreeViewerInputContents(Object sourceRoot) {
+ this.sourceRoot = sourceRoot;
+ }
+
+ public Object getTargetTreeViewerInputContents() {
+ return targetRoot;
+ }
+
+ public void setTargetTreeViewerInputContents(Object targetRoot) {
+ this.targetRoot = targetRoot;
+ }
+
public SmooksFileEditorInput(IFile file) {
super(file);
}
@@ -58,7 +78,5 @@
public void setTargetModel(List targetModel) {
this.targetModel = targetModel;
}
-
-
}
Modified:
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/ui/editors/SmooksFormEditor.java
===================================================================
---
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/ui/editors/SmooksFormEditor.java 2008-10-11
15:42:39 UTC (rev 10783)
+++
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/ui/editors/SmooksFormEditor.java 2008-10-13
08:01:29 UTC (rev 10784)
@@ -47,6 +47,7 @@
*/
public class SmooksFormEditor extends FormEditor implements
ITabbedPropertySheetPageContributor {
+
SmooksGraphicalFormPage graphicalPage = null;
private TabbedPropertySheetPage tabbedPropertySheetPage;
private SmooksNormalContentEditFormPage normalPage;
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-11
15:42:39 UTC (rev 10783)
+++
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/ui/editors/SmooksGraphicalFormPage.java 2008-10-13
08:01:29 UTC (rev 10784)
@@ -258,7 +258,8 @@
Composite rootMainControl = form.getBody();
form.setText("Data Mapping Page");
Section section = this.createPageSectionHeader(rootMainControl,
- Section.TITLE_BAR | Section.DESCRIPTION , "Mapping Graph Edit Panel",
+ Section.TITLE_BAR | Section.DESCRIPTION,
+ "Mapping Graph Edit Panel",
"Edit the source and target assosiation");
Composite mappingMainComposite = toolkit.createComposite(section);
GridLayout gly = new GridLayout();
@@ -453,9 +454,7 @@
protected void initTargetTreeViewer() {
if (this.targetTreeViewerInputModel != null) {
- List list = new ArrayList();
- list.add(targetTreeViewerInputModel);
- targetViewer.setInput(list);
+ targetViewer.setInput(targetTreeViewerInputModel);
}
}
@@ -475,9 +474,7 @@
protected void initSourceTreeViewer() {
if (this.sourceTreeViewerInputModel != null) {
- List list = new ArrayList();
- list.add(sourceTreeViewerInputModel);
- sourceViewer.setInput(list);
+ sourceViewer.setInput(sourceTreeViewerInputModel);
}
}
@@ -862,10 +859,10 @@
.getInstance().getTargetModelAnalyzer(targetDataTypeID);
IMappingAnalyzer connectionAnalyzer = AnalyzerFactory.getInstance()
.getMappingAnalyzer(sourceDataTypeID, targetDataTypeID);
- if (sourceModelAnalyzer != null)
+ if (sourceModelAnalyzer != null && sourceTreeViewerInputModel == null)
sourceTreeViewerInputModel = sourceModelAnalyzer
.buildSourceInputObjects(graph, listType, file);
- if (targetModelAnalyzer != null)
+ if (targetModelAnalyzer != null && targetTreeViewerInputModel == null)
targetTreeViewerInputModel = targetModelAnalyzer
.buildTargetInputObjects(graph, listType, file);
if (connectionAnalyzer != null) {
@@ -953,6 +950,13 @@
smooksResource = ((SmooksFormEditor) parentEditor)
.getSmooksResource();
}
+ if (input instanceof SmooksFileEditorInput) {
+ this.sourceTreeViewerInputModel = ((SmooksFileEditorInput) input)
+ .getSourceTreeViewerInputContents();
+
+ this.targetTreeViewerInputModel = ((SmooksFileEditorInput) input)
+ .getTargetTreeViewerInputContents();
+ }
// }
}
Modified:
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/ui/editors/TypeIDSelectionWizard.java
===================================================================
---
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/ui/editors/TypeIDSelectionWizard.java 2008-10-11
15:42:39 UTC (rev 10783)
+++
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/ui/editors/TypeIDSelectionWizard.java 2008-10-13
08:01:29 UTC (rev 10784)
@@ -35,7 +35,7 @@
public void addPages(){
if(page == null){
- page = new TypeIDSelectionWizardPage("TypeID Selection");
+ page = new TypeIDSelectionWizardPage("TypeID Selection",false);
this.addPage(page);
}
super.addPages();
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-11
15:42:39 UTC (rev 10783)
+++
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/ui/editors/TypeIDSelectionWizardPage.java 2008-10-13
08:01:29 UTC (rev 10784)
@@ -10,6 +10,7 @@
******************************************************************************/
package org.jboss.tools.smooks.ui.editors;
+import java.util.Collection;
import java.util.Iterator;
import java.util.List;
@@ -17,11 +18,14 @@
import org.eclipse.jface.viewers.CheckboxTableViewer;
import org.eclipse.jface.viewers.ICheckStateListener;
import org.eclipse.jface.viewers.IStructuredContentProvider;
+import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.viewers.ITableLabelProvider;
import org.eclipse.jface.viewers.LabelProvider;
import org.eclipse.jface.viewers.Viewer;
import org.eclipse.jface.wizard.IWizard;
-import org.eclipse.jface.wizard.WizardPage;
+import org.eclipse.jface.wizard.IWizardNode;
+import org.eclipse.jface.wizard.IWizardPage;
+import org.eclipse.jface.wizard.WizardSelectionPage;
import org.eclipse.swt.SWT;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.layout.GridData;
@@ -29,24 +33,39 @@
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.TableColumn;
+import org.eclipse.ui.INewWizard;
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.IViewerInitor;
+import org.jboss.tools.smooks.ui.ViewerInitorStore;
+import org.jboss.tools.smooks.ui.wizards.TransformSelectWizardNode;
/**
* @author Dart Peng<br>
* Date : Sep 5, 2008
*/
-public class TypeIDSelectionWizardPage extends WizardPage {
+public class TypeIDSelectionWizardPage extends WizardSelectionPage {
+ protected IStrucutredDataCreationWizard sourceWizard;
+ protected IStrucutredDataCreationWizard targetWizard;
+
protected CheckboxTableViewer source;
protected CheckboxTableViewer target;
private List sourceList;
private String sourceID = null;
private String targetID = null;
-
-
-
+ private IStructuredSelection selection;
+ private boolean showDataSelectPage = false;
+ public IStructuredSelection getSelection() {
+ return selection;
+ }
+
+ public void setSelection(IStructuredSelection selection) {
+ this.selection = selection;
+ }
+
public String getSourceID() {
return sourceID;
}
@@ -63,13 +82,49 @@
this.targetID = targetID;
}
- public TypeIDSelectionWizardPage(String pageName) {
+ public TypeIDSelectionWizardPage(String pageName, boolean showDataSelectPage) {
super(pageName);
+ this.showDataSelectPage = showDataSelectPage;
}
/*
* (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 IStrucutredDataCreationWizard) {
+ String targetID = getDataTypeID(target);
+ if (targetID != null) {
+ ((IStrucutredDataCreationWizard) wizard)
+ .setNextDataCreationWizardNode(this
+ .getSourceWizard(targetID));
+ }
+ }
+ if (wizard instanceof INewWizard) {
+ ((INewWizard) wizard).init(null, selection);
+ }
+ wizard.addPages();
+ }
+ return wizard.getStartingPage();
+ }
+
+ /*
+ * (non-Javadoc)
+ *
* @see
org.eclipse.jface.dialogs.IDialogPage#createControl(org.eclipse.swt.widgets.Composite)
*/
public void createControl(Composite parent) {
@@ -78,8 +133,7 @@
gl.numColumns = 2;
gl.makeColumnsEqualWidth = true;
mainComposite.setLayout(gl);
- sourceList = AnalyzerFactory.getInstance()
- .getRegistrySourceIDList();
+ sourceList = AnalyzerFactory.getInstance().getRegistrySourceIDList();
Label sl = new Label(mainComposite, SWT.NONE);
sl.setText("Source Data Type ID List : ");
@@ -95,7 +149,7 @@
source.setInput(sourceList);
target.setInput(sourceList);
initViewer();
-
+
this.setControl(mainComposite);
}
@@ -124,7 +178,8 @@
}
protected boolean initViewerCheckState(String id, CheckboxTableViewer viewer) {
- if(id == null) return false;
+ if (id == null)
+ return false;
List l = (List) viewer.getInput();
for (Iterator iterator = l.iterator(); iterator.hasNext();) {
DataTypeID dti = (DataTypeID) iterator.next();
@@ -136,6 +191,27 @@
return false;
}
+ private IWizardNode getSourceWizard(String id) {
+ Collection<IViewerInitor> viewers = ViewerInitorStore.getInstance()
+ .getViewerInitorCollection();
+ for (Iterator iterator = viewers.iterator(); iterator.hasNext();) {
+ IViewerInitor viewerInitor = (IViewerInitor) iterator.next();
+ if (viewerInitor.getTypeID().equals(id)) {
+ TransformSelectWizardNode wn = new TransformSelectWizardNode();
+ IStrucutredDataCreationWizard wizard = viewerInitor
+ .getStructuredDataLoadWizard();
+ if (wizard == null)
+ return null;
+ wn.setWizard(wizard);
+ wn.setName(viewerInitor.getName());
+ wn.setIconPath(viewerInitor.getWizardIconPath());
+ wn.setDescription(viewerInitor.getDescription());
+ return wn;
+ }
+ }
+ return null;
+ }
+
protected CheckboxTableViewer createTableViewer(Composite parent) {
final CheckboxTableViewer viewer = CheckboxTableViewer.newCheckList(
parent, SWT.FULL_SELECTION);
@@ -152,13 +228,35 @@
viewer.setChecked(event.getElement(), true);
fireEvent = true;
}
-
- if(viewer == source){
- setSourceID(getDataTypeID(source));
+
+ if (viewer == source) {
+ String sourceID = getDataTypeID(source);
+ IWizardNode wn = getSourceWizard(sourceID);
+ setSelectedNode(wn);
+ setSourceID(sourceID);
+ IWizard sw = wn.getWizard();
+ if (sw instanceof IStrucutredDataCreationWizard) {
+ setSourceWizard((IStrucutredDataCreationWizard) sw);
+ }
}
-
- if(viewer == target){
- setTargetID(getDataTypeID(target));
+
+ if (viewer == target) {
+ IWizardNode node = getSelectedNode();
+ String targetID = getDataTypeID(target);
+ IWizardNode targetNode = getSourceWizard(targetID);
+ IWizard tnw = targetNode.getWizard();
+ if (tnw instanceof IStrucutredDataCreationWizard) {
+ setTargetWizard((IStrucutredDataCreationWizard) tnw);
+ }
+ if (node != null) {
+ IWizard wizard = node.getWizard();
+ if (wizard != null
+ && wizard instanceof IStrucutredDataCreationWizard) {
+ ((IStrucutredDataCreationWizard) wizard)
+ .setNextDataCreationWizardNode(targetNode);
+ }
+ }
+ setTargetID(targetID);
}
}
@@ -166,9 +264,9 @@
TableColumn nameColumn = new TableColumn(viewer.getTable(), SWT.NONE);
nameColumn.setWidth(100);
nameColumn.setText("Name");
-// TableColumn idColumn = new TableColumn(viewer.getTable(), SWT.NONE);
-// idColumn.setWidth(100);
-// idColumn.setText("ID");
+ // TableColumn idColumn = new TableColumn(viewer.getTable(), SWT.NONE);
+ // idColumn.setWidth(100);
+ // idColumn.setText("ID");
viewer.setContentProvider(new TypeIDContentProvider());
viewer.setLabelProvider(new TypeIDLabelProvider());
return viewer;
@@ -205,12 +303,28 @@
switch (columnIndex) {
case 0:
return ((DataTypeID) element).getName();
-// case 1:
-// return ((DataTypeID) element).getId();
+ // case 1:
+ // return ((DataTypeID) element).getId();
}
}
return "";
}
}
+
+ 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;
+ }
}
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-11
15:42:39 UTC (rev 10783)
+++
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/ui/wizards/SmooksConfigFileNewWizard.java 2008-10-13
08:01:29 UTC (rev 10784)
@@ -13,6 +13,7 @@
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.Wizard;
import org.eclipse.ui.INewWizard;
import org.eclipse.ui.IWorkbench;
@@ -21,6 +22,9 @@
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.IStrucutredDataCreationWizard;
+import org.jboss.tools.smooks.ui.editors.SmooksFileEditorInput;
+import org.jboss.tools.smooks.ui.editors.SmooksFormEditor;
import org.jboss.tools.smooks.ui.editors.TypeIDSelectionWizardPage;
/**
@@ -55,7 +59,8 @@
page = new SmooksConfigFileNewWizardPage("newSmooksFile1",
getSelection());
addPage(page);
- typeIDPage = new TypeIDSelectionWizardPage("");
+ typeIDPage = new TypeIDSelectionWizardPage("", true);
+ typeIDPage.setSelection(selection);
addPage(typeIDPage);
}
@@ -124,7 +129,33 @@
IWorkbenchPage page = PlatformUI.getWorkbench()
.getActiveWorkbenchWindow().getActivePage();
try {
- IDE.openEditor(page, file, true);
+ SmooksFileEditorInput input = new SmooksFileEditorInput(
+ file);
+ IStrucutredDataCreationWizard sourceWizard = typeIDPage
+ .getSourceWizard();
+
+ IStrucutredDataCreationWizard targetWizard = typeIDPage
+ .getTargetWizard();
+
+ if (sourceWizard != null) {
+ if (((IWizard) sourceWizard).getPageCount() != 0) {
+ if (((IWizard) sourceWizard).performFinish())
+ input
+ .setSourceTreeViewerInputContents(sourceWizard
+ .getTreeViewerInputContents());
+ }
+ }
+ if (targetWizard != null) {
+ if (((IWizard) targetWizard).getPageCount() != 0) {
+ if (((IWizard) targetWizard).performFinish())
+ input
+ .setTargetTreeViewerInputContents(targetWizard
+ .getTreeViewerInputContents());
+ }
+ }
+
+ IDE.openEditor(page, input, SmooksFormEditor.EDITOR_ID,
+ true);// openEditor(page, file, true);
} catch (PartInitException e) {
}
}
Modified:
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/ui/wizards/TransformSelectWizardNode.java
===================================================================
---
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/ui/wizards/TransformSelectWizardNode.java 2008-10-11
15:42:39 UTC (rev 10783)
+++
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/ui/wizards/TransformSelectWizardNode.java 2008-10-13
08:01:29 UTC (rev 10784)
@@ -12,7 +12,6 @@
import org.eclipse.jface.wizard.IWizard;
import org.eclipse.jface.wizard.IWizardNode;
-import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.graphics.Point;
/**
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-11
15:42:39 UTC (rev 10783)
+++
trunk/smooks/plugins/org.jboss.tools.smooks.xml/src/org/jboss/tools/smooks/xml/AbstractFileSelectionWizardPage.java 2008-10-13
08:01:29 UTC (rev 10784)
@@ -8,12 +8,12 @@
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.emf.common.ui.dialogs.WorkspaceResourceDialog;
-import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jface.viewers.CheckStateChangedEvent;
import org.eclipse.jface.viewers.CheckboxTableViewer;
-import org.eclipse.jface.viewers.ICheckStateListener;
-import org.eclipse.jface.wizard.WizardPage;
+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.swt.SWT;
import org.eclipse.swt.events.ModifyEvent;
import org.eclipse.swt.events.ModifyListener;
@@ -28,16 +28,15 @@
import org.eclipse.swt.widgets.FileDialog;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Text;
-import org.jboss.tools.smooks.xsd.model.XSDStructuredModelContentProvider;
-import org.jboss.tools.smooks.xsd.model.XSDStructuredModelLabelProvider;
+import org.eclipse.ui.INewWizard;
/**
*
* @author Dart Peng Date : 2008-8-13
*/
-public abstract class AbstractFileSelectionWizardPage extends WizardPage
+public abstract class AbstractFileSelectionWizardPage extends WizardSelectionPage
implements SelectionListener {
-
+ protected IStructuredSelection selection;
protected Object returnObject = null;
protected Text fileText;
protected Composite fileTextComposite;
@@ -46,12 +45,6 @@
protected boolean reasourceLoaded = false;
private Button workspaceBrowseButton;
- public AbstractFileSelectionWizardPage(String pageName, String title,
- ImageDescriptor titleImage) {
- super(pageName, title, titleImage);
- // TODO Auto-generated constructor stub
- }
-
public AbstractFileSelectionWizardPage(String pageName) {
super(pageName);
// TODO Auto-generated constructor stub
@@ -69,7 +62,33 @@
public String getFilePath(){
return fileText.getText();
}
+ /*
+ * (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)
*
@@ -245,6 +264,10 @@
return xsdComposite;
}
+
+ public void activeNextWizardNode(IWizardNode node){
+ setSelectedNode(node);
+ }
abstract protected Object loadedTheObject(String path) throws Exception;
@@ -324,4 +347,12 @@
this.tableViewer = tableViewer;
}
+ public IStructuredSelection getSelection() {
+ return selection;
+ }
+
+ public void setSelection(IStructuredSelection selection) {
+ this.selection = selection;
+ }
+
}
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-11
15:42:39 UTC (rev 10783)
+++
trunk/smooks/plugins/org.jboss.tools.smooks.xml/src/org/jboss/tools/smooks/xml/AbstractStructuredDdataWizard.java 2008-10-13
08:01:29 UTC (rev 10784)
@@ -3,9 +3,13 @@
*/
package org.jboss.tools.smooks.xml;
+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;
+import org.eclipse.ui.INewWizard;
+import org.eclipse.ui.IWorkbench;
import org.jboss.tools.smooks.ui.IStrucutredDataCreationWizard;
/**
@@ -13,9 +17,14 @@
*
*/
public abstract class AbstractStructuredDdataWizard extends Wizard implements
- IStrucutredDataCreationWizard {
+ IStrucutredDataCreationWizard ,INewWizard{
+ protected IWorkbench workbench;
+
+ protected IStructuredSelection selection;
+
protected AbstractFileSelectionWizardPage page = null;
protected Object xsdElement = null;
+ protected IWizardNode strucutredDataCreationWizardNode;
/**
*
*/
@@ -27,6 +36,8 @@
public void addPages() {
if(page == null){
page = createAbstractFileSelectionWizardPage();
+ page.setSelection(this.selection);
+ page.activeNextWizardNode(strucutredDataCreationWizardNode);
}
this.addPage(page);
}
@@ -50,5 +61,17 @@
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;
+ this.selection = selection;
+ }
+
+
}
Modified:
trunk/smooks/plugins/org.jboss.tools.smooks.xml/src/org/jboss/tools/smooks/xml/ui/XMLStructuredDataWizard.java
===================================================================
---
trunk/smooks/plugins/org.jboss.tools.smooks.xml/src/org/jboss/tools/smooks/xml/ui/XMLStructuredDataWizard.java 2008-10-11
15:42:39 UTC (rev 10783)
+++
trunk/smooks/plugins/org.jboss.tools.smooks.xml/src/org/jboss/tools/smooks/xml/ui/XMLStructuredDataWizard.java 2008-10-13
08:01:29 UTC (rev 10784)
@@ -21,6 +21,8 @@
* @Date Aug 18, 2008
*/
public class XMLStructuredDataWizard extends AbstractStructuredDdataWizard {
+
+
Properties properties = new Properties();
String filePath = null;
@@ -49,5 +51,4 @@
public Properties getProperties() {
return properties;
}
-
}
Modified:
trunk/smooks/plugins/org.jboss.tools.smooks.xml/src/org/jboss/tools/smooks/xml/ui/XMLStructuredDataWizardPage.java
===================================================================
---
trunk/smooks/plugins/org.jboss.tools.smooks.xml/src/org/jboss/tools/smooks/xml/ui/XMLStructuredDataWizardPage.java 2008-10-11
15:42:39 UTC (rev 10783)
+++
trunk/smooks/plugins/org.jboss.tools.smooks.xml/src/org/jboss/tools/smooks/xml/ui/XMLStructuredDataWizardPage.java 2008-10-13
08:01:29 UTC (rev 10784)
@@ -3,7 +3,6 @@
*/
package org.jboss.tools.smooks.xml.ui;
-import org.eclipse.jface.resource.ImageDescriptor;
import org.jboss.tools.smooks.xml.AbstractFileSelectionWizardPage;
import org.jboss.tools.smooks.xml.model.DocumentObject;
import org.jboss.tools.smooks.xml.model.XMLObjectAnalyzer;
@@ -14,11 +13,6 @@
public class XMLStructuredDataWizardPage extends
AbstractFileSelectionWizardPage {
- public XMLStructuredDataWizardPage(String pageName, String title,
- ImageDescriptor titleImage) {
- super(pageName, title, titleImage);
- setPageText();
- }
public XMLStructuredDataWizardPage(String pageName) {
super(pageName);
@@ -38,10 +32,8 @@
*/
@Override
protected Object loadedTheObject(String path) throws Exception {
-
XMLObjectAnalyzer analyzer = new XMLObjectAnalyzer();
DocumentObject doc = analyzer.analyze(path);
-
return doc;
}
}
Modified:
trunk/smooks/plugins/org.jboss.tools.smooks.xml/src/org/jboss/tools/smooks/xsd/ui/XSDStructuredDataWizard.java
===================================================================
---
trunk/smooks/plugins/org.jboss.tools.smooks.xml/src/org/jboss/tools/smooks/xsd/ui/XSDStructuredDataWizard.java 2008-10-11
15:42:39 UTC (rev 10783)
+++
trunk/smooks/plugins/org.jboss.tools.smooks.xml/src/org/jboss/tools/smooks/xsd/ui/XSDStructuredDataWizard.java 2008-10-13
08:01:29 UTC (rev 10784)
@@ -12,6 +12,7 @@
import java.util.Properties;
+import org.eclipse.jface.wizard.IWizardNode;
import org.jboss.tools.smooks.xml.AbstractFileSelectionWizardPage;
import org.jboss.tools.smooks.xml.AbstractStructuredDdataWizard;
import org.jboss.tools.smooks.xml.XmlActivator;
@@ -21,6 +22,7 @@
* @Date Aug 18, 2008
*/
public class XSDStructuredDataWizard extends AbstractStructuredDdataWizard {
+ IWizardNode wizard;
Properties properties = new Properties();
/* (non-Javadoc)
* @see
org.jboss.tools.smooks.xml.AbstractStructuredDdataWizard#createAbstractFileSelectionWizardPage()
@@ -39,5 +41,4 @@
public Properties getProperties() {
return this.properties;
}
-
}