Author: jflesch
Date: 2006-10-18 20:11:56 +0000 (Wed, 18 Oct 2006)
New Revision: 10671

Modified:
   trunk/apps/Thaw/src/thaw/plugins/index/Index.java
Log:
Fix link display

Modified: trunk/apps/Thaw/src/thaw/plugins/index/Index.java
===================================================================
--- trunk/apps/Thaw/src/thaw/plugins/index/Index.java   2006-10-18 18:37:20 UTC 
(rev 10670)
+++ trunk/apps/Thaw/src/thaw/plugins/index/Index.java   2006-10-18 20:11:56 UTC 
(rev 10671)
@@ -531,10 +531,12 @@
                        file.insert();

                        addFileToList(file);
-
+               
                        setChanged();
                        notifyObservers(file);
                }
+               else
+                       Logger.notice(this, "File already in the database for 
this index");
        }


@@ -579,16 +581,22 @@
                if (!link.isInTheDatabase()) {
                        link.insert();

-                       if (linkList != null) {
-                               linkList.add(link);
-
-                               setChanged();
-                               notifyObservers(link);
-                       }
+                       addLinkToList(link);
+                       setChanged();
+                       notifyObservers(link);
                }
+               else
+                       Logger.notice(this, "Link already in the database for 
this index");

        }

+       protected void addLinkToList(Link link) {
+               if (linkList == null)
+                       loadLinks(null, true);
+
+               linkList.add(link);
+       }
+
        public void removeLink(Link link) {
                link.delete();

@@ -639,7 +647,7 @@
                                while(results.next()) {
                                        try {
                                                Link link = new Link(db, 
results, this);
-                                               addLink(link);
+                                               addLinkToList(link);
                                        } catch(Exception e) {
                                                Logger.warning(this, "Unable to 
add index '"+publicKey+"' to the list because: "+e.toString());
                                        }


Reply via email to