コード例 #1
0
  protected ToolItem createSynchronizeItem(final GamaToolbar2 tb) {
    return tb.check(
        IGamaIcons.DISPLAY_TOOLBAR_SYNC.getCode(),
        "Synchronize with simulation",
        "Synchronize",
        new SelectionAdapter() {

          @Override
          public void widgetSelected(final SelectionEvent e) {
            view.getOutput().setSynchronized(((ToolItem) e.widget).getSelection());
            view.synchronizeChanged();
          }
        },
        SWT.RIGHT);
  }
コード例 #2
0
  /** @param tb */
  private void createPauseItem(final GamaToolbar2 tb) {

    tb.check(
        IGamaIcons.DISPLAY_TOOLBAR_PAUSE.getCode(),
        "Pause",
        "Pause or resume the current view",
        new SelectionAdapter() {

          @Override
          public void widgetSelected(final SelectionEvent e) {

            IOutput output = view.getOutput();
            if (output != null) {
              if (output.isPaused()) {
                // output.getScope().getExperiment().getSpecies().getController().userStart();
                // hqnghi resume thread of co-experiment
                // WARNING: AD the pause button can be invoked on any view: why pause the thread,
                // then ?
                // if ( !output.getDescription().getModelDescription().getAlias().equals("") ) {
                // GAMA.getController(output.getDescription().getModelDescription().getAlias()).offer(
                // ExperimentController._START);
                // }
                // end-hqnghi
                resume((ToolItem) e.widget, output);
              } else {
                pause((ToolItem) e.widget, output);
                // hqnghi pause thread of co-experiment
                // WARNING: AD the pause button can be invoked on any view: why pause the thread,
                // then ?
                // output.getScope().getExperiment().getSpecies().getController().userPause();
                // end-hqnghi
              }
            } else {
              toggle();
            }
          }
        },
        SWT.RIGHT);
  }