Tabnine Logo
IProgressMonitor
Code IndexAdd Tabnine to your IDE (free)

How to use
IProgressMonitor
in
org.eclipse.core.runtime

Best Java code snippets using org.eclipse.core.runtime.IProgressMonitor (Showing top 20 results out of 2,331)

Refine searchRefine arrow

  • OperationCanceledException
  • IPath
  • NLS
  • CoreException
  • IProject
origin: pentaho/pentaho-kettle

@SuppressWarnings( "unchecked" )
private RowMetaAndData[] doScan( IProgressMonitor monitor ) throws Exception {
 monitor.beginTask( BaseMessages.getString( PKG, "GetXMLDateLoopNodesImportProgressDialog.Task.ScanningFile",
   filename ), 1 );
 monitor.worked( 1 );
 if ( monitor.isCanceled() ) {
  return null;
 monitor.worked( 1 );
 monitor
   .beginTask( BaseMessages.getString( PKG, "GetXMLDateLoopNodesImportProgressDialog.Task.ReadingDocument" ), 1 );
 if ( monitor.isCanceled() ) {
  return null;
  monitor.worked( 1 );
  monitor.beginTask( BaseMessages.getString( PKG, "GetXMLDateLoopNodesImportProgressDialog.Task.DocumentOpened" ),
    1 );
  monitor.worked( 1 );
  monitor.beginTask( BaseMessages.getString( PKG, "GetXMLDateLoopNodesImportProgressDialog.Task.ReadingNode" ), 1 );
  if ( monitor.isCanceled() ) {
   return null;
  monitor.worked( 1 );
  monitor.subTask( BaseMessages.getString( PKG, "GetXMLDateLoopNodesImportProgressDialog.Task.FetchNodes" ) );
  if ( monitor.isCanceled() ) {
   return null;
origin: pentaho/pentaho-kettle

private void addLoopXPath( Node node, IProgressMonitor monitor ) {
 Element ce = (Element) node;
 monitor.worked( 1 );
 // List child
 for ( int j = 0; j < ce.nodeCount(); j++ ) {
  if ( monitor.isCanceled() ) {
   return;
  }
  Node cnode = ce.node( j );
  if ( !Utils.isEmpty( cnode.getName() ) ) {
   Element cce = (Element) cnode;
   if ( !listpath.contains( cnode.getPath() ) ) {
    nr++;
    monitor.subTask( BaseMessages.getString( PKG, "GetXMLDateLoopNodesImportProgressDialog.Task.FetchNodes",
      String.valueOf( nr ) ) );
    monitor.subTask( BaseMessages.getString( PKG, "GetXMLDateLoopNodesImportProgressDialog.Task.AddingNode",
      cnode.getPath() ) );
    listpath.add( cnode.getPath() );
   }
   // let's get child nodes
   if ( cce.nodeCount() > 1 ) {
    addLoopXPath( cnode, monitor );
   }
  }
 }
}
origin: pentaho/pentaho-kettle

public void run( IProgressMonitor monitor ) throws InvocationTargetException, InterruptedException {
 int size = transMeta.findNrPrevSteps( stepInfo );
 try {
  if ( before ) {
   monitor.beginTask( BaseMessages.getString(
    PKG, "SearchFieldsProgressDialog.Dialog.SearchInputFields.Message" ), size ); // Searching
                                           // for
                                           // input
                                           // fields...
   fields = transMeta.getPrevStepFields( stepInfo, new ProgressMonitorAdapter( monitor ) );
  } else {
   monitor.beginTask( BaseMessages.getString(
    PKG, "SearchFieldsProgressDialog.Dialog.SearchOutputFields.Message" ), size ); // Searching
                                            // for
                                            // output
                                            // fields...
   fields = transMeta.getStepFields( stepInfo, new ProgressMonitorAdapter( monitor ) );
  }
 } catch ( KettleStepException kse ) {
  throw new InvocationTargetException( kse, BaseMessages.getString(
   PKG, "SearchFieldsProgressDialog.Log.UnableToGetFields", stepInfo.toString(), kse.getMessage() ) );
 }
 monitor.done();
}
origin: org.eclipse/org.eclipse.pde.core

private void validateManifestFile(IFile file, IProgressMonitor monitor) {
  if (monitor.isCanceled())
    return;
  String message = NLS.bind(PDECoreMessages.Builders_verifying, file.getFullPath().toString());
  monitor.subTask(message);
  BundleErrorReporter reporter = new BundleErrorReporter(file);
  if (reporter != null) {
    reporter.validateContent(monitor);
    monitor.subTask(PDECoreMessages.Builders_updating);
  }
  monitor.done();
}
origin: org.eclipse/org.eclipse.jst.server.tomcat.core

try {
  monitor = ProgressUtil.getMonitorFor(monitor);
  monitor.beginTask(Messages.loadingTask, 5);
  InputStream in = new FileInputStream(path.append("catalina.policy").toFile());
  in.read();
  in.close();
  monitor.worked(1);
  server = (Server) serverFactory.loadDocument(new FileInputStream(path.append("server.xml").toFile()));
  serverInstance = new ServerInstance(server, null, null);
  monitor.worked(1);
  webAppDocument = new WebAppDocument(path.append("web.xml"));
  monitor.worked(1);
  tomcatUsersDocument = XMLUtil.getDocumentBuilder().parse(new InputSource(new FileInputStream(path.append("tomcat-users.xml").toFile())));
  monitor.worked(1);
  policyFile = TomcatVersionHelper.getFileContents(new FileInputStream(path.append("catalina.policy").toFile()));
  monitor.worked(1);
  if (monitor.isCanceled())
    return;
  monitor.done();
} catch (Exception e) {
  Trace.trace(Trace.WARNING, "Could not load Tomcat v4.0 configuration from " + path.toOSString() + ": " + e.getMessage());
  throw new CoreException(new Status(IStatus.ERROR, TomcatPlugin.PLUGIN_ID, 0, NLS.bind(Messages.errorCouldNotLoadConfiguration, path.toOSString()), e));
origin: org.eclipse.jdt/org.eclipse.jdt.core

  protected void worked(IProgressMonitor monitor, int work) {
    if (monitor != null) {
      if (monitor.isCanceled()) {
        throw new OperationCanceledException();
      } else {
        monitor.worked(work);
      }
    }
  }
/**
origin: org.eclipse.platform/org.eclipse.team.core

@Override
protected void collectAll(IResource resource, int depth,
    final IProgressMonitor monitor) {
  Policy.checkCanceled(monitor);
  monitor.beginTask(null, IProgressMonitor.UNKNOWN);
  ResourceTraversal[] traversals = new ResourceTraversal[] { new ResourceTraversal(new IResource[] { resource }, depth, IResource.NONE) };
  try {
    getSubscriber().accept(traversals, diff -> {
      Policy.checkCanceled(monitor);
      monitor.subTask(NLS.bind(Messages.SubscriberDiffTreeEventHandler_0, tree.getResource(diff).getFullPath().toString()));
      // Queue up any found diffs for inclusion into the output tree
      queueDispatchEvent(
          new SubscriberDiffChangedEvent(tree.getResource(diff), SubscriberEvent.CHANGE, IResource.DEPTH_ZERO, diff));
      // Handle any pending dispatches
      handlePreemptiveEvents(monitor);
      handlePendingDispatch(monitor);
      return true;
    });
  } catch (CoreException e) {
    if (resource.getProject().isAccessible())
      handleException(e, resource, ITeamStatus.SYNC_INFO_SET_ERROR, e.getMessage());
  } finally {
    monitor.done();
  }
}
origin: org.eclipse.pde/org.eclipse.pde.ui

@Override
public void run(IProgressMonitor mon) throws InvocationTargetException, InterruptedException {
  mon.beginTask(PDEUIMessages.FormatManifestOperation_task, fObjects.length);
  for (int i = 0; !mon.isCanceled() && i < fObjects.length; i++) {
    Object obj = fObjects[i];
    if (obj instanceof IFileEditorInput)
      obj = ((IFileEditorInput) obj).getFile();
    if (obj instanceof IFile) {
      mon.subTask(NLS.bind(PDEUIMessages.FormatManifestOperation_subtask, ((IFile) obj).getFullPath().toString()));
      format((IFile) obj, mon);
    }
    mon.worked(1);
  }
}
origin: eclipse/eclemma

private void createExecFile(IProgressMonitor monitor) throws IOException,
  CoreException {
 monitor.beginTask(
   NLS.bind(CoreMessages.ExportingSession_task, session.getDescription()),
   1);
 final OutputStream out = new BufferedOutputStream(new FileOutputStream(
   destination));
 final ExecutionDataWriter writer = new ExecutionDataWriter(out);
 session.accept(writer, writer);
 out.close();
 monitor.done();
}
origin: org.eclipse.jdt/org.eclipse.jdt.ui

  private void modifyClassPaths(IProgressMonitor pm) throws JavaModelException {
    IProject[] referencing= getProject().getReferencingProjects();
    pm.beginTask(RefactoringCoreMessages.RenameJavaProjectChange_update, referencing.length);
    for (int i= 0; i < referencing.length; i++) {
      IJavaProject jp= JavaCore.create(referencing[i]);
      if (jp != null && jp.exists()) {
        modifyClassPath(jp, new SubProgressMonitor(pm, 1));
      } else {
        pm.worked(1);
      }
    }
    pm.done();
  }
}
origin: org.eclipse/org.eclipse.datatools.connectivity

  protected IStatus run(IProgressMonitor monitor) {
    IStatus status = Status.OK_STATUS;
    monitor.beginTask(getName(), IProgressMonitor.UNKNOWN);
    try {
      mListener.closeConnection(mEvent);
    }
    catch (CoreException e) {
      status = e.getStatus();
    }
    monitor.done();
    return status;
  }
}
origin: org.eclipse.platform/org.eclipse.team.core

private IStatus refresh(IResource resource, int depth, IProgressMonitor monitor) {
  monitor = Policy.monitorFor(monitor);
  try {
    monitor.beginTask(null, 100);
    Set<IResource> allChanges = new HashSet<>();
    if (getResourceComparator().isThreeWay()) {
      IResource[] baseChanges = getBaseTree().refresh(new IResource[] {resource}, depth, Policy.subMonitorFor(monitor, 25));
      allChanges.addAll(Arrays.asList(baseChanges));
    }
    IResource[] remoteChanges = getRemoteTree().refresh(new IResource[] {resource}, depth, Policy.subMonitorFor(monitor, 75));
    allChanges.addAll(Arrays.asList(remoteChanges));
    IResource[] changedResources = allChanges.toArray(new IResource[allChanges.size()]);
    fireTeamResourceChange(SubscriberChangeEvent.asSyncChangedDeltas(this, changedResources));
    return Status.OK_STATUS;
  } catch (TeamException e) {
    return new TeamStatus(IStatus.ERROR, TeamPlugin.ID, 0, NLS.bind(Messages.ResourceVariantTreeSubscriber_2, new String[] { resource.getFullPath().toString(), e.getMessage() }), e, resource);
  } catch (OperationCanceledException e) {
    return new TeamStatus(IStatus.CANCEL, TeamPlugin.ID, 0, NLS.bind(
        Messages.ResourceVariantTreeSubscriber_4,
        new String[] { resource.getFullPath().toString() }), e,
        resource);
  } finally {
    monitor.done();
  }
}
origin: org.eclipse/org.eclipse.jdt.ui

public final void acceptAST(final ICompilationUnit unit, final CompilationUnit node) {
  final IProgressMonitor subsubsubMonitor= new SubProgressMonitor(subsubMonitor, 100);
  try {
    subsubsubMonitor.beginTask("", 100); //$NON-NLS-1$
    subsubsubMonitor.setTaskName(RefactoringCoreMessages.SuperTypeRefactoringProcessor_creating);
    if (sourceRewrite != null)
      rewriteTypeOccurrences(manager, this, sourceRewrite, unit, node, replacements, new SubProgressMonitor(subsubsubMonitor, 100));
  } catch (CoreException exception) {
    status.merge(RefactoringStatus.createFatalErrorStatus(exception.getLocalizedMessage()));
  } finally {
    subsubsubMonitor.done();
  }
}
origin: org.eclipse.tycho/org.eclipse.jdt.core

/**
 * Check whether the build has been canceled.
 */
public void checkCancel() {
  if (this.monitor != null && this.monitor.isCanceled())
    throw new OperationCanceledException();
}

origin: org.eclipse.platform/org.eclipse.core.resources

  @Override
  public IStatus run(IProgressMonitor monitor) {
    if (monitor.isCanceled())
      return Status.CANCEL_STATUS;
    notificationRequested = true;
    try {
      workspace.run(noop, null, IResource.NONE, null);
    } catch (CoreException e) {
      return e.getStatus();
    }
    return Status.OK_STATUS;
  }
}
origin: pentaho/pentaho-kettle

public boolean isCanceled() {
 return monitor.isCanceled();
}
origin: org.eclipse/org.eclipse.pde.core

public static void convertToOSGIFormat(IProject project, String target, Dictionary dictionary, HashMap newProps, IProgressMonitor monitor) throws CoreException {
  try {
    File outputFile = new File(project.getLocation().append(
        "META-INF/MANIFEST.MF").toOSString()); //$NON-NLS-1$
    File inputFile = new File(project.getLocation().toOSString());
    PluginConverter converter = PluginConverter.getDefault();
    converter.convertManifest(inputFile, outputFile, false, target, true, dictionary);
    if (newProps != null && newProps.size() > 0)
      converter.writeManifest(outputFile, getProperties(outputFile, newProps), false);
  
    project.refreshLocal(IResource.DEPTH_INFINITE, null);
  } catch (PluginConversionException e) {
  }  finally {
    monitor.done();
  }
}

origin: org.eclipse.egit/ui

@Override
protected IStatus run(IProgressMonitor monitor) {
  try {
    removeOperation.execute(monitor);
  } catch (CoreException e) {
    return Activator.createErrorStatus(e.getStatus()
        .getMessage(), e);
  } finally {
    monitor.done();
  }
  return Status.OK_STATUS;
}
origin: org.eclipse/org.eclipse.jdt.ui

public final Change perform(IProgressMonitor pm) throws CoreException, OperationCanceledException {
  pm.beginTask(getName(), 2);
  try {
    String newName= getNewResourceName();
    IPackageFragmentRoot root= getRoot();
    ResourceMapping mapping= JavaElementResourceMapping.create(root);
    final Change result= doPerformReorg(getDestinationProjectPath().append(newName), new SubProgressMonitor(pm, 1));
    markAsExecuted(root, mapping);
    return result;
  } finally {
    pm.done();
  }
}
origin: org.eclipse/org.eclipse.jdt.ui

protected IStatus run(IProgressMonitor monitor) {
  monitor.beginTask("", 10); //$NON-NLS-1$
  try {
    JavaCore.initializeAfterLoad(new SubProgressMonitor(monitor, 6));
    JavaPlugin.initializeAfterLoad(new SubProgressMonitor(monitor, 4));
  } catch (CoreException e) {
    JavaPlugin.log(e);
    return e.getStatus();
  }
  return new Status(IStatus.OK, JavaPlugin.getPluginId(), IStatus.OK, "", null); //$NON-NLS-1$
}
public boolean belongsTo(Object family) {
org.eclipse.core.runtimeIProgressMonitor

Javadoc

The IProgressMonitor interface is implemented by objects that monitor the progress of an activity; the methods in this interface are invoked by code that performs the activity.

All activity is broken down into a linear sequence of tasks against which progress is reported. When a task begins, a beginTask(String, int) notification is reported, followed by any number and mixture of progress reports (worked()) and subtask notifications (subTask(String)). When the task is eventually completed, a done() notification is reported. After the done() notification, the progress monitor cannot be reused; i.e., beginTask(String, int) cannot be called again after the call to done().

A request to cancel an operation can be signaled using the setCanceled method. Operations taking a progress monitor are expected to poll the monitor (using isCanceled) periodically and abort at their earliest convenience. Operation can however choose to ignore cancelation requests.

Since notification is synchronous with the activity itself, the listener should provide a fast and robust implementation. If the handling of notifications would involve blocking operations, or operations which might throw uncaught exceptions, the notifications should be queued, and the actual processing deferred (or perhaps delegated to a separate thread).

This interface can be used without OSGi running.

Clients may implement this interface.

Most used methods

  • done
    Notifies that the work is done; that is, either the main task is completed or the user canceled it.
  • beginTask
    Notifies that the main task is beginning. This must only be called once on a given progress monitor
  • isCanceled
    Returns whether cancelation of current operation has been requested. Long-running operations should
  • worked
    Notifies that a given number of work unit of the main task has been completed. Note that this amount
  • subTask
    Notifies that a subtask of the main task is beginning. Subtasks are optional; the main task might no
  • setTaskName
    Sets the task name to the given value. This method is used to restore the task label after a nested
  • setCanceled
    Sets the cancel state to the given value.
  • internalWorked
    Internal method to handle scaling correctly. This method must not be called by a client. Clients sho

Popular in Java

  • Creating JSON documents from java classes using gson
  • setContentView (Activity)
  • getSharedPreferences (Context)
  • addToBackStack (FragmentTransaction)
  • Runnable (java.lang)
    Represents a command that can be executed. Often used to run code in a different Thread.
  • ExecutorService (java.util.concurrent)
    An Executor that provides methods to manage termination and methods that can produce a Future for tr
  • JTextField (javax.swing)
  • StringUtils (org.apache.commons.lang)
    Operations on java.lang.String that arenull safe. * IsEmpty/IsBlank - checks if a String contains
  • Reflections (org.reflections)
    Reflections one-stop-shop objectReflections scans your classpath, indexes the metadata, allows you t
  • SAXParseException (org.xml.sax)
    Encapsulate an XML parse error or warning.> This module, both source code and documentation, is in t
  • CodeWhisperer alternatives
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now