Author: jflesch
Date: 2008-02-17 03:42:35 +0000 (Sun, 17 Feb 2008)
New Revision: 18022

Modified:
   trunk/apps/Thaw/src/thaw/plugins/index/CommentTab.java
   trunk/apps/Thaw/src/thaw/plugins/index/DetailPanel.java
   trunk/apps/Thaw/src/thaw/plugins/index/IndexManagementHelper.java
   trunk/apps/Thaw/src/thaw/plugins/index/IndexSelecter.java
   trunk/apps/Thaw/src/thaw/plugins/index/IndexTree.java
   trunk/apps/Thaw/src/thaw/plugins/index/SearchBar.java
Log:
IndexBrowser : allow multiple selections in the index tree

Modified: trunk/apps/Thaw/src/thaw/plugins/index/CommentTab.java
===================================================================
--- trunk/apps/Thaw/src/thaw/plugins/index/CommentTab.java      2008-02-17 
01:54:32 UTC (rev 18021)
+++ trunk/apps/Thaw/src/thaw/plugins/index/CommentTab.java      2008-02-17 
03:42:35 UTC (rev 18022)
@@ -156,11 +156,14 @@
                        else
                                hideTab();
                }
+               
+               Vector v = new Vector();
+               v.add(index);

                for (Iterator it = buttonActions.iterator();
                     it.hasNext();) {
                        IndexManagementHelper.IndexAction action = 
(IndexManagementHelper.IndexAction)it.next();
-                       action.setTarget((Index)index);
+                       action.setTargets(v);
                }

                this.index = index;

Modified: trunk/apps/Thaw/src/thaw/plugins/index/DetailPanel.java
===================================================================
--- trunk/apps/Thaw/src/thaw/plugins/index/DetailPanel.java     2008-02-17 
01:54:32 UTC (rev 18021)
+++ trunk/apps/Thaw/src/thaw/plugins/index/DetailPanel.java     2008-02-17 
03:42:35 UTC (rev 18022)
@@ -58,19 +58,35 @@



+       public void setTargets(Vector targets) {
+               
+               IndexTreeNode l;
+               
+               if (targets.size() != 1)
+                       l = null;
+               else
+                       l = (IndexTreeNode)targets.get(0);
+               
+               setTarget(l);
+       }
+
        public void setTarget(IndexTreeNode l) {
-
+               
                if (l != null && l instanceof Index)
                        
viewCommentButton.setText(I18n.getMessage("thaw.plugin.index.comment.comments").replaceAll("\\?",
                                                                                
                                   
Integer.toString(((Index)l).getNmbComments())));
                else
                        
viewCommentButton.setText(I18n.getMessage("thaw.plugin.index.comment.comments").replaceAll("\\?",
                                                                                
                                   "0"));
+               
+               Vector v = new Vector();
+               if (l != null)
+                       v.add(l);

                for (Iterator it = buttonActions.iterator();
                     it.hasNext();) {
                        IndexManagementHelper.IndexAction action = 
(IndexManagementHelper.IndexAction)it.next();
-                       action.setTarget(l);
+                       action.setTargets(v);
                }
        }


Modified: trunk/apps/Thaw/src/thaw/plugins/index/IndexManagementHelper.java
===================================================================
--- trunk/apps/Thaw/src/thaw/plugins/index/IndexManagementHelper.java   
2008-02-17 01:54:32 UTC (rev 18021)
+++ trunk/apps/Thaw/src/thaw/plugins/index/IndexManagementHelper.java   
2008-02-17 03:42:35 UTC (rev 18022)
@@ -76,7 +76,7 @@
                 * Can disable the abstract button if required
                 * @param node can be null
                 */
-               public void setTarget(IndexTreeNode node);
+               public void setTargets(Vector nodes);
        }


@@ -85,7 +85,7 @@

                private FCPQueueManager queueManager;
                private AbstractButton actionSource;
-               private IndexTreeNode target;
+               private Vector targets;

                private IndexBrowserPanel indexBrowser;

