Update of /cvsroot/pydev/org.python.pydev/src_navigator/org/python/pydev/navigator/elements
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24486/src_navigator/org/python/pydev/navigator/elements
Modified Files:
PythonSourceFolder.java
Log Message:
Fixes in the package explorer: there was a case where the item was being re-created even if it was already created in the python model.
Index: PythonSourceFolder.java
===================================================================
RCS file: /cvsroot/pydev/org.python.pydev/src_navigator/org/python/pydev/navigator/elements/PythonSourceFolder.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** PythonSourceFolder.java 8 Sep 2007 16:36:13 -0000 1.3
--- PythonSourceFolder.java 19 Jun 2008 15:29:46 -0000 1.4
***************
*** 16,19 ****
--- 16,20 ----
import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.ui.IContributorResourceAdapter;
+ import org.python.pydev.plugin.PydevPlugin;
/**
***************
*** 61,64 ****
--- 62,80 ----
public void addChild(IWrappedResource child){
IResource actualObject = (IResource) child.getActualObject();
+
+ Object p = child.getParentElement();
+ if(p != null && p instanceof IWrappedResource){
+ IWrappedResource pWrapped = (IWrappedResource) p;
+ if(pWrapped.getActualObject().equals(actualObject)){
+ PydevPlugin.log("Trying to add an element that has itself as parent: "+actualObject);
+ }
+ }
+
+ //if there was already a child to the given object, remove it before adding this one.
+ IWrappedResource existing = children.get(actualObject);
+ if(existing != null){
+ removeChild(actualObject);
+ }
+
children.put(actualObject, child);
|