Author: DartPeng
Date: 2008-11-06 04:12:35 -0500 (Thu, 06 Nov 2008)
New Revision: 11565
Modified:
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/xml/AbstractFileSelectionWizardPage.java
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/xml2java/analyzer/AbstractXMLModelAnalyzer.java
Log:
JBIDE-2995
Change the "sourceDataPath" and "targetDataPath" :
Workspace file path : "Workspace : //project/file.smooks"
File System file path : "File ://home/test.smooks"
Modified:
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/xml/AbstractFileSelectionWizardPage.java
===================================================================
---
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/xml/AbstractFileSelectionWizardPage.java 2008-11-06
08:40:43 UTC (rev 11564)
+++
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/xml/AbstractFileSelectionWizardPage.java 2008-11-06
09:12:35 UTC (rev 11565)
@@ -25,6 +25,7 @@
import org.eclipse.swt.widgets.FileDialog;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Text;
+import org.jboss.tools.smooks.utils.UIUtils;
import org.jboss.tools.smooks.xml2java.analyzer.AbstractXMLModelAnalyzer;
/**
@@ -50,9 +51,11 @@
public Object getReturnValue() {
try {
- returnObject = this.loadedTheObject(filePath);
+ String path = getFilePath();
+ path = AbstractXMLModelAnalyzer.parseFilePath(path);
+ returnObject = this.loadedTheObject(path);
} catch (Exception e) {
- e.printStackTrace();
+ UIUtils.showErrorDialog(getShell(), UIUtils.createErrorStatus(e));
}
return returnObject;
}
Modified:
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/xml2java/analyzer/AbstractXMLModelAnalyzer.java
===================================================================
---
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/xml2java/analyzer/AbstractXMLModelAnalyzer.java 2008-11-06
08:40:43 UTC (rev 11564)
+++
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/xml2java/analyzer/AbstractXMLModelAnalyzer.java 2008-11-06
09:12:35 UTC (rev 11565)
@@ -45,6 +45,30 @@
public AbstractXMLModelAnalyzer(String paramKey) {
this.parmaKey = paramKey;
}
+
+ public static String parseFilePath(String path) throws InvocationTargetException{
+ int index = path.indexOf(FILE_PRIX);
+ if (index != -1) {
+ path = path.substring(index + FILE_PRIX.length(), path.length());
+ } else {
+ index = path.indexOf(WORKSPACE_PRIX);
+ if (index != -1) {
+ path = path.substring(index + WORKSPACE_PRIX.length(), path
+ .length());
+ Path wpath = new Path(path);
+ IFile file = ResourcesPlugin.getWorkspace().getRoot().getFile(
+ wpath);
+ if (file.exists()) {
+ path = file.getLocation().toOSString();
+ } else {
+ throw new InvocationTargetException(new Exception("file dosen't exist"
+ path + " on the workspace."));
+ }
+ }else{
+ throw new InvocationTargetException(new Exception("Illegal file path : " +
path + "."));
+ }
+ }
+ return path;
+ }
public Object buildSourceInputObjects(GraphInformations graphInfo,
SmooksResourceListType listType, IFile sourceFile)
@@ -67,26 +91,7 @@
// throw new InvocationTargetException(new Exception(
// "xml file can't be found in the .graph file."));
}
- int index = path.indexOf(FILE_PRIX);
- if (index != -1) {
- path = path.substring(index + FILE_PRIX.length(), path.length());
- } else {
- index = path.indexOf(WORKSPACE_PRIX);
- if (index != -1) {
- path = path.substring(index + WORKSPACE_PRIX.length(), path
- .length());
- Path wpath = new Path(path);
- IFile file = ResourcesPlugin.getWorkspace().getRoot().getFile(
- wpath);
- if (file.exists()) {
- path = file.getLocation().toOSString();
- } else {
- throw new InvocationTargetException(new Exception("file dosen't exist"
+ path + " on the workspace."));
- }
- }else{
- throw new InvocationTargetException(new Exception("Illegal file path : " +
path + "."));
- }
- }
+ path = parseFilePath(path);
XMLObjectAnalyzer objectBuilder = new XMLObjectAnalyzer();
try {
FileInputStream stream = new FileInputStream(path);