Skip to content

Commit

Permalink
Merge pull request #7 from valyo/2.5.x
Browse files Browse the repository at this point in the history
2.5.x Also quick but better solution addressing Bug 3223 from Arvid
  • Loading branch information
goglepox committed Jun 21, 2012
2 parents 61a7aea + 67a1938 commit 845ca20
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 2 deletions.
Binary file added plugins/net.bioclipse.cdk.business/icons/benzene.gif
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
7 changes: 7 additions & 0 deletions plugins/net.bioclipse.cdk.business/plugin.xml
Expand Up @@ -27,6 +27,13 @@
type="net.bioclipse.cdk.domain.MoleculesIndexEditorInput">
</adapter>
</factory>
<factory
adaptableType="net.bioclipse.cdk.domain.ICDKMolecule"
class="net.bioclipse.cdk.domain.CDKAdapterFactory">
<adapter
type="org.eclipse.jface.resource.ImageDescriptor">
</adapter>
</factory>
</extension>
<extension
point="org.eclipse.ui.preferencePages">
Expand Down
Expand Up @@ -15,6 +15,7 @@
import net.bioclipse.core.util.LogUtils;

import org.apache.log4j.Logger;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.ui.plugin.AbstractUIPlugin;
import org.openscience.cdk.tools.LoggingToolFactory;
import org.osgi.framework.BundleContext;
Expand Down Expand Up @@ -44,6 +45,10 @@ public Activator() {
logger.info("Registering the BioclipseLoggingTool...");
}

public static ImageDescriptor getImageDescriptor(String path) {
return imageDescriptorFromPlugin(PLUGIN_ID, path);
}

/*
* (non-Javadoc)
* @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
Expand Down
Expand Up @@ -7,6 +7,8 @@
import org.apache.log4j.Logger;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.runtime.IAdapterFactory;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.swt.graphics.Image;

@SuppressWarnings("unchecked")
public class CDKAdapterFactory implements IAdapterFactory {
Expand Down Expand Up @@ -34,11 +36,16 @@ public Object getAdapter( Object adaptableObject,
}
if(molecule !=null &&adapterType.isAssignableFrom( molecule.getClass()))
return molecule;

if(adapterType.isAssignableFrom(ImageDescriptor.class)) {
return Activator.getImageDescriptor( "icons/benzene.gif" );
}

return null;
}

public Class[] getAdapterList() {

return new Class[] { ICDKMolecule.class };
return new Class[] { ICDKMolecule.class,ImageDescriptor.class };
}
}
Expand Up @@ -28,6 +28,7 @@
import nu.xom.Element;

import org.eclipse.core.runtime.Preferences;
import org.eclipse.swt.graphics.Image;
import org.eclipse.ui.views.properties.IPropertySource;
import org.openscience.cdk.CDKConstants;
import org.openscience.cdk.atomtype.CDKAtomTypeMatcher;
Expand Down Expand Up @@ -56,6 +57,7 @@ public class CDKMolecule extends BioObject implements ICDKMolecule {

private String name;
private IAtomContainer atomContainer;
private Object icon;

// cached properties
public static final String FINGERPRINT_KEY = "net.bioclipse.fingerprint";
Expand Down Expand Up @@ -251,7 +253,7 @@ public boolean has3dCoords() throws BioclipseException {

@Override
public Object getAdapter( Class adapter ) {

if (adapter == IMolecule.class){
return this;
}
Expand Down

0 comments on commit 845ca20

Please sign in to comment.