+ Create Version to work with Ganymede

* Disable Live Validation
 * PyDev 1.1.2+ compatibility issue

+ Create Warning when trying to synchronize classes without package
This commit is contained in:
polki 2009-05-12 11:24:34 +00:00
parent 19ec7a8c8d
commit 7611028aa2
5 changed files with 38 additions and 11 deletions

View File

@ -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: 1.0.1 Bundle-Version: 1.2
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,

View File

@ -7,8 +7,8 @@ import org.eclipse.ui.IPropertyListener;
import org.eclipse.ui.IWorkbenchWindow; import org.eclipse.ui.IWorkbenchWindow;
import org.eclipse.ui.PlatformUI; import org.eclipse.ui.PlatformUI;
import org.eclipse.uml2.diagram.clazz.part.UMLDiagramEditor; import org.eclipse.uml2.diagram.clazz.part.UMLDiagramEditor;
import org.eclipse.uml2.diagram.clazz.part.ValidateAction; //import org.eclipse.uml2.diagram.clazz.part.ValidateAction;
import org.eclipse.uml2.diagram.clazz.providers.UMLValidationDecoratorProvider; //import org.eclipse.uml2.diagram.clazz.providers.UMLValidationDecoratorProvider;
/** /**
* This class is a listener that runs a live validation run, * This class is a listener that runs a live validation run,
@ -63,13 +63,18 @@ public class LiveValidationListener implements IPropertyListener{
if (!(ed instanceof UMLDiagramEditor)) if (!(ed instanceof UMLDiagramEditor))
return; return;
UMLDiagramEditor umlEditor = (UMLDiagramEditor) ed;
IWorkbenchPartDescriptor desc = new WorkbenchPartDescriptor(umlEditor.getSite().getId(), umlEditor.getSite().getClass(), umlEditor.getSite().getPage()); /* TODO: UML2Tools Editor has to be changed with every Eclipse Version
ValidateAction action = new ValidateAction(desc); for Live Validation.
UMLValidationDecoratorProvider.usedResource = umlEditor.getDiagram().eResource(); So we are disabling Live Validation for now! */
action.run(); // 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();
} }
/** /**

View File

@ -464,6 +464,18 @@ public class PythonTreeClass extends PythonTreeNode {
* deleted and newly created * deleted and newly created
*/ */
public boolean synchronizeModel(NamedElement modelElement){ 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 // run super method to save corresponding model element
super.synchronizeModel(modelElement); super.synchronizeModel(modelElement);
Classifier modelClass = (Classifier) modelElement; Classifier modelClass = (Classifier) modelElement;

View File

@ -336,6 +336,16 @@ public class PythonTreePackage extends PythonTreeNode{
// handle child classes in model // handle child classes in model
else if (modelChild instanceof Class || modelChild instanceof Interface) { else if (modelChild instanceof Class || modelChild instanceof Interface) {
Classifier modelChildClass = (Classifier) modelChild; 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().worked(this.getName() + "/" + modelChildClass.getName());
this.getRoot().setSubTaskName(this.getName() + "/" + modelChildClass.getName()); this.getRoot().setSubTaskName(this.getName() + "/" + modelChildClass.getName());
String xmi_id = modelXmiDict.get(modelChildClass); String xmi_id = modelXmiDict.get(modelChildClass);

View File

@ -44,7 +44,7 @@ public class BicycleRefactoring {
AbstractShell pytonShell = AbstractShell.getServerShell(pythonNature, AbstractShell.OTHERS_SHELL); AbstractShell pytonShell = AbstractShell.getServerShell(pythonNature, AbstractShell.OTHERS_SHELL);
String output = ""; String output = "";
try{ try{
pytonShell.changePythonPath(pythonNature.getPythonPathNature().getCompleteProjectPythonPath(null)); //default pytonShell.changePythonPath(pythonNature.getPythonPathNature().getCompleteProjectPythonPath(null, null)); //default
pytonShell.write(refactorCommand); pytonShell.write(refactorCommand);
output = URLDecoder.decode(pytonShell.read((IProgressMonitor)null), "UTF-8"); output = URLDecoder.decode(pytonShell.read((IProgressMonitor)null), "UTF-8");
} catch (Exception e) { } catch (Exception e) {