Author: clopes
Date: 2012-07-23 10:31:14 -0700 (Mon, 23 Jul 2012)
New Revision: 29957

Modified:
   
core3/impl/trunk/model-impl/impl/src/main/java/org/cytoscape/model/internal/CyTableManagerImpl.java
Log:
Minor change that prevents the CyTable Manager from firing a TableAddedEvent 
when the same table is added again.

Modified: 
core3/impl/trunk/model-impl/impl/src/main/java/org/cytoscape/model/internal/CyTableManagerImpl.java
===================================================================
--- 
core3/impl/trunk/model-impl/impl/src/main/java/org/cytoscape/model/internal/CyTableManagerImpl.java
 2012-07-23 17:22:37 UTC (rev 29956)
+++ 
core3/impl/trunk/model-impl/impl/src/main/java/org/cytoscape/model/internal/CyTableManagerImpl.java
 2012-07-23 17:31:14 UTC (rev 29957)
@@ -94,21 +94,19 @@
                tables.clear();
        }
 
-       /**
-        * {@inheritDoc}
-        */
        @Override
        public synchronized void addTable(final CyTable t) {
                if (t == null)
                        throw new NullPointerException("added table is null");
 
-               tables.put(t.getSUID(), t);
-               eventHelper.fireEvent(new TableAddedEvent(this, t));
+               final Long suid = t.getSUID();
+               
+               if (tables.get(suid) == null) {
+                       tables.put(suid, t);
+                       eventHelper.fireEvent(new TableAddedEvent(this, t));
+               }
        }
 
-       /**
-        * {@inheritDoc}
-        */
        @Override
        public synchronized Set<CyTable> getAllTables(final boolean 
includePrivate) {
                final Set<CyTable> res = new HashSet<CyTable>();
@@ -121,10 +119,6 @@
                return res;
        }
 
-
-       /**
-        * {@inheritDoc}
-        */
        @Override
        public synchronized CyTable getTable(final long suid) {
                return tables.get(suid);
@@ -164,9 +158,6 @@
                table = null;
        }
 
-       /**
-        * {@inheritDoc}
-        */
        @Override
        public void deleteTable(long suid) {
                deleteTableInternal(suid, false);
@@ -180,7 +171,6 @@
                                deleteTableInternal(table.getSUID(), true);
        }
 
-
        @Override
        public Set<CyTable> getGlobalTables() {
                final Set<CyTable> nonGlobalTables = new HashSet<CyTable>();
@@ -200,7 +190,6 @@
                return globalTables;
        }
 
-
        @Override
        public Set<CyTable> getLocalTables(final Class<? extends 
CyIdentifiable> type) {
                final Set<CyTable> localTables = new HashSet<CyTable>();

-- 
You received this message because you are subscribed to the Google Groups 
"cytoscape-cvs" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/cytoscape-cvs?hl=en.

Reply via email to