tmf: Update copyright headers in tmf.ui
[deliverable/tracecompass.git] / org.eclipse.linuxtools.tmf.ui / src / org / eclipse / linuxtools / tmf / ui / project / model / TmfProjectModelElement.java
index bf6cef78dc32e42eceaf8ffe86bb0b5a7078a514..39f0b84f7a64f489ce4c965d49da8e34dfbbbaeb 100644 (file)
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2010, 2012 Ericsson
+ * Copyright (c) 2010, 2013 Ericsson
  *
  * All rights reserved. This program and the accompanying materials are
  * made available under the terms of the Eclipse Public License v1.0 which
@@ -82,6 +82,10 @@ public abstract class TmfProjectModelElement implements ITmfProjectModelElement,
         ResourcesPlugin.getWorkspace().addResourceChangeListener(this);
     }
 
+    private void dispose() {
+        ResourcesPlugin.getWorkspace().removeResourceChangeListener(this);
+    }
+
     // ------------------------------------------------------------------------
     // ITmfProjectModelElement
     // ------------------------------------------------------------------------
@@ -156,6 +160,9 @@ public abstract class TmfProjectModelElement implements ITmfProjectModelElement,
     @Override
     public void removeChild(ITmfProjectModelElement child) {
         fChildren.remove(child);
+        if (child instanceof TmfProjectModelElement) {
+            ((TmfProjectModelElement) child).dispose();
+        }
         refresh();
     }
     /*
@@ -192,8 +199,6 @@ public abstract class TmfProjectModelElement implements ITmfProjectModelElement,
     public int hashCode() {
         final int prime = 31;
         int result = 1;
-        result = prime * result + ((fLocation == null) ? 0 : fLocation.hashCode());
-        result = prime * result + ((fName == null) ? 0 : fName.hashCode());
         result = prime * result + ((fPath == null) ? 0 : fPath.hashCode());
         return result;
     }
@@ -213,7 +218,7 @@ public abstract class TmfProjectModelElement implements ITmfProjectModelElement,
             return false;
         }
         TmfProjectModelElement element = (TmfProjectModelElement) other;
-        return element.fName.equals(fName) && element.fLocation.equals(fLocation);
+        return element.fPath.equals(fPath);
     }
 
     /**
This page took 0.024163 seconds and 5 git commands to generate.