本文整理匯總了Java中org.eclipse.core.runtime.SubMonitor.beginTask方法的典型用法代碼示例。如果您正苦於以下問題:Java SubMonitor.beginTask方法的具體用法?Java SubMonitor.beginTask怎麽用?Java SubMonitor.beginTask使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.eclipse.core.runtime.SubMonitor
的用法示例。
在下文中一共展示了SubMonitor.beginTask方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: build
import org.eclipse.core.runtime.SubMonitor; //導入方法依賴的package包/類
@Override
public void build(IBuildContext context, IProgressMonitor monitor) throws CoreException {
SubMonitor progress = SubMonitor.convert(monitor);
if (!prefs.isCompilerEnabled()) {
return;
}
final List<IResourceDescription.Delta> deltas = getRelevantDeltas(context);
if (deltas.isEmpty()) {
return;
}
if (progress.isCanceled()) {
throw new OperationCanceledException();
}
progress.beginTask("Compiling solidity...", deltas.size());
List<URI> uris = deltas.stream().map(delta -> delta.getUri()).collect(Collectors.toList());
compiler.compile(uris, progress);
context.getBuiltProject().refreshLocal(IProject.DEPTH_INFINITE, progress);
progress.done();
}
示例2: applyDiff
import org.eclipse.core.runtime.SubMonitor; //導入方法依賴的package包/類
protected void applyDiff ( final IProgressMonitor parentMonitor ) throws InterruptedException, ExecutionException
{
final SubMonitor monitor = SubMonitor.convert ( parentMonitor, 100 );
monitor.setTaskName ( Messages.ImportWizard_TaskName );
final Collection<DiffEntry> result = this.mergeController.merge ( wrap ( monitor.newChild ( 10 ) ) );
if ( result.isEmpty () )
{
monitor.done ();
return;
}
final Iterable<List<DiffEntry>> splitted = Iterables.partition ( result, Activator.getDefault ().getPreferenceStore ().getInt ( PreferenceConstants.P_DEFAULT_CHUNK_SIZE ) );
final SubMonitor sub = monitor.newChild ( 90 );
try
{
final int size = Iterables.size ( splitted );
sub.beginTask ( Messages.ImportWizard_TaskName, size );
int pos = 0;
for ( final Iterable<DiffEntry> i : splitted )
{
sub.subTask ( String.format ( Messages.ImportWizard_SubTaskName, pos, size ) );
final List<DiffEntry> entries = new LinkedList<DiffEntry> ();
Iterables.addAll ( entries, i );
final NotifyFuture<Void> future = this.connection.getConnection ().applyDiff ( entries, null, new DisplayCallbackHandler ( getShell (), "Apply diff", "Confirmation for applying diff is required" ) );
future.get ();
pos++;
sub.worked ( 1 );
}
}
finally
{
sub.done ();
}
}