import jalview.analysis.AlignmentAnnotationUtils;
import jalview.analysis.AlignmentUtils;
import jalview.analysis.Conservation;
-import jalview.bin.Cache;
+import jalview.bin.JalviewLite;
import jalview.commands.ChangeCaseCommand;
import jalview.commands.EditCommand;
import jalview.commands.EditCommand.Action;
import jalview.datamodel.SequenceGroup;
import jalview.datamodel.SequenceI;
import jalview.io.AppletFormatAdapter;
+import jalview.io.DataSourceType;
+import jalview.io.FileFormat;
import jalview.io.SequenceAnnotationReport;
import jalview.schemes.Blosum62ColourScheme;
import jalview.schemes.BuriedColourScheme;
e.printStackTrace();
}
- for (int i = 0; i < jalview.io.AppletFormatAdapter.WRITEABLE_FORMATS.length; i++)
+ for (String ff : FileFormat.getWritableFormats(true))
{
- MenuItem item = new MenuItem(
- jalview.io.AppletFormatAdapter.WRITEABLE_FORMATS[i]);
+ MenuItem item = new MenuItem(ff);
item.addActionListener(this);
outputmenu.add(item);
urlLink = new UrlLink(link);
} catch (Exception foo)
{
- Cache.log.error("Exception for URLLink '" + link + "'", foo);
+ System.err.println("Exception for URLLink '" + link + "': "
+ + foo.getMessage());
continue;
}
if (!urlLink.isValid())
{
- Cache.log.error(urlLink.getInvalidMessage());
+ System.err.println(urlLink.getInvalidMessage());
continue;
}
addshowLinks(linkMenu, linkset.values());
+ // disable link menu if there are no valid entries
if (linkMenu.getItemCount() > 0)
{
- if (seq != null)
- {
- seqMenu.add(linkMenu);
- }
- else
- {
- add(linkMenu);
- }
+ linkMenu.setEnabled(true);
}
+ else
+ {
+ linkMenu.setEnabled(false);
+ }
+
+ if (seq != null)
+ {
+ seqMenu.add(linkMenu);
+ }
+ else
+ {
+ add(linkMenu);
+ }
+
}
private void addshowLinks(Menu linkMenu, Collection<List<String>> linkset)
Frame frame = new Frame();
frame.add(cap);
- jalview.bin.JalviewLite.addFrame(frame, MessageManager.formatMessage(
+ JalviewLite.addFrame(frame, MessageManager.formatMessage(
"label.selection_output_command",
new Object[] { e.getActionCommand() }), 600, 500);
// JBPNote: getSelectionAsNewSequence behaviour has changed - this method
// now returns a full copy of sequence data
// TODO consider using getSequenceSelection instead here
- cap.setText(new jalview.io.AppletFormatAdapter().formatSequences(
- e.getActionCommand(), ap.av.getShowJVSuffix(), ap, true));
+ FileFormat fileFormat = FileFormat.valueOf(e.getActionCommand());
+ cap.setText(new AppletFormatAdapter().formatSequences(fileFormat,
+ ap.av.getShowJVSuffix(), ap, true));
}
CutAndPasteTransfer cap = new CutAndPasteTransfer(false, ap.alignFrame);
- StringBuffer contents = new StringBuffer();
+ StringBuilder contents = new StringBuilder(128);
for (SequenceI seq : sequences)
{
contents.append(MessageManager.formatMessage(
seq,
true,
true,
- false,
(ap.seqPanel.seqCanvas.fr != null) ? ap.seqPanel.seqCanvas.fr
.getMinMax() : null);
contents.append("</p>");
void addPDB()
{
- if (seq.getAllPDBEntries() != null)
+ Vector<PDBEntry> pdbs = seq.getAllPDBEntries();
+ if (pdbs != null&& !pdbs.isEmpty())
{
- PDBEntry entry = seq.getAllPDBEntries().firstElement();
+ PDBEntry entry = pdbs.firstElement();
if (ap.av.applet.jmolAvailable)
{
new jalview.appletgui.AppletJmol(entry, new SequenceI[] { seq },
- null, ap, AppletFormatAdapter.URL);
+ null, ap, DataSourceType.URL);
}
else
{
new MCview.AppletPDBViewer(entry, new SequenceI[] { seq }, null,
- ap, AppletFormatAdapter.URL);
+ ap, DataSourceType.URL);
}
}
if (conservationMenuItem.getState())
{
-
- sg.cs.setConservation(Conservation.calculateConservation("Group", 3,
- sg.getSequences(ap.av.getHiddenRepSequences()), 0, ap.av
- .getAlignment().getWidth(), false, ap.av
- .getConsPercGaps(), false));
+ sg.cs.setConservation(Conservation.calculateConservation("Group", sg
+ .getSequences(ap.av.getHiddenRepSequences()), 0, ap.av
+ .getAlignment().getWidth(), false, ap.av.getConsPercGaps(),
+ false));
SliderPanel.setConservationSlider(ap, sg.cs, sg.getName());
SliderPanel.showConservationSlider();
}