* Added experimental branch

* Enabled fix imports in experimental
This commit is contained in:
polki 2009-06-11 11:55:39 +00:00
parent 33c1888228
commit 82c6ada992
8 changed files with 276 additions and 99 deletions

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<feature <feature
id="pyUML" id="pyUML-experimental"
label="PyUML Feature" label="PyUML Feature (Experimental)"
version="1.2.2" version="1.2.2"
provider-name="Freie University Berlin, Germany, Martin Dittmar"> provider-name="Freie University Berlin, Germany, Martin Dittmar">
@ -104,7 +104,6 @@ This Agreement is governed by the laws of the State of New York and the intellec
</license> </license>
<requires> <requires>
<import feature="org.python.pydev.feature"/>
<import plugin="org.eclipse.core.resources"/> <import plugin="org.eclipse.core.resources"/>
<import plugin="org.eclipse.core.runtime"/> <import plugin="org.eclipse.core.runtime"/>
<import plugin="org.eclipse.jface"/> <import plugin="org.eclipse.jface"/>
@ -122,11 +121,12 @@ This Agreement is governed by the laws of the State of New York and the intellec
<import plugin="org.python.pydev.core"/> <import plugin="org.python.pydev.core"/>
<import plugin="org.python.pydev.parser"/> <import plugin="org.python.pydev.parser"/>
<import plugin="org.eclipse.uml2.diagram.clazz"/> <import plugin="org.eclipse.uml2.diagram.clazz"/>
<import feature="org.python.pydev.feature"/>
</requires> </requires>
<plugin <plugin
id="pyUml" id="pyUml-experimental"
download-size="541" download-size="0"
install-size="0" install-size="0"
version="0.0.0" version="0.0.0"
unpack="false"/> unpack="false"/>

View File

@ -1,7 +1,7 @@
Manifest-Version: 1.0 Manifest-Version: 1.0
Bundle-ManifestVersion: 2 Bundle-ManifestVersion: 2
Bundle-Name: PyUML Bundle-Name: PyUML (Experimental)
Bundle-SymbolicName: pyUml;singleton:=true Bundle-SymbolicName: pyUml-experimental;singleton:=true
Bundle-Version: 1.2.2 Bundle-Version: 1.2.2
Bundle-Activator: pyUML.plugin.Activator Bundle-Activator: pyUML.plugin.Activator
Eclipse-LazyStart: true Eclipse-LazyStart: true

View File

