Permalink
Browse files

Use index 0 if no molecule is selected when switching from JCP-tab to…

… structure-tab in SDFEditor

Solves bug 1973
  • Loading branch information...
1 parent dac2570 commit 940f5fa4cf31ef8b242646a196bf3edc8ff70b51 Arvid Berg committed with Jun 21, 2010
@@ -354,8 +354,10 @@ private void syncJCP() {
if(jcpPage.isDirty()) {
setDirty(true);
calculateProperties( newMol );
+ int selection = moleculesPage.getMolTableViewer().getFirstSelected();
+ selection = selection < 0 ? 0:selection;// see updateJCPPage()
moleculesPage.getModel().markDirty(
- moleculesPage.getMolTableViewer().getFirstSelected(),
+ selection,
newMol );
moleculesPage.setDirty( true );
}
@@ -397,6 +399,10 @@ public void selectionChanged( IWorkbenchPart part, ISelection selection ) {
}
}
+ /**
+ * Updates the input for the JChemPaint editor from selection.
+ * If there is no selection the molecule at index 0 is used.
+ */
private void updateJCPPage() {
int index = moleculesPage.getMolTableViewer().getFirstSelected();
if(index < 0 ) index = 0;

0 comments on commit 940f5fa

Please sign in to comment.