Author: DartPeng
Date: 2008-10-15 05:02:47 -0400 (Wed, 15 Oct 2008)
New Revision: 10846
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/TypeIDSelectionWizardPage.java
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/ui/wizards/SmooksConfigFileNewWizard.java
Log:
JBIDE-2867
Deal with a problem that is the collection interface type property can't
display/connect correctly
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-15
08:10:33 UTC (rev 10845)
+++
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/ui/editors/SmooksGraphicalFormPage.java 2008-10-15
09:02:47 UTC (rev 10846)
@@ -454,7 +454,9 @@
protected void initTargetTreeViewer() {
if (this.targetTreeViewerInputModel != null) {
- targetViewer.setInput(targetTreeViewerInputModel);
+ List arrayList = new ArrayList();
+ arrayList.add(targetTreeViewerInputModel);
+ targetViewer.setInput(arrayList);
}
}
@@ -474,7 +476,9 @@
protected void initSourceTreeViewer() {
if (this.sourceTreeViewerInputModel != null) {
- sourceViewer.setInput(sourceTreeViewerInputModel);
+ List arrayList = new ArrayList();
+ arrayList.add(sourceTreeViewerInputModel);
+ sourceViewer.setInput(arrayList);
}
}
@@ -601,6 +605,7 @@
protected void createTargetGraphModels() {
Tree tree = targetViewer.getTree();
TreeItem[] items = tree.getItems();
+ clearExsitingGraphModels(TargetModel.class);
createGraphModels(items, TargetModel.class);
}
@@ -975,7 +980,9 @@
}
/**
- *
+ * It's a very important method <p>
+ * If call the method , there will open the data selection wizard to allow user select
new data , <p>
+ * when user select the new data , the connections will be removed.
* @param viewer
*/
protected void showCreationWizard(TreeViewer viewer) {
@@ -991,19 +998,18 @@
this.getSmooksConfigurationFileGenerateContext().addProperties(
cw.getProperties());
String typeID = cw.getInputDataTypeID();
+ if (viewer.getInput() != null) {
+ if (!MessageDialog
+ .openQuestion(
+ getSite().getShell(),
+ "Changed Data ?",
+ "Do you want to change the data ? If you do so , all connections will be
losted")) {
+ return;
+ }
+ }
if (UIUtils.setTheProvidersForTreeViewer(viewer, typeID)) {
- if (viewer.getInput() != null) {
- if (!MessageDialog
- .openQuestion(
- getSite().getShell(),
- "Changed Data?",
- "Do you want to change the data?if you do this , all connections will be
losted")) {
- return;
- }
- }
viewer.setInput(cw.getTreeViewerInputContents());
try {
- // viewer.expandAll();
if (viewer == this.sourceViewer) {
this.createSourceGraphModels();
sourceDataTypeID = typeID;
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-15
08:10:33 UTC (rev 10845)
+++
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/ui/editors/TypeIDSelectionWizardPage.java 2008-10-15
09:02:47 UTC (rev 10846)
@@ -106,53 +106,6 @@
this.showDataSelectPage = showDataSelectPage;
}
- // public boolean canFlipToNextPage() {
- // if (!showDataSelectPage) {
- // return isPageComplete() && getNextPage() != null;
- // }
- // return super.canFlipToNextPage();
- // }
-
- // /*
- // * (non-Javadoc)
- // *
- // * @see org.eclipse.jface.wizard.WizardSelectionPage#getNextPage()
- // */
- // public IWizardPage getNextPage() {
- // if (!showDataSelectPage) {
- // if (this.getWizard() != null) {
- // return this.getWizard().getNextPage(this);
- // }
- // }
- // 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)
*
@@ -350,34 +303,10 @@
if (viewer == source) {
String sourceID = getDataTypeID(source);
setSourceID(sourceID);
- // TODO don't use that to display the source selection
- // wizard page.
- // IWizardNode wn = getSourceWizard(sourceID);
- // setSelectedNode(wn);
- // IWizard sw = wn.getWizard();
- // if (sw instanceof IStrucutredDataCreationWizard) {
- // setSourceWizard((IStrucutredDataCreationWizard) sw);
- // }
}
if (viewer == target) {
- // IWizardNode node = getSelectedNode();
String targetID = getDataTypeID(target);
- // TODO don't use that to display the target selection
- // wizard page.
- // 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);
}
}
@@ -386,9 +315,6 @@
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");
viewer.setContentProvider(new TypeIDContentProvider());
viewer.setLabelProvider(new TypeIDLabelProvider());
return viewer;
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-15
08:10:33 UTC (rev 10845)
+++
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/ui/wizards/SmooksConfigFileNewWizard.java 2008-10-15
09:02:47 UTC (rev 10846)
@@ -4,6 +4,7 @@
import java.io.IOException;
import java.io.InputStream;
import java.lang.reflect.InvocationTargetException;
+import java.util.List;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.runtime.CoreException;
@@ -13,7 +14,6 @@
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;
@@ -22,7 +22,6 @@
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;
@@ -132,8 +131,21 @@
try {
SmooksFileEditorInput input = new SmooksFileEditorInput(
file);
- input.setSourceTreeViewerInputContents(typeIDPage.getSourceTreeViewerInputContents());
- input.setTargetTreeViewerInputContents(typeIDPage.getTargetTreeViewerInputContents());
+ Object sourceObj = typeIDPage.getSourceTreeViewerInputContents();
+ if(sourceObj instanceof List){
+ if(!((List)sourceObj).isEmpty()){
+ sourceObj = ((List)sourceObj).get(0);
+ }
+ }
+ input.setSourceTreeViewerInputContents(sourceObj);
+
+ Object targetObj = typeIDPage.getSourceTreeViewerInputContents();
+ 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);
Show replies by date