Esempio n. 1
0
  protected void init() {
    if (toolMap == null) {
      toolMap = new HashMap<>();
      toolList = new ArrayList<>();

      List<? extends FxTool> tools = pluginService.createInstancesOfType(FxTool.class);

      for (FxTool tool : tools) {
        toolMap.put(tool.getClass(), tool);
        toolList.add(tool);
      }
      setCurrentTool(Hand.class);
    }
  }
Esempio n. 2
0
 private List<Gateway> gateways() {
   final ArrayList<Gateway> gateways = new ArrayList<>();
   if (pluginService == null) return gateways;
   // HACK: Instantiating a Gateway with the noargs constructor spins
   // up a second Context, which is not what we want. Perhaps SJC should
   // be changed to prefer a single-argument constructor that accepts a
   // Context, before trying the noargs constructor?
   // In the meantime, we do it manually here.
   final List<PluginInfo<Gateway>> infos = pluginService.getPluginsOfType(Gateway.class);
   for (final PluginInfo<Gateway> info : infos) {
     try {
       final Constructor<? extends Gateway> ctor = info.loadClass().getConstructor(Context.class);
       final Gateway gateway = ctor.newInstance(context);
       gateways.add(gateway);
     } catch (final Throwable t) {
       t.printStackTrace(out);
     }
   }
   return gateways;
 }
Esempio n. 3
0
 /** Creates the postprocessor chain. */
 private List<? extends PostprocessorPlugin> post(final boolean process) {
   if (!process) return null;
   return pluginService.createInstancesOfType(PostprocessorPlugin.class);
 }