From: jprocter Date: Mon, 21 Jun 2010 10:15:25 +0000 (+0000) Subject: ensure service menu is rebuilt after update listeners registered, and flatten JWS2... X-Git-Tag: Release_2_6~168 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=7ac3fac5daad2af7e538b199dc015737f12a22b1;p=jalview.git ensure service menu is rebuilt after update listeners registered, and flatten JWS2 service tree. --- 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)); + } } } }