Ejemplo n.º 1
0
  public void actionPerformed(ActionEvent ae) {
    if (nodes != null && nodes.size() > 0) {
      final SVNData cd = new SVNData();
      List<String> paths = new ArrayList<String>();
      boolean has_directory = false;
      for (VPTNode node : nodes) {
        if (node != null && node.getNodePath() != null) {
          paths.add(node.getNodePath());
          if (node.isDirectory() || node.isProject()) {
            has_directory = true;
          }
        }
      }
      cd.setPaths(paths);
      if (has_directory) {
        int answer =
            JOptionPane.showConfirmDialog(
                view,
                "One or more of the items selected is a directory.\nWould you like to see status for subdirectories and files?",
                "Show Child Status?",
                JOptionPane.YES_NO_CANCEL_OPTION,
                JOptionPane.QUESTION_MESSAGE);
        if (JOptionPane.CANCEL_OPTION == answer) {
          return;
        }
        cd.setRecursive(JOptionPane.YES_OPTION == answer);
      }
      if (username != null && password != null) {
        cd.setUsername(username);
        cd.setPassword(password);
      }

      cd.setOut(new ConsolePrintStream(view));

      StatusAction action = new StatusAction(view, cd);
      action.actionPerformed(null);
    }
  }
Ejemplo n.º 2
0
  public void actionPerformed(ActionEvent ae) {
    if (paths != null && paths.size() > 0) {
      dialog = new LockDialog(getView(), paths, false, remote);
      GUIUtils.center(getView(), dialog);
      dialog.setVisible(true);
      final CommitData data = dialog.getData();
      if (data == null) {
        return; // null means user canceled
      }

      if (getUsername() == null) {
        verifyLogin(data.getPaths() == null ? null : data.getPaths().get(0));
        if (isCanceled()) {
          return;
        }
      }
      data.setUsername(getUsername());
      data.setPassword(getPassword());
      data.setOut(new ConsolePrintStream(getView()));

      getView().getDockableWindowManager().showDockableWindow("subversion");
      final OutputPanel panel = SVNPlugin.getOutputPanel(getView());
      panel.showConsole();
      final Logger logger = panel.getLogger();
      logger.log(Level.INFO, jEdit.getProperty("ips.Unlocking_...", "Unlocking ..."));
      for (Handler handler : logger.getHandlers()) {
        handler.flush();
      }

      class Runner extends SwingWorker<LockResults, Object> {

        @Override
        public LockResults doInBackground() {
          try {
            Lock lock = new Lock();
            return lock.unlock(data);
          } catch (Exception e) {
            data.getOut().printError(e.getMessage());
          } finally {
            data.getOut().close();
          }
          return null;
        }

        @Override
        public boolean cancel(boolean mayInterruptIfRunning) {
          boolean cancelled = super.cancel(mayInterruptIfRunning);
          if (cancelled) {
            data.getOut().printError("Stopped 'Unlock' action.");
            data.getOut().close();
          } else {
            data.getOut().printError("Unable to stop 'Unlock' action.");
          }
          return cancelled;
        }

        @Override
        protected void done() {
          if (isCancelled()) {
            return;
          }

          try {
            JPanel results_panel =
                new AddResultsPanel(
                    get(), AddResultsPanel.UNLOCK, getView(), getUsername(), getPassword());
            panel.addTab(jEdit.getProperty("ips.Unlocked", "Unlocked"), results_panel);
          } catch (Exception e) { // NOPMD
            // ignored
          }
        }
      }
      Runner runner = new Runner();
      panel.addWorker("Unlock", runner);
      runner.execute();
    }
  }