@ -1022,81 +1022,81 @@ public class PythonTreeClass extends PythonTreeNode {
* @return true, if anything was changed, false otherwise * @return true, if anything was changed, false otherwise
*/ */
public boolean fixImports(Classifier modelClass) throws PyUMLSynchronizeCodeException{ public boolean fixImports(Classifier modelClass) throws PyUMLSynchronizeCodeException{
return false; // See issues in FIXME below // return false; // See issues in FIXME below
// // iterate over all superclasses in project // iterate over all superclasses in project
// Map<String, String> superClassPackages = new HashMap<String, String>(); Map<String, String> superClassPackages = new HashMap<String, String>();
// for (PythonTreeClass superClass : this.getModelGeneralizationsInProject(modelClass)) { for (PythonTreeClass superClass : this.getModelGeneralizationsInProject(modelClass)) {
//
// // get package structure, e.g. mypackage.subpackage.MyClass // get package structure, e.g. mypackage.subpackage.MyClass
// String packageDef = ""; String packageDef = "";
// PythonTreePackage superPackage = superClass.getParent(); PythonTreePackage superPackage = superClass.getParent();
// while (superPackage != null && (! (superPackage instanceof PythonTreeRoot))) { while (superPackage != null && (! (superPackage instanceof PythonTreeRoot))) {
// packageDef = superPackage.getName() + "." + packageDef; packageDef = superPackage.getName() + "." + packageDef;
// superPackage = superPackage.getParent(); superPackage = superPackage.getParent();
// } }
// String superClassModuleName = superClass.inFile.getName().replace(".py", ""); String superClassModuleName = superClass.inFile.getName().replace(".py", "");
// packageDef += superClassModuleName; packageDef += superClassModuleName;
// superClassPackages.put(superClass.getName(), packageDef); superClassPackages.put(superClass.getName(), packageDef);
// } }
//
// // find import statements in code // find import statements in code
// // suppose, that all import statements are at the beginning of the // suppose, that all import statements are at the beginning of the
// // file, only white or comment lines can be above them. // file, only white or comment lines can be above them.
// String[] fileContent = this.inFile.getFileContent().split("\n"); String[] fileContent = this.inFile.getFileContent().split("\n");
// int lineNo = 0; int lineNo = 0;
// String line = ""; String line = "";
// if (superClassPackages.size() > 0) { if (superClassPackages.size() > 0) {
// do { do {
// line = fileContent[lineNo]; line = fileContent[lineNo];
// String[] importParts = getImport(line); String[] importParts = getImport(line);
// if (importParts != null){ if (importParts != null){
// String className = importParts[0]; String className = importParts[0];
// String packageDef = importParts[1]; String packageDef = importParts[1];
// String comment = importParts[2]; String comment = importParts[2];
// // if class is imported, but package changed -> rewrite line! // if class is imported, but package changed -> rewrite line!
// // FIXME: This is messed up since an import may be done without a "from" statement; // FIXME: This is messed up since an import may be done without a "from" statement;
// // it might look like "import mypackage" and refer to it by "mypackage.MyClass" // it might look like "import mypackage" and refer to it by "mypackage.MyClass"
// // or even like "import mypackage.mysubpackage as myalias"... // or even like "import mypackage.mysubpackage as myalias"...
// // therefore I disable import fixing as long as this issue has not been solved // therefore I disable import fixing as long as this issue has not been solved
// // by Jakob // by Jakob
// if (superClassPackages.containsKey(className) && if (superClassPackages.containsKey(className) &&
// ( ! packageDef.equals(superClassPackages.get(className)))) { ( ! packageDef.equals(superClassPackages.get(className)))) {
// String newString = "from " + superClassPackages.get(className) + " import " + className + comment; String newString = "from " + superClassPackages.get(className) + " import " + className + comment;
// FileRefactoring.replaceLine(this.inFile, lineNo, newString, true); FileRefactoring.replaceLine(this.inFile, lineNo, newString, true);
// this.setChanged(null, lineNo); this.setChanged(null, lineNo);
// return true; return true;
// } }
// if (superClassPackages.containsKey(className) && superClassPackages.get(className).equals(packageDef)) { if (superClassPackages.containsKey(className) && superClassPackages.get(className).equals(packageDef)) {
// // line is OK -> remove them from new-import-to-insert-list // line is OK -> remove them from new-import-to-insert-list
// superClassPackages.remove(className); superClassPackages.remove(className);
// } }
// } }
// lineNo ++; lineNo ++;
// } while(line.matches("[\\s]*[#]?") || line.matches("from.*import.*")||line.matches("import.*")); } while(line.matches("[\\s]*[#]?") || line.matches("from.*import.*")||line.matches("import.*"));
//
// // now, all lines were analyzed; the needed import, that were not covered // now, all lines were analyzed; the needed import, that were not covered
// // by a line, must be inserted now! // by a line, must be inserted now!
// if (superClassPackages.size() == 0) if (superClassPackages.size() == 0)
// return false; return false;
//
// String insertLines = ""; String insertLines = "";
// for (String superClassName : superClassPackages.keySet()) { for (String superClassName : superClassPackages.keySet()) {
// String packageLine = superClassPackages.get(superClassName); String packageLine = superClassPackages.get(superClassName);
// insertLines += "from " + packageLine + " import " + superClassName + "\n"; insertLines += "from " + packageLine + " import " + superClassName + "\n";
// } }
// // if last line is empty, don't insert new empty line // if last line is empty, don't insert new empty line
// if (lineNo == 1) if (lineNo == 1)
// // no empty lines are in fron of the insertion -> insert empty line // no empty lines are in fron of the insertion -> insert empty line
// insertLines += "\n"; insertLines += "\n";
// else if (line.length() > 0 && (! fileContent[lineNo-2].matches("^[\\s]*$"))) { else if (line.length() > 0 && (! fileContent[lineNo-2].matches("^[\\s]*$"))) {
// insertLines += "\n"; insertLines += "\n";
// } }
// FileRefactoring.insertAtLine(this.inFile, lineNo-1, insertLines); FileRefactoring.insertAtLine(this.inFile, lineNo-1, insertLines);
// this.setChanged(null, lineNo); this.setChanged(null, lineNo);
// return true; return true;
// } }
//
// return false; return false;
} }
/** /**

View File

@ -3,20 +3,59 @@
<repository name='file:/home/didi/workspace/pyUml_updatesite/ - artifacts' type='org.eclipse.equinox.p2.artifact.repository.simpleRepository' version='1.0.0'> <repository name='file:/home/didi/workspace/pyUml_updatesite/ - artifacts' type='org.eclipse.equinox.p2.artifact.repository.simpleRepository' version='1.0.0'>
<properties size='2'> <properties size='2'>
<property name='p2.compressed' value='false'/> <property name='p2.compressed' value='false'/>
<property name='p2.timestamp' value='1244719702943'/> <property name='p2.timestamp' value='1244720592729'/>
</properties> </properties>
<mappings size='3'> <mappings size='3'>
<rule filter='(&amp; (classifier=osgi.bundle))' output='${repoUrl}/plugins/${id}_${version}.jar'/> <rule filter='(&amp; (classifier=osgi.bundle))' output='${repoUrl}/plugins/${id}_${version}.jar'/>
<rule filter='(&amp; (classifier=binary))' output='${repoUrl}/binary/${id}_${version}'/> <rule filter='(&amp; (classifier=binary))' output='${repoUrl}/binary/${id}_${version}'/>
<rule filter='(&amp; (classifier=org.eclipse.update.feature))' output='${repoUrl}/features/${id}_${version}.jar'/> <rule filter='(&amp; (classifier=org.eclipse.update.feature))' output='${repoUrl}/features/${id}_${version}.jar'/>
</mappings> </mappings>
<artifacts size='10'> <artifacts size='14'>
<artifact classifier='org.eclipse.update.feature' id='pyUML' version='1.2.1'> <artifact classifier='org.eclipse.update.feature' id='pyUML' version='1.2.1'>
<properties size='2'> <properties size='2'>
<property name='artifact.size' value='4963'/> <property name='artifact.size' value='4963'/>
<property name='download.size' value='4963'/> <property name='download.size' value='4963'/>
</properties> </properties>
</artifact> </artifact>
<artifact classifier='osgi.bundle' id='pyUml' version='1.2.0'>
<properties size='3'>
<property name='artifact.size' value='551466'/>
<property name='download.size' value='551466'/>
<property name='download.contentType' value='application/zip'/>
</properties>
</artifact>
<artifact classifier='org.eclipse.update.feature' id='pyUML-experimental' version='1.2.2'>
<properties size='2'>
<property name='artifact.size' value='4976'/>
<property name='download.size' value='4976'/>
</properties>
</artifact>
<artifact classifier='osgi.bundle' id='pyUml-experimental' version='1.2.2'>
<properties size='3'>
<property name='artifact.size' value='556653'/>
<property name='download.size' value='556653'/>
<property name='download.contentType' value='application/zip'/>
</properties>
</artifact>
<artifact classifier='org.eclipse.update.feature' id='pyUML' version='1.2.1'>
<properties size='2'>
<property name='artifact.size' value='4980'/>
<property name='download.size' value='4980'/>
</properties>
</artifact>
<artifact classifier='org.eclipse.update.feature' id='pyUML-experimental' version='1.2.2'>
<properties size='2'>
<property name='artifact.size' value='4980'/>
<property name='download.size' value='4980'/>
</properties>
</artifact>
<artifact classifier='osgi.bundle' id='pyUml-experimental' version='1.2.2'>
<properties size='3'>
<property name='artifact.size' value='556646'/>
<property name='download.size' value='556646'/>
<property name='download.contentType' value='application/zip'/>
</properties>
</artifact>
<artifact classifier='osgi.bundle' id='pyUml' version='1.2.0'> <artifact classifier='osgi.bundle' id='pyUml' version='1.2.0'>
<properties size='3'> <properties size='3'>
<property name='artifact.size' value='554276'/> <property name='artifact.size' value='554276'/>
@ -36,13 +75,6 @@
<property name='download.size' value='4974'/> <property name='download.size' value='4974'/>
</properties> </properties>
</artifact> </artifact>
<artifact classifier='osgi.bundle' id='pyUml' version='1.2.0'>
<properties size='3'>
<property name='artifact.size' value='551466'/>
<property name='download.size' value='551466'/>
<property name='download.contentType' value='application/zip'/>
</properties>
</artifact>
<artifact classifier='org.eclipse.update.feature' id='pyUML' version='1.2.0'> <artifact classifier='org.eclipse.update.feature' id='pyUML' version='1.2.0'>
<properties size='2'> <properties size='2'>
<property name='artifact.size' value='725'/> <property name='artifact.size' value='725'/>
@ -62,12 +94,6 @@
<property name='download.size' value='4980'/> <property name='download.size' value='4980'/>
</properties> </properties>
</artifact> </artifact>
<artifact classifier='org.eclipse.update.feature' id='pyUML' version='1.2.1'>
<properties size='2'>
<property name='artifact.size' value='4980'/>
<property name='download.size' value='4980'/>
</properties>
</artifact>
<artifact classifier='osgi.bundle' id='pyUml' version='1.2.2'> <artifact classifier='osgi.bundle' id='pyUml' version='1.2.2'>
<properties size='3'> <properties size='3'>
<property name='artifact.size' value='555052'/> <property name='artifact.size' value='555052'/>

File diff suppressed because one or more lines are too long

Binary file not shown.

Binary file not shown.

View File

@ -12,9 +12,13 @@
<feature url="features/pyUML_1.2.2.jar" id="pyUML" version="1.2.2"> <feature url="features/pyUML_1.2.2.jar" id="pyUML" version="1.2.2">
<category name="Eclipse PyUML"/> <category name="Eclipse PyUML"/>
</feature> </feature>
<feature url="features/pyUML-experimental_1.2.2.jar" id="pyUML-experimental" version="1.2.2">
<category name="Eclipse PyUML Experimental"/>
</feature>
<category-def name="Eclipse PyUML" label="Eclipse PyUML"> <category-def name="Eclipse PyUML" label="Eclipse PyUML">
<description> <description>
A UML Roundtrip Tool for Python A UML Roundtrip Tool for Python
</description> </description>
</category-def> </category-def>
<category-def name="Eclipse PyUML Experimental" label="Eclipse PyUML Experimental"/>
</site> </site>