Examples of ProgressMonitorDialog


Examples of org.eclipse.jface.dialogs.ProgressMonitorDialog

  }

  private void startCore() {

    /* Dialog to show progress */
    final ProgressMonitorDialog dialog = new ProgressMonitorDialog(new Shell(Display.getDefault())) {
      @Override
      protected Point getInitialLocation(Point initialSize) {
        Rectangle displayBounds = getParentShell().getDisplay().getPrimaryMonitor().getBounds();
        Point shellSize = getInitialSize();
        int x = displayBounds.x + (displayBounds.width - shellSize.x) >> 1;
        int y = displayBounds.y + (displayBounds.height - shellSize.y) >> 1;

        return new Point(x, y);
      }

      @Override
      protected Point getInitialSize() {
        int minWidth = 380;
        int minHeight = getShell().computeSize(minWidth, SWT.DEFAULT).y;

        return new Point(minWidth, minHeight);
      }

      @Override
      protected Control createButtonBar(Composite parent) {
        return null;
      }
    };
    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() {
              public void run() {
                dialog.open();
              }
            });
          }
        };

        /* Start Core */
        InternalOwl.getDefault().startup(callbackMonitor);
      }
    };

    /* Execute the Runnable */
    try {
      dialog.run(false, false, runnable);
    } catch (InvocationTargetException e) {
      Activator.getDefault().logError(e.getMessage(), e);
    } catch (InterruptedException e) {
      Activator.getDefault().logError(e.getMessage(), e);
    }
View Full Code Here

Examples of org.eclipse.jface.dialogs.ProgressMonitorDialog

  private NewsCounter countAll() {
    final NewsCounter newsCounter = new NewsCounter();
    final long start = System.currentTimeMillis();
    final Collection<IFeed> feeds = DynamicDAO.loadAll(IFeed.class);

    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) {
          newsCounter.put(feed.getLink(), count(feed));

          /* Open the Dialog if exceeded SHOW_PROGRESS_THRESHOLD ms */
          if (System.currentTimeMillis() - start > SHOW_PROGRESS_THRESHOLD && !fDialogOpened) {
            dialog.open();
            monitor.beginTask("RSSOwl was not shutdown properly. Restoring data...", feeds.size() - worked);
            fDialogOpened = true;
          }

          /* Worked a bit again... */
          if (fDialogOpened)
            monitor.worked(1);

          /* Remember the worked items */
          worked++;
        }

        /* Completed */
        monitor.done();
      }
    };

    /* Execute the Runnable */
    try {
      dialog.run(false, false, runnable);
    } catch (InvocationTargetException e) {
      Activator.getDefault().logError(e.getMessage(), e);
    } catch (InterruptedException e) {
      Activator.getDefault().logError(e.getMessage(), e);
    }
View Full Code Here

Examples of org.eclipse.jface.dialogs.ProgressMonitorDialog

        monitor.done();
      }
    };

    /* Show progress and allow for cancellation */
    ProgressMonitorDialog dialog = new ProgressMonitorDialog(getShell());
    dialog.setBlockOnOpen(false);
    dialog.setCancelable(true);
    dialog.setOpenOnRun(true);
    try {
      dialog.run(true, true, runnable);
    } catch (InvocationTargetException e) {
      Activator.getDefault().logError(e.getMessage(), e);
    } catch (InterruptedException e) {
      Activator.getDefault().logError(e.getMessage(), e);
    }
View Full Code Here

Examples of org.eclipse.jface.dialogs.ProgressMonitorDialog

     * @param mode the mode to launch in
     * @param editor activated on an editor (or from a selection in a viewer)
     */
    public void searchAndLaunch(Object[] search, String mode, boolean editor) {
        IType[] types = null;
        ProgressMonitorDialog dialog = new ProgressMonitorDialog(getShell());
       
        if (search != null) {
            try {       
                IJavaElement[] elements = getJavaElements(search);
                MainMethodSearchEngine engine = new MainMethodSearchEngine();
View Full Code Here

Examples of org.eclipse.jface.dialogs.ProgressMonitorDialog

        {
            shell = getActiveWorkbenchShell();
        }
        try
        {
            new ProgressMonitorDialog(shell).run(true, true, op);
        }
        catch (InvocationTargetException e)
        {
            SigilCore.error("Workspace operation failed", e);
        }
View Full Code Here

Examples of org.eclipse.jface.dialogs.ProgressMonitorDialog

        {
            shell = getActiveWorkbenchShell();
        }
        try
        {
            new ProgressMonitorDialog(shell).run(false, true, op);
        }
        catch (InvocationTargetException e)
        {
            if (e.getCause() instanceof CoreException) {
                throw (CoreException) e.getCause();
View Full Code Here

Examples of org.eclipse.jface.dialogs.ProgressMonitorDialog

                                throw new InterruptedException();
                            }
                        }
                    }
                };
                new ProgressMonitorDialog(shell).run(false, true, saveOperation);

                // Execute on the file
                IFile file = fileInput.getFile();
                getResourceCommandHandler().execute(new IResource[] { file }, event);
            }
View Full Code Here

Examples of org.eclipse.jface.dialogs.ProgressMonitorDialog

            }
        };

        try
        {
            new ProgressMonitorDialog(Display.getCurrent().getActiveShell()).run(false,
                false, op);
        }
        catch (InvocationTargetException e)
        {
            // TODO Auto-generated catch block
View Full Code Here

Examples of org.eclipse.jface.dialogs.ProgressMonitorDialog

    {
        monitor.beginTask("Saving", IProgressMonitor.UNKNOWN);
        try
        {
            saving = true;
            new ProgressMonitorDialog(getSite().getShell()).run(true, true,
                new IRunnableWithProgress()
                {
                    public void run(IProgressMonitor monitor)
                        throws InvocationTargetException, InterruptedException
                    {
View Full Code Here

Examples of org.eclipse.jface.dialogs.ProgressMonitorDialog

        installOrUpdateSupportBundleLink.addHyperlinkListener(new HyperlinkAdapter() {

            @Override
            public void linkActivated(HyperlinkEvent e) {

                ProgressMonitorDialog dialog = new ProgressMonitorDialog(getShell());
                dialog.setCancelable(true);
                try {
                    dialog.run(true, false, new IRunnableWithProgress() {

                        @Override
                        public void run(IProgressMonitor monitor) throws InvocationTargetException,
                                InterruptedException {
                            final Version remoteVersion;
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.