svn commit: r12861 - trunk/src_new/org/argouml/uml/diagram: activity/ui ui

[email protected]
Newsgroups gmane.comp.lang.uml.argouml.cvs
Message-ID <[email protected]>
Author: mvw
Date: 2007-06-16 10:54:13-0700
New Revision: 12861

Modified:
   trunk/src_new/org/argouml/uml/diagram/activity/ui/FigPartition.java
   trunk/src_new/org/argouml/uml/diagram/ui/FigNodeModelElement.java

Log:
Fix some exceptions that happen when a project that contains several Partitions (and a Pool) is deleted.

Modified: trunk/src_new/org/argouml/uml/diagram/activity/ui/FigPartition.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src_new/org/argouml/uml/diagram/activity/ui/FigPartition.java?view=diff&rev=12861&p1=trunk/src_new/org/argouml/uml/diagram/activity/ui/FigPartition.java&p2=trunk/src_new/org/argouml/uml/diagram/activity/ui/FigPartition.java&r1=12860&r2=12861
==============================================================================
--- trunk/src_new/org/argouml/uml/diagram/activity/ui/FigPartition.java	(original)
+++ trunk/src_new/org/argouml/uml/diagram/activity/ui/FigPartition.java	2007-06-16 10:54:13-0700
@@ -280,6 +280,10 @@
     public void removeFromDiagramImpl() {
 	int width = getWidth();
 	FigPool figPool = getFigPool();
+        if (figPool == null) { //Needed for project deletion
+            return;
+        }
+        
 	int newFigPoolWidth = figPool.getWidth() - width;
 	
 	super.removeFromDiagramImpl();
@@ -340,11 +344,11 @@
      * @return th partitions
      */
     private FigPool getFigPool() {
-        Iterator it = getLayer().getContents().iterator();
-        while (it.hasNext()) {
-            Object o = it.next();
-            if (o instanceof FigPool) {
-                return (FigPool) o;
+        if (getLayer() != null) { // This test needed for project deletion
+            for (Object o : getLayer().getContents()) {
+                if (o instanceof FigPool) {
+                    return (FigPool) o;
+                }
             }
         }
         

Modified: trunk/src_new/org/argouml/uml/diagram/ui/FigNodeModelElement.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src_new/org/argouml/uml/diagram/ui/FigNodeModelElement.java?view=diff&rev=12861&p1=trunk/src_new/org/argouml/uml/diagram/ui/FigNodeModelElement.java&p2=trunk/src_new/org/argouml/uml/diagram/ui/FigNodeModelElement.java&r1=12860&r2=12861
==============================================================================
--- trunk/src_new/org/argouml/uml/diagram/ui/FigNodeModelElement.java	(original)
+++ trunk/src_new/org/argouml/uml/diagram/ui/FigNodeModelElement.java	2007-06-16 10:54:13-0700
@@ -1468,7 +1468,9 @@
     }
     
     protected void removeFromDiagramImpl() {
-        notationProviderName.cleanListener(this, getOwner());
+        if (notationProviderName != null) { //This test needed for a FigPool
+            notationProviderName.cleanListener(this, getOwner());
+        }
         ArgoEventPump.removeListener(this);
         removeAllElementListeners();
         setShadowSize(0);
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.