commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gu...@apache.org
Subject svn commit: r979694 - in /commons/sandbox/gsoc/2010/scxml-eclipse/trunk/src/main/java/org.apache.commons.scxml.modeling.diagram: debug/CommonsSCXMLEngine.java src/org/apache/commons/scxml/modeling/diagram/part/ModelingNewDebugFileWizard.java
Date Tue, 27 Jul 2010 13:40:49 GMT
Author: guixl
Date: Tue Jul 27 13:40:48 2010
New Revision: 979694

URL: http://svn.apache.org/viewvc?rev=979694&view=rev
Log:
add package info for Apache Commons SCXML debug class

Modified:
    commons/sandbox/gsoc/2010/scxml-eclipse/trunk/src/main/java/org.apache.commons.scxml.modeling.diagram/debug/CommonsSCXMLEngine.java
    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

Modified: commons/sandbox/gsoc/2010/scxml-eclipse/trunk/src/main/java/org.apache.commons.scxml.modeling.diagram/debug/CommonsSCXMLEngine.java
URL: http://svn.apache.org/viewvc/commons/sandbox/gsoc/2010/scxml-eclipse/trunk/src/main/java/org.apache.commons.scxml.modeling.diagram/debug/CommonsSCXMLEngine.java?rev=979694&r1=979693&r2=979694&view=diff
==============================================================================
--- commons/sandbox/gsoc/2010/scxml-eclipse/trunk/src/main/java/org.apache.commons.scxml.modeling.diagram/debug/CommonsSCXMLEngine.java
(original)
+++ commons/sandbox/gsoc/2010/scxml-eclipse/trunk/src/main/java/org.apache.commons.scxml.modeling.diagram/debug/CommonsSCXMLEngine.java
Tue Jul 27 13:40:48 2010
@@ -1,4 +1,4 @@
-
+$PACKAGE_INFO$
 
 import java.io.BufferedReader;
 import java.io.IOException;

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=979694&r1=979693&r2=979694&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
Tue Jul 27 13:40:48 2010
@@ -45,7 +45,9 @@ import org.eclipse.gmf.runtime.diagram.c
 import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter;
 import org.eclipse.jdt.core.IClasspathEntry;
 import org.eclipse.jdt.core.IJavaProject;
+import org.eclipse.jdt.core.IPackageFragmentRoot;
 import org.eclipse.jdt.core.JavaCore;
+import org.eclipse.jdt.internal.core.PackageFragmentRoot;
 import org.eclipse.jface.dialogs.ProgressMonitorDialog;
 import org.eclipse.jface.operation.IRunnableWithProgress;
 import org.eclipse.jface.viewers.StructuredSelection;
@@ -229,7 +231,7 @@ public class ModelingNewDebugFileWizard 
 			int diagramVID = ModelingVisualIDRegistry
 					.getDiagramVisualID(diagramRootElementSelectionPage
 							.getModelElement());
-			monitor.beginTask("SCXML document export progress",19);
+			monitor.beginTask("SCXML document export progress",20);
 			
 			try {
 				String scxmlDoc=testCaseClassName+".xml";
@@ -325,9 +327,29 @@ public class ModelingNewDebugFileWizard 
 					
 					content=content.replace("$SCXML_DOCUMENT_RESOURCE$", scxmlDoc);
 					monitor.worked(1);
-					debugClassFile.setContents(string2InputStream(content), 1, null);
-					monitor.worked(1);
 					
+					boolean packageFlag=true;
+                    if(JavaProjectFlag){
+                            IPackageFragmentRoot[] ifrList=javaProject.getPackageFragmentRoots();
+                            for(int i=0;i<ifrList.length;i++){
+                                    IPackageFragmentRoot ifr=ifrList[i];
+                                    if(ifr instanceof PackageFragmentRoot){
+                                            PackageFragmentRoot pfr=(PackageFragmentRoot)ifr;
+                                            String prefix=pfr.getPath().toString();
+                                            String pathStr=selectedPath.toString();
+                                            if(pathStr.startsWith(prefix)&&pathStr.length()>prefix.length()){
+                                                    String packageName=pathStr.substring(prefix.length()+1).replace('/',
'.');
+                                                    content=content.replace("$PACKAGE_INFO$",
"package "+packageName+";");
+                                                    packageFlag=false;
+                                                    break;
+                                            }
+                                    }
+                            }
+                    }
+                    if(packageFlag) content=content.replace("$PACKAGE_INFO$", ""); 
+                    monitor.worked(1);
+                    debugClassFile.setContents(string2InputStream(content), 1, null);
+					monitor.worked(1);
 					if (monitor.isCanceled()) throw new InterruptedException(
 					"The SCXML document debug class creation operation was cancelled");
 					



Mime
View raw message