diff --git a/pyUml/META-INF/MANIFEST.MF b/pyUml/META-INF/MANIFEST.MF index e5368d8..66460c5 100755 --- a/pyUml/META-INF/MANIFEST.MF +++ b/pyUml/META-INF/MANIFEST.MF @@ -2,7 +2,7 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: PyUML Bundle-SymbolicName: pyUml;singleton:=true -Bundle-Version: 1.0.1 +Bundle-Version: 1.2 Bundle-Activator: pyUML.plugin.Activator Eclipse-LazyStart: true Bundle-ClassPath: lib/refactoring.jar, diff --git a/pyUml/src/pyUML/listeners/LiveValidationListener.java b/pyUml/src/pyUML/listeners/LiveValidationListener.java index 62ac997..655cb9e 100755 --- a/pyUml/src/pyUML/listeners/LiveValidationListener.java +++ b/pyUml/src/pyUML/listeners/LiveValidationListener.java @@ -7,8 +7,8 @@ import org.eclipse.ui.IPropertyListener; import org.eclipse.ui.IWorkbenchWindow; import org.eclipse.ui.PlatformUI; import org.eclipse.uml2.diagram.clazz.part.UMLDiagramEditor; -import org.eclipse.uml2.diagram.clazz.part.ValidateAction; -import org.eclipse.uml2.diagram.clazz.providers.UMLValidationDecoratorProvider; +//import org.eclipse.uml2.diagram.clazz.part.ValidateAction; +//import org.eclipse.uml2.diagram.clazz.providers.UMLValidationDecoratorProvider; /** * This class is a listener that runs a live validation run, @@ -63,13 +63,18 @@ public class LiveValidationListener implements IPropertyListener{ if (!(ed instanceof UMLDiagramEditor)) return; - UMLDiagramEditor umlEditor = (UMLDiagramEditor) ed; - - IWorkbenchPartDescriptor desc = new WorkbenchPartDescriptor(umlEditor.getSite().getId(), umlEditor.getSite().getClass(), umlEditor.getSite().getPage()); - ValidateAction action = new ValidateAction(desc); - UMLValidationDecoratorProvider.usedResource = umlEditor.getDiagram().eResource(); - - action.run(); + +/* TODO: UML2Tools Editor has to be changed with every Eclipse Version + for Live Validation. + So we are disabling Live Validation for now! */ + +// UMLDiagramEditor umlEditor = (UMLDiagramEditor) ed; +// +// IWorkbenchPartDescriptor desc = new WorkbenchPartDescriptor(umlEditor.getSite().getId(), umlEditor.getSite().getClass(), umlEditor.getSite().getPage()); +// ValidateAction action = new ValidateAction(desc); +// UMLValidationDecoratorProvider.usedResource = umlEditor.getDiagram().eResource(); +// +// action.run(); } /** diff --git a/pyUml/src/pyUML/pythonTree/PythonTreeClass.java b/pyUml/src/pyUML/pythonTree/PythonTreeClass.java index 57793e2..564ae6e 100755 --- a/pyUml/src/pyUML/pythonTree/PythonTreeClass.java +++ b/pyUml/src/pyUML/pythonTree/PythonTreeClass.java @@ -464,6 +464,18 @@ public class PythonTreeClass extends PythonTreeNode { * deleted and newly created */ public boolean synchronizeModel(NamedElement modelElement){ + + /* only classes in packages are supported. If we find a top-level-class, + * exit with warning! */ + if (super.getParent().isRoot()) { + if (getRoot().isShowWarnings()) { + MessageDialog.openWarning(null, "Error: Top level class detected!", + "Please use in model and code *only* classes inside packages!\n" + + "The class was: " + this.getInFile().getName()); + } + return false; + } + // run super method to save corresponding model element super.synchronizeModel(modelElement); Classifier modelClass = (Classifier) modelElement; diff --git a/pyUml/src/pyUML/pythonTree/PythonTreePackage.java b/pyUml/src/pyUML/pythonTree/PythonTreePackage.java index 7798150..d36ef5f 100755 --- a/pyUml/src/pyUML/pythonTree/PythonTreePackage.java +++ b/pyUml/src/pyUML/pythonTree/PythonTreePackage.java @@ -336,6 +336,16 @@ public class PythonTreePackage extends PythonTreeNode{ // handle child classes in model else if (modelChild instanceof Class || modelChild instanceof Interface) { Classifier modelChildClass = (Classifier) modelChild; + + /* only classes in packages are supported. If we find a top-level-class, + * exit with warning! */ + if (isRoot()) { + MessageDialog.openWarning(null, "Error: Top level class detected!", + "Please use in model and code *only* classes inside packages!\n" + + "The class was: " + modelChildClass.getName()); + continue globalLoop; + } + this.getRoot().worked(this.getName() + "/" + modelChildClass.getName()); this.getRoot().setSubTaskName(this.getName() + "/" + modelChildClass.getName()); String xmi_id = modelXmiDict.get(modelChildClass); diff --git a/pyUml/src/pyUML/refactoring/BicycleRefactoring.java b/pyUml/src/pyUML/refactoring/BicycleRefactoring.java index f64f375..8f302e5 100755 --- a/pyUml/src/pyUML/refactoring/BicycleRefactoring.java +++ b/pyUml/src/pyUML/refactoring/BicycleRefactoring.java @@ -44,7 +44,7 @@ public class BicycleRefactoring { AbstractShell pytonShell = AbstractShell.getServerShell(pythonNature, AbstractShell.OTHERS_SHELL); String output = ""; try{ - pytonShell.changePythonPath(pythonNature.getPythonPathNature().getCompleteProjectPythonPath(null)); //default + pytonShell.changePythonPath(pythonNature.getPythonPathNature().getCompleteProjectPythonPath(null, null)); //default pytonShell.write(refactorCommand); output = URLDecoder.decode(pytonShell.read((IProgressMonitor)null), "UTF-8"); } catch (Exception e) {