fetchStructuresMetaData();
// revise filter options if no results were found
populateFilterComboBox(isStructuresDiscovered(), cachedPDBExists);
+ discoverStructureViews();
updateProgressIndicator(null, startTime);
mainFrame.setVisible(true);
updateCurrentView();
discoverPDBStructuresThread.start();
}
+ private void discoverStructureViews()
+ {
+ if (Desktop.instance != null)
+ {
+ targetView.removeAllItems();
+ targetView.addItem(
+ new StructureViewer(ap.getStructureSelectionManager()));
+ if (lastTargetedView != null && !lastTargetedView.isVisible())
+ {
+ lastTargetedView = null;
+ }
+ int linkedViewsAt = 1;
+ for (StructureViewerBase view : Desktop.instance
+ .getStructureViewers(null, null))
+ {
+ StructureViewer viewHandler = (lastTargetedView != null
+ && lastTargetedView.sview == view) ? lastTargetedView
+ : StructureViewer.reconfigure(view);
+
+ if (view.isLinkedWith(ap))
+ {
+ targetView.insertItemAt(viewHandler,
+ linkedViewsAt++);
+ }
+ else
+ {
+ targetView.addItem(viewHandler);
+ }
+ }
+ targetView.setVisible(targetView.getItemCount() > 1);
+
+ // finally, restore last targeted view by default.
+ if (lastTargetedView != null)
+ {
+ targetView.setSelectedItem(lastTargetedView);
+ }
+ }
+ }
+
+ private static StructureViewer lastTargetedView = null;
+
/**
* Updates the progress indicator with the specified message
*
return foundEntry;
}
+ public StructureViewer getTargetedStructureViewer(
+ StructureSelectionManager ssm)
+ {
+ Object _sv = targetView.getSelectedItem();
+
+ if (_sv == null)
+ {
+ return new StructureViewer(ssm);
+ } else {
+ return (StructureViewer) _sv;
+ }
+ }
private StructureViewer launchStructureViewer(
StructureSelectionManager ssm,
final PDBEntry[] pdbEntriesToView,
long progressId = sequences.hashCode();
setProgressBar(MessageManager
.getString("status.launching_3d_structure_viewer"), progressId);
- final StructureViewer sViewer = new StructureViewer(ssm);
- setProgressBar(null, progressId);
+ final StructureViewer sViewer = getTargetedStructureViewer(ssm);
+ setProgressBar(null, progressId);
if (SiftsSettings.isMapWithSifts())
{
List<SequenceI> seqsWithoutSourceDBRef = new ArrayList<>();
sViewer.viewStructures(pdbEntriesToView[0], sequences, alignPanel);
}
setProgressBar(null, progressId);
+ // remember the last viewer we used...
+ lastTargetedView = sViewer;
return sViewer;
}