public void stop() { running = false; for (Handler handler : logger.getHandlers()) { handler.flush(); handler.close(); } }
public void stop() { running = false; for (Handler handler : logger.getHandlers()) { handler.flush(); handler.close(); } if (jFrame != null) { jFrame.dispose(); } }
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(); } }