Skip to content

Commit

Permalink
Quick solution addressing Bug 3223
Browse files Browse the repository at this point in the history
Rich Browser Extraction view should handle icons better
  • Loading branch information
Valentin Georgiev committed Jun 21, 2012
1 parent b9499c9 commit 59635cc
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 1 deletion.
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.
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 @@ -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,13 @@ public boolean has3dCoords() throws BioclipseException {

@Override
public Object getAdapter( Class adapter ) {


if (Image.class .equals( adapter )){
if (icon==null)
icon=Activator.getImageDescriptor( "icons/benzene.gif" ).createImage();
return icon;
}

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

0 comments on commit 59635cc

Please sign in to comment.