Fix Bug #1 -> Superclasses in the form Outerclass.Innerclass are no more reproduced in Python just as a Innerclass, but as Outerclass.Innerclass
This commit is contained in:
parent
997f68e0f3
commit
bb149cb7f2
@ -2,7 +2,7 @@ Manifest-Version: 1.0
|
|||||||
Bundle-ManifestVersion: 2
|
Bundle-ManifestVersion: 2
|
||||||
Bundle-Name: PyUML
|
Bundle-Name: PyUML
|
||||||
Bundle-SymbolicName: pyUml;singleton:=true
|
Bundle-SymbolicName: pyUml;singleton:=true
|
||||||
Bundle-Version: 0.9
|
Bundle-Version: 1.0.1
|
||||||
Bundle-Activator: pyUML.plugin.Activator
|
Bundle-Activator: pyUML.plugin.Activator
|
||||||
Eclipse-LazyStart: true
|
Eclipse-LazyStart: true
|
||||||
Bundle-ClassPath: lib/refactoring.jar,
|
Bundle-ClassPath: lib/refactoring.jar,
|
||||||
|
@ -33,7 +33,6 @@ import org.eclipse.uml2.uml.Realization;
|
|||||||
import org.eclipse.uml2.uml.Relationship;
|
import org.eclipse.uml2.uml.Relationship;
|
||||||
import org.eclipse.uml2.uml.Type;
|
import org.eclipse.uml2.uml.Type;
|
||||||
import org.eclipse.uml2.uml.VisibilityKind;
|
import org.eclipse.uml2.uml.VisibilityKind;
|
||||||
import org.eclipse.uml2.uml.internal.impl.RealizationImpl;
|
|
||||||
import org.python.pydev.parser.jython.ast.Assign;
|
import org.python.pydev.parser.jython.ast.Assign;
|
||||||
import org.python.pydev.parser.jython.ast.Attribute;
|
import org.python.pydev.parser.jython.ast.Attribute;
|
||||||
import org.python.pydev.parser.jython.ast.ClassDef;
|
import org.python.pydev.parser.jython.ast.ClassDef;
|
||||||
@ -47,6 +46,7 @@ import org.python.pydev.parser.jython.ast.stmtType;
|
|||||||
|
|
||||||
import pyUML.backend.EclipseHelperMethods;
|
import pyUML.backend.EclipseHelperMethods;
|
||||||
import pyUML.backend.GlobalConstants;
|
import pyUML.backend.GlobalConstants;
|
||||||
|
import pyUML.backend.JavaHelperMethods;
|
||||||
import pyUML.backend.ParseHelpers;
|
import pyUML.backend.ParseHelpers;
|
||||||
import pyUML.exceptions.PyUMLCancelledException;
|
import pyUML.exceptions.PyUMLCancelledException;
|
||||||
import pyUML.exceptions.PyUMLParseException;
|
import pyUML.exceptions.PyUMLParseException;
|
||||||
@ -155,7 +155,8 @@ public class PythonTreeClass extends PythonTreeNode{
|
|||||||
root.getClassDict().put(structuredName, this);
|
root.getClassDict().put(structuredName, this);
|
||||||
root.getClassNameDict().put(structuredName, this.name);
|
root.getClassNameDict().put(structuredName, this.name);
|
||||||
|
|
||||||
for (exprType superClass: this.astNode.bases) {
|
for (int i=0; i < this.astNode.bases.length; i++) {
|
||||||
|
exprType superClass = this.astNode.bases[i];
|
||||||
if (superClass instanceof Name) {
|
if (superClass instanceof Name) {
|
||||||
String superName = ((Name)superClass).id;
|
String superName = ((Name)superClass).id;
|
||||||
String superClassPackString = this.getPackFromImports(superName);
|
String superClassPackString = this.getPackFromImports(superName);
|
||||||
@ -163,11 +164,32 @@ public class PythonTreeClass extends PythonTreeNode{
|
|||||||
this.superClasses.add(superClassPackString);
|
this.superClasses.add(superClassPackString);
|
||||||
}
|
}
|
||||||
else if (superClass instanceof Attribute) {
|
else if (superClass instanceof Attribute) {
|
||||||
|
// Just extract the content in the paranthesis without
|
||||||
|
// any further analysis
|
||||||
|
// This can be a subclass or a class under a package
|
||||||
|
/// -> this cannot be recognized
|
||||||
|
|
||||||
Attribute superAtt = (Attribute) superClass;
|
Attribute superAtt = (Attribute) superClass;
|
||||||
String superName = ((NameTok)superAtt.attr).id;
|
String line = FileRefactoring.getLine(inFile, superAtt.beginLine);
|
||||||
String packages = ((Name)superAtt.value).id;
|
|
||||||
String packageStructure = "/" + packages.replace(".", "/") + "/";
|
// find i'th component of bases -> current component
|
||||||
this.superClasses.add(packageStructure+superName);
|
String separator = "(";
|
||||||
|
for (int j=0; j <= i; j++) {
|
||||||
|
if (j > 0)
|
||||||
|
separator = ",";
|
||||||
|
line = line.substring(line.indexOf(separator) + 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( i < this.astNode.bases.length - 1)
|
||||||
|
separator = ",";
|
||||||
|
else
|
||||||
|
separator = ")";
|
||||||
|
|
||||||
|
String superClassFullName = line.substring(0, line.indexOf(separator));
|
||||||
|
superClassFullName = superClassFullName.replaceAll("[\\s]", "");
|
||||||
|
|
||||||
|
|
||||||
|
this.superClasses.add(superClassFullName);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user