Ejemplo n.º 1
0
 @Override
 public void onKeyDown(final KyPressedEvent evt) {
   if (evt.getCode() == CODE[index]) {
     index++;
     if (index > CODE.length - 2) evt.consume();
     if (index == CODE.length) {
       index = 0;
       final ThreadService threadService = getContext().getService(ThreadService.class);
       threadService.run(this);
       final CommandService commandService = getContext().getService(CommandService.class);
       commandService.run(COMMAND);
     }
   } else index = 0;
 }
Ejemplo n.º 2
0
 @Override
 public <M extends Module> Future<M> run(
     final M module,
     final List<? extends ModulePreprocessor> pre,
     final List<? extends ModulePostprocessor> post,
     final Map<String, Object> inputMap) {
   assignInputs(module, inputMap);
   final ModuleRunner runner = new ModuleRunner(getContext(), module, pre, post);
   @SuppressWarnings("unchecked")
   final Callable<M> callable = (Callable<M>) runner;
   final Future<M> future = threadService.run(callable);
   return future;
 }
Ejemplo n.º 3
0
  @Override
  protected void addLeafToMenu(ShadowMenu sm, Menu m) {
    MenuItem item = new MenuItem(sm.getName());

    item.setOnAction(
        event -> {
          // ImageJFX.getThreadPool().submit(sm);

          //            context.inject(sm);
          threadService.run(sm);
        });
    m.getItems().add(item);
  }
Ejemplo n.º 4
0
  @Override
  public void refreshWidget() {

    // If this widget requires the EDT, ensure its refresh action takes place
    // on the EDT.
    if (ui().requiresEDT()) {
      try {
        threadService.invoke(
            new Runnable() {
              @Override
              public void run() {
                doRefresh();
              }
            });
      } catch (InterruptedException e) {
        log.error("Interrupted while refresh widget: " + getClass(), e);
      } catch (InvocationTargetException e) {
        log.error("Failed to refresh widget: " + getClass() + " on EDT", e);
      }
    } else {
      doRefresh();
    }
  }