Author: DartPeng
Date: 2009-03-10 05:06:31 -0400 (Tue, 10 Mar 2009)
New Revision: 14122
Modified:
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/javabean/model/JavaBeanModel.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/utils/UIUtils.java
Log:
JBIDE-3981
Add a new codes for loading input source when open the editor
Modified:
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/javabean/model/JavaBeanModel.java
===================================================================
---
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/javabean/model/JavaBeanModel.java 2009-03-10
02:13:52 UTC (rev 14121)
+++
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/javabean/model/JavaBeanModel.java 2009-03-10
09:06:31 UTC (rev 14122)
@@ -23,7 +23,6 @@
import java.util.List;
import java.util.Properties;
-import org.eclipse.ui.internal.part.NullEditorInput;
import org.jboss.tools.smooks.analyzer.IValidatable;
import org.jboss.tools.smooks.javabean.uitils.JavaPropertyUtils;
import org.jboss.tools.smooks.ui.IXMLStructuredObject;
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 2009-03-10
02:13:52 UTC (rev 14121)
+++
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/ui/editors/SmooksGraphicalFormPage.java 2009-03-10
09:06:31 UTC (rev 14122)
@@ -1336,6 +1336,22 @@
context);
}
}
+ if (sourceTreeViewerInputModel == null && sourceDataTypeID != null) {
+ SmooksConfigurationFileGenerateContext context =
getSmooksConfigurationFileGenerateContext();
+ context.setSourceDataTypeID(sourceDataTypeID);
+ context.setTargetDataTypeID(targetDataTypeID);
+ sourceTreeViewerInputModel = selectSourceDataSource(
+ sourceDataTypeID, context);
+ if(sourceTreeViewerInputModel != null) setDirty(true);
+ }
+ if (targetTreeViewerInputModel == null && targetDataTypeID != null) {
+ SmooksConfigurationFileGenerateContext context =
getSmooksConfigurationFileGenerateContext();
+ context.setSourceDataTypeID(sourceDataTypeID);
+ context.setTargetDataTypeID(targetDataTypeID);
+ targetTreeViewerInputModel = selectSourceDataSource(
+ targetDataTypeID, context);
+ if(targetTreeViewerInputModel != null) setDirty(true);
+ }
smooksResource = this.getSmooksResource();
if (smooksResource != null) {
smooksResource.load(Collections.EMPTY_MAP);
@@ -1429,8 +1445,10 @@
wizard1);
((Wizard) wizard1).setWindowTitle("Target Data Selection");
if (dialog1.open() == Dialog.OK) {
- context.getProperties().put("targetDataPath",
- wizard1.getStructuredDataSourcePath());
+ UIUtils
+ .addParamToGraphModel(graphinformations,
+ "targetDataPath", wizard1
+ .getStructuredDataSourcePath());
}
return wizard1.getTreeViewerInputContents();
}
@@ -1446,8 +1464,10 @@
wizard1);
((Wizard) wizard1).setWindowTitle("Source Data Selection");
if (dialog1.open() == Dialog.OK) {
- context.getProperties().put("sourceDataPath",
- wizard1.getStructuredDataSourcePath());
+ UIUtils
+ .addParamToGraphModel(graphinformations,
+ "sourceDataPath", wizard1
+ .getStructuredDataSourcePath());
}
return wizard1.getTreeViewerInputContents();
}
Modified:
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/utils/UIUtils.java
===================================================================
---
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/utils/UIUtils.java 2009-03-10
02:13:52 UTC (rev 14121)
+++
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/utils/UIUtils.java 2009-03-10
09:06:31 UTC (rev 14122)
@@ -32,12 +32,17 @@
import org.jboss.tools.smooks.analyzer.CompositeResolveCommand;
import org.jboss.tools.smooks.analyzer.DesignTimeAnalyzeResult;
import org.jboss.tools.smooks.analyzer.MappingModel;
+import org.jboss.tools.smooks.graphical.GraphInformations;
+import org.jboss.tools.smooks.graphical.GraphicalFactory;
+import org.jboss.tools.smooks.graphical.Param;
+import org.jboss.tools.smooks.graphical.Params;
import org.jboss.tools.smooks.javabean.analyzer.JavaModelConnectionResolveCommand;
import org.jboss.tools.smooks.javabean.analyzer.JavaModelResolveCommand;
import org.jboss.tools.smooks.javabean.model.JavaBeanModel;
import org.jboss.tools.smooks.javabean.model.SelectorAttributes;
import org.jboss.tools.smooks.javabean.ui.BeanPopulatorMappingAnalyzer;
import org.jboss.tools.smooks.model.AbstractResourceConfig;
+import org.jboss.tools.smooks.model.ParamType;
import org.jboss.tools.smooks.model.ResourceConfigType;
import org.jboss.tools.smooks.model.SmooksPackage;
import org.jboss.tools.smooks.model.SmooksResourceListType;
@@ -750,7 +755,50 @@
}
return null;
}
+
+ public static void removeParamToGraphModel(GraphInformations graph,String paramName){
+ Params params = graph.getParams();
+ if(params == null){
+ return;
+ }
+ List<Param> paramList = params.getParam();
+ Param p = null;
+ for (Iterator iterator = paramList.iterator(); iterator.hasNext();) {
+ Param param = (Param) iterator.next();
+ if(paramName.equalsIgnoreCase(param.getName())){
+ p = param;
+ break;
+ }
+ }
+ if(p == null){
+ return;
+ }
+ params.getParam().remove(p);
+ }
+ public static void addParamToGraphModel(GraphInformations graph,String paramName,String
paramValue){
+ Params params = graph.getParams();
+ if(params == null){
+ params = GraphicalFactory.eINSTANCE.createParams();
+ graph.setParams(params);
+ }
+ List<Param> paramList = params.getParam();
+ Param p = null;
+ for (Iterator iterator = paramList.iterator(); iterator.hasNext();) {
+ Param param = (Param) iterator.next();
+ if(paramName.equalsIgnoreCase(param.getName())){
+ p = param;
+ break;
+ }
+ }
+ if(p == null){
+ p = GraphicalFactory.eINSTANCE.createParam();
+ p.setName(paramName);
+ params.getParam().add(p);
+ }
+ p.setValue(paramValue);
+ }
+
public static IXMLStructuredObject localXMLNodeWithPath(String path,
IXMLStructuredObject contextNode) {
if(path == null) return null;
Show replies by date