Author: DartPeng
Date: 2008-11-07 00:50:50 -0500 (Fri, 07 Nov 2008)
New Revision: 11605
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/SmooksNormalContentEditFormPage.java
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/xml2java/analyzer/XML2JavaAnalyzer.java
Log:
JBIDE-2988
Throw several exceptions during analyzing java2java config file
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-11-07
05:20:18 UTC (rev 11604)
+++
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/ui/editors/SmooksFormEditor.java 2008-11-07
05:50:50 UTC (rev 11605)
@@ -98,10 +98,10 @@
"Mapping");
int index = this.addPage(this.graphicalPage);
this.setPageText(index, "Graph");
- normalPage = new SmooksNormalContentEditFormPage(this, "normal",
- "Normal Edition", null);
+ normalPage = new SmooksNormalContentEditFormPage(this, "configuration",
+ "Configuration", null);
index = this.addPage(normalPage);
- setPageText(index, "Normal");
+ setPageText(index, "Configuration");
// Set a default NormalPacakge to Normal Page
this.refreshNormalPage(Collections.EMPTY_LIST);
if (onlyShowTextEditor) {
Modified:
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/ui/editors/SmooksNormalContentEditFormPage.java
===================================================================
---
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/ui/editors/SmooksNormalContentEditFormPage.java 2008-11-07
05:20:18 UTC (rev 11604)
+++
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/ui/editors/SmooksNormalContentEditFormPage.java 2008-11-07
05:50:50 UTC (rev 11605)
@@ -91,7 +91,7 @@
GridLayout gridLayout = UIUtils.createGeneralFormEditorLayout(1);
resourceBlock.createContent(managedForm);
Composite rootMainControl = form.getBody();
- form.setText("Normal Page");
+ form.setText("Configuration Page");
createSmooksTypeGUI(rootMainControl, tool);
form.getBody().setLayout(gridLayout);
form.pack();
Modified:
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/xml2java/analyzer/XML2JavaAnalyzer.java
===================================================================
---
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/xml2java/analyzer/XML2JavaAnalyzer.java 2008-11-07
05:20:18 UTC (rev 11604)
+++
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/xml2java/analyzer/XML2JavaAnalyzer.java 2008-11-07
05:50:50 UTC (rev 11605)
@@ -221,19 +221,33 @@
}
if (!(sourceObject instanceof AbstractXMLObject)
|| !(targetObject instanceof JavaBeanModel)) {
- return MappingResourceConfigList.createEmptyList();
+ // TODO if the type of input source/target data is illegal , throw
+ // exceptions.
+ // MODIFY by Dart 2008.11.07
+ throw new RuntimeException(
+ "Can't load the source/target data from Smooks configuration file.");
+ // return MappingResourceConfigList.createEmptyList();
}
AbstractXMLObject sourceRoot = (AbstractXMLObject) sourceObject;
JavaBeanModel sourceTarget = (JavaBeanModel) targetObject;
ResourceConfigType rootResourceConfig = findFirstMappingResourceConfig(listType);
// if can't find the root , return null
- if (rootResourceConfig == null)
- return null;
+ if (rootResourceConfig == null) {
+ // TODO if can't find the org.milyn.javabean.BeanPopulator , throw
+ // exception
+ // MODIFY by Dart 2008.11.07
+// throw new RuntimeException("Can't parse the config file.");
+ return null;
+ }
String xmlName = rootResourceConfig.getSelector();
AbstractXMLObject source = findXMLObjectByName(xmlName, sourceRoot);
- if (source == null)
- return MappingResourceConfigList.createEmptyList();
+ if (source == null) {
+ // TODO if can't find the root , throw exception
+ // MODIFY by Dart 2008.11.07
+ throw new RuntimeException("Can't find the root node.");
+ // return MappingResourceConfigList.createEmptyList();
+ }
MappingResourceConfigList rcl = new MappingResourceConfigList();
this.createMappingResourceConfigList(rcl, listType, rootResourceConfig,
@@ -323,11 +337,21 @@
if (newSelector == null)
return;
AbstractXMLObject newRoot = findXMLObjectByName(newSelector, root);
+ if (newRoot == null) {
+ // TODO If can't find the element , throw exception
+ // MODIFY by Dart , 2008.11.07
+ throw new RuntimeException("Can't find the \""+ newSelector +
"\" node.");
+ }
createMappingResourceConfigList(configList, listType,
resourceConfig1, newRoot, targetBean);
} else {
AbstractXMLObject source = findXMLObjectWithSelectorString(
selector, root);
+ if (source == null) {
+ // TODO If can't find the element , throw exception
+ // MODIFY by Dart , 2008.11.07
+ throw new RuntimeException("Can't find the \""+ selector +
"\" node.");
+ }
if (source != null) {
MappingModel mapping = new MappingModel(source, targetBean);
UIUtils.assignBindingPropertyToMappingModel(currentBinding,
Show replies by date