/* * @(#)NewSession.java * * This file is part of webCDwriter - Network CD/DVD Writing. * * Copyright (C) 1999-2006 Jörg P. M. Haeger * * webCDwriter is free software. See CDcreator.java for details. */ import java.io.*; import javax.swing.*; public class NewSession extends Command { protected QueueDialog queueDialog; void cancelCommand() { super.cancelCommand(); writeCommandIgnoreException("noop"); } int getDialogDelay() { return 1000; } protected void parseRankHint(String lineStr) throws IOException { StreamTokenizer tokenizer = new StreamTokenizer( new StringReader(lineStr)); tokenizer.nextToken(); if (tokenizer.nextToken() != StreamTokenizer.TT_NUMBER) return; queueDialog.setRank((int)tokenizer.nval); } void processHint(String str) { try { if (str.startsWith("rank")) parseRankHint(str); } catch (IOException e) { } } public void run() { if (!(this instanceof OpenSession)) run("newSession", "titleCreateSession", "createSession"); super.run(); } protected void run(String cmd, String title, String msg) { queueDialog = new QueueDialog(i18n(msg), cancelButton); showCentered(queueDialog, i18n(title)); if (State.sessionID != State.none) cmd = cmd + " " + spaceToEsc(State.sessionID); execCommand(cmd); } void showResult() { if (!lastResultOK()) JOptionPane.showMessageDialog( CDcreator.mainWin, lastResult, i18n("error"), JOptionPane.ERROR_MESSAGE); execSemaphore.setDone(); } }