J
Jeff Kish
Hi.
I have an swt app and I'm working in eclipse.
I'm trying to figure out the best way to fit a status dialog up that
will allow me to report records processed etc and make cancel /pause
processing buttons available.
I'm pretty rust so a pointer to a code snippet or actual code would be
appreciated.
Thanks
Jeff
p.s. here is my main. basically the'processingToDo' method puts up a
couple of file dialogs to get input and output file names, and then
reads one file and writes the other.
public class HelloWorld {
public static void main(String[] args) {
boolean firstTime = true;
String fileToProcess = new String();
String outputFile = new String();
LogFileProcessor theLFP = null;
Display display = new Display ();
Shell shell = new Shell (display);
Label label = new Label (shell, SWT.CENTER);
label.setText ("Hello_world");
label.setBounds (shell.getClientArea ());
shell.open ();
theLFP = new LogFileProcessor(shell);
while (!shell.isDisposed ())
{
if (firstTime)
{
firstTime = false;
}
else
{
// The file already exists; asks for
confirmation
MessageBox mb = new MessageBox(shell,
SWT.ICON_WARNING
| SWT.YES | SWT.NO);
// We really should read this string from a
// resource bundle
mb.setMessage("Process Another? ");
// If they click Yes, we're done and we drop
out. If
// they click No, we redisplay the File
Dialog
if (mb.open() != SWT.YES)
{
break;
}
}
fileToProcess = theLFP.ProcessingToDo();
if (fileToProcess != null)
{
label.setText("input file: " + fileToProcess);
outputFile = theLFP.GetOutputFileName();
if (outputFile != null)
{
label.setText("input file: " +
fileToProcess + ", output file: " + outputFile);
ProcessInputDrWatsonFile PIDWF = new
ProcessInputDrWatsonFile();
if (PIDWF != null)
{
try
{
PIDWF.StartProcessing(fileToProcess, outputFile);
}
catch (IOException ex)
{
label.setText("EXCEPTION " + ex.getMessage() + " Processing input
file: " + fileToProcess + ", output file: " + outputFile);
}
}
}
}
else
{
break;
}
if (!display.readAndDispatch ()) display.sleep ();
}
display.dispose ();
}
}
I have an swt app and I'm working in eclipse.
I'm trying to figure out the best way to fit a status dialog up that
will allow me to report records processed etc and make cancel /pause
processing buttons available.
I'm pretty rust so a pointer to a code snippet or actual code would be
appreciated.
Thanks
Jeff
p.s. here is my main. basically the'processingToDo' method puts up a
couple of file dialogs to get input and output file names, and then
reads one file and writes the other.
public class HelloWorld {
public static void main(String[] args) {
boolean firstTime = true;
String fileToProcess = new String();
String outputFile = new String();
LogFileProcessor theLFP = null;
Display display = new Display ();
Shell shell = new Shell (display);
Label label = new Label (shell, SWT.CENTER);
label.setText ("Hello_world");
label.setBounds (shell.getClientArea ());
shell.open ();
theLFP = new LogFileProcessor(shell);
while (!shell.isDisposed ())
{
if (firstTime)
{
firstTime = false;
}
else
{
// The file already exists; asks for
confirmation
MessageBox mb = new MessageBox(shell,
SWT.ICON_WARNING
| SWT.YES | SWT.NO);
// We really should read this string from a
// resource bundle
mb.setMessage("Process Another? ");
// If they click Yes, we're done and we drop
out. If
// they click No, we redisplay the File
Dialog
if (mb.open() != SWT.YES)
{
break;
}
}
fileToProcess = theLFP.ProcessingToDo();
if (fileToProcess != null)
{
label.setText("input file: " + fileToProcess);
outputFile = theLFP.GetOutputFileName();
if (outputFile != null)
{
label.setText("input file: " +
fileToProcess + ", output file: " + outputFile);
ProcessInputDrWatsonFile PIDWF = new
ProcessInputDrWatsonFile();
if (PIDWF != null)
{
try
{
PIDWF.StartProcessing(fileToProcess, outputFile);
}
catch (IOException ex)
{
label.setText("EXCEPTION " + ex.getMessage() + " Processing input
file: " + fileToProcess + ", output file: " + outputFile);
}
}
}
}
else
{
break;
}
if (!display.readAndDispatch ()) display.sleep ();
}
display.dispose ();
}
}