commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gu...@apache.org
Subject svn commit: r978795 - in /commons/sandbox/gsoc/2010/scxml-eclipse/trunk/src/main/java/org.apache.commons.scxml.modeling.diagram/src/org/apache/commons/scxml/modeling: diagram/part/ export/
Date Sat, 24 Jul 2010 04:32:46 GMT
Author: guixl
Date: Sat Jul 24 04:32:45 2010
New Revision: 978795

URL: http://svn.apache.org/viewvc?rev=978795&view=rev
Log:
improve SCXML document export function

Modified:
    commons/sandbox/gsoc/2010/scxml-eclipse/trunk/src/main/java/org.apache.commons.scxml.modeling.diagram/src/org/apache/commons/scxml/modeling/diagram/part/ModelingNewDebugFileWizard.java
    commons/sandbox/gsoc/2010/scxml-eclipse/trunk/src/main/java/org.apache.commons.scxml.modeling.diagram/src/org/apache/commons/scxml/modeling/export/ModelingDocumentExportWizard.java
    commons/sandbox/gsoc/2010/scxml-eclipse/trunk/src/main/java/org.apache.commons.scxml.modeling.diagram/src/org/apache/commons/scxml/modeling/export/ScxmlExportStreamHandlerAction.java

Modified: commons/sandbox/gsoc/2010/scxml-eclipse/trunk/src/main/java/org.apache.commons.scxml.modeling.diagram/src/org/apache/commons/scxml/modeling/diagram/part/ModelingNewDebugFileWizard.java
URL: http://svn.apache.org/viewvc/commons/sandbox/gsoc/2010/scxml-eclipse/trunk/src/main/java/org.apache.commons.scxml.modeling.diagram/src/org/apache/commons/scxml/modeling/diagram/part/ModelingNewDebugFileWizard.java?rev=978795&r1=978794&r2=978795&view=diff
==============================================================================
--- commons/sandbox/gsoc/2010/scxml-eclipse/trunk/src/main/java/org.apache.commons.scxml.modeling.diagram/src/org/apache/commons/scxml/modeling/diagram/part/ModelingNewDebugFileWizard.java
(original)
+++ commons/sandbox/gsoc/2010/scxml-eclipse/trunk/src/main/java/org.apache.commons.scxml.modeling.diagram/src/org/apache/commons/scxml/modeling/diagram/part/ModelingNewDebugFileWizard.java
Sat Jul 24 04:32:45 2010
@@ -271,7 +271,7 @@ public class ModelingNewDebugFileWizard 
 						monitor.worked(1);
 						content=content.replace("xmlns_attribute_url_in_xslt_file", "xmlns");
 						monitor.worked(1);
-						target.create(shc.string2InputStream(content), false, null);
+						target.create(shc.string2InputStream(shc.formatXML(content)), false, null);
 						monitor.worked(1);
 					}else monitor.worked(8);
 					

Modified: commons/sandbox/gsoc/2010/scxml-eclipse/trunk/src/main/java/org.apache.commons.scxml.modeling.diagram/src/org/apache/commons/scxml/modeling/export/ModelingDocumentExportWizard.java
URL: http://svn.apache.org/viewvc/commons/sandbox/gsoc/2010/scxml-eclipse/trunk/src/main/java/org.apache.commons.scxml.modeling.diagram/src/org/apache/commons/scxml/modeling/export/ModelingDocumentExportWizard.java?rev=978795&r1=978794&r2=978795&view=diff
==============================================================================
--- commons/sandbox/gsoc/2010/scxml-eclipse/trunk/src/main/java/org.apache.commons.scxml.modeling.diagram/src/org/apache/commons/scxml/modeling/export/ModelingDocumentExportWizard.java
(original)
+++ commons/sandbox/gsoc/2010/scxml-eclipse/trunk/src/main/java/org.apache.commons.scxml.modeling.diagram/src/org/apache/commons/scxml/modeling/export/ModelingDocumentExportWizard.java
Sat Jul 24 04:32:45 2010
@@ -222,7 +222,7 @@ public class ModelingDocumentExportWizar
 				content=content.replace("xmlns_attribute_url_in_xslt_file", "xmlns");
 				monitor.worked(1);
 				
