예제 #1
0
 private void showMessageDialogError() {
   String title = "Error";
   String mesg = "An everyday error occured.\n " + "Nothing to get worried.";
   MessageDialog.openError(getShell(), title, mesg);
   messageDlgResLabel.setText("Result: none");
   messageDlgResLabel.pack();
 }
예제 #2
0
 /**
  * This method is called when 'Finish' button is pressed in the wizard. We will create an
  * operation and run it using wizard as execution context.
  */
 public boolean performFinish() {
   final String containerName = page.getContainerName();
   final String fileName = page.getFileName();
   IRunnableWithProgress op =
       new IRunnableWithProgress() {
         public void run(IProgressMonitor monitor) throws InvocationTargetException {
           try {
             doFinish(containerName, fileName, monitor);
           } catch (CoreException e) {
             throw new InvocationTargetException(e);
           } finally {
             monitor.done();
           }
         }
       };
   try {
     getContainer().run(true, false, op);
   } catch (InterruptedException e) {
     return false;
   } catch (InvocationTargetException e) {
     Throwable realException = e.getTargetException();
     MessageDialog.openError(getShell(), "Error", realException.getMessage());
     return false;
   }
   return true;
 }
예제 #3
0
 private void showProgressDialog() {
   ProgressMonitorDialog dialog = new ProgressMonitorDialog(getShell());
   try {
     dialog.run(
         true,
         true,
         new IRunnableWithProgress() {
           public void run(final IProgressMonitor monitor)
               throws InvocationTargetException, InterruptedException {
             monitor.beginTask("Counting from one to 20...", 20);
             for (int i = 1; !monitor.isCanceled() && i <= 20; i++) {
               monitor.worked(1);
               Thread.sleep(1000);
             }
             monitor.done();
           }
         });
   } catch (Exception e) {
     MessageDialog.openError(getShell(), "Error", e.getMessage());
   }
 }