From 7ac3fac5daad2af7e538b199dc015737f12a22b1 Mon Sep 17 00:00:00 2001 From: jprocter Date: Mon, 21 Jun 2010 10:15:25 +0000 Subject: [PATCH] ensure service menu is rebuilt after update listeners registered, and flatten JWS2 service tree. --- src/jalview/gui/AlignFrame.java | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/src/jalview/gui/AlignFrame.java b/src/jalview/gui/AlignFrame.java index 6ee243e..ca4a48b 100755 --- a/src/jalview/gui/AlignFrame.java +++ b/src/jalview/gui/AlignFrame.java @@ -516,10 +516,8 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, private void addServiceListeners() { final java.beans.PropertyChangeListener thisListener; - // Do this once to get current state - BuildWebServiceMenu(); Desktop.instance.addJalviewPropertyChangeListener("services", - thisListener=new java.beans.PropertyChangeListener() + thisListener = new java.beans.PropertyChangeListener() { public void propertyChange(PropertyChangeEvent evt) { @@ -547,10 +545,13 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, javax.swing.event.InternalFrameEvent evt) { System.out.println("deregistering discoverer listener"); - Desktop.instance.removeJalviewPropertyChangeListener("services",thisListener); + Desktop.instance.removeJalviewPropertyChangeListener("services", + thisListener); closeMenuItem_actionPerformed(true); }; }); + // Finally, build the menu once to get current service state + BuildWebServiceMenu(); } public void setGUINucleotide(boolean nucleotide) @@ -3900,7 +3901,10 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, { JMenu jws2men = new JMenu("Jalview 2 Services"); jws2servs.attachWSMenuEntry(jws2men, this); - wsmenu.add(jws2men); + for (int i = 0, iSize = jws2men.getMenuComponentCount(); i < iSize; i++) + { + wsmenu.add(jws2men.getMenuComponent(i)); + } } } } -- 1.7.10.2