-				xmlFile.setContents(shc.string2InputStream(formatXML(content)), 1, null);
+				xmlFile.setContents(shc.string2InputStream(shc.formatXML(content)), 1, null);
 				monitor.worked(1);
 				if (monitor.isCanceled()) throw new InterruptedException(
 				"The SCXML document export operation was cancelled");
@@ -233,46 +233,7 @@ public class ModelingDocumentExportWizar
 			}
 		}
 		
-		/**
-		 * 
-		 * @param content (initial SCXML content,without new line char)
-		 * @return format SCXML content
-		 */
-		public String formatXML(String content){
-			String newContent="";
-			int tabNumber=0;
-			char lastChar='-';
-			for(int i=0;i<content.length();i++){
-				char each=content.charAt(i);
-				if(each=='<'&&i<content.length()-1){
-					char after=content.charAt(i+1);
-					if(after!='?'){
-						if(after=='/'){
-							newContent=newContent.concat("\r\n");
-							if(lastChar=='-') tabNumber--;
-							for(int j=0;j<tabNumber;j++)
-								newContent=newContent.concat("\t");
-							lastChar='-';
-						}else{
-							newContent=newContent.concat("\r\n");
-							if(lastChar=='+') tabNumber++;
-							for(int j=0;j<tabNumber;j++)
-								newContent=newContent.concat("\t");
-							lastChar='+';
-						}
-					}
-				}else if(each=='/'&&i<content.length()-1){
-					char before=content.charAt(i-1);
-					if(before!='<'){
-						lastChar='-';
-					}
-				}
-				
-				newContent=newContent.concat(String.valueOf(each));
-			}
-			
-			return newContent;
-		}
+		
 	}
 
 	/**

Modified: commons/sandbox/gsoc/2010/scxml-eclipse/trunk/src/main/java/org.apache.commons.scxml.modeling.diagram/src/org/apache/commons/scxml/modeling/export/ScxmlExportStreamHandlerAction.java
URL: http://svn.apache.org/viewvc/commons/sandbox/gsoc/2010/scxml-eclipse/trunk/src/main/java/org.apache.commons.scxml.modeling.diagram/src/org/apache/commons/scxml/modeling/export/ScxmlExportStreamHandlerAction.java?rev=978795&r1=978794&r2=978795&view=diff
==============================================================================
--- commons/sandbox/gsoc/2010/scxml-eclipse/trunk/src/main/java/org.apache.commons.scxml.modeling.diagram/src/org/apache/commons/scxml/modeling/export/ScxmlExportStreamHandlerAction.java
(original)
+++ commons/sandbox/gsoc/2010/scxml-eclipse/trunk/src/main/java/org.apache.commons.scxml.modeling.diagram/src/org/apache/commons/scxml/modeling/export/ScxmlExportStreamHandlerAction.java
Sat Jul 24 04:32:45 2010
@@ -188,6 +188,47 @@ public class ScxmlExportStreamHandlerAct
 		}
 
 	}
+	
+	/**
+	 * 
+	 * @param content (initial SCXML content,without new line char)
+	 * @return format SCXML content
+	 */
+	public String formatXML(String content){
+		String newContent="";
+		int tabNumber=0;
+		char lastChar='-';
+		for(int i=0;i<content.length();i++){
+			char each=content.charAt(i);
+			if(each=='<'&&i<content.length()-1){
+				char after=content.charAt(i+1);
+				if(after!='?'){
+					if(after=='/'){
+						newContent=newContent.concat("\r\n");
+						if(lastChar=='-') tabNumber--;
+						for(int j=0;j<tabNumber;j++)
+							newContent=newContent.concat("\t");
+						lastChar='-';
+					}else{
+						newContent=newContent.concat("\r\n");
+						if(lastChar=='+') tabNumber++;
+						for(int j=0;j<tabNumber;j++)
+							newContent=newContent.concat("\t");
+						lastChar='+';
+					}
+				}
+			}else if(each=='/'&&i<content.length()-1){
+				char before=content.charAt(i-1);
+				if(before!='<'){
+					lastChar='-';
+				}
+			}
+			
+			newContent=newContent.concat(String.valueOf(each));
+		}
+		
+		return newContent;
+	}
 
 	public InputStream string2InputStream(String str) {
 		ByteArrayInputStream stream = null;



Mime
View raw message