Esempio n. 1
0
 // saves the current configuration (breakpoints, window sizes and positions...)
 private void saveConfig() {
   try {
     ObjectOutputStream out = new ObjectOutputStream(new FileOutputStream(idxName + ".config"));
     Breakpoints.save(out);
     Properties.save(out);
     out.close();
   } catch (IOException exc) {
     consoleFrame.echoInfo("Could not save settings: " + exc);
   }
 }
Esempio n. 2
0
  public void updateGuiState(int priorState, LibgistCommand cmd, boolean success) {
    switch (cmd.cmdType) {
      case LibgistCommand.CREATE:
      case LibgistCommand.OPEN:
        resetState();
        if (!success) return; // done
        setGuiState(IDXOPENSTATE);
        isOpen = true;
        idxName = cmd.indexName.toString();
        if (cmd.cmdType == LibgistCommand.CREATE) {
          resetConfig();
        } else {
          restoreConfig();
        }
        // setTitle("amdb: " + filename);
        setTree(idxName);
        try {
          treeView = new TreeView(desktop); // creates a display of the opened index
          desktop.add(treeView, JLayeredPane.PALETTE_LAYER);
        } catch (LibgistException e) {
          // what to do now?
          consoleFrame.echoInfo("new TreeView() failed");
        }
        break;

      case LibgistCommand.CLOSE:
        saveConfig();
        resetState();
        break;

      case LibgistCommand.OPENANL:
        resetState();
        if (!success) return; // done
        // enable menu items and open tree view
        setGuiState(ANLOPENSTATE);
        // setTitle("amdb: " + filename);
        setTree(idxName);
        try {
          treeView = new TreeView(desktop); // creates a display of the opened index
          desktop.add(treeView, JLayeredPane.PALETTE_LAYER);
        } catch (LibgistException e) {
          // what to do now?
          consoleFrame.echoInfo("new TreeView() failed");
        }

        // get ready to display dialogs
        if (analysisInfo.actualHasWkldStats) {
          wkldStatsDlg.init(treeView);
        }
        if (analysisInfo.actualHasSplitStats) {
          splitStatsDlg.init(treeView);
        }
        if (analysisInfo.actualHasPenaltyStats) {
          penaltyStatsDlg.init(treeView);
        }
        break;

      case LibgistCommand.CLOSEANL:
        treeView.dispose();
        treeView = null;
        setGuiState(INITSTATE);
        setTree("");
        break;

        // if these didn't work, we don't care
      case LibgistCommand.INSERT:
      case LibgistCommand.REMOVE:
      case LibgistCommand.FETCH:
      case LibgistCommand.FLUSH:
      case LibgistCommand.CREATEANL:
      case LibgistCommand.SCRIPT:
        setGuiState(priorState);
        break;
    }
  }