diff --git a/plugins/net.bioclipse.cdk.ui.sdfeditor/src/net/bioclipse/cdk/ui/sdfeditor/editor/MultiPageMoleculesEditorPart.java b/plugins/net.bioclipse.cdk.ui.sdfeditor/src/net/bioclipse/cdk/ui/sdfeditor/editor/MultiPageMoleculesEditorPart.java index 664f86aec..085a8b386 100644 --- a/plugins/net.bioclipse.cdk.ui.sdfeditor/src/net/bioclipse/cdk/ui/sdfeditor/editor/MultiPageMoleculesEditorPart.java +++ b/plugins/net.bioclipse.cdk.ui.sdfeditor/src/net/bioclipse/cdk/ui/sdfeditor/editor/MultiPageMoleculesEditorPart.java @@ -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;