Package org.eclipse.ui.progress

Examples of org.eclipse.ui.progress.WorkbenchJob


    /**
     * Create the update job that handles the updatesInfo.
     */
    private void createUpdateJob() {
        updateJob = new WorkbenchJob(ProgressMessages.ProgressContentProvider_UpdateProgressJob) {
            /*
             * (non-Javadoc)
             *
             * @see org.eclipse.ui.progress.UIJob#runInUIThread(org.eclipse.core.runtime.IProgressMonitor)
             */
 
View Full Code Here


    AnimationManager() {

        animationProcessor = new ProgressAnimationProcessor(this);

        animationUpdateJob = new WorkbenchJob(ProgressMessages.AnimationManager_AnimationStart) {

            /*
             * (non-Javadoc)
             *
             * @see org.eclipse.ui.progress.UIJob#runInUIThread(org.eclipse.core.runtime.IProgressMonitor)
View Full Code Here

        }
        // nothing to do if the dialog is already closed
        if (getShell() == null) {
          return;
        }
        WorkbenchJob closeJob = new WorkbenchJob(
            ProgressMessages.ProgressMonitorFocusJobDialog_CLoseDialogJob) {
          /*
           * (non-Javadoc)
           *
           * @see org.eclipse.ui.progress.UIJob#runInUIThread(org.eclipse.core.runtime.IProgressMonitor)
           */
          public IStatus runInUIThread(IProgressMonitor monitor) {
            Shell currentShell = getShell();
            if (currentShell == null || currentShell.isDisposed()) {
              return Status.CANCEL_STATUS;
            }
            finishedRun();
            return Status.OK_STATUS;
          }
        };
        closeJob.setSystem(true);
        closeJob.schedule();
      }
    };
  }
View Full Code Here

              // lock listener
            }
          }
        });

    WorkbenchJob openJob = new WorkbenchJob(
        ProgressMessages.ProgressMonitorFocusJobDialog_UserDialogJob) {
      /*
       * (non-Javadoc)
       *
       * @see org.eclipse.ui.progress.UIJob#runInUIThread(org.eclipse.core.runtime.IProgressMonitor)
       */
      public IStatus runInUIThread(IProgressMonitor monitor) {

        // if the job is done at this point, we don't need the dialog
        if (job.getState() == Job.NONE) {
          finishedRun();
          cleanUpFinishedJob();
          return Status.CANCEL_STATUS;
        }

        // now open the progress dialog if nothing else is
        if (!ProgressManagerUtil.safeToOpen(
            ProgressMonitorFocusJobDialog.this, originatingShell)) {
          return Status.CANCEL_STATUS;
        }

        // Do not bother if the parent is disposed
        if (getParentShell() != null && getParentShell().isDisposed()) {
          return Status.CANCEL_STATUS;
        }

        open();

        return Status.OK_STATUS;
      }
    };
    openJob.setSystem(true);
    openJob.schedule();

  }
View Full Code Here

     * If there is no parent shell we have not been asked for a parent so we
     * want to avoid blocking. If there is a parent then it is OK to open.
     */
    if (parentShell == null) {
      // create the job that will open the dialog after a delay.
      WorkbenchJob dialogJob = new WorkbenchJob(
          WorkbenchMessages.EventLoopProgressMonitor_OpenDialogJobName) {
        /*
         * (non-Javadoc)
         *
         * @see org.eclipse.ui.progress.UIJob#runInUIThread(org.eclipse.core.runtime.IProgressMonitor)
         */
        public IStatus runInUIThread(IProgressMonitor monitor) {
          if (singleton == null) {
            return Status.CANCEL_STATUS;
          }
          if (ProgressManagerUtil.rescheduleIfModalShellOpen(this)) {
            return Status.CANCEL_STATUS;
          }
          singleton.open();
          return Status.OK_STATUS;
        }
      };
      // Wait for long operation time to prevent a proliferation
      // of dialogs
      dialogJob.setSystem(true);
      dialogJob.schedule(PlatformUI.getWorkbench().getProgressService()
          .getLongOperationTime());
    } else {
      singleton.open();
    }

View Full Code Here

   * renders the whole score to fix any visual glitches called upon bootup or
   * by user via explicit action
   */
  public void refreshScreen() {
    final GraphicalViewer graphicalViewer = getGraphicalViewer();
    WorkbenchJob job = new WorkbenchJob(MusicMessages.MeiseEditor_37) {
      @Override
      public IStatus runInUIThread(IProgressMonitor monitor) {
        monitor.beginTask(MusicMessages.MeiseEditor_38, 4);
        Image img;
        GC imageGC;
        ScalableFreeformRootEditPart rootEditPart = (ScalableFreeformRootEditPart) graphicalViewer
            .getEditPartRegistry().get(LayerManager.ID);
        IFigure fig1 = ((FreeformGraphicalRootEditPart) rootEditPart)
            .getLayer(LayerConstants.PRINTABLE_LAYERS);
        monitor.worked(1);
        ImageData data = new ImageData(fig1.getClientArea().width,
            fig1.getClientArea().height, 24, new PaletteData(0xFF,
                0xFF00, 0xFF000));
        monitor.worked(2);
        img = new Image(Display.getCurrent(), data);
        imageGC = new GC(img);
        Graphics g = new SWTGraphics(imageGC);
        monitor.worked(3);
        fig1.paint(g);
        g.dispose();
        imageGC.dispose();
        img.dispose();
        monitor.done();
        return Status.OK_STATUS;
      }
    };
    job.setPriority(Job.BUILD);
    job.schedule();
  }
View Full Code Here

      }
    });
  }

  public static Job uijob(final String name, final Function<IProgressMonitor, IStatus> fn) {
    return new WorkbenchJob(name) {
      @Override
      public IStatus runInUIThread(final IProgressMonitor monitor) {
        return fn.apply(monitor);
      }
    };
View Full Code Here

    };
  }

  public static Job stateJob(final String name, final AtomicInteger state,
      final Function2<IProgressMonitor, Integer, IStatus> fn) {
    return new WorkbenchJob(name) {
      @Override
      public IStatus runInUIThread(final IProgressMonitor monitor) {
        return fn.apply(monitor, state.incrementAndGet());
      }
    };
View Full Code Here

 
  @Override
  public void run(IAction action) {
    final IFile agentFile = getSelectedAgentFile();
    final IActionDelegate wizard = getActionToRun();
    WorkbenchJob job = new WorkbenchJob(Display.getCurrent(),"Launch Wizard") {
     
      @Override
      public IStatus runInUIThread(IProgressMonitor monitor) {
        final Action action = new Action() {};
        wizard.selectionChanged(action, new StructuredSelection(agentFile));
          wizard.run(action);
      return Status.OK_STATUS;
      }
    };
    job.schedule();
  }
View Full Code Here

 
  @Override
  public void run(IAction action) {
    final IFile agentFile = getSelectedAgentFile();
    final IActionDelegate wizard = getActionToRun();
    WorkbenchJob job = new WorkbenchJob(Display.getCurrent(),"Launch Wizard") {
     
      @Override
      public IStatus runInUIThread(IProgressMonitor monitor) {
        final Action action = new Action() {};
        wizard.selectionChanged(action, new StructuredSelection(agentFile));
          wizard.run(action);
      return Status.OK_STATUS;
      }
    };
    job.schedule();
  }
View Full Code Here

TOP

Related Classes of org.eclipse.ui.progress.WorkbenchJob

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.