Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Clear property if it is set to null

  • Loading branch information...
commit dca281ccf23102e7398ac8b12c66cc29caee6afa 1 parent 8a850c5
Arvid Berg authored committed
View
11 plugins/net.bioclipse.cdk.business/src/net/bioclipse/cdk/domain/CDKMolecule.java
@@ -263,7 +263,8 @@ public String getInChI(IMolecule.Property urgency)
getDefault().getJavaInChIManager();
try {
InChI cachedInchi = inchi.generate(this);
- setProperty( INCHI_KEY, cachedInchi );
+ if(cachedInchi != null)
+ setProperty( INCHI_KEY, cachedInchi );
return cachedInchi.getValue();
} catch (Exception e) {
throw new BioclipseException("Could not create InChI: "
@@ -281,7 +282,8 @@ public String getInChIKey(IMolecule.Property urgency)
getDefault().getJavaInChIManager();
try {
InChI cachedInchi = inchi.generate(this);
- setProperty( INCHI_KEY, cachedInchi );
+ if(cachedInchi != null)
+ setProperty( INCHI_KEY, cachedInchi );
return cachedInchi.getKey();
} catch (Exception e) {
throw new BioclipseException("Could not create InChIKey: "
@@ -294,7 +296,10 @@ public Object getProperty(String propertyKey, Property urgency) {
}
public void setProperty(String propertyKey, Object value) {
- atomContainer.setProperty( propertyKey, value );
+ if(value == null)
+ atomContainer.getProperties().remove( propertyKey );
+ else
+ atomContainer.setProperty( propertyKey, value );
}
void clearProperty( String key ) {
View
5 plugins/net.bioclipse.cdk.ui.sdfeditor/src/net/bioclipse/cdk/ui/sdfeditor/business/SDFIndexEditorModel.java
@@ -261,6 +261,11 @@ public void removePropertyKey(Object key) {
String property,
T value) {
Map<String,Object> props = molProps.get( moleculeIndex );
+ if(value == null) {
+ if(props!=null)
+ setDirty( props.remove( property )!=null );
+ return;
+ }
if(value!=null)
propertyList.put( property, value.getClass() );
if(props==null)
Please sign in to comment.
Something went wrong with that request. Please try again.