當前位置: 首頁>>代碼示例>>Java>>正文


Java SubProgressMonitor.beginTask方法代碼示例

本文整理匯總了Java中org.eclipse.core.runtime.SubProgressMonitor.beginTask方法的典型用法代碼示例。如果您正苦於以下問題:Java SubProgressMonitor.beginTask方法的具體用法?Java SubProgressMonitor.beginTask怎麽用?Java SubProgressMonitor.beginTask使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.eclipse.core.runtime.SubProgressMonitor的用法示例。


在下文中一共展示了SubProgressMonitor.beginTask方法的14個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的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();
}
 
開發者ID:eclipse,項目名稱:che,代碼行數:25,代碼來源:InferTypeArgumentsConstraintsSolver.java

示例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;
}
 
開發者ID:DarwinSPL,項目名稱:DarwinSPL,代碼行數:13,代碼來源:HyexpressionBuilder.java

示例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;
}
 
開發者ID:DarwinSPL,項目名稱:DarwinSPL,代碼行數:13,代碼來源:HymanifestBuilder.java

示例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;
}
 
開發者ID:DarwinSPL,項目名稱:DarwinSPL,代碼行數:13,代碼來源:HymappingBuilder.java

示例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;
}
 
開發者ID:DarwinSPL,項目名稱:DarwinSPL,代碼行數:13,代碼來源:HyconstraintsBuilder.java

示例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;
}
 
開發者ID:DarwinSPL,項目名稱:DarwinSPL,代碼行數:13,代碼來源:HyvalidityformulaBuilder.java

示例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;
}
 
開發者ID:DarwinSPL,項目名稱:DarwinSPL,代碼行數:13,代碼來源:HydatavalueBuilder.java

示例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;
}
 
開發者ID:DarwinSPL,項目名稱:DarwinSPL,代碼行數:13,代碼來源:DwprofileBuilder.java

示例9: beginTask

import org.eclipse.core.runtime.SubProgressMonitor; //導入方法依賴的package包/類
@Override
public void beginTask(final String title, final int totalWork) {
    if (totalWork < 0) {
        logger.error("Negative total work amount"); //$NON-NLS-1$
    }

    taskTitle = title;
    taskPercent = StringUtil.EMPTY;
    taskDone = 0;
    taskTotalWork = totalWork;
    task = new SubProgressMonitor(parentProgress, 1);
    task.beginTask(taskTitle, totalWork);
}
 
開發者ID:Microsoft,項目名稱:team-explorer-everywhere,代碼行數:14,代碼來源:CloneGitRepositoryCommand.java

示例10: 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();
}
 
開發者ID:eclipse,項目名稱:che,代碼行數:13,代碼來源:InferTypeArgumentsConstraintsSolver.java

示例11: createNewWorkingCopies

import org.eclipse.core.runtime.SubProgressMonitor; //導入方法依賴的package包/類
static ICompilationUnit[] createNewWorkingCopies(
    ICompilationUnit[] compilationUnitsToModify,
    TextChangeManager manager,
    WorkingCopyOwner owner,
    SubProgressMonitor pm)
    throws CoreException {
  pm.beginTask("", compilationUnitsToModify.length); // $NON-NLS-1$
  ICompilationUnit[] newWorkingCopies = new ICompilationUnit[compilationUnitsToModify.length];
  for (int i = 0; i < compilationUnitsToModify.length; i++) {
    ICompilationUnit cu = compilationUnitsToModify[i];
    newWorkingCopies[i] = createNewWorkingCopy(cu, manager, owner, new SubProgressMonitor(pm, 1));
  }
  pm.done();
  return newWorkingCopies;
}
 
開發者ID:eclipse,項目名稱:che,代碼行數:16,代碼來源:RenameAnalyzeUtil.java

示例12: 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 ();
}
 
開發者ID:eclipse,項目名稱:neoscada,代碼行數:69,代碼來源:EquinoxApplicationProcessor.java

示例13: 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);
    }
}
 
開發者ID:Microsoft,項目名稱:team-explorer-everywhere,代碼行數:62,代碼來源:AnnotateCommand.java

示例14: 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;
}
 
開發者ID:Microsoft,項目名稱:team-explorer-everywhere,代碼行數:75,代碼來源:AnnotateCommand.java


注:本文中的org.eclipse.core.runtime.SubProgressMonitor.beginTask方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。