X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;ds=sidebyside;f=src%2Fjalview%2Fgui%2FPopupMenu.java;h=3c32180ed65672a53b5ca215ae77487d7b7fdb9f;hb=747167089ecf8d6afc70d417f5a20352e029bd95;hp=7b284a925da0a96e19527a8068606f04e0360a67;hpb=0aa7f6fab658c9a203b410d4bead72217da5c9a0;p=jalview.git
diff --git a/src/jalview/gui/PopupMenu.java b/src/jalview/gui/PopupMenu.java
index 7b284a9..3c32180 100644
--- a/src/jalview/gui/PopupMenu.java
+++ b/src/jalview/gui/PopupMenu.java
@@ -56,7 +56,7 @@ import jalview.analysis.AlignmentAnnotationUtils;
import jalview.analysis.AlignmentUtils;
import jalview.analysis.Conservation;
import jalview.api.AlignViewportI;
-import jalview.bin.Cache;
+import jalview.bin.Console;
import jalview.commands.ChangeCaseCommand;
import jalview.commands.EditCommand;
import jalview.commands.EditCommand.Action;
@@ -66,11 +66,13 @@ import jalview.datamodel.DBRefEntry;
import jalview.datamodel.HiddenColumns;
import jalview.datamodel.MappedFeatures;
import jalview.datamodel.PDBEntry;
+import jalview.datamodel.ResidueCount;
import jalview.datamodel.SequenceFeature;
import jalview.datamodel.SequenceGroup;
import jalview.datamodel.SequenceI;
import jalview.gui.ColourMenuHelper.ColourChangeListener;
import jalview.gui.JalviewColourChooser.ColourChooserListener;
+import jalview.io.CountReader;
import jalview.io.FileFormatI;
import jalview.io.FileFormats;
import jalview.io.FormatAdapter;
@@ -89,6 +91,8 @@ import jalview.util.StringUtils;
import jalview.util.UrlLink;
import jalview.viewmodel.seqfeatures.FeatureRendererModel;
+import java.io.IOException;
+import java.net.MalformedURLException;
/**
* The popup menu that is displayed on right-click on a sequence id, or in the
* sequence alignment.
@@ -230,13 +234,13 @@ public class PopupMenu extends JPopupMenu implements ColourChangeListener
urlLink = new UrlLink(link);
} catch (Exception foo)
{
- Cache.log.error("Exception for URLLink '" + link + "'", foo);
+ Console.error("Exception for URLLink '" + link + "'", foo);
continue;
}
if (!urlLink.isValid())
{
- Cache.log.error(urlLink.getInvalidMessage());
+ Console.error(urlLink.getInvalidMessage());
continue;
}
@@ -303,7 +307,7 @@ public class PopupMenu extends JPopupMenu implements ColourChangeListener
jalview.util.BrowserLauncher.openURL(url);
} catch (Exception ex)
{
- JvOptionPane.showInternalMessageDialog(Desktop.desktop,
+ JvOptionPane.showInternalMessageDialog(Desktop.getDesktopPane(),
MessageManager.getString("label.web_browser_not_found_unix"),
MessageManager.getString("label.web_browser_not_found"),
JvOptionPane.WARNING_MESSAGE);
@@ -547,6 +551,35 @@ public class PopupMenu extends JPopupMenu implements ColourChangeListener
}
}
+ if (seq.hasHMMProfile())
+ {
+ menuItem = new JMenuItem(MessageManager
+ .getString("action.add_background_frequencies"));
+ menuItem.addActionListener(new ActionListener()
+ {
+ @Override
+ public void actionPerformed(ActionEvent e)
+ {
+ try
+ {
+ ResidueCount counts = CountReader.getBackgroundFrequencies(ap,
+ seq);
+ if (counts != null)
+ {
+ seq.getHMM().setBackgroundFrequencies(counts);
+ ap.alignFrame.buildColourMenu();
+ }
+ } catch (MalformedURLException e1)
+ {
+ e1.printStackTrace();
+ } catch (IOException e1)
+ {
+ e1.printStackTrace();
+ }
+ }
+ });
+ add(menuItem);
+ }
menuItem = new JMenuItem(
MessageManager.getString("action.hide_sequences"));
menuItem.addActionListener(new ActionListener()
@@ -670,8 +703,10 @@ public class PopupMenu extends JPopupMenu implements ColourChangeListener
{
buildGroupURLMenu(sg, groupLinks);
}
+ // TODO REMOVE FOR 2.12 ?
// Add a 'show all structures' for the current selection
- Hashtable" + MessageManager.formatMessage(
"label.create_sequence_details_report_annotation_for",
new Object[]
- { seq.getDisplayId(true) }) + "
"); + { seq.getDisplayId(true) }) + "
\n"); new SequenceAnnotationReport(false).createSequenceAnnotationReport( contents, seq, true, true, ap.getSeqPanel().seqCanvas.fr); contents.append("
"); @@ -2046,8 +2081,7 @@ public class PopupMenu extends JPopupMenu implements ColourChangeListener ap.paintAlignment(false, false); } sequence.setDescription(dialog.getDescription()); - ap.av.firePropertyChange("alignment", null, - ap.av.getAlignment().getSequences()); + ap.av.notifyAlignment(); } }); } @@ -2089,7 +2123,7 @@ public class PopupMenu extends JPopupMenu implements ColourChangeListener refresh(); } }; - JalviewColourChooser.showColourChooser(Desktop.getDesktop(), + JalviewColourChooser.showColourChooser(Desktop.getDesktopPane(), title, Color.BLUE, listener); } @@ -2178,9 +2212,8 @@ public class PopupMenu extends JPopupMenu implements ColourChangeListener startEnd, caseChange); ap.alignFrame.addHistoryItem(caseCommand); + ap.av.notifyAlignment(); - ap.av.firePropertyChange("alignment", null, - ap.av.getAlignment().getSequences()); } } @@ -2287,8 +2320,7 @@ public class PopupMenu extends JPopupMenu implements ColourChangeListener sg.getStartRes(), sg.getEndRes() + 1, ap.av.getAlignment()); ap.alignFrame.addHistoryItem(editCommand); - ap.av.firePropertyChange("alignment", null, - ap.av.getAlignment().getSequences()); + ap.av.notifyAlignment(); } }); }