Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Removed one level of wraping of generators contributed by extensionpoint

  • Loading branch information...
commit 52203ee8fbdf42652ff73c4c424bdf43127b4489 1 parent 551fbf1
authored May 24, 2010
10  plugins/net.bioclipse.cdk.jchempaint.view/src/net/bioclipse/cdk/jchempaint/view/ChoiceGenerator.java
@@ -77,7 +77,15 @@ public IRenderingElement generate( IAtomContainer ac,
77 77
     public static final String EP_GENERATOR = "net.bioclipse.cdk.jchempaint.generator";
78 78
 
79 79
     public static ChoiceGenerator getGeneratorsFromExtensionPoint() {
80  
-        ChoiceGenerator choiseGenerator = new ChoiceGenerator();
  80
+        ChoiceGenerator choiceGenerator = new ChoiceGenerator();
  81
+        for(IGenerator generator:getGeneratorsFromExtension()) {
  82
+            choiceGenerator.add(generator);
  83
+        }
  84
+        return choiceGenerator;
  85
+    }
  86
+
  87
+    public static List<IGenerator> getGeneratorsFromExtension() {
  88
+        List<IGenerator> choiseGenerator = new ArrayList<IGenerator>();
81 89
         IExtensionRegistry registry = Platform.getExtensionRegistry();
82 90
         IExtensionPoint generatorExtensionPoint = registry
83 91
         .getExtensionPoint(EP_GENERATOR);
10  plugins/net.bioclipse.cdk.jchempaint.view/src/net/bioclipse/cdk/jchempaint/view/JChemPaintWidget.java
@@ -167,9 +167,7 @@ public void paintControl( PaintEvent event ) {
167 167
     protected List<IGenerator> createGenerators() {
168 168
         List<IGenerator> generatorList = new ArrayList<IGenerator>();
169 169
 
170  
-        generatorList.add( extensionGenerator
171  
-                           = ChoiceGenerator.getGeneratorsFromExtensionPoint());
172  
-        extensionGenerator.setUse( true );
  170
+        generatorList.addAll(ChoiceGenerator.getGeneratorsFromExtension());
173 171
         // This generator can be used for debugging partitioning problems
174 172
         //generatorList.add( new AtomContainerBoundsGenerator() );
175 173
         generatorList.add( new RingGenerator() );
@@ -258,8 +256,10 @@ public Point computeSize(int wHint, int hHint, boolean changed) {
258 256
      }
259 257
 
260 258
     public void setUseExtensionGenerators( boolean useExtensionGenerators ) {
261  
-        extensionGenerator.setUse( useExtensionGenerators);
262  
-        this.redraw();
  259
+        if(extensionGenerator!=null) {
  260
+            extensionGenerator.setUse( useExtensionGenerators);
  261
+            this.redraw();
  262
+        }
263 263
     }
264 264
 
265 265
     public static void paintMessage( GC gc, Message message , Rectangle rect) {

0 notes on commit 52203ee

Please sign in to comment.
Something went wrong with that request. Please try again.