X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fgui%2FViewSelectionMenu.java;h=26c52c991b5a303c321c66e28d85979118aa45c9;hb=e33b171845992fd21094ba754498f9ab3d29f110;hp=f58a816e03159366d66dbb47464370f84b2dc6c8;hpb=d35615977a165ed5a0710e5f747218d03499cd73;p=jalview.git diff --git a/src/jalview/gui/ViewSelectionMenu.java b/src/jalview/gui/ViewSelectionMenu.java index f58a816..26c52c9 100644 --- a/src/jalview/gui/ViewSelectionMenu.java +++ b/src/jalview/gui/ViewSelectionMenu.java @@ -1,3 +1,20 @@ +/******************************************************************************* + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7) + * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle + * + * This file is part of Jalview. + * + * Jalview is free software: you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. + * + * Jalview is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty + * of MERCHANTABILITY or FITNESS FOR A PARTICULAR + * PURPOSE. See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with Jalview. If not, see . + *******************************************************************************/ package jalview.gui; import java.awt.Component; @@ -121,9 +138,10 @@ public class ViewSelectionMenu extends JMenu } if (allviews.length >= 2) { - + // ensure we update menu state to reflect external selection list state + append = append || _selectedviews.size()>1; toggleview = new JCheckBoxMenuItem("Select many views",append); - toggleview.setToolTipText("When selected, toggles whether a particular view is used to colour the alignment."); + toggleview.setToolTipText("When enabled, allows many views to be selected."); toggleview.addItemListener(new ItemListener() { @Override @@ -201,14 +219,19 @@ public class ViewSelectionMenu extends JMenu { if (append) { - if (e.getStateChange() == e.SELECTED) + enabled=false; + // toggle the inclusion state + if (_selectedviews.indexOf(p)==-1) { _selectedviews.add(p); + a.setSelected(true); } else { _selectedviews.remove(p); + a.setSelected(false); } + enabled=true; _handler.itemStateChanged(e); } else