Skip to content

Commit

Permalink
Misc updates: for CDK 1.4, missing deps, etc
Browse files Browse the repository at this point in the history
  • Loading branch information
egonw committed Sep 2, 2011
1 parent 4b86507 commit a9c05d2
Show file tree
Hide file tree
Showing 10 changed files with 47 additions and 28 deletions.
5 changes: 3 additions & 2 deletions plugins/net.bioclipse.nmrshiftdb.test/META-INF/MANIFEST.MF
Expand Up @@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: NMRShiftDB Test Plug-in
Bundle-SymbolicName: net.bioclipse.nmrshiftdb.test
Bundle-Version: 2.0.0.v20090707
Bundle-Version: 2.5.0.qualifier
Bundle-Activator: net.bioclipse.nmrshiftdb.test.Activator
Require-Bundle: org.eclipse.ui,
org.eclipse.core.runtime,
Expand All @@ -19,4 +19,5 @@ Require-Bundle: org.eclipse.ui,
Eclipse-LazyStart: true
Export-Package: net.bioclipse.nmrshiftdb.business.test
Import-Package: nu.xom;version="1.1.0",
org.xmlcml.cml.base
org.xmlcml.cml.base,
org.xmlcml.cml.element
5 changes: 3 additions & 2 deletions plugins/net.bioclipse.nmrshiftdb/META-INF/MANIFEST.MF
Expand Up @@ -31,10 +31,11 @@ Require-Bundle: org.eclipse.ui,
org.eclipse.ui.cheatsheets,
org.openscience.cdk.standard;bundle-version="1.3.2"
Bundle-ActivationPolicy: lazy
Import-Package: org.apache.log4j,
org.openscience.cdk.exception,
Import-Package: net.xomtools,
nu.xom;version="1.1.0",
nu.xom.converters;version="1.1.0",
org.apache.log4j,
org.openscience.cdk.exception,
org.xmlcml.cml.base,
org.xmlcml.cml.element
Export-Package: net.bioclipse.nmrshiftdb,
Expand Down
Expand Up @@ -13,21 +13,16 @@

import net.bioclipse.cdk.domain.CDKMolecule;
import net.bioclipse.cdk.domain.ICDKMolecule;
import net.bioclipse.cdk.jchempaint.wizards.NewMoleculeWizard;
import net.bioclipse.core.business.BioclipseException;
import net.bioclipse.core.util.LogUtils;
import net.bioclipse.nmrshiftdb.wizards.DownloadSpectraServerWizardPage;
import net.bioclipse.specmol.wizards.NewSpecMolWizard;
import net.bioclipse.spectrum.wizards.NewSpectrumWizard;
import net.bioclipse.ui.business.Activator;

