git://source.jalview.org
/
jalview.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge branch 'develop' into bug/JAL-2399textColour
[jalview.git]
/
src
/
jalview
/
gui
/
StructureViewerBase.java
diff --git
a/src/jalview/gui/StructureViewerBase.java
b/src/jalview/gui/StructureViewerBase.java
index
44a429c
..
d7f7c31
100644
(file)
--- a/
src/jalview/gui/StructureViewerBase.java
+++ b/
src/jalview/gui/StructureViewerBase.java
@@
-747,9
+747,9
@@
public abstract class StructureViewerBase extends GStructureViewer
public void itemStateChanged(ItemEvent e)
{
alignStructs.setEnabled(!_alignwith.isEmpty());
public void itemStateChanged(ItemEvent e)
{
alignStructs.setEnabled(!_alignwith.isEmpty());
- alignStructs
- .setToolTipText(MessageManager
- .getString("label.align_structures_using_linked_alignment_views"));
+ alignStructs.setToolTipText(MessageManager.formatMessage(
+ "label.align_structures_using_linked_alignment_views",
+ _alignwith.size()));
}
};
viewSelectionMenu = new ViewSelectionMenu(
}
};
viewSelectionMenu = new ViewSelectionMenu(
@@
-783,16
+783,24
@@
public abstract class StructureViewerBase extends GStructureViewer
public void setJalviewColourScheme(ColourSchemeI cs) {
getBinding().setJalviewColourScheme(cs);
}
public void setJalviewColourScheme(ColourSchemeI cs) {
getBinding().setJalviewColourScheme(cs);
}
+
+ /**
+ * Sends commands to the structure viewer to superimpose structures based on
+ * currently associated alignments. May optionally return an error message for
+ * the operation.
+ */
@Override
@Override
- protected void alignStructs_actionPerformed(ActionEvent actionEvent)
+ protected String alignStructs_actionPerformed(
+ ActionEvent actionEvent)
{
{
- alignStructs_withAllAlignPanels();
+ return alignStructs_withAllAlignPanels();
}
}
- protected void alignStructs_withAllAlignPanels()
+
+ protected String alignStructs_withAllAlignPanels()
{
if (getAlignmentPanel() == null)
{
{
if (getAlignmentPanel() == null)
{
- return;
+ return null;
}
if (_alignwith.size() == 0)
}
if (_alignwith.size() == 0)
@@
-800,6
+808,7
@@
public abstract class StructureViewerBase extends GStructureViewer
_alignwith.add(getAlignmentPanel());
}
_alignwith.add(getAlignmentPanel());
}
+ String reply = null;
try
{
AlignmentI[] als = new Alignment[_alignwith.size()];
try
{
AlignmentI[] als = new Alignment[_alignwith.size()];
@@
-813,7
+822,13
@@
public abstract class StructureViewerBase extends GStructureViewer
alm[a] = -1;
alc[a++] = ap.av.getColumnSelection();
}
alm[a] = -1;
alc[a++] = ap.av.getColumnSelection();
}
- getBinding().superposeStructures(als, alm, alc);
+ reply = getBinding().superposeStructures(als, alm, alc);
+ if (reply != null)
+ {
+ String text = MessageManager.formatMessage(
+ "error.superposition_failed", reply);
+ statusBar.setText(text);
+ }
} catch (Exception e)
{
StringBuffer sp = new StringBuffer();
} catch (Exception e)
{
StringBuffer sp = new StringBuffer();
@@
-824,7
+839,9
@@
public abstract class StructureViewerBase extends GStructureViewer
Cache.log.info("Couldn't align structures with the " + sp.toString()
+ "associated alignment panels.", e);
}
Cache.log.info("Couldn't align structures with the " + sp.toString()
+ "associated alignment panels.", e);
}
+ return reply;
}
}
+
@Override
public void background_actionPerformed(ActionEvent actionEvent)
{
@Override
public void background_actionPerformed(ActionEvent actionEvent)
{
@@
-954,6
+971,10
@@
public abstract class StructureViewerBase extends GStructureViewer
}
protected abstract String getViewerName();
}
protected abstract String getViewerName();
+
+ /**
+ * Configures the title and menu items of the viewer panel.
+ */
public void updateTitleAndMenus()
{
AAStructureBindingModel binding = getBinding();
public void updateTitleAndMenus()
{
AAStructureBindingModel binding = getBinding();
@@
-965,10
+986,30
@@
public abstract class StructureViewerBase extends GStructureViewer
setChainMenuItems(binding.getChainNames());
this.setTitle(binding.getViewerTitle(getViewerName(), true));
setChainMenuItems(binding.getChainNames());
this.setTitle(binding.getViewerTitle(getViewerName(), true));
- if (binding.getPdbFile().length > 1 && binding.getSequence().length > 1)
+
+ /*
+ * enable 'Superpose with' if more than one mapped structure
+ */
+ viewSelectionMenu.setEnabled(false);
+ if (getBinding().getPdbFile().length > 1
+ && getBinding().getSequence().length > 1)
{
{
- viewerActionMenu.setVisible(true);
+ viewSelectionMenu.setEnabled(true);
}
}
+
+ /*
+ * Show action menu if it has any enabled items
+ */
+ viewerActionMenu.setVisible(false);
+ for (int i = 0; i < viewerActionMenu.getItemCount(); i++)
+ {
+ if (viewerActionMenu.getItem(i).isEnabled())
+ {
+ viewerActionMenu.setVisible(true);
+ break;
+ }
+ }
+
if (!binding.isLoadingFromArchive())
{
seqColour_actionPerformed(null);
if (!binding.isLoadingFromArchive())
{
seqColour_actionPerformed(null);