コード例 #1
0
  private void reconfigureViewer(final PrologInterface pif) {

    if (Display.getCurrent() != viewer.getControl().getDisplay()) {
      viewer
          .getControl()
          .getDisplay()
          .asyncExec(
              new Runnable() {
                @Override
                public void run() {
                  reconfigureViewer(pif);
                }
              });
      return;
    }
    if (pif == null) {

      viewer.setModel(null);
      viewer.setHistory(null);
      viewer.setCompletionProvider(null);
      title.setText("no console available(yet).");
      return;
    }

    ConsoleViewer.SavedState savedState = viewerStates.get(pif);
    if (savedState == null) {
      viewer.clearOutput();
      viewer.setModel(models.get(pif));
      PrologCompletionProvider completionProvider = new PrologCompletionProvider();
      completionProvider.setPrologInterface(pif);
      viewer.setCompletionProvider(completionProvider);
      ConsoleHistory history = new ConsoleHistory();
      viewer.setHistory(history);
      loadHistory(history);
    } else {
      viewer.loadState(savedState);
    }
    PrologInterfaceRegistry reg = PrologRuntimePlugin.getDefault().getPrologInterfaceRegistry();
    String key = reg.getKey(pif);
    title.setText(SelectContextPIFAutomatedAction.getLabelForPif(key, reg));
    //		Object configuration = pif.getAttribute(PrologRuntimeUI.CONFIGURATION_ATTRIBUTE);
    //		if (configuration == null) {
    //			title.setText(key);
    //		} else {
    //			title.setText(key + " (" + configuration.toString().replaceAll("&", "&&") + ")");
    //		}

    viewer.setEnterSendsSemicolon(false);
  }
コード例 #2
0
  public PrologInterface activateNewPrologProcess(
      PrologInterfaceRegistry registry, String pifKey, String configuration) {
    DefaultSubscription subscription =
        new DefaultSubscription(
            pifKey + "_indepent", pifKey, "Independent prolog process", "Prolog");
    registry.addSubscription(subscription);
    PrologInterface pif =
        PrologRuntimeUIPlugin.getDefault().getPrologInterface(subscription, configuration);

    if (automatedSelector.getActiveTrackers().isEmpty()) {
      setPrologInterface(pif);
      automatedSelector.setImageDescriptor(
          ImageRepository.getImageDescriptor(ImageRepository.MANUAL_MODE));
    }
    return pif;
  }