+/*
+ * Jalview - A Sequence Alignment Editor and Viewer ($$Version-Rel$$)
+ * Copyright (C) $$Year-Rel$$ The Jalview Authors
+ *
+ * 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 <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ */
package jalview.gui;
import java.awt.event.ActionEvent;
AlignmentPanel ap)
{
this();
- openNewPymol(ap, new PDBEntry[] { pdb },
- new SequenceI[][]
- { seqs });
+ openNewPymol(ap, new PDBEntry[] { pdb }, new SequenceI[][] { seqs });
}
public PymolViewer(PDBEntry[] pe, boolean alignAdded, SequenceI[][] seqs,
public void run()
{
// todo pull up much of this
-
+
StringBuilder errormsgs = new StringBuilder(128);
List<PDBEntry> filePDB = new ArrayList<>();
List<Integer> filePDBpos = new ArrayList<>();
- String[] curfiles = binding.getStructureFiles(); // files currently in viewer
+ String[] curfiles = binding.getStructureFiles(); // files currently in
+ // viewer
for (int pi = 0; pi < binding.getPdbCount(); pi++)
{
String file = null;
/*
* got file already
*/
- file = new File(thePdbEntry.getFile()).getAbsoluteFile()
- .getPath();
+ file = new File(thePdbEntry.getFile()).getAbsoluteFile().getPath();
// todo - skip if already loaded in PyMOL
}
if (file != null)
filePDBpos.add(Integer.valueOf(pi));
}
}
-
+
if (!filePDB.isEmpty())
{
/*
return;
}
}
+ if (!binding.isViewerRunning())
+ {
+ // nothing to do
+ // TODO: ensure we tidy up JAL-3619
+
+ return;
+ }
+
int num = -1;
for (PDBEntry pe : filePDB)
{
StructureFile pdb = binding.getSsm().setMapping(
binding.getSequence()[pos], binding.getChains()[pos],
- pe.getFile(), protocol,
- getProgressIndicator());
+ pe.getFile(), protocol, getProgressIndicator());
binding.stashFoundChains(pdb, pe.getFile());
} catch (Exception ex)
{
- Console.error(
- "Couldn't open " + pe.getFile() + " in Chimera viewer!",
- ex);
+ Console.error("Couldn't open " + pe.getFile() + " in "
+ + getViewerName() + "!", ex);
} finally
{
// Cache.debug("File locations are " + files);
boolean opened = binding.openSession(pymolSessionFile);
if (!opened)
{
- Console.error(
- "An error occurred opening PyMOL session file "
+ Console.error("An error occurred opening PyMOL session file "
+ pymolSessionFile);
}
}
{
return "PyMOL";
}
+
JMenuItem writeFeatures = null;
+
@Override
protected void initMenus()
{
writeFeatures = new JMenuItem(
MessageManager.getString("label.create_viewer_attributes"));
- writeFeatures.setToolTipText(MessageManager
- .getString("label.create_viewer_attributes_tip"));
+ writeFeatures.setToolTipText(
+ MessageManager.getString("label.create_viewer_attributes_tip"));
writeFeatures.addActionListener(new ActionListener()
{
@Override
});
viewerActionMenu.add(writeFeatures);
}
-
+
@Override
protected void buildActionMenu()
{
protected void sendFeaturesToPymol()
{
int count = binding.sendFeaturesToViewer(getAlignmentPanel());
- statusBar.setText(
- MessageManager.formatMessage("label.attributes_set", count, getViewerName()));
+ statusBar.setText(MessageManager.formatMessage("label.attributes_set",
+ count, getViewerName()));
}
}