import org.apache.log4j.Logger;
import org.eclipse.jface.action.Action;
import org.eclipse.jface.viewers.StructuredSelection;
import org.eclipse.jface.wizard.IWizard;
import org.eclipse.jface.wizard.WizardDialog;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.cheatsheets.ICheatSheetAction;
import org.eclipse.ui.cheatsheets.ICheatSheetManager;
import org.openscience.cdk.DefaultChemObjectBuilder;
Expand All @@ -39,8 +34,11 @@ public class CheatSheetAction extends Action implements ICheatSheetAction {
public void run(String[] params, ICheatSheetManager manager) {
if(params[0].equals("newstruc")){
//Open editor with content (String) as content
ICDKMolecule mol = new CDKMolecule(DefaultChemObjectBuilder
.getInstance().newMolecule());
ICDKMolecule mol = new CDKMolecule(
DefaultChemObjectBuilder.getInstance().newInstance(
org.openscience.cdk.interfaces.IMolecule.class
)
);
try {
Activator.getDefault().getUIManager().open( mol,
"net.bioclipse.cdk.ui.editors.jchempaint.cml" );
Expand Down
Expand Up @@ -153,7 +153,10 @@ public void searchBySpectrum(ISpectrum cmlspectrum,
nu.xom.Element mol=cmlelud.getChildElements().get(i);
mol.setNamespaceURI(CmlFileDescriber.NS_CML);
CMLReader reader = new CMLReader(new ByteArrayInputStream(mol.toXML().getBytes()));
IChemFile file = (IChemFile)reader.read(DefaultChemObjectBuilder.getInstance().newChemFile());
IChemFile file = (IChemFile)reader.read(
DefaultChemObjectBuilder.getInstance()
.newInstance(IChemFile.class)
);

CMLMolecule cmlMol = (CMLMolecule)cmlelud.getChildElements(
"molecule",CmlFileDescriber.NS_CML).get(i);
Expand Down Expand Up @@ -276,7 +279,13 @@ public void predictSpectrum(IMolecule molecule, String type, boolean useCalculat
monitor.beginTask( "Performing Prediction", IProgressMonitor.UNKNOWN );
try{
CMLSpectrum spectrum;
org.openscience.cdk.interfaces.IMolecule cdkmol=DefaultChemObjectBuilder.getInstance().newMolecule(net.bioclipse.cdk.business.Activator.getDefault().getJavaCDKManager().asCDKMolecule(molecule).getAtomContainer());
org.openscience.cdk.interfaces.IMolecule cdkmol =
DefaultChemObjectBuilder.getInstance().newInstance(
org.openscience.cdk.interfaces.IMolecule.class,
net.bioclipse.cdk.business.Activator.getDefault()
.getJavaCDKManager().asCDKMolecule(molecule)
.getAtomContainer()
);
if(local){
net.bioclipse.nmrshiftdb.util.PredictionTool predtool= new net.bioclipse.nmrshiftdb.util.PredictionTool();
spectrum=new CMLSpectrum();
Expand Down
@@ -1,7 +1,6 @@
package net.bioclipse.nmrshiftdb.wizards;

import java.io.ByteArrayInputStream;
import java.io.UnsupportedEncodingException;
import java.net.URL;
import java.util.Iterator;
import java.util.List;
Expand All @@ -12,7 +11,6 @@
import javax.xml.parsers.DocumentBuilderFactory;

import net.bioclipse.cdk.domain.CDKMolecule;
import net.bioclipse.core.business.BioclipseException;
import net.bioclipse.core.util.LogUtils;
import net.bioclipse.jobs.BioclipseUIJob;
import net.bioclipse.nmrshiftdb.util.Bc_nmrshiftdbConstants;
Expand All @@ -29,7 +27,6 @@
import org.apache.axis.utils.Options;
import org.apache.log4j.Logger;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.wizard.Wizard;
Expand All @@ -47,7 +44,6 @@
import org.openscience.cdk.smiles.SmilesGenerator;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
import org.xmlcml.cml.element.CMLBond;
import org.xmlcml.cml.element.CMLCml;
import org.xmlcml.cml.element.CMLConditionList;
Expand Down Expand Up @@ -514,7 +510,7 @@ public boolean performFinish() {
.getPeakElements()
.get( i )
.getAtomRefs()[0] )
.getHydrogenCount();
.getImplicitHydrogenCount();
List<IAtom> connatoms =
cdkmol
.getConnectedAtomsList( getAtomById(
Expand Down
Expand Up @@ -107,7 +107,10 @@ private void findPeakListForAc(IAtomContainer ac2) {
*/
private void findAcForPeakList(ArrayList<CMLPeak> peakList2) {
if (ac == null) {
setSelectedSubstructure(DefaultChemObjectBuilder.getInstance().newAtomContainer());
setSelectedSubstructure(
DefaultChemObjectBuilder.getInstance().
newInstance(IAtomContainer.class)
);
}
else {
this.getSelectedSubstructure().removeAllElements();
Expand All @@ -116,7 +119,10 @@ private void findAcForPeakList(ArrayList<CMLPeak> peakList2) {
String[] atomrefs = peakList.get(j).getAtomRefs();
IAtomContainer allac=page.getJcpComposite().getAtomContainer();
if (!page.isAssigmentMode()) {
page.getJcpComposite().getDrawingPanel().getRenderer2DModel().setExternalSelectedPart(allac.getBuilder().newAtomContainer());
page.getJcpComposite().getDrawingPanel().getRenderer2DModel().
setExternalSelectedPart(
allac.getBuilder().newInstance(IAtomContainer.class)
);
}
if (atomrefs != null) {
for(int i=0;i<atomrefs.length;i++){
Expand Down
Expand Up @@ -41,6 +41,7 @@
import org.openscience.cdk.interfaces.IChemFile;
import org.openscience.cdk.interfaces.IChemModel;
import org.openscience.cdk.io.CMLReader;
import org.openscience.cdk.renderer.RendererModel.ExternalHighlightColor;
import org.xmlcml.cml.base.CMLElement;
import org.xmlcml.cml.element.CMLCml;
import org.xmlcml.cml.element.CMLMolecule;
Expand Down Expand Up @@ -152,7 +153,10 @@ public void createPartControl(Composite parent) {
child1 = new SpecMolDrawingComposite(form, SWT.PUSH,this);
assignmentController.addSpecMolListener(child1);
child1.addFocusListener(focusListener);
highlightColor = child1.getDrawingPanel().getRenderer2DModel().getExternalHighlightColor();
highlightColor = child1.getDrawingPanel().
getRenderer2DModel().getParameter(
ExternalHighlightColor.class
).getValue();

child2 = new SpecMolTableComposite(form,SWT.NONE, this);
assignmentController.addSpecMolListener(child2);
Expand Down
Expand Up @@ -44,7 +44,7 @@ public String getDrawModeString() {
public void mouseClickedDown(Point2d worldCoord) {
IAtom atom = chemModelRelay.getClosestAtom(worldCoord);
if (atom != null) {
IAtomContainer ac= atom.getBuilder().newAtomContainer();
IAtomContainer ac= atom.getBuilder().newInstance(IAtomContainer.class);
if(ctrl)
ac=chemModelRelay.getRenderer().getRenderer2DModel().getExternalSelectedPart();
ac.addAtom(atom);
Expand Down
Expand Up @@ -14,14 +14,10 @@
import net.bioclipse.cdk.jchempaint.widgets.JChemPaintEditorWidget;
import net.bioclipse.specmol.listeners.SpecMolListener;

import org.eclipse.jface.action.GroupMarker;
import org.eclipse.jface.action.MenuManager;
import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.FillLayout;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Menu;
import org.eclipse.ui.IWorkbenchActionConstants;
import org.openscience.cdk.DefaultChemObjectBuilder;
import org.openscience.cdk.exception.CDKException;
import org.openscience.cdk.interfaces.IAtomContainer;
Expand Down Expand Up @@ -113,7 +109,11 @@ public AssignmentPage getPage() {
* deselect all selected atoms/bonds
*/
public void unselect() {
drawingPanel.getRenderer2DModel().setExternalSelectedPart(DefaultChemObjectBuilder.getInstance().newAtomContainer());
drawingPanel.getRenderer2DModel().setExternalSelectedPart(
DefaultChemObjectBuilder.getInstance().newInstance(
IAtomContainer.class
)
);
if (page.getAssignmentController().getSelectedSubstructure() != null) {
page.getAssignmentController().getSelectedSubstructure().removeAllElements();
}
Expand Down
6 changes: 5 additions & 1 deletion plugins/net.bioclipse.spectrum.test/META-INF/MANIFEST.MF
Expand Up @@ -13,5 +13,9 @@ Require-Bundle: org.eclipse.ui,
org.eclipse.core.resources
Bundle-ActivationPolicy: lazy
Bundle-RequiredExecutionEnvironment: J2SE-1.5
Import-Package: org.apache.log4j
Import-Package: nu.xom;version="1.1.0",
org.apache.log4j,
org.xmlcml.cml.attribute,
org.xmlcml.cml.base,
org.xmlcml.cml.element
Export-Package: net.bioclipse.spectrum.business.test

0 comments on commit a9c05d2

Please sign in to comment.