@@ -94,7 +94,7 @@
                                        final AbstractButton actionSource) {
                        this.indexBrowser = indexBrowser;
                        this.actionSource = actionSource;
-                       target = null;
+                       targets = null;
                        this.queueManager = queueManager;

                        if (actionSource != null) {
@@ -107,17 +107,16 @@
                        return actionSource;
                }

-               public void setTarget(final IndexTreeNode node) {
-                       target = node;
-
+               public void setTargets(final Vector nodes) {
+                       targets = nodes;
                }

                public FCPQueueManager getQueueManager() {
                        return queueManager;
                }

-               public IndexTreeNode getTarget() {
-                       return target;
+               public Vector getTargets() {
+                       return targets;
                }

                public IndexBrowserPanel getIndexBrowserPanel() {
@@ -139,31 +138,48 @@


                public void run() {
-                       apply();
+                       if (targets == null)
+                               return;
+                       
+                       for (Iterator it = targets.iterator(); it.hasNext() ; ) 
{
+                               IndexTreeNode node = (IndexTreeNode)it.next();
+                               apply(node);
+                       }
                }

                public void stop() {
                        /* \_o< */
                }

-               public abstract void apply();
+               public abstract void apply(IndexTreeNode target);
        }



        public static class IndexCreator extends BasicIndexAction implements 
Observer {
+               private IndexTreeNode target;
+               
                public IndexCreator(final FCPQueueManager queueManager, final 
IndexBrowserPanel indexBrowser, final AbstractButton actionSource) {
                        super(queueManager, indexBrowser, actionSource);
                }
+               
+               public void setTargets(Vector nodes) {
+                       super.setTargets(nodes);
+                       
+                       if (nodes == null || nodes.size() != 1)
+                               getActionSource().setEnabled(false);
+                       else
+                               setTarget((IndexTreeNode)nodes.get(0));
+               }

                public void setTarget(final IndexTreeNode node) {
-                       super.setTarget(node);
-
+                       this.target = node;
+                       
                        if (getActionSource() != null)
                                getActionSource().setEnabled((node == null) || 
(node instanceof IndexFolder));
                }

-               public void apply() {
+               public void apply(IndexTreeNode target) {
                        final String name = 
IndexManagementHelper.askAName(getIndexBrowserPanel().getMainWindow().getMainFrame(),
                                                                           
I18n.getMessage("thaw.plugin.index.indexName"),
                                                                           
I18n.getMessage("thaw.plugin.index.newIndex"));
@@ -172,17 +188,14 @@
                                return;

                        /* will create a dedicated IndexCreator */
-                       IndexManagementHelper.createIndex(getQueueManager(), 
getIndexBrowserPanel(), (IndexFolder)getTarget(), name);
+                       IndexManagementHelper.createIndex(getQueueManager(), 
getIndexBrowserPanel(), (IndexFolder)target, name);
                }


                private String name;

-               /**
-                * Don't use directly
-                */
-               public void createIndex(String name) {
-                       if (getTarget() == null)
+               private void createIndex(IndexTreeNode target, String name) {
+                       if (target == null)
                                
setTarget(getIndexBrowserPanel().getIndexTree().getRoot());

                        if ((name == null) || (name.indexOf("/") >= 0) || 
name.indexOf("\\") >= 0) {
@@ -241,8 +254,8 @@
                                        st.setBoolean(9, false);
                                        st.setBoolean(10, false);

-                                       if (getTarget().getId() >= 0)
-                                               st.setInt(11, 
getTarget().getId());
+                                       if (target.getId() >= 0)
+                                               st.setInt(11, target.getId());
                                        else
                                                st.setNull(11, Types.INTEGER);

@@ -250,7 +263,7 @@
                                        st.close();

                                        index = new Index(db, 
getIndexBrowserPanel().getConfig(),
-                                                         id, 
(TreeNode)getTarget(),
+                                                         id, (TreeNode)target,
                                                          
sskGenerator.getPublicKey(), 0,
                                                          
sskGenerator.getPrivateKey(), false,
                                                          name, null,
@@ -263,9 +276,9 @@
                                }
                        }

-                       ((MutableTreeNode)getTarget()).insert((index), 0);
+                       ((MutableTreeNode)target).insert((index), 0);

-                       
getIndexBrowserPanel().getIndexTree().refresh(getTarget());
+                       getIndexBrowserPanel().getIndexTree().refresh(target);

                        IndexConfigDialog dialog = new 
IndexConfigDialog(getIndexBrowserPanel(),
                                                                         
getQueueManager(),
@@ -281,27 +294,33 @@

                IndexCreator creator = new IndexCreator(queueManager, 
indexBrowser, null);
                creator.setTarget(target);
-               creator.createIndex(name);
+               creator.createIndex(target, name);

        }



        public static class IndexModifier extends BasicIndexAction implements 
ThawRunnable {
-
                public IndexModifier(final FCPQueueManager queueManager, final 
IndexBrowserPanel indexBrowser, final AbstractButton actionSource) {
                        super(queueManager, indexBrowser, actionSource);
                }
+               
+               public void setTargets(Vector nodes) {
+                       super.setTargets(nodes);
+                       
+                       if (nodes == null || nodes.size() != 1)
+                               getActionSource().setEnabled(false);
+                       else
+                               setTarget((IndexTreeNode)nodes.get(0));
+               }

                public void setTarget(final IndexTreeNode node) {
-                       super.setTarget(node);
-
                        if (getActionSource() != null)
                                getActionSource().setEnabled((node != null) && 
(node instanceof Index));
                }

-               public void apply() {
-                       final Index index = ((Index)getTarget());
+               public void apply(IndexTreeNode target) {
+                       final Index index = ((Index)target);

                        IndexConfigDialog dialog = new 
IndexConfigDialog(getIndexBrowserPanel(),
                                                                         
getQueueManager(),
@@ -325,15 +344,22 @@
                public IndexReuser(final FCPQueueManager queueManager, final 
IndexBrowserPanel indexBrowser, final AbstractButton actionSource) {
                        super(queueManager, indexBrowser, actionSource);
                }
+               
+               public void setTargets(Vector nodes) {
+                       super.setTargets(nodes);
+                       
+                       if (nodes == null || nodes.size() != 1)
+                               getActionSource().setEnabled(false);
+                       else
+                               setTarget((IndexTreeNode)nodes.get(0));
+               }

                public void setTarget(final IndexTreeNode node) {
-                       super.setTarget(node);
-
                        if (getActionSource() != null)
                                getActionSource().setEnabled((node == null) || 
(node instanceof IndexFolder));
                }

-               public void apply() {
+               public void apply(IndexTreeNode target) {
                        String publicKey = null;
                        String privateKey = null;

@@ -507,21 +533,28 @@
                public IndexFolderAdder(final IndexBrowserPanel indexBrowser, 
final AbstractButton actionSource) {
                        super(null, indexBrowser, actionSource);
                }
+               
+               public void setTargets(Vector nodes) {
+                       super.setTargets(nodes);
+                       
+                       if (nodes == null || nodes.size() != 1)
+                               getActionSource().setEnabled(false);
+                       else
+                               setTarget((IndexTreeNode)nodes.get(0));
+               }

                public void setTarget(final IndexTreeNode node) {
-                       super.setTarget(node);
-
                        if (getActionSource() != null)
                                getActionSource().setEnabled((node == null) || 
(node instanceof IndexFolder));
                }

-               public void apply() {
+               public void apply(IndexTreeNode target) {
                        final String name = 
IndexManagementHelper.askAName(getIndexBrowserPanel().getMainWindow().getMainFrame(),
                                                                           
I18n.getMessage("thaw.plugin.index.categoryName"),
                                                                           
I18n.getMessage("thaw.plugin.index.newCategory"));

                        if (name != null)
-                               
IndexManagementHelper.addIndexFolder(getIndexBrowserPanel(), 
(IndexFolder)getTarget(), name);
+                               
IndexManagementHelper.addIndexFolder(getIndexBrowserPanel(), 
(IndexFolder)target, name);
                }
        }

@@ -580,15 +613,15 @@
                public IndexHasChangedFlagReseter(IndexBrowserPanel 
indexBrowser, final AbstractButton actionSource) {
                        super(null, indexBrowser, actionSource);
                }
-
-               public void setTarget(final IndexTreeNode node) {
-                       super.setTarget(node);
+               
+               public void setTargets(Vector nodes) {
+                       super.setTargets(nodes);
                }

-               public void apply() {
-                       getTarget().setHasChangedFlag(false);
-                       getTarget().setNewCommentFlag(false);
-                       
getIndexBrowserPanel().getIndexTree().redraw(getTarget());
+               public void apply(IndexTreeNode target) {
+                       target.setHasChangedFlag(false);
+                       target.setNewCommentFlag(false);
+                       getIndexBrowserPanel().getIndexTree().redraw(target);
                }
        }

@@ -609,16 +642,16 @@
                        this(queueManager, indexBrowser, actionSource);
                        this.autoSort = autoSort;
                }
-
-               public void setTarget(final IndexTreeNode node) {
-                       super.setTarget(node);
+               
+               public void setTargets(Vector paths) {
+                       super.setTargets(paths);
                }

-               public void apply() {
-                       getTarget().downloadFromFreenet(this,
-                                                       
getIndexBrowserPanel().getIndexTree(),
-                                                       getQueueManager());
-                       
getIndexBrowserPanel().getIndexTree().redraw(getTarget());
+               public void apply(IndexTreeNode target) {
+                       target.downloadFromFreenet(this,
+                                               
getIndexBrowserPanel().getIndexTree(),
+                                               getQueueManager());
+                       getIndexBrowserPanel().getIndexTree().redraw(target);
                }

                public void update(Observable o, Object param) {
@@ -642,7 +675,7 @@

                                if ( (cat = index.getCategory()) == null) {
                                        Logger.notice(this, "No category 
defined ; Can't autosort "+
-                                                     "the index 
'"+index.toString(false)+"'");
+                                                                               
"the index '"+index.toString(false)+"'");
                                        return;
                                }

@@ -662,7 +695,9 @@
                                                                 indexBrowser,
                                                                 null,
                                                                 autoSort);
-               downloader.setTarget(target);
+               Vector v = new Vector();
+               v.add(target);
+               downloader.setTargets(v);

                Thread th = new ThawThread(downloader, "Index downloader");
                th.start();
@@ -806,24 +841,24 @@

                        super(null, indexBrowser, actionSource);
                }
+               
+               public void setTargets(Vector nodes) {
+                       super.setTargets(nodes);

-               public void setTarget(final IndexTreeNode node) {
-                       super.setTarget(node);
-
                        if (getActionSource() != null)
-                               getActionSource().setEnabled(node != null);
+                               getActionSource().setEnabled(nodes != null && 
nodes.size() > 0);
                }

-               public void apply() {
-                       if (getTarget() instanceof Index) {
-                               if (((Index)getTarget()).getCategory() == null) 
{
+               public void apply(IndexTreeNode target) {
+                       if (target instanceof Index) {
+                               if (((Index)target).getCategory() == null) {
                                        Logger.warning(this, "No category => 
can't sort !");
                                        return;
                                }
                        }

                        autoSortIndexes(getIndexBrowserPanel(),
-                                                       
(IndexTreeNode)getTarget(),
+                                                       (IndexTreeNode)target,
                                                        
getIndexBrowserPanel().getMainWindow());
                }
        }
@@ -836,18 +871,27 @@

                        super(queueManager, indexBrowser, actionSource);
                }
+               
+               public void setTargets(Vector nodes) {
+                       super.setTargets(nodes);

-               public void setTarget(final IndexTreeNode node) {
-                       super.setTarget(node);
-
                        if (getActionSource() != null)
-                               getActionSource().setEnabled((node != null) && 
node.isModifiable());
+                               getActionSource().setEnabled(nodes != null && 
nodes.size() > 0);
+                       
+                       if (getActionSource().isEnabled()) {
+                               for (Iterator it = nodes.iterator() ; 
it.hasNext() && getActionSource().isEnabled() ; ) {
+                                       IndexTreeNode node = 
(IndexTreeNode)it.next();
+                                       
+                                       if (!node.isModifiable())
+                                               
getActionSource().setEnabled(false);
+                               }
+                       }
                }

-               public void apply() {
-                       getTarget().insertOnFreenet(this, 
getIndexBrowserPanel(), getQueueManager());
+               public void apply(IndexTreeNode target) {
+                       target.insertOnFreenet(this, getIndexBrowserPanel(), 
getQueueManager());

-                       
getIndexBrowserPanel().getIndexTree().redraw(getTarget());
+                       getIndexBrowserPanel().getIndexTree().redraw(target);
                }

                public void update(Observable o, Object param) {
@@ -859,7 +903,9 @@

        public static boolean insert(FCPQueueManager queueManager, 
IndexBrowserPanel indexBrowser, IndexTreeNode target) {
                IndexUploader uploader = new IndexUploader(queueManager, 
indexBrowser, null);
-               uploader.setTarget(target);
+               Vector v = new Vector();
+               v.add(target);
+               uploader.setTargets(v);

                Thread th = new ThawThread(uploader, "Index inserter");
                th.start();
@@ -873,15 +919,12 @@
                        super(null, null, actionSource);
                }

-               public void setTarget(final IndexTreeNode node) {
-                       super.setTarget(node);
-
-                       if (getActionSource() != null)
-                               getActionSource().setEnabled(node != null);
+               public void setTargets(final Vector nodes) {
+                       super.setTargets(nodes);
                }

-               public void apply() {
-                       IndexManagementHelper.copyPublicKeyFrom(getTarget());
+               public void apply(IndexTreeNode target) {
+                       IndexManagementHelper.copyPublicKeyFrom(target);
                }
        }

@@ -905,15 +948,26 @@
                        super(null, null, actionSource);
                }

-               public void setTarget(final IndexTreeNode node) {
-                       super.setTarget(node);
-
-                       if (getActionSource() != null)
-                               getActionSource().setEnabled((node != null) && 
(node instanceof Index) && node.isModifiable());
+               public void setTargets(final Vector nodes) {
+                       super.setTargets(nodes);
+                       
+                       boolean e = true;
+                       
+                       if (nodes == null)
+                               e = false;
+                       else {
+                               for (Iterator it = nodes.iterator(); 
it.hasNext() && e; ) {
+                                       IndexTreeNode node = 
(IndexTreeNode)it.next();
+                                       if (!(node instanceof Index) || 
!node.isModifiable())
+                                               e = false;
+                               }
+                       }
+                       
+                       getActionSource().setEnabled(e);
                }

-               public void apply() {
-                       IndexManagementHelper.copyPrivateKeyFrom(getTarget());
+               public void apply(IndexTreeNode target) {
+                       IndexManagementHelper.copyPrivateKeyFrom(target);
                }
        }

@@ -935,31 +989,38 @@
                public IndexRenamer(final IndexBrowserPanel indexBrowser, final 
AbstractButton actionSource) {
                        super(null, indexBrowser, actionSource);
                }
+               
+               public void setTargets(Vector nodes) {
+                       super.setTargets(nodes);
+                       
+                       if (nodes == null || nodes.size() != 1)
+                               getActionSource().setEnabled(false);
+                       else
+                               setTarget((IndexTreeNode)nodes.get(0));
+               }

                public void setTarget(final IndexTreeNode node) {
-                       super.setTarget(node);
-
                        if (getActionSource() != null)
                                getActionSource().setEnabled(node != null);
                }

-               public void apply() {
+               public void apply(IndexTreeNode target) {
                        String newName;

-                       if (getTarget() instanceof Index) {
+                       if (target instanceof Index) {
                                newName = 
IndexManagementHelper.askAName(getIndexBrowserPanel().getMainWindow().getMainFrame(),
                                                                         
I18n.getMessage("thaw.plugin.index.indexName"),
-                                                                        
((Index)getTarget()).toString(false));
+                                                                        
((Index)target).toString(false));
                        } else {
                                newName = 
IndexManagementHelper.askAName(getIndexBrowserPanel().getMainWindow().getMainFrame(),
                                                                         
I18n.getMessage("thaw.plugin.index.categoryName"),
-                                                                        
getTarget().toString());
+                                                                        
target.toString());
                        }

                        if (newName == null)
                                return;

-                       
IndexManagementHelper.renameNode(getIndexBrowserPanel(), getTarget(), newName);
+                       
IndexManagementHelper.renameNode(getIndexBrowserPanel(), target, newName);
                }
        }

@@ -979,15 +1040,22 @@
                public IndexExporter(final AbstractButton actionSource) {
                        super(null, null, actionSource);
                }
+               
+               public void setTargets(Vector nodes) {
+                       super.setTargets(nodes);
+                       
+                       if (nodes == null || nodes.size() != 1)
+                               getActionSource().setEnabled(false);
+                       else
+                               setTarget((IndexTreeNode)nodes.get(0));
+               }

                public void setTarget(final IndexTreeNode node) {
-                       super.setTarget(node);
-
                        if (getActionSource() != null)
                                getActionSource().setEnabled((node != null) && 
(node instanceof Index));
                }

-               public void apply() {
+               public void apply(IndexTreeNode target) {
                        java.io.File newFile;

                        final FileChooser fileChooser = new FileChooser();
@@ -1008,7 +1076,7 @@
                                return;
                        }

-                       new IndexParser(((Index)getTarget())).generateXML(out);
+                       new IndexParser(((Index)target)).generateXML(out);

                        try {
                                out.close();
@@ -1023,15 +1091,22 @@
                public IndexImporter(final IndexBrowserPanel indexBrowser, 
final AbstractButton actionSource) {
                        super(null, indexBrowser, actionSource);
                }
+               
+               public void setTargets(Vector nodes) {
+                       super.setTargets(nodes);
+                       
+                       if (nodes == null || nodes.size() != 1)
+                               getActionSource().setEnabled(false);
+                       else
+                               setTarget((IndexTreeNode)nodes.get(0));
+               }

                public void setTarget(final IndexTreeNode node) {
-                       super.setTarget(node);
-
                        if (getActionSource() != null)
                                getActionSource().setEnabled((node != null) && 
(node instanceof Index));
                }

-               public void apply() {
+               public void apply(IndexTreeNode target) {
                        java.io.File newFile;

                        final FileChooser fileChooser = new FileChooser();
@@ -1043,7 +1118,7 @@
                        if (newFile == null)
                                return;

-                       new 
IndexParser(((Index)getTarget())).loadXML(newFile.getPath(), false);
+                       new 
IndexParser(((Index)target)).loadXML(newFile.getPath(), false);

                        
getIndexBrowserPanel().getTables().getFileTable().refresh();
                        
getIndexBrowserPanel().getTables().getLinkTable().refresh();
@@ -1061,12 +1136,11 @@
                        super(null, indexBrowser, actionSource);
                }

-               public void setTarget(final IndexTreeNode node) {
-                       super.setTarget(node);
+               public void setTargets(final Vector nodes) {
+                       super.setTargets(nodes);

                        if (getActionSource() != null)
-                               getActionSource().setEnabled(node != null
-                                                            && 
(getIndexBrowserPanel().getIndexTree() != null));
+                               
getActionSource().setEnabled(getIndexBrowserPanel().getIndexTree() != null);
                }

                public void  keyPressed(KeyEvent e) {
@@ -1083,8 +1157,8 @@

                }

-               public void apply() {
-                       
IndexManagementHelper.deleteNode(getIndexBrowserPanel(), getTarget());
+               public void apply(IndexTreeNode target) {
+                       
IndexManagementHelper.deleteNode(getIndexBrowserPanel(), target);
                }
        }

@@ -1118,11 +1192,8 @@
                        this.indexBrowser = indexBrowser;
                }

-               public void setTarget(final IndexTreeNode node) {
-                       if (node != null)
-                               super.setTarget(node);
-                       else
-                               super.setTarget(null);
+               public void setTargets(final Vector nodes) {
+                       super.setTargets(nodes);
                }

                private void blackListRecursivly(Hsqldb db, IndexFolder target) 
{
@@ -1142,14 +1213,14 @@
                        }
                }

-               public void apply() {
-                       if (getTarget() instanceof IndexFolder) {
-                               blackListRecursivly(indexBrowser.getDb(), 
(IndexFolder)getTarget());
-                       } else if (getTarget() instanceof Index) {
-                               BlackList.addToBlackList(indexBrowser.getDb(), 
getTarget().getPublicKey());
+               public void apply(IndexTreeNode target) {
+                       if (target instanceof IndexFolder) {
+                               blackListRecursivly(indexBrowser.getDb(), 
(IndexFolder)target);
+                       } else if (target instanceof Index) {
+                               BlackList.addToBlackList(indexBrowser.getDb(), 
target.getPublicKey());
                        }

-                       super.apply();
+                       super.apply(target);
                        indexBrowser.getBlackList().updateList();
                }
        }
@@ -1164,15 +1235,23 @@
                        super(queueManager, indexBrowser, actionSource);
                        this.config = config;
                }
+               
+               public void setTargets(Vector nodes) {
+                       super.setTargets(nodes);
+                       
+                       if (nodes == null || nodes.size() != 1)
+                               getActionSource().setEnabled(false);
+                       else
+                               setTarget((IndexTreeNode)nodes.get(0));
+               }

                public void setTarget(final IndexTreeNode node) {
-                       super.setTarget(node);

                        if (getActionSource() != null)
                                getActionSource().setEnabled((node != null) && 
(node instanceof Index) && ((Index)node).isModifiable());
                }

-               public void apply() {
+               public void apply(IndexTreeNode target) {
                        final FileChooser fileChooser;

                        String lastDir = null;
@@ -1200,7 +1279,7 @@

                        final String category = 
FileCategory.promptForACategory();

-                       IndexManagementHelper.addFiles(getQueueManager(), 
getIndexBrowserPanel(), (Index)getTarget(), files, category, true);
+                       IndexManagementHelper.addFiles(getQueueManager(), 
getIndexBrowserPanel(), (Index)target, files, category, true);
                }
        }

@@ -1212,15 +1291,23 @@
                        super(queueManager, indexBrowser, actionSource);
                        this.config = config;
                }
+               
+               public void setTargets(Vector nodes) {
+                       super.setTargets(nodes);
+                       
+                       if (nodes == null || nodes.size() != 1)
+                               getActionSource().setEnabled(false);
+                       else
+                               setTarget((IndexTreeNode)nodes.get(0));
+               }

                public void setTarget(final IndexTreeNode node) {
-                       super.setTarget(node);

                        if (getActionSource() != null)
                                getActionSource().setEnabled((node != null) && 
(node instanceof Index) && ((Index)node).isModifiable());
                }

-               public void apply() {
+               public void apply(IndexTreeNode target) {
                        final FileChooser fileChooser;
                        String lastDir = null;

@@ -1247,7 +1334,7 @@

                        final String category = 
FileCategory.promptForACategory();

-                       IndexManagementHelper.addFiles(getQueueManager(), 
getIndexBrowserPanel(), (Index)getTarget(), files, category, false);
+                       IndexManagementHelper.addFiles(getQueueManager(), 
getIndexBrowserPanel(), (Index)target, files, category, false);
                }
        }

@@ -1354,19 +1441,29 @@
                private JDialog frame = null;

                private JPopupMenu popupMenu = null;
+               
+               private IndexTreeNode target = null;

                public KeyAdder(final IndexBrowserPanel indexBrowser, final 
AbstractButton actionSource) {
                        super(null, indexBrowser, actionSource);
                }
+               
+               public void setTargets(Vector nodes) {
+                       super.setTargets(nodes);
+                       
+                       if (nodes == null || nodes.size() != 1)
+                               getActionSource().setEnabled(false);
+                       else
+                               setTarget((IndexTreeNode)nodes.get(0));
+               }

                public void setTarget(final IndexTreeNode node) {
-                       super.setTarget(node);
-
                        if (getActionSource() != null)
                                getActionSource().setEnabled((node != null) && 
(node instanceof Index) && ((Index)node).isModifiable());
                }

-               public void apply() {
+               public void apply(IndexTreeNode target) {
+                       this.target = target;
                        JLabel header = null;
                        JPanel buttonPanel = null;

@@ -1424,7 +1521,7 @@
                                        }
                                }

-                               
IndexManagementHelper.addKeys(getIndexBrowserPanel(), (Index)getTarget(), 
keyVec, category);
+                               
IndexManagementHelper.addKeys(getIndexBrowserPanel(), (Index)target, keyVec, 
category);
                        }

                        if (e.getSource() == cancelButton) {
@@ -1549,20 +1646,28 @@
                public LinkAdder(IndexBrowserPanel indexBrowser, final 
AbstractButton actionSource) {
                        super(null, indexBrowser, actionSource);
                }
+               
+               public void setTargets(Vector nodes) {
+                       super.setTargets(nodes);
+                       
+                       if (nodes == null || nodes.size() != 1)
+                               getActionSource().setEnabled(false);
+                       else
+                               setTarget((IndexTreeNode)nodes.get(0));
+               }

                public void setTarget(final IndexTreeNode node) {
-                       super.setTarget(node);
-
                        if (getActionSource() != null)
                                getActionSource().setEnabled((node != null) && 
(node instanceof Index) && ((Index)node).isModifiable());
                }

-               public void apply() {
+               public void apply(IndexTreeNode target) {
                        final IndexSelecter indexSelecter = new 
IndexSelecter(getIndexBrowserPanel());
-                       final String indexKey = 
indexSelecter.askForAnIndexURI(getIndexBrowserPanel().getDb());
+                       final String[] indexKeys = 
indexSelecter.askForIndexURIs(getIndexBrowserPanel().getDb());

-                       if (indexKey != null) {
-                               
IndexManagementHelper.addLink(getIndexBrowserPanel(), (Index)getTarget(), 
indexKey);
+                       if (indexKeys != null) {
+                               for (int i = 0 ; i < indexKeys.length ; i++)
+                                       
IndexManagementHelper.addLink(getIndexBrowserPanel(), (Index)target, 
indexKeys[i]);
                        }
                }
        }
@@ -1612,20 +1717,31 @@
                        super(null, indexBrowser, actionSource);
                }

-               public void setTarget(final IndexTreeNode node) {
-                       super.setTarget(node);
-                       getActionSource().setEnabled(node != null && node 
instanceof IndexFolder);
-               }
+               public void setTargets(final Vector nodes) {
+                       super.setTargets(nodes);

-               public void apply() {
-                       if (getTarget() != null && getTarget() instanceof 
IndexFolder) {
-                               ((IndexFolder)getTarget()).reorder();
-                               ((IndexFolder)getTarget()).forceReload();
-                               
getIndexBrowserPanel().getIndexTree().refresh(getTarget());
+                       boolean e = false;
+                       
+                       if (nodes != null) {
+                               for (Iterator it = nodes.iterator() ; 
it.hasNext() ; ) {
+                                       if (it.next() instanceof IndexFolder)
+                                               e = true;
+                               }
                        }
-                       else
-                               Logger.notice(this, "No target ?!");
+                       
+                       e = e && nodes.size() > 0;
+                       
+                       getActionSource().setEnabled(e);
                }
+
+               public void apply(IndexTreeNode target) {
+                       if (!(target instanceof IndexFolder))
+                               return;
+                       
+                       ((IndexFolder)target).reorder();
+                       ((IndexFolder)target).forceReload();
+                       getIndexBrowserPanel().getIndexTree().refresh(target);
+               }
        }


@@ -1639,6 +1755,7 @@
                private JButton okButton;
                private JButton cancelButton;

+               private IndexTreeNode target;

                public IndexCommentAdder(FCPQueueManager queueManager,
                                         IndexBrowserPanel indexBrowser,
@@ -1648,11 +1765,17 @@
                        if (actionSource != null)
                                actionSource.setEnabled(false);
                }
+               
+               public void setTargets(Vector nodes) {
+                       super.setTargets(nodes);
+                       
+                       if (nodes == null || nodes.size() != 1)
+                               getActionSource().setEnabled(false);
+                       else
+                               setTarget((IndexTreeNode)nodes.get(0));
+               }

-
                public void setTarget(final IndexTreeNode node) {
-                       super.setTarget(node);
-
                        if (getActionSource() != null) {
                                getActionSource().setEnabled(node != null
                                                             && node instanceof 
Index
@@ -1722,7 +1845,7 @@
                        }

                        if (e.getSource() == okButton) {
-                               if (getTarget() instanceof Index) {
+                               if (target instanceof Index) {
                                        Identity i = 
((Identity)author.getSelectedItem());

                                        if (i == null) {
@@ -1731,7 +1854,7 @@
                                                return;
                                        }

-                                       
((Index)getTarget()).postComment(getQueueManager(),
+                                       
((Index)target).postComment(getQueueManager(),
                                                                         
getIndexBrowserPanel().getMainWindow(),
                                                                         i,
                                                                         
textArea.getText().trim());
@@ -1755,7 +1878,8 @@
                }


-               public void apply() {
+               public void apply(IndexTreeNode target) {
+                       this.target = target;
                        showDialog();
                }
        }
@@ -1769,17 +1893,23 @@
                                actionSource.setEnabled(false);
                }

+               public void setTargets(Vector nodes) {
+                       super.setTargets(nodes);
+                       
+                       if (nodes == null || nodes.size() != 1)
+                               getActionSource().setEnabled(false);
+                       else
+                               setTarget((IndexTreeNode)nodes.get(0));
+               }

                public void setTarget(final IndexTreeNode node) {
-                       super.setTarget(node);
-
                        if (getActionSource() != null)
                                getActionSource().setEnabled(node != null
                                                             && node instanceof 
Index
                                                             && 
((Index)node).canHaveComments());
                }

-               public void apply() {
+               public void apply(IndexTreeNode target) {
                        getIndexBrowserPanel().getCommentTab().showTab();
                }
        }
@@ -1796,11 +1926,18 @@
                        if (actionSource != null)
                                actionSource.setEnabled(false);
                }
+               
+               public void setTargets(Vector nodes) {
+                       super.setTargets(nodes);
+                       
+                       if (nodes == null || nodes.size() != 1)
+                               getActionSource().setEnabled(false);
+                       else
+                               setTarget((IndexTreeNode)nodes.get(0));
+               }


                public void setTarget(final IndexTreeNode node) {
-                       super.setTarget(node);
-
                        getActionSource().setEnabled(node != null);
                }

@@ -1870,8 +2007,8 @@
                }


-               public void apply() {
-                       IndexTreeNode node = getTarget();
+               public void apply(IndexTreeNode target) {
+                       IndexTreeNode node = target;

                        Hsqldb db = getIndexBrowserPanel().getDb();
                        PreparedStatement st;
@@ -1979,12 +2116,14 @@
                        button.setEnabled(false);
                }

-               public void setTarget(IndexTreeNode node) {
-                       if (node == null) {
+               public void setTargets(Vector nodes) {
+                       if (nodes == null || nodes.size() != 1) {
                                button.setText("N/A");
                                return;
                        }

+                       IndexTreeNode node = (IndexTreeNode)nodes.get(0);
+
                        if (node instanceof Index)
                                button.setText(((Index)node).toString(false));
                        else

Modified: trunk/apps/Thaw/src/thaw/plugins/index/IndexSelecter.java
===================================================================
--- trunk/apps/Thaw/src/thaw/plugins/index/IndexSelecter.java   2008-02-17 
01:54:32 UTC (rev 18021)
+++ trunk/apps/Thaw/src/thaw/plugins/index/IndexSelecter.java   2008-02-17 
03:42:35 UTC (rev 18022)
@@ -3,12 +3,15 @@

 import java.awt.BorderLayout;
 import java.awt.GridLayout;
+import java.util.Iterator;
+import java.util.Vector;

 import javax.swing.JButton;
 import javax.swing.JFrame;
 import javax.swing.JLabel;
 import javax.swing.JPanel;
-import javax.swing.JTextField;
+import javax.swing.JScrollPane;
+import javax.swing.JTextArea;

 import thaw.core.I18n;
 import thaw.core.Logger;
@@ -45,14 +48,14 @@
        private IndexTree indexTree;

        private JPanel fieldPanel;
-       private JTextField keyField;
+       private JTextArea keyArea;

        private JPanel downPanel;
        private JButton cancelButton;
        private JButton okButton;

        private boolean closeWin;
-       private String selectedIndexKey = null;
+       private String[] selectedIndexKeys = null;

        private IndexBrowserPanel indexBrowser;

@@ -63,7 +66,7 @@
        /**
         * Returned null if canceled. Is blocking !
         */
-       public String askForAnIndexURI(final Hsqldb db) {
+       public String[] askForIndexURIs(final Hsqldb db) {
                frame = new 
JFrame(I18n.getMessage("thaw.plugin.index.selectIndex"));

                frame.setVisible(false);
@@ -74,7 +77,7 @@
                Logger.info(this, "plus indexes");

                fieldPanel = new JPanel();
-               keyField = new JTextField("");
+               keyArea = new JTextArea("");

                downPanel = new JPanel();
                cancelButton = new 
JButton(I18n.getMessage("thaw.common.cancel"));
@@ -90,9 +93,15 @@


                upPanel.add(indexPanel, BorderLayout.CENTER);
-
-               fieldPanel.add(new 
JLabel(I18n.getMessage("thaw.plugin.index.indexKey")), BorderLayout.WEST);
-               fieldPanel.add(keyField, BorderLayout.CENTER);
+               
+               JScrollPane sp = new JScrollPane(keyArea);
+               
+               keyArea.setSize(100, 100);
+               sp.setSize(100, 100);
+               sp.setPreferredSize(new java.awt.Dimension(100, 100));
+               
+               fieldPanel.add(new 
JLabel(I18n.getMessage("thaw.plugin.index.indexKey")), BorderLayout.NORTH);
+               fieldPanel.add(sp, BorderLayout.CENTER);
                upPanel.add(fieldPanel, BorderLayout.SOUTH);

                downPanel.add(okButton);
@@ -102,7 +111,13 @@
                frame.getContentPane().add(upPanel, BorderLayout.CENTER);
                frame.getContentPane().add(downPanel, BorderLayout.SOUTH);

-               frame.setSize(500, 400);
+               frame.setSize(600, 600);
+               
+               keyArea.setSize(100, 100);
+               sp.setSize(100, 100);
+               sp.setPreferredSize(new java.awt.Dimension(100, 100));
+               
+               selectedIndexKeys = null;

                cancelButton.addActionListener(this);
                okButton.addActionListener(this);
@@ -119,6 +134,7 @@
                }

                frame.setVisible(false);
+               frame.dispose();

                frame = null;

@@ -126,37 +142,53 @@
                indexTree = null;

                fieldPanel = null;
-               keyField = null;
+               keyArea = null;

                downPanel = null;
                cancelButton = null;
                okButton = null;

-               return FreenetURIHelper.cleanURI(selectedIndexKey);
+               //return FreenetURIHelper.cleanURI(selectedIndexKey);
+               return selectedIndexKeys;
        }


        public void update(final java.util.Observable o, final Object param) {
-               if (param instanceof Index) {
-                       final Index index = (Index)param;
-                       selectedIndexKey = index.getPublicKey();
+               if (param instanceof Vector) {
+                       keyArea.setText("");
+                       
+                       for (Iterator it = ((Vector)param).iterator(); 
it.hasNext(); ) {
+                               IndexTreeNode node = (IndexTreeNode)it.next();
+                               
+                               if (node instanceof Index) {
+                                       final Index index = (Index)node;
+                                       final String key = index.getPublicKey();

-                       Logger.info(this, "Selected index key: 
"+selectedIndexKey);
-                       keyField.setText(selectedIndexKey);
+                                       Logger.info(this, "Selected index key: 
"+key);
+                                       
keyArea.setText(keyArea.getText()+key+"\n");
+                               }
+                       }                       
                }
+               
        }

        public void actionPerformed(final java.awt.event.ActionEvent e) {
                if (e.getSource() == okButton) {
-                       if ((keyField.getText() == null) || "".equals( 
keyField.getText() ))
-                               selectedIndexKey = null;
-                       else
-                               selectedIndexKey = keyField.getText();
+                       if ((keyArea.getText() == null) || "".equals( 
keyArea.getText() ))
+                               selectedIndexKeys = null;
+                       else {
+                               selectedIndexKeys = 
keyArea.getText().trim().split("\n");
+                               
+                               for (int i = 0 ; i < selectedIndexKeys.length ; 
i++) {
+                                       selectedIndexKeys[i] = 
FreenetURIHelper.cleanURI(selectedIndexKeys[i]);                                
 
+                               }
+                               
+                       }
                        closeWin = true;
                }

                if (e.getSource() == cancelButton) {
-                       selectedIndexKey = null;
+                       selectedIndexKeys = null;
                        closeWin = true;
                }


Modified: trunk/apps/Thaw/src/thaw/plugins/index/IndexTree.java
===================================================================
--- trunk/apps/Thaw/src/thaw/plugins/index/IndexTree.java       2008-02-17 
01:54:32 UTC (rev 18021)
+++ trunk/apps/Thaw/src/thaw/plugins/index/IndexTree.java       2008-02-17 
03:42:35 UTC (rev 18022)
@@ -22,6 +22,7 @@
 import javax.swing.JPopupMenu;
 import javax.swing.JScrollPane;
 import javax.swing.JTree;
+import javax.swing.event.TreeSelectionEvent;
 import javax.swing.tree.DefaultMutableTreeNode;
 import javax.swing.tree.DefaultTreeCellRenderer;
 import javax.swing.tree.DefaultTreeModel;
@@ -89,7 +90,7 @@

        private boolean selectionOnly;

-       private IndexTreeNode selectedNode = null;
+       private Vector selectedNodes = null;

        private DefaultTreeModel treeModel;

@@ -133,14 +134,15 @@

                if (!selectionOnly) {
                        tree = new JDragTree(treeModel);
-                       tree.addMouseListener(this);
                } else {
                        tree = new JTree(treeModel);
-                       //tree.addMouseListener(this);
                }
+               
+               tree.addMouseListener(this);
+               tree.addTreeSelectionListener(this);

                tree.setCellRenderer(treeRenderer);
-               
tree.getSelectionModel().setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION);
+               
tree.getSelectionModel().setSelectionMode(TreeSelectionModel.DISCONTIGUOUS_TREE_SELECTION);
                tree.setExpandsSelectedPaths(true);

                // Menus :
@@ -329,9 +331,6 @@

                panel.add(new JScrollPane(tree), BorderLayout.CENTER);

-               addTreeSelectionListener(this);
-
-
                // Toolbar
                JButton button;
                IndexManagementHelper.IndexAction action;
@@ -343,42 +342,42 @@
                
button.setToolTipText(I18n.getMessage("thaw.plugin.index.downloadIndexes"));
                button.setMnemonic(KeyEvent.VK_R);
                action = new 
IndexManagementHelper.IndexDownloader(queueManager, indexBrowser, button);
-               action.setTarget(getRoot());
+               action.setTargets(null);
                toolbarModifier.addButtonToTheToolbar(button);
                toolbarActions.add(action);

                button = new JButton(IconBox.folderNew);
                
button.setToolTipText(I18n.getMessage("thaw.plugin.index.addCategory"));
                action = new 
IndexManagementHelper.IndexFolderAdder(indexBrowser, button);
-               action.setTarget(getRoot());
+               action.setTargets(null);
                toolbarModifier.addButtonToTheToolbar(button);
                toolbarActions.add(action);

                button = new JButton(IconBox.indexReuse);
                
button.setToolTipText(I18n.getMessage("thaw.plugin.index.addAlreadyExistingIndex"));
                action = new IndexManagementHelper.IndexReuser(queueManager, 
indexBrowser, button);
-               action.setTarget(getRoot());
+               action.setTargets(null);
                toolbarModifier.addButtonToTheToolbar(button);
                toolbarActions.add(action);

                button = new JButton(IconBox.indexNew);
                
button.setToolTipText(I18n.getMessage("thaw.plugin.index.createIndex"));
                action = new IndexManagementHelper.IndexCreator(queueManager, 
indexBrowser, button);
-               action.setTarget(getRoot());
+               action.setTargets(null);
                toolbarModifier.addButtonToTheToolbar(button);
                toolbarActions.add(action);

                button = new JButton(IconBox.indexSettings);
                
button.setToolTipText(I18n.getMessage("thaw.plugin.index.indexSettings"));
                action = new IndexManagementHelper.IndexModifier(queueManager, 
indexBrowser, button);
-               action.setTarget(getRoot());
+               action.setTargets(null);
                toolbarModifier.addButtonToTheToolbar(button);
                toolbarActions.add(action);

                button = new JButton(IconBox.copy);
                
button.setToolTipText(I18n.getMessage("thaw.plugin.index.copyKeys"));
                action = new IndexManagementHelper.PublicKeyCopier(button);
-               action.setTarget(null);
+               action.setTargets(null);
                toolbarModifier.addButtonToTheToolbar(button);
                toolbarActions.add(action);

@@ -386,14 +385,14 @@
                
button.setToolTipText(I18n.getMessage("thaw.plugin.index.addToBlackList"));
                button.setMnemonic(KeyEvent.VK_B);
                action = new 
IndexManagementHelper.IndexBlackLister(indexBrowser, button);
-               action.setTarget(getRoot());
+               action.setTargets(null);
                toolbarModifier.addButtonToTheToolbar(button);
                toolbarActions.add(action);

                button = new JButton(IconBox.delete);
                
button.setToolTipText(I18n.getMessage("thaw.plugin.index.delete"));
                action = new IndexManagementHelper.IndexDeleter(indexBrowser, 
button);
-               action.setTarget(getRoot());
+               action.setTargets(null);
                if (!selectionOnly)
                        
tree.addKeyListener((IndexManagementHelper.IndexDeleter)action);
                toolbarModifier.addButtonToTheToolbar(button);
@@ -405,14 +404,14 @@
                button = new JButton(IconBox.addToIndexAction);
                
button.setToolTipText(I18n.getMessage("thaw.plugin.index.addFilesWithoutInserting"));
                action = new IndexManagementHelper.FileAdder(config, 
queueManager, indexBrowser, button);
-               action.setTarget(null);
+               action.setTargets(null);
                toolbarModifier.addButtonToTheToolbar(button);
                toolbarActions.add(action);

                button = new JButton(IconBox.makeALinkAction);
                
button.setToolTipText(I18n.getMessage("thaw.plugin.index.addLink"));
                action = new IndexManagementHelper.LinkAdder(indexBrowser, 
button);
-               action.setTarget(getRoot());
+               action.setTargets(null);
                toolbarModifier.addButtonToTheToolbar(button);
                toolbarActions.add(action);
        }
@@ -438,45 +437,72 @@
        public void addTreeSelectionListener(final 
javax.swing.event.TreeSelectionListener tsl) {
                tree.addTreeSelectionListener(tsl);
        }
+       
+       public void checkSelection() {
+               
+               final TreePath[] paths = tree.getSelectionPaths();

-       public void valueChanged(final javax.swing.event.TreeSelectionEvent e) {
-               final TreePath path = e.getPath();
-
-               if(path == null)
+               if(paths == null)
                        return;
+                       
+               selectedNodes = new Vector();
+               
+               for (int i = 0 ; i < paths.length ; i++) {
+                       selectedNodes.add(paths[i].getLastPathComponent());
+               }

-               selectedNode = (IndexTreeNode)(path.getLastPathComponent());
+               indexBrowser.getDetailPanel().setTargets(selectedNodes);

-               indexBrowser.getDetailPanel().setTarget(selectedNode);
-
                // Update toolbar
                for (final Iterator it = toolbarActions.iterator();
                     it.hasNext(); ) {
                        final IndexManagementHelper.IndexAction action = 
(IndexManagementHelper.IndexAction)it.next();
-                       action.setTarget(selectedNode);
+                       action.setTargets(selectedNodes);
                }
+               
+               // Update nodes
+               
+               for (int i = 0 ; i < paths.length ; i++) {
+                       IndexTreeNode selectedNode = 
(IndexTreeNode)paths[i].getLastPathComponent();
+                       
+                       if ((indexBrowser != null) && (selectedNode instanceof 
Index)) {
+                               
indexBrowser.getUnknownIndexList().addLinks(((Index)selectedNode));

+                               if (((Index)selectedNode).hasChanged()) {
+                                       
((Index)selectedNode).setHasChangedFlag(false);
+                                       redraw(paths[i]);
+                               }

+                               if (((Index)selectedNode).hasNewComment()) {
+                                       
((Index)selectedNode).setNewCommentFlag(false);
+                                       redraw(paths[i]);
+                               }
+                       }
+               }
+
+               toolbarModifier.displayButtonsInTheToolbar();
+
                // Notify observers

                setChanged();
-               notifyObservers(selectedNode); /* will make the toolbar visible 
*/
+               notifyObservers(selectedNodes); /* will make the toolbar 
visible */
        }


-       public void updateMenuState(final IndexTreeNode node) {
+       public void updateMenuState(final Vector nodes) {
                IndexManagementHelper.IndexAction action;
+               

                for(final Iterator it = indexFolderActions.iterator();
                    it.hasNext();) {
                        action = (IndexManagementHelper.IndexAction)it.next();
-                       action.setTarget(node);
+                       action.setTargets(nodes);
                }

                for(final Iterator it = indexAndFileActions.iterator();
                    it.hasNext();) {
                        action = (IndexManagementHelper.IndexAction)it.next();
-                       action.setTarget(node);
+                       action.setTargets(nodes);
                }
        }

@@ -490,7 +516,7 @@
        }

        public void mouseClicked(final MouseEvent e) {
-               notifySelection(e);
+               checkSelection();
        }

        public void mouseEntered(final MouseEvent e) { }
@@ -508,54 +534,19 @@

        protected void showPopupMenu(final MouseEvent e) {
                if(e.isPopupTrigger()) {
-                       if(selectedNode == null)
+                       if(selectedNodes == null)
                                return;
+                       
+                       updateMenuState(selectedNodes);

-                       if(selectedNode instanceof IndexFolder) {
-                               updateMenuState(selectedNode);
+                       if(selectedNodes.size() == 1 && selectedNodes.get(0) 
instanceof IndexFolder) {
                                indexFolderMenu.show(e.getComponent(), 
e.getX(), e.getY());
-                       }
-
-                       if(selectedNode instanceof Index) {
-                               updateMenuState(selectedNode);
+                       } else if(selectedNodes.size() >= 1) {
                                indexAndFileMenu.show(e.getComponent(), 
e.getX(), e.getY());
                        }
                }
        }

-       public void notifySelection(final MouseEvent e) {
-               final TreePath path = tree.getPathForLocation(e.getX(), 
e.getY());
-
-               if(path == null)
-                       return;
-
-               selectedNode = (IndexTreeNode)(path.getLastPathComponent());
-
-               if (selectedNode != null) {
-                       if ((indexBrowser != null) && (selectedNode instanceof 
Index)) {
-                               
indexBrowser.getUnknownIndexList().addLinks(((Index)selectedNode));
-                       }
-
-                       if (selectedNode instanceof Index) {
-                               if (((Index)selectedNode).hasChanged()) {
-                                       
((Index)selectedNode).setHasChangedFlag(false);
-                                       redraw(path);
-                               }
-
-                               if (((Index)selectedNode).hasNewComment()) {
-                                       
((Index)selectedNode).setNewCommentFlag(false);
-                                       redraw(path);
-                               }
-                       }
-
-               }
-
-               toolbarModifier.displayButtonsInTheToolbar();
-
-               setChanged();
-               notifyObservers(selectedNode);
-       }
-
        public IndexTreeNode getSelectedNode() {
                final Object obj = tree.getLastSelectedPathComponent();

@@ -575,8 +566,7 @@


        public void actionPerformed(final ActionEvent e) {
-               if(selectedNode == null)
-                       selectedNode = root;
+
        }


@@ -918,4 +908,9 @@
        public boolean isIndexUpdating(Index index) {
                return (updatingIndexes.indexOf(new Integer(index.getId())) >= 
0);
        }
+
+
+       public void valueChanged(TreeSelectionEvent arg0) {
+               checkSelection();               
+       }
 }

Modified: trunk/apps/Thaw/src/thaw/plugins/index/SearchBar.java
===================================================================
--- trunk/apps/Thaw/src/thaw/plugins/index/SearchBar.java       2008-02-17 
01:54:32 UTC (rev 18021)
+++ trunk/apps/Thaw/src/thaw/plugins/index/SearchBar.java       2008-02-17 
03:42:35 UTC (rev 18022)
@@ -54,6 +54,7 @@
                userText.setSelectionStart(0);
                userText.setSelectionEnd(userText.getText().length());

+               /* TOFIX : Make it possible to search in many indexes at once ! 
*/
                IndexTreeNode node = 
indexBrowser.getIndexTree().getSelectedNode();

                if (node == null)


Reply via email to