]> gerrit.simantics Code Review - simantics/platform.git/blob - bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/internal/decompilation/DecompilerFactory.java
(refs #7245) The first version of decompiler for SCL compilations
[simantics/platform.git] / bundles / org.simantics.scl.compiler / src / org / simantics / scl / compiler / internal / decompilation / DecompilerFactory.java
1 package org.simantics.scl.compiler.internal.decompilation;
2
3 public class DecompilerFactory {
4     private static boolean initialized;
5     private static IDecompiler DECOMPILER;
6     public static IDecompiler getDecompiler() {
7         if(!initialized) {
8             try {
9                 Class<?> clazz = DecompilerFactory.class.getClassLoader().loadClass("org.simantics.scl.compiler.internal.decompiler.impl.DecompilerImpl");
10                 if(clazz != null) {
11                     DECOMPILER = (IDecompiler)clazz.newInstance();
12                 }
13             } catch(ClassNotFoundException e) {
14                 e.printStackTrace();
15             } catch (InstantiationException e) {
16                 e.printStackTrace();
17             } catch (IllegalAccessException e) {
18                 e.printStackTrace();
19             } catch(NoClassDefFoundError e) {
20                 e.printStackTrace();
21             }
22             initialized = true;
23         }
24         return DECOMPILER;
25     }
26 }