private void handleFinishedDropMove(DragSourceEvent event) {
   MultiStatus status =
       new MultiStatus(
           JavaScriptPlugin.getPluginId(),
           IJavaStatusConstants.INTERNAL_ERROR,
           JavaUIMessages.ResourceTransferDragAdapter_cannot_delete_resource,
           null);
   List resources = convertSelection();
   for (Iterator iter = resources.iterator(); iter.hasNext(); ) {
     IResource resource = (IResource) iter.next();
     try {
       resource.delete(true, null);
     } catch (CoreException e) {
       status.add(e.getStatus());
     }
   }
   if (status.getChildren().length > 0) {
     Shell parent = SWTUtil.getShell(event.widget);
     ErrorDialog error =
         new ErrorDialog(
             parent,
             JavaUIMessages.ResourceTransferDragAdapter_moving_resource,
             JavaUIMessages.ResourceTransferDragAdapter_cannot_delete_files,
             status,
             IStatus.ERROR);
     error.open();
   }
 }
Ejemplo n.º 2
0
 public void testBogusCommand() throws Exception {
   IProject proj = ensureProject(TEST_PROJECT_NAME);
   GrailsCommand cmd = GrailsCommand.forTest(proj, "create-domain").addArgument("gTunes.Album");
   try {
     cmd.synchExec();
     fail("Should have an exception, but didn't have one");
   } catch (CoreException e) {
     if (e.getStatus() instanceof MultiStatus) {
       MultiStatus m = (MultiStatus) e.getStatus();
       if (m.getChildren().length == 2) {
         assertContains("Script 'CreateDomain' not found", m.getChildren()[0].getMessage());
         return;
       }
     }
     fail("Incorrect exception thrown.  Status:\n" + e.getMessage());
   }
 }
  void updatePreviewTable(List<TaskMapper> queryHits, MultiStatus queryStatus) {
    previewTable.setInput(queryHits);

    if (queryStatus.isOK()) {
      setMessage(null, IMessageProvider.WARNING);
    } else {
      StringBuffer sb = new StringBuffer();
      for (IStatus status : queryStatus.getChildren()) {
        sb.append(status.getMessage()).append("\n"); // $NON-NLS-1$
      }
      setMessage(sb.toString(), IMessageProvider.WARNING);
    }
  }
Ejemplo n.º 4
0
 /**
  * Returns the status of the reader. If there were any errors, the result is a status object
  * containing individual status objects for each error. If there were no errors, the result is a
  * status object with error code <code>OK</code>.
  *
  * @return the status of this operation
  */
 public IStatus getStatus() {
   if (fWarnings.getChildren().length == 0) return Status.OK_STATUS;
   else return fWarnings;
 }