Ejemplo n.º 1
0
  private void switchToDebugView(boolean dueToBreakpoint) {
    if (isInPerspective("org.eclipse.debug.ui.DebugPerspective")) return;

    IPreferenceStore prefs = RuntimePlugin.getDefault().getPreferenceStore();
    boolean dontAsk = prefs.getBoolean(RuntimePreferences.DONT_ASK_DEBUG_SWITCH);
    int rtnCode = 2;

    if (!dontAsk) {
      MessageDialogWithToggle mdwt =
          MessageDialogWithToggle.openYesNoQuestion(
              PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(),
              dueToBreakpoint
                  ? "Switch to jACT-R Run Perspective?"
                  : "Switch to Debug Perspective?",
              dueToBreakpoint
                  ? "Model breakpoint detected! Switch to debug perspective?"
                  : "Debug models start suspended. To resume, use the Debug Perspective. Switch now?",
              "Don't ask again",
              false,
              prefs,
              RuntimePreferences.DONT_ASK_DEBUG_SWITCH);

      rtnCode = mdwt.getReturnCode();

      if (mdwt.getToggleState()) {
        prefs.setValue(RuntimePreferences.SWITCH_TO_DEBUG_PERSPECTIVE, rtnCode == 2);
        prefs.setValue(RuntimePreferences.DONT_ASK_DEBUG_SWITCH, true);
      } else prefs.setValue(RuntimePreferences.DONT_ASK_DEBUG_SWITCH, false);
    } else if (prefs.getBoolean(RuntimePreferences.SWITCH_TO_DEBUG_PERSPECTIVE)) rtnCode = 2;
    else rtnCode = 3;

    if (rtnCode == 2) switchToPerspective("org.eclipse.debug.ui.DebugPerspective");
  }
Ejemplo n.º 2
0
  private void switchToRuntimeView() {
    if (isInPerspective(ACTRRuntimePerspective.ID)) return;
    /*
     * query
     */
    IPreferenceStore prefs = RuntimePlugin.getDefault().getPreferenceStore();
    boolean dontAsk = prefs.getBoolean(RuntimePreferences.DONT_ASK_RUN_SWITCH);
    int rtnCode = 2; // yes

    if (!dontAsk) {
      MessageDialogWithToggle mdwt =
          MessageDialogWithToggle.openYesNoQuestion(
              PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(),
              "Switch to jACT-R Run Perspective?",
              "Models are best inspected using the jACT-R Run perspective. Switch now?",
              "Don't ask again",
              false,
              prefs,
              RuntimePreferences.DONT_ASK_RUN_SWITCH);

      rtnCode = mdwt.getReturnCode();

      if (mdwt.getToggleState()) {
        prefs.setValue(RuntimePreferences.SWITCH_TO_RUN_PERSPECTIVE, rtnCode == 2);
        prefs.setValue(RuntimePreferences.DONT_ASK_RUN_SWITCH, true);
      } else prefs.setValue(RuntimePreferences.DONT_ASK_RUN_SWITCH, false);
    } else if (prefs.getBoolean(RuntimePreferences.SWITCH_TO_RUN_PERSPECTIVE)) rtnCode = 2;
    else rtnCode = 3;

    if (rtnCode == 2) switchToPerspective(ACTRRuntimePerspective.ID);
  }