Package org.eclipse.core.runtime.jobs

Examples of org.eclipse.core.runtime.jobs.Job


  public void debugSessionTerminated()
  {
        fireTerminateEvent();
        getLaunch().removeDebugTarget(CGIDebugTarget.this);

        Job acceptNewDebugger = new Job("EPIC.acceptNewDebugger") {
          protected IStatus run(IProgressMonitor monitor)
          {
            if (acceptNewDebugger()) { respawn(); return Status.OK_STATUS; }
            else return Status.CANCEL_STATUS;
          }
        };
        acceptNewDebugger.setPriority(Job.LONG);
        acceptNewDebugger.setSystem(true);
        acceptNewDebugger.schedule();
  }
View Full Code Here


        final String marker = getMarker();
        final IResource resource = getResource();

        final MarkerUtilities factory = new MarkerUtilities(getLog(), getPluginId());

        Job job =
            new Job(getJobTitle(resource))
        {
            protected IStatus run(IProgressMonitor monitor)
            {
                // cancelled while sitting in queue
                if (monitor.isCanceled()) { return Status.CANCEL_STATUS; }

                factory.deleteMarkers(resource, marker);

                /*
                 * this should be able to support multiple resources as well in the future - the
                 * loop would just need to include a check against the monitor for cancellation
                 */
                Object[] violations = doJob(resource);

                // check if we were cancelled while the thread was running
                if (monitor.isCanceled()) { return Status.CANCEL_STATUS; }

                for (int i = 0; i < violations.length; i++)
                {
                    Map attributes = createMarkerAttributes(factory, violations[i]);
                    factory.createMarker(resource, marker, attributes);
                }

                return Status.OK_STATUS;
            }
        };

        job.setUser(true);
        job.schedule();
    }
View Full Code Here

        scheduleJob(getMarkerType());
    }

    private void scheduleJob(final String markerType)
    {
        Job job =
            new Job("Clear EPIC Marker(s)")
        {
            protected IStatus run(IProgressMonitor monitor)
            {
                MarkerUtilities factory = new MarkerUtilities(getLog(), getPluginId());
                factory.deleteMarkers(getResource(), markerType);

                return Status.OK_STATUS;
            }
        };

        job.setSystem(true);
        job.schedule();
    }
View Full Code Here

    GridDataFactory.fillDefaults().align(SWT.FILL, SWT.CENTER).applyTo(connectButton);
   
    connectButton.addSelectionListener(new SelectionAdapter() {
      @Override
      public void widgetSelected(SelectionEvent e) {
        Job job = new Job(Messages.CloudFoundryServerStatusSection_JOB_CONN_SERVER) {
         
          @Override
          protected IStatus run(IProgressMonitor monitor) {
            try {
              cfServer.getBehaviour().connect(monitor);
            }
            catch (CoreException e) {
              StatusManager.getManager().handle(new Status(Status.ERROR, CloudFoundryServerUiPlugin.PLUGIN_ID, "", e), StatusManager.LOG); //$NON-NLS-1$
              return Status.CANCEL_STATUS;
            }
           
            return Status.OK_STATUS;
          }
        };
        job.schedule();
      }
    });
   
    disconnectButton = toolkit.createButton(composite, Messages.CloudFoundryServerStatusSection_TEXT_DISCONN_BUTTON, SWT.PUSH);
    GridDataFactory.fillDefaults().align(SWT.FILL, SWT.CENTER).applyTo(disconnectButton);
   
    disconnectButton.addSelectionListener(new SelectionAdapter() {
      @Override
      public void widgetSelected(SelectionEvent e) {
        Job job = new Job(Messages.CloudFoundryServerStatusSection_JOB_CONN_SERVER) {
         
          @Override
          protected IStatus run(IProgressMonitor monitor) {
            try {
              cfServer.getBehaviour().disconnect(monitor);
            }
            catch (CoreException e) {
              StatusManager.getManager().handle(new Status(Status.ERROR, CloudFoundryServerUiPlugin.PLUGIN_ID, "", e), StatusManager.LOG); //$NON-NLS-1$
              return Status.CANCEL_STATUS;
            }
           
            return Status.OK_STATUS;
          }
        };
        job.schedule();
      }
    });
   
    update();
   
View Full Code Here

    }
    catch (CoreException e1) {
      CloudFoundryPlugin.log(e1);
    }

    Job job = new Job(jobName) {

      @Override
      protected IStatus run(IProgressMonitor monitor) {
        closeCaldecottTunnels(monitor);
        return Status.OK_STATUS;
      }

    };
    job.setSystem(false);
    job.schedule();
  }
View Full Code Here

      // not appear
      // in the list of Server apps until after some manual refresh
      // occurs, or another operation
      // triggers a refresh.
      // Launch in Job as it could be long-running
      Job job = new Job(NLS.bind(Messages.REFRESHING_MODULES, getServer().getName())) {

        @Override
        protected IStatus run(IProgressMonitor monitor) {
          refreshModules(monitor);
          return Status.OK_STATUS;
        }

      };

      job.setPriority(Job.INTERACTIVE);
      job.schedule();

    }
    catch (CoreException e) {
      CloudFoundryPlugin.logError(Messages.ERROR_INITIALISE_REFRESH_NO_SERVER);
    }
View Full Code Here

  public String getJobName() {
    return displayName;
  }

  protected Job getJob() {
    Job job = super.getJob();
    job.setUser(true);
    return job;
  }
View Full Code Here

          // thread as it may be a long
          // running process that may block the thread while waiting
          // for the user to exist the external
          // application
          if (resolvedCommand != null) {
            Job job = new Job(Messages.LaunchTunnelCommandAction_JOB_LAUNCH) {

              @Override
              protected IStatus run(IProgressMonitor monitor) {
                // Finally launch the external tool after
                // options
                // are filled
                // in.
                try {
                  new LaunchTunnelCommandManager(resolvedCommand).run(monitor);
                }
                catch (CoreException e) {
                  IStatus errorStatus = CloudFoundryPlugin.getErrorStatus(e);
                  CloudFoundryPlugin.log(errorStatus);
                  return errorStatus;
                }
                return Status.OK_STATUS;
              }
            };

            // As this may be a long running process, so set it as a
            // system job
            job.setSystem(true);
            job.schedule();
          }

          return Status.OK_STATUS;
        }
      };
View Full Code Here

    return PlatformUI.getWorkbench().getModalDialogShellProvider().getShell();
  }

  @Override
  protected Job getJob() {
    Job job = super.getJob();
    // As starting a Caldecott tunnel may take time, show progress dialog
    // that also
    // allows the user to run it as a background job.
    job.setUser(true);
    return job;
  }
View Full Code Here

                // Now do a publish AFTER the IModule is
                // created. If no IModule is created (either
                // user cancels or project
                // is not supported), the publish operation will
                // do nothing.
                Job job = new Job(jobName) {

                  @Override
                  protected IStatus run(IProgressMonitor monitor) {
                    cloudServer.getBehaviour().publishAdd(moduleName, monitor);
                    return Status.OK_STATUS;
                  }

                };
                job.setPriority(Job.INTERACTIVE);
                job.schedule();
                return Status.OK_STATUS;
              }
            }
          }
          return Status.CANCEL_STATUS;
        }
      };
      job.schedule();

      return true;
    }
View Full Code Here

TOP

Related Classes of org.eclipse.core.runtime.jobs.Job

Copyright © 2018 www.massapicom. 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.