本文整理匯總了Java中org.eclipse.core.runtime.SubProgressMonitor.worked方法的典型用法代碼示例。如果您正苦於以下問題:Java SubProgressMonitor.worked方法的具體用法?Java SubProgressMonitor.worked怎麽用?Java SubProgressMonitor.worked使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.eclipse.core.runtime.SubProgressMonitor
的用法示例。
在下文中一共展示了SubProgressMonitor.worked方法的12個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: chooseTypes
import org.eclipse.core.runtime.SubProgressMonitor; //導入方法依賴的package包/類
private void chooseTypes(ConstraintVariable2[] allConstraintVariables, SubProgressMonitor pm) {
pm.beginTask("", allConstraintVariables.length); // $NON-NLS-1$
for (int i = 0; i < allConstraintVariables.length; i++) {
ConstraintVariable2 cv = allConstraintVariables[i];
TypeEquivalenceSet set = cv.getTypeEquivalenceSet();
if (set == null)
continue; // TODO: should not happen iff all unused constraint variables got pruned
// TODO: should calculate only once per EquivalenceRepresentative; can throw away estimate
// TypeSet afterwards
TType type =
chooseSingleType((TypeSet) cv.getTypeEstimate()); // TODO: is null for Universe TypeSet
setChosenType(cv, type);
if (cv instanceof CollectionElementVariable2) {
CollectionElementVariable2 elementCv = (CollectionElementVariable2) cv;
fUpdate.addDeclaration(elementCv);
}
pm.worked(1);
if (pm.isCanceled()) throw new OperationCanceledException();
}
pm.done();
}
示例2: build
import org.eclipse.core.runtime.SubProgressMonitor; //導入方法依賴的package包/類
public IStatus build(eu.hyvar.feature.expression.resource.hyexpression.mopp.HyexpressionResource resource, IProgressMonitor monitor) {
// Set option 'overrideBuilder' to 'false' and then perform build here.
// We use one tick from the parent monitor because the BuilderAdapter reserves one
// tick for the Builder.
SubProgressMonitor subMonitor = new SubProgressMonitor(monitor, 1);
subMonitor.beginTask("Building " + resource.getURI().lastSegment(), 10);
// The actual work of the builder can be performed here.
subMonitor.worked(10);
subMonitor.done();
return Status.OK_STATUS;
}
示例3: build
import org.eclipse.core.runtime.SubProgressMonitor; //導入方法依賴的package包/類
public IStatus build(eu.hyvar.mspl.manifest.resource.hymanifest.mopp.HymanifestResource resource, IProgressMonitor monitor) {
// Set option 'overrideBuilder' to 'false' and then perform build here.
// We use one tick from the parent monitor because the BuilderAdapter reserves one
// tick for the Builder.
SubProgressMonitor subMonitor = new SubProgressMonitor(monitor, 1);
subMonitor.beginTask("Building " + resource.getURI().lastSegment(), 10);
// The actual work of the builder can be performed here.
subMonitor.worked(10);
subMonitor.done();
return Status.OK_STATUS;
}
示例4: build
import org.eclipse.core.runtime.SubProgressMonitor; //導入方法依賴的package包/類
public IStatus build(eu.hyvar.feature.mapping.resource.hymapping.mopp.HymappingResource resource, IProgressMonitor monitor) {
// Set option 'overrideBuilder' to 'false' and then perform build here.
// We use one tick from the parent monitor because the BuilderAdapter reserves one
// tick for the Builder.
SubProgressMonitor subMonitor = new SubProgressMonitor(monitor, 1);
subMonitor.beginTask("Building " + resource.getURI().lastSegment(), 10);
// The actual work of the builder can be performed here.
subMonitor.worked(10);
subMonitor.done();
return Status.OK_STATUS;
}
示例5: build
import org.eclipse.core.runtime.SubProgressMonitor; //導入方法依賴的package包/類
public IStatus build(eu.hyvar.feature.constraint.resource.hyconstraints.mopp.HyconstraintsResource resource, IProgressMonitor monitor) {
// Set option 'overrideBuilder' to 'false' and then perform build here.
// We use one tick from the parent monitor because the BuilderAdapter reserves one
// tick for the Builder.
SubProgressMonitor subMonitor = new SubProgressMonitor(monitor, 1);
subMonitor.beginTask("Building " + resource.getURI().lastSegment(), 10);
// The actual work of the builder can be performed here.
subMonitor.worked(10);
subMonitor.done();
return Status.OK_STATUS;
}
示例6: build
import org.eclipse.core.runtime.SubProgressMonitor; //導入方法依賴的package包/類
public IStatus build(eu.hyvar.context.contextValidity.resource.hyvalidityformula.mopp.HyvalidityformulaResource resource, IProgressMonitor monitor) {
// Set option 'overrideBuilder' to 'false' and then perform build here.
// We use one tick from the parent monitor because the BuilderAdapter reserves one
// tick for the Builder.
SubProgressMonitor subMonitor = new SubProgressMonitor(monitor, 1);
subMonitor.beginTask("Building " + resource.getURI().lastSegment(), 10);
// The actual work of the builder can be performed here.
subMonitor.worked(10);
subMonitor.done();
return Status.OK_STATUS;
}
示例7: build
import org.eclipse.core.runtime.SubProgressMonitor; //導入方法依賴的package包/類
public IStatus build(eu.hyvar.dataValues.resource.hydatavalue.mopp.HydatavalueResource resource, IProgressMonitor monitor) {
// Set option 'overrideBuilder' to 'false' and then perform build here.
// We use one tick from the parent monitor because the BuilderAdapter reserves one
// tick for the Builder.
SubProgressMonitor subMonitor = new SubProgressMonitor(monitor, 1);
subMonitor.beginTask("Building " + resource.getURI().lastSegment(), 10);
// The actual work of the builder can be performed here.
subMonitor.worked(10);
subMonitor.done();
return Status.OK_STATUS;
}
示例8: build
import org.eclipse.core.runtime.SubProgressMonitor; //導入方法依賴的package包/類
public IStatus build(de.darwinspl.preferences.resource.dwprofile.mopp.DwprofileResource resource, IProgressMonitor monitor) {
// Set option 'overrideBuilder' to 'false' and then perform build here.
// We use one tick from the parent monitor because the BuilderAdapter reserves one
// tick for the Builder.
SubProgressMonitor subMonitor = new SubProgressMonitor(monitor, 1);
subMonitor.beginTask("Building " + resource.getURI().lastSegment(), 10);
// The actual work of the builder can be performed here.
subMonitor.worked(10);
subMonitor.done();
return Status.OK_STATUS;
}
示例9: runSolver
import org.eclipse.core.runtime.SubProgressMonitor; //導入方法依賴的package包/類
private void runSolver(SubProgressMonitor pm) {
pm.beginTask("", fWorkList.size() * 3); // $NON-NLS-1$
while (!fWorkList.isEmpty()) {
// Get a variable whose type estimate has changed
ConstraintVariable2 cv = fWorkList.removeFirst();
List<ITypeConstraint2> usedIn = fTCModel.getUsedIn(cv);
processConstraints(usedIn);
pm.worked(1);
if (pm.isCanceled()) throw new OperationCanceledException();
}
pm.done();
}
示例10: processLocal
import org.eclipse.core.runtime.SubProgressMonitor; //導入方法依賴的package包/類
@Override
public void processLocal ( final IFolder output, final IProgressMonitor parentMonitor ) throws Exception
{
final IProgressMonitor monitor = new SubProgressMonitor ( parentMonitor, 13 );
// create context
final OscarContext ctx = createContext ();
// generate common content
new SecurityProcessor ( this.app, ctx ).process ( new SubProgressMonitor ( monitor, 1 ) ); // COUNT:1
new JdbcUserServiceModuleProcessor ( this.app, ctx ).process ( new SubProgressMonitor ( monitor, 1 ) ); // COUNT:1
new EventStoragePostgresModuleProcessor ( this.app, ctx ).process ( new SubProgressMonitor ( monitor, 1 ) ); // COUNT:1
new EventStorageJdbcModuleProcessor ( this.app, ctx ).process ( new SubProgressMonitor ( monitor, 1 ) ); // COUNT:1
new EventInjectorJdbcProcessor ( this.app, ctx ).process ( new SubProgressMonitor ( monitor, 1 ) ); // COUNT:1
new EventInjectorPostgresProcessor ( this.app, ctx ).process ( new SubProgressMonitor ( monitor, 1 ) ); // COUNT:1
new ConnectionProcessor ( this.app, ctx ).process ();
new ExporterProcessor ( this.app, ctx ).process ();
// generate based on processors
final Collection<OscarProcessor> processors = createProcessors ();
monitor.worked ( 1 ); // COUNT:1
{
final SubProgressMonitor subMonitor = new SubProgressMonitor ( monitor, 1 ); // COUNT:1
subMonitor.beginTask ( "Process application modules", processors.size () );
for ( final OscarProcessor processor : processors )
{
processor.process ( ctx, this.app, subMonitor );
subMonitor.worked ( 1 );
}
subMonitor.done ();
}
// generate custom content
processForContext ( ctx, output, monitor );
// write out oscar context
final OscarWriter writer = new OscarWriter ( ctx.getData (), ctx.getIgnoreFields () );
monitor.worked ( 1 ); // COUNT:1
final IFile file = output.getFile ( "configuration.oscar" ); //$NON-NLS-1$
try ( FileOutputStream fos = new FileOutputStream ( file.getRawLocation ().toOSString () ) )
{
writer.write ( fos );
}
monitor.worked ( 1 ); // COUNT:1
final IFile jsonFile = output.getFile ( "data.json" ); //$NON-NLS-1$
try ( final FileOutputStream fos = new FileOutputStream ( jsonFile.getRawLocation ().toOSString () ) )
{
OscarWriter.writeData ( ctx.getData (), fos );
}
monitor.worked ( 1 ); // COUNT:1
// write out profile
new P2ProfileProcessor ( this.app ).process ( output.getLocation ().toFile (), monitor );
monitor.worked ( 1 ); // COUNT:1
// refresh
output.refreshLocal ( IResource.DEPTH_INFINITE, monitor );
monitor.done ();
}
示例11: expandChildChangesets
import org.eclipse.core.runtime.SubProgressMonitor; //導入方法依賴的package包/類
/**
* Expands the given list of {@link Changeset}s into a potentially larger
* list by following any branch/merge children that need followed (applies
* to TFS 2010 and later changesets, but harmless to follow changesets from
* previous servers).
*
* Consumes one unit of work from the given {@link IProgressMonitor}.
*
* @param progressMonitor
* a progress monitor used for cancellation and status repotring; 1
* unit of work will be used by this method (must not be
* <code>null</code>)
* @param changesets
* the changesets to expand children of (must not be
* <code>null</code>)
* @return the expanded changesets, never <code>null</code>
* @throws CoreException
* if cancelled
*/
private Changeset[] expandChildChangesets(final IProgressMonitor progressMonitor, final Changeset[] changesets)
throws CoreException {
Check.notNull(progressMonitor, "progressMonitor"); //$NON-NLS-1$
Check.notNull(changesets, "changesets"); //$NON-NLS-1$
/*
* Use a sub monitor to give the user more feedback.
*/
final SubProgressMonitor expandChildrenMonitor = new SubProgressMonitor(progressMonitor, 1);
try {
expandChildrenMonitor.beginTask(
Messages.getString("AnnotateCommand.ProgressFollowBranch"), //$NON-NLS-1$
changesets.length);
final List expandedChangesetList = new ArrayList();
for (int i = 0; i < changesets.length; i++) {
checkForCancellation(expandChildrenMonitor);
expandChildrenMonitor.subTask(
Messages.getString("AnnotateCommand.ProgressGetMergeHistory") + changesets[i].getChangesetID()); //$NON-NLS-1$
// Always add the original.
expandedChangesetList.add(changesets[i]);
// check if we have children
if (HistoryManager.mayHaveChildren(repository, changesets[i])) {
final Changeset[] children = HistoryManager.findChangesetChildren(repository, changesets[i]);
if (children != null && children.length > 0) {
expandedChangesetList.addAll(Arrays.asList(children));
}
}
expandChildrenMonitor.worked(1);
}
return (Changeset[]) expandedChangesetList.toArray(new Changeset[expandedChangesetList.size()]);
} finally {
expandChildrenMonitor.worked(1);
}
}
示例12: downloadTempFiles
import org.eclipse.core.runtime.SubProgressMonitor; //導入方法依賴的package包/類
/**
* Downloads this command's current resource in each of the given changesets
* to temporary files on disk.
*
* Consumes one unit of work from the given {@link IProgressMonitor}.
*
* @param progressMonitor
* a progress monitor used for cancellation and status repotring and
* passed to {@link GetVersionedItemToTempLocationCommand}; 1 unit of
* work will be used by this method (must not be <code>null</code>)
* @param multiStatus
* a {@link MultiStatus} into which the status of the download
* commands will be merged (must not be <code>null</code>)
* @param changesets
* the changesets to download items for (must not be
* <code>null</code>)
* @return the {@link Map} of {@link Changeset} to {@link File} or
* <code>null</code> if the user cancelled
* @throws Exception
* if {@link GetVersionedItemToTempLocationCommand} throw an
* exception
*/
private Map downloadTempFiles(
final IProgressMonitor progressMonitor,
final MultiStatus multiStatus,
final Changeset[] changesets) throws Exception {
final Map changesetToFilePathMap = new LinkedHashMap();
/*
* Use a sub monitor to give the user more feedback.
*/
final SubProgressMonitor downloadMonitor = new SubProgressMonitor(progressMonitor, 1);
try {
downloadMonitor.beginTask(
Messages.getString("AnnotateCommand.ProgressRetrievingHistory"), //$NON-NLS-1$
changesets.length);
for (int i = 0; i < changesets.length; i++) {
checkForCancellation(downloadMonitor);
final Changeset changeset = changesets[i];
final String messageFormat = Messages.getString("AnnotateCommand.ProgressRetrievingHistoryFormat"); //$NON-NLS-1$
final String message =
MessageFormat.format(messageFormat, Integer.toString(changeset.getChangesetID()));
downloadMonitor.subTask(message);
final Item item = changeset.getChanges()[0].getItem();
final GetVersionedItemToTempLocationCommand cmd = new GetVersionedItemToTempLocationCommand(
repository,
item.getServerItem(),
new ChangesetVersionSpec(changeset.getChangesetID()));
final IStatus status = cmd.run(new NullProgressMonitor());
multiStatus.merge(status);
if (status.isOK()) {
final String tempFilePath = cmd.getTempLocation();
if (tempFilePath != null) {
changesetToFilePathMap.put(changeset, tempFilePath);
}
findChangeBlocks(changesetToFilePathMap);
}
downloadMonitor.worked(1);
}
} finally {
downloadMonitor.done();
}
return changesetToFilePathMap;
}