Skip to content

Commit

Permalink
Moved content type initialization to a static block.
Browse files Browse the repository at this point in the history
No need to use lazy initialization for this code.
  • Loading branch information
goglepox committed Apr 19, 2012
1 parent b5aa4df commit 16e45cb
Showing 1 changed file with 10 additions and 19 deletions.
Expand Up @@ -55,6 +55,16 @@ public class BalloonManager implements IBioclipseManager {
= Logger.getLogger( BalloonManager.class );

private static List<String> supportedContentTypes;
static {
// These entries need to match the command in plugin.xml but found
// no easy way to read this info from there
supportedContentTypes = new ArrayList<String>();
supportedContentTypes.add( "net.bioclipse.contenttypes.smi" );
supportedContentTypes.add( "net.bioclipse.contenttypes.sdf" );
supportedContentTypes.add( "net.bioclipse.contenttypes.mdlMolFile" );
supportedContentTypes
.add( "net.bioclipse.contenttypes.cml.singleMolecule2d" );
}

/**
* Defines the Bioclipse namespace for balloon.
Expand Down Expand Up @@ -264,9 +274,6 @@ public String generate3Dconformations( String inputfile,
int numConformations )
throws BioclipseException {

if (supportedContentTypes==null)
fillSupportedContentTypes();

//Must have different input as output files
if (inputfile.equals( outputfile ))
throw new IllegalArgumentException("Outputfile must be different " +
Expand Down Expand Up @@ -400,22 +407,6 @@ public String generate3Dconformations( String inputfile,

}



private void fillSupportedContentTypes() {

//These entries need to match the command in plugin.xml but found
//no easy way to read this info from there
supportedContentTypes=new ArrayList<String>();
supportedContentTypes.add( "net.bioclipse.contenttypes.smi" );
supportedContentTypes.add( "net.bioclipse.contenttypes.sdf" );
supportedContentTypes.add( "net.bioclipse.contenttypes.mdlMolFile" );
supportedContentTypes.add(
"net.bioclipse.contenttypes.cml.singleMolecule2d" );

}


private boolean isSupportedContenttype(IContentDescription condesc) {

for (String supCon : supportedContentTypes){
Expand Down

0 comments on commit 16e45cb

Please sign in to comment.