示例#1
0
  /** Construct the JobQueue. This is private; use getJobQueue() to get the job queue instance. */
  private JobQueue() {
    // determine which compiler we should be using
    String compilertype = Config.getPropString("bluej.compiler.type");

    // even though it is specified to use internal, the preferred compiler for a
    // system running Java 6 or greater is the JavaCompiler API
    if (compilertype.equals("internal")) {
      if (Config.isJava16()) {
        try {
          Class<?> c = Class.forName("bluej.compiler.CompilerAPICompiler");
          compiler = (Compiler) c.newInstance();
        } catch (Throwable e) {
          Debug.message(
              "Could not instantiate the compiler API compiler implementation; defaulting to old compiler");
          compiler = new JavacCompilerInternal();
        }
      } else {
        compiler = new JavacCompilerInternal();
      }
    } else if (compilertype.equals("javac")) {
      compiler =
          new JavacCompiler(Config.getJDKExecutablePath("bluej.compiler.executable", "javac"));
    } else {
      Debug.message(Config.getString("compiler.invalidcompiler"));
    }

    thread = new CompilerThread();

    // Lower priority to improve GUI response time during compilation
    int priority = Thread.currentThread().getPriority() - 1;
    priority = Math.max(priority, Thread.MIN_PRIORITY);
    thread.setPriority(priority);

    thread.start();
  }
示例#2
0
    public void processKeyEvent(Component focusedComponent, KeyEvent e) {
      if (e.getID() != KeyEvent.KEY_PRESSED) return;

      int keyCode = e.getKeyCode();

      if (keyCode == KeyEvent.VK_CAPS_LOCK
          || // the keys we want to ignore...
          keyCode == KeyEvent.VK_SHIFT
          || keyCode == KeyEvent.VK_CONTROL
          || keyCode == KeyEvent.VK_META
          || keyCode == KeyEvent.VK_ALT
          || keyCode == KeyEvent.VK_ALT_GRAPH
          || keyCode == KeyEvent.VK_COMPOSE
          || keyCode == KeyEvent.VK_NUM_LOCK
          || keyCode == KeyEvent.VK_SCROLL_LOCK
          || keyCode == KeyEvent.VK_UNDEFINED) return;

      if (currentAction == null) Debug.message("FunctionDialog: currentAction is null...");
      else {
        KeyStroke key = KeyStroke.getKeyStrokeForEvent(e);
        if (isPrintable(key, e)) helpLabel.setText(getHelpText("cannot-redefine"));
        else {
          actions.addActionForKeyStroke(key, currentAction);
          handleFuncListSelect();
        }
      }
      e.consume();
      removeKeyListener();
    }
示例#3
0
  /**
   * Traverse the directory tree starting in dir and add all the encountered files to the Set
   * allFiles.
   */
  private void traverseDirsForFiles(Set allFiles, File dir, FileFilter filter) {
    if (!filter.accept(dir)) {
      return;
    }
    if (dir.isFile()) {
      allFiles.add(dir);
      return;
    }

    File[] files = dir.listFiles(filter);
    if (files == null) {
      return;
    }

    try {
      getLocallyDeletedFiles(allFiles, dir);
    } catch (IOException ioe) {
      Debug.message("CVS error determining locally deleted files: " + ioe.getLocalizedMessage());
      // TODO: should probably propagate and cause the command to fail.
    }
    for (int i = 0; i < files.length; i++) {
      if (files[i].isFile()) {
        allFiles.add(files[i]);
      } else {
        traverseDirsForFiles(allFiles, files[i], filter);
      }
    }
  }
示例#4
0
  /**
   * Create the connection, open it and associate it with the client.
   *
   * @throws AuthenticationException
   * @throws CommandAbortedException
   * @throws AuthenticationException
   * @throws CommandAbortedException
   * @throws InvalidCvsRootException
   */
  void setupConnection(Client client) throws CommandAbortedException, AuthenticationException {
    Connection connection = getConnection(cvsroot);

    if (connection != null) {
      connection.open();
      client.setConnection(connection);
    } else {
      Debug.message("Repository.setupConnection: connection is null");
    }
  }