Skip to content

Commit

Permalink
Use index 0 if no molecule is selected when switching from JCP-tab to…
Browse files Browse the repository at this point in the history
… structure-tab in SDFEditor

Solves bug 1973
  • Loading branch information
Arvid Berg authored and egonw committed Jun 21, 2010
1 parent dac2570 commit 940f5fa
Showing 1 changed file with 7 additions and 1 deletion.
Expand Up @@ -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 );
}
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit 940f5fa

Please sign in to comment.