Examples of IRunnableWithProgress


Examples of org.eclipse.jface.operation.IRunnableWithProgress

        // join wga distribution download if present
        Job[] jobs = Job.getJobManager().find(WGADesignerPlugin.JOB_FAMILY_WGA_DISTRIBUTION_DOWNLOAD);
        if (jobs != null && jobs.length > 0) {
            ProgressMonitorDialog dialog = new ProgressMonitorDialog(getShell());
            IRunnableWithProgress runnable = new IRunnableWithProgress() {
                public void run(IProgressMonitor arg0) throws InvocationTargetException, InterruptedException {
                    Job.getJobManager().join(WGADesignerPlugin.JOB_FAMILY_WGA_DISTRIBUTION_DOWNLOAD, arg0);
                }
            };
            try {
View Full Code Here

Examples of org.eclipse.jface.operation.IRunnableWithProgress

  @Override
  public boolean performFinish() {
    final String runtimeName = _page.getRuntimeName();
    final WGADeployment deployment = _page.getWGADeployment();
    final List<String> selectedWorkingSets = _page.getSelectedWorkingSets();
    IRunnableWithProgress op = new IRunnableWithProgress() {
      public void run(IProgressMonitor monitor) throws InvocationTargetException {
        try {
          doFinish(runtimeName, deployment, monitor, selectedWorkingSets);
        } catch (CoreException e) {
          WGADesignerPlugin.getDefault().logError(e.getMessage(), e);         
View Full Code Here

Examples of org.eclipse.jface.operation.IRunnableWithProgress

                }
            } catch (Exception e) {
                // ignore
            }
           
            getContainer().run(true, false, new IRunnableWithProgress() {
                public void run(IProgressMonitor monitor) {
                    try {
                        int totalWork = 6;
                        if (isCopyContent()) {
                            totalWork += 2;
View Full Code Here

Examples of org.eclipse.jface.operation.IRunnableWithProgress

  }
 
  public static void call(final IResource fResource, Shell shell) {
   
   
    final IRunnableWithProgress runnable = new IRunnableWithProgress() {

      public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
        // count resources
        /*
        final Integer count = 0;
        try {
          fResource.accept(new IResourceVisitor() {
           
            public boolean visit(IResource resource) throws CoreException {
              if (resource instanceof IFile) {
                IFile file = (IFile) resource;
                if (file.getName().endsWith(".tml")) {
                  count++
                }
              }
              return true;
            }
          });
        } catch (CoreException e) {
        }*/
       
        try {
          final IProgressMonitor fMonitor = monitor;
          fMonitor.beginTask("Validating resources", IProgressMonitor.UNKNOWN);
          fResource.accept(new IResourceVisitor() {
           
            public boolean visit(IResource resource) throws CoreException {
              if (resource instanceof IFile) {
                IFile file = (IFile) resource;
                if (WGADesignResourceValidator.shouldBeValidated(file)) {
                  try {
                    fMonitor.setTaskName("Validating '" + file.getLocation().toString() + "'.");
                    WGADesignResourceValidator.validate(file);
                    fMonitor.worked(1);                     
                  } catch (Exception e) { 
                  }
                }
              }
              if (resource instanceof IContainer) {
                IContainer container = (IContainer) resource;
                if (WGADesignResourceValidator.shouldBeValidated(container)) {
                  try {
                    fMonitor.setTaskName("Validating '" + container.getLocation().toString() + "'.");
                    WGADesignResourceValidator.validate(container);
                    fMonitor.worked(1);                     
                  } catch (Exception e) { 
                  }
                }
              }
              if (!fMonitor.isCanceled()) {
                return true;
              } else {
                return false;
              }
            }
          });
        } catch (CoreException e) {           
        } finally {
          monitor.done();
        }
      }
    };
   
    try {
      if (shell != null) {
        ProgressMonitorDialog dialog = new ProgressMonitorDialog(shell);
        dialog.run(true, true, runnable);
      } else {
        Job job = new Job("validation") {

          @Override
          protected IStatus run(IProgressMonitor monitor) {
            try {
              runnable.run(monitor);
              return Status.OK_STATUS;
            } catch (Exception e) {
              return new Status(Status.ERROR, Plugin.PLUGIN_ID, "Validation failed", e);
            }
          }
View Full Code Here

Examples of org.eclipse.jface.operation.IRunnableWithProgress

    if (_addDialog.getReturnCode() == Dialog.OK) {
      // check if deployment already exists     
      if (WGADesignerPlugin.getDefault().getWGADeploymentManager().hasDeployment(_addDialog.getSymbolicName())) {
        WorkbenchUtils.showErrorDialog(getShell(), "WGA deployment already exists.", "A WGA deployment with name '" + _addDialog.getSymbolicName() + "' already exists.");
      } else {
        IRunnableWithProgress runnable = null;
        if (_addDialog.isDownloadRequested()) {
          runnable = new IRunnableWithProgress() {
           
            public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
              TemporaryFile wgaWar = null;
              try {
                monitor.beginTask("Deploying wga", 100);
                SubProgressMonitor downloadMonitor = new SubProgressMonitor(monitor, 90);
                boolean isCustomDownloadLocation = false;
                if (_addDialog.getLocation() != null && !_addDialog.getLocation().trim().equalsIgnoreCase("")) {
                                    wgaWar = WGADesignerPlugin.getDefault().downloadWGA(downloadMonitor, _addDialog.getLocation());
                                    isCustomDownloadLocation = true;
                                } else {
                                    wgaWar = WGADesignerPlugin.getDefault().downloadCurrentWGARelease(downloadMonitor);                                
                                }
                if (!monitor.isCanceled()) {
                  SubProgressMonitor deployMonitor = new SubProgressMonitor(monitor, 10);
                  WGADeployment deployment = WGADesignerPlugin.getDefault().getWGADeploymentManager().createDeployment(_addDialog.getSymbolicName(), wgaWar.getFile(), deployMonitor);
                  if (deployment != null && isCustomDownloadLocation) {
                      deployment.setUpdateURL(_addDialog.getLocation());
                  }
                }
              } catch (Exception e) {
                throw new InterruptedException(e.getMessage());
              } finally {
                if (wgaWar != null) {
                  wgaWar.delete();
                }
                monitor.done();
              }
            }
          };
        } else {
          final File wgaWar = new File(_addDialog.getLocation());
          runnable = new IRunnableWithProgress() { 
            public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
              try {
                WGADesignerPlugin.getDefault().getWGADeploymentManager().createDeployment(_addDialog.getSymbolicName(), wgaWar, monitor);           
              } catch (Exception e) {
                throw new InterruptedException(e.getMessage());
View Full Code Here

Examples of org.eclipse.jface.operation.IRunnableWithProgress

  private void handleRemove() {   
      if (_tableControl.getTable().getSelectionCount() > 0) {
        _selectedDeployment = (WGADeployment) _tableControl.getTable().getSelection()[0].getData();
        boolean remove = MessageDialog.openConfirm(getShell(), "Remove wga deployment?", "Are you sure you want permanently remove the wga deployment '" + _selectedDeployment.toString() + "'? Depending WGA runtimes will stop working.");
        if (remove) {
          IRunnableWithProgress runnable = new IRunnableWithProgress() {
            public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
              try {               
                WGADesignerPlugin.getDefault().getWGADeploymentManager().removeDeployment(_selectedDeployment, monitor);           
              } catch (Exception e) {
                throw new InterruptedException(e.getMessage());
View Full Code Here

Examples of org.eclipse.jface.operation.IRunnableWithProgress

      _selectedDeployment = (WGADeployment) _tableControl.getTable().getSelection()[0].getData();
      _updateDialog = new WGADeploymentDialog(getShell(), _selectedDeployment);
      _updateDialog.setTitle("Update wga deployment");
      _updateDialog.open();
      if (_updateDialog.getReturnCode() == Dialog.OK) {
        IRunnableWithProgress runnable = null;     
        if (_updateDialog.isDownloadRequested()) {
          runnable = new IRunnableWithProgress() {           
            public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
              TemporaryFile wgaWar = null;
              try {
                monitor.beginTask("Deploying wga", 100);
                SubProgressMonitor downloadMonitor = new SubProgressMonitor(monitor, 90);
                if (_updateDialog.getLocation() != null && !_updateDialog.getLocation().trim().equalsIgnoreCase("")) {
                    wgaWar = WGADesignerPlugin.getDefault().downloadWGA(downloadMonitor, _updateDialog.getLocation());
                } else {
                    wgaWar = WGADesignerPlugin.getDefault().downloadCurrentWGARelease(downloadMonitor);                   
                }
                if (!monitor.isCanceled()) {
                  SubProgressMonitor deployMonitor = new SubProgressMonitor(monitor, 10);
                  _selectedDeployment.updateWGA(wgaWar.getFile(), deployMonitor)
                }
              } catch (Exception e) {
                throw new InterruptedException(e.getMessage());
              } finally {
                if (wgaWar != null) {
                  wgaWar.delete();
                }
                monitor.done();
              }
            }
          };
        } else {       
          final File wgaWar = new File(_updateDialog.getLocation());
          runnable = new IRunnableWithProgress() {
   
            public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
              try {
                _selectedDeployment.updateWGA(wgaWar, monitor);           
              } catch (Exception e) {
View Full Code Here

Examples of org.eclipse.jface.operation.IRunnableWithProgress

    final ProgressMonitorDialog dialog = new NewsServiceProgressMonitorDialog(new Shell(Display.getDefault(), SWT.NONE));
    dialog.setOpenOnRun(false);

    /* Runnable will open the Dialog after SHOW_PROGRESS_THRESHOLD ms */
    IRunnableWithProgress runnable = new IRunnableWithProgress() {
      private boolean fDialogOpened;

      public void run(IProgressMonitor monitor) {
        int worked = 0;
        for (IFeed feed : feeds) {
View Full Code Here

Examples of org.eclipse.jface.operation.IRunnableWithProgress

      }
    };
    dialog.setOpenOnRun(false);

    /* Runnable to start core */
    IRunnableWithProgress runnable = new IRunnableWithProgress() {
      public void run(IProgressMonitor monitor) {
        LongOperationMonitor callbackMonitor = new LongOperationMonitor(monitor) {
          @Override
          public void beginLongOperation() {
            Display.getDefault().syncExec(new Runnable() {
View Full Code Here

Examples of org.eclipse.jface.operation.IRunnableWithProgress

  }

  private void deleteInBackground(final Runnable deleteRunnable) {

    /* Runnable with Progress */
    IRunnableWithProgress runnableWithProgress = new IRunnableWithProgress() {
      public void run(IProgressMonitor monitor) {
        monitor.beginTask(Messages.DeleteTypesAction_WAIT_DELETE, IProgressMonitor.UNKNOWN);
        try {
          deleteRunnable.run();
        } finally {
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.