本文整理汇总了Java中org.eclipse.core.runtime.IProgressMonitor.worked方法的典型用法代码示例。如果您正苦于以下问题:Java IProgressMonitor.worked方法的具体用法?Java IProgressMonitor.worked怎么用?Java IProgressMonitor.worked使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.core.runtime.IProgressMonitor
的用法示例。
在下文中一共展示了IProgressMonitor.worked方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: performFinish
import org.eclipse.core.runtime.IProgressMonitor; //导入方法依赖的package包/类
public boolean performFinish() {
final Collection<ProjectDescriptor> projectDescriptors = getProjectDescriptors();
WorkspaceJob job = new WorkspaceJob("Unzipping Projects") {
@Override
public IStatus runInWorkspace(IProgressMonitor monitor) throws CoreException {
monitor.beginTask("Unzipping Projects", projectDescriptors.size());
//System.out.println("Unzipping projects...");
for ( ProjectDescriptor desc : projectDescriptors ) {
unzipProject(desc, monitor);
monitor.worked(1);
}
//System.out.println("Projects unzipped");
return Status.OK_STATUS;
}
};
job.setRule(ResourcesPlugin.getWorkspace().getRoot());
job.schedule();
return true;
}
示例2: setComparison
import org.eclipse.core.runtime.IProgressMonitor; //导入方法依赖的package包/类
/**
* Show the given comparison in the widget. All arguments may be <code>null</code>.
*
* @param comparison
* the comparison to show in the widget or <code>null</code> to clear the widget.
* @param focusImplId
* the ID of a single implementation to focus on (all other implementations will be hidden; columns of
* index 2 and above will show additional information for this focus implementation) or <code>null</code>
* to show all available implementations side-by-side (but without additional information in separate
* columns).
* @param monitor
* the progress monitor to use or <code>null</code>.
*/
public void setComparison(ProjectComparison comparison, String focusImplId, IProgressMonitor monitor) {
this.comparison = comparison;
this.focusImplIndex = comparison != null && focusImplId != null ? comparison.getImplIndex(focusImplId) : -1;
this.cachedDocumentation = null;
// in case of a focus implementation, read documentation for API and the focus implementation into cache
if (comparison != null && focusImplId != null) {
if (monitor != null) {
monitor.subTask("Scanning jsdoc ...");
monitor.worked(1);
}
final int focusImplIdx = comparison.getImplIndex(focusImplId);
cachedDocumentation = projectCompareTreeHelper.readDocumentation(comparison, new int[] { focusImplIdx });
}
if (monitor != null) {
monitor.subTask("Updating UI ...");
monitor.worked(1);
}
setInput(comparison);
refreshColumnHeaders();
expandAll();
}
示例3: installUninstallNPMs
import org.eclipse.core.runtime.IProgressMonitor; //导入方法依赖的package包/类
private void installUninstallNPMs(final Map<String, String> versionedNPMs, final IProgressMonitor monitor,
final MultiStatus status, final Set<String> requestedNPMs, final Set<String> oldNPMs) {
logger.logInfo(LINE_SINGLE);
logger.logInfo("Installing packages... [step 1 of 4]");
monitor.setTaskName("Installing packages... [step 1 of 4]");
// calculate already installed to skip
final Set<String> npmNamesToInstall = difference(requestedNPMs, oldNPMs);
final Set<String> npmsToInstall = versionedNPMs.entrySet().stream()
// skip already installed
.filter(e -> npmNamesToInstall.contains(e.getKey()))
// [name, @">=1.0.0 <2.0.0"] to [[email protected]">=1.0.0 <2.0.0"]
.map(e -> e.getKey() + Strings.emptyIfNull(e.getValue()))
.collect(Collectors.toSet());
IStatus installStatus = batchInstallUninstall(monitor, npmsToInstall, true);
// log possible errors, but proceed with the process
// assume that at least some packages were installed correctly and can be adapted
if (!installStatus.isOK()) {
logger.logInfo("Some packages could not be installed due to errors, see log for details.");
status.merge(installStatus);
}
monitor.worked(2);
}
示例4: adaptNPMPackages
import org.eclipse.core.runtime.IProgressMonitor; //导入方法依赖的package包/类
private Collection<File> adaptNPMPackages(final IProgressMonitor monitor, final MultiStatus status,
final Collection<String> addedDependencies) {
logger.logInfo(LINE_SINGLE);
logger.logInfo("Adapting npm package structure to N4JS project structure... [step 3 of 4]");
monitor.setTaskName("Adapting npm package structure to N4JS project structure... [step 3 of 4]");
final Pair<IStatus, Collection<File>> result = npmPackageToProjectAdapter.adaptPackages(addedDependencies);
final IStatus adaptionStatus = result.getFirst();
// log possible errors, but proceed with the process
// assume that at least some packages were installed correctly and can be adapted
if (!adaptionStatus.isOK()) {
logger.logError(adaptionStatus);
status.merge(adaptionStatus);
}
final Collection<File> adaptedPackages = result.getSecond();
logger.logInfo("Packages structures has been adapted to N4JS project structure.");
monitor.worked(2);
logger.logInfo(LINE_SINGLE);
return adaptedPackages;
}
示例5: doFinish
import org.eclipse.core.runtime.IProgressMonitor; //导入方法依赖的package包/类
private void doFinish(IPath containerPath, String[] path, IProgressMonitor monitor) throws CoreException {
monitor.beginTask("Creating package " + String.join(".", path), path.length);
IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
IResource resource = root.findMember(containerPath);
if (!resource.exists() || !(resource instanceof IContainer)) {
throwCoreException("Container \"" + containerPath + "\" does not exist.");
}
IContainer container = (IContainer) resource;
for(int i = 0; i < path.length; i++) {
Path p = new Path(path[i]);
final IFolder folder = container.getFolder(p);
if(!folder.exists())
folder.create(true, false, monitor);
container = container.getFolder(p);
monitor.worked(1);
}
}
示例6: automate
import org.eclipse.core.runtime.IProgressMonitor; //导入方法依赖的package包/类
private void automate(IProgressMonitor monitor) throws TraceException {
final List<EObject> allEObjects = new ArrayList<>();
for (LoadItem load : TraceManager.get().getLoads()) {
if (load.getInstanceRoot() == null) {
throw new TraceException("Check alias: " + load.getAlias()
+ "\nYou must define the ecore instance location to create the traces.\n"
+ "\n e.g. -- [email protected]/path/to/your.xmi");
}
findAllEObjects(allEObjects, load.getInstanceRoot());
allEObjects.remove(load.getInstanceRoot());
}
monitor.worked(1);
createMarkers(allEObjects);
monitor.worked(2);
createRelations();
monitor.worked(2);
}
示例7: doGenerateClassifier
import org.eclipse.core.runtime.IProgressMonitor; //导入方法依赖的package包/类
/**
* Performs the actual generation of {@link #performFinish()} call.
*
* @throw {@link WorkspaceWizardGeneratorException} in case of any problem during the generation process. The
* message of these exceptions is reported on the UI.
*
*/
protected void doGenerateClassifier(IProgressMonitor monitor)
throws WorkspaceWizardGeneratorException {
monitor = SubMonitor.convert(monitor, 2);
WorkspaceWizardGenerator<M> generator = getGenerator();
generator.performManifestChanges(getModel(), monitor);
monitor.worked(1);
generator.writeToFile(getModel(), monitor);
monitor.worked(1);
}
示例8: doGenerate
import org.eclipse.core.runtime.IProgressMonitor; //导入方法依赖的package包/类
/**
* Launches the generation.
*
* @param monitor
* This will be used to display progress information to the user.
* @throws IOException
* Thrown when the output cannot be saved.
* @generated
*/
public void doGenerate(IProgressMonitor monitor) throws IOException {
if (!targetFolder.getLocation().toFile().exists()) {
targetFolder.getLocation().toFile().mkdirs();
}
monitor.subTask("Loading...");
org.eclipse.cmf.occi.core.gen.uris.main.Generate gen0 = new org.eclipse.cmf.occi.core.gen.uris.main.Generate(modelURI, targetFolder.getLocation().toFile(), arguments);
monitor.worked(1);
String generationID = org.eclipse.acceleo.engine.utils.AcceleoLaunchingUtil.computeUIProjectID("org.eclipse.cmf.occi.core.gen.uris", "org.eclipse.cmf.occi.core.gen.uris.main.Generate", modelURI.toString(), targetFolder.getFullPath().toString(), new ArrayList<String>());
gen0.setGenerationID(generationID);
gen0.doGenerate(BasicMonitor.toMonitor(monitor));
}
示例9: getChangedDependencies
import org.eclipse.core.runtime.IProgressMonitor; //导入方法依赖的package包/类
private Pair<Collection<String>, Iterable<java.net.URI>> getChangedDependencies(final IProgressMonitor monitor,
Set<String> oldNPMs) {
logger.logInfo(LINE_SINGLE);
logger.logInfo("Calculating dependency changes... [step 2 of 4]");
monitor.setTaskName("Calculating dependency changes... [step 2 of 4]");
externalLibraryWorkspace.updateState();
URI targetPlatformNodeModulesLocation = locationProvider.getTargetPlatformNodeModulesLocation();
Map<String, String> afterDependencies = locationProvider.getTargetPlatformContent().dependencies;
if (null == afterDependencies) {
afterDependencies = newHashMap();
}
final Set<String> newDependencies = new HashSet<>(afterDependencies.keySet());
Set<String> newNpmProjectNames = new HashSet<>();
Iterable<IProject> newNPMs = externalLibraryWorkspace.getProjects(targetPlatformNodeModulesLocation);
for (IProject newNPM : newNPMs) {
newNpmProjectNames.add(newNPM.getName());
}
Set<String> overwrittenShippedLibNames = getOverwrittenShippedLibs(newNpmProjectNames);
newDependencies.addAll(overwrittenShippedLibNames);
final Collection<String> addedDependencies = difference(newDependencies, oldNPMs);
final Collection<String> deletedDependencies = difference(oldNPMs, newDependencies);
final File nodeModulesFolder = new File(targetPlatformNodeModulesLocation);
final Iterable<java.net.URI> toBeDeleted = from(deletedDependencies)
.transform(name -> new File(nodeModulesFolder, name).toURI());
monitor.worked(1);
logger.logInfo("Dependency changes have been successfully calculated.");
Pair<Collection<String>, Iterable<java.net.URI>> changedDeps = Tuples.pair(addedDependencies, toBeDeleted);
return changedDeps;
}
示例10: doGenerate
import org.eclipse.core.runtime.IProgressMonitor; //导入方法依赖的package包/类
/**
* Launches the generation.
*
* @param monitor
* This will be used to display progress information to the user.
* @throws IOException
* Thrown when the output cannot be saved.
* @generated
*/
public void doGenerate(IProgressMonitor monitor) throws IOException {
if (!targetFolder.getLocation().toFile().exists()) {
targetFolder.getLocation().toFile().mkdirs();
}
monitor.subTask("Loading...");
org.eclipse.cmf.occi.core.gen.textile.main.Generate gen0 = new org.eclipse.cmf.occi.core.gen.textile.main.Generate(modelURI, targetFolder.getLocation().toFile(), arguments);
monitor.worked(1);
String generationID = org.eclipse.acceleo.engine.utils.AcceleoLaunchingUtil.computeUIProjectID("org.eclipse.cmf.occi.core.gen.textile", "org.eclipse.cmf.occi.core.gen.textile.main.Generate", modelURI.toString(), targetFolder.getFullPath().toString(), new ArrayList<String>());
gen0.setGenerationID(generationID);
gen0.doGenerate(BasicMonitor.toMonitor(monitor));
}
示例11: doFinish
import org.eclipse.core.runtime.IProgressMonitor; //导入方法依赖的package包/类
private void doFinish ( final IProgressMonitor monitor, final Item item, final Variant value ) throws Exception
{
monitor.beginTask ( "Writing value to item", 2 );
monitor.worked ( 1 );
try
{
final DataItemHolder itemHolder = new DataItemHolder ( Activator.getDefault ().getBundle ().getBundleContext (), item, null );
if ( !itemHolder.waitForConnection ( 5 * 1000 ) )
{
handleError ( new RuntimeException ( "No available connection" ).fillInStackTrace () );
return;
}
final NotifyFuture<WriteResult> future = itemHolder.startWrite ( value, null, new DisplayCallbackHandler ( getShell (), "Write operation", "Write operation" ) );
try
{
future.get ();
}
catch ( final Throwable e )
{
handleError ( e );
}
}
finally
{
monitor.done ();
}
}
示例12: doGenerate
import org.eclipse.core.runtime.IProgressMonitor; //导入方法依赖的package包/类
/**
* Launches the generation.
*
* @param monitor
* This will be used to display progress information to the user.
* @throws IOException
* Thrown when the output cannot be saved.
* @generated
*/
public void doGenerate(IProgressMonitor monitor) throws IOException {
if (!targetFolder.getLocation().toFile().exists()) {
targetFolder.getLocation().toFile().mkdirs();
}
monitor.subTask("Loading...");
org.eclipse.cmf.occi.core.gen.xml.main.Generate gen0 = new org.eclipse.cmf.occi.core.gen.xml.main.Generate(modelURI, targetFolder.getLocation().toFile(), arguments);
monitor.worked(1);
String generationID = org.eclipse.acceleo.engine.utils.AcceleoLaunchingUtil.computeUIProjectID("org.eclipse.cmf.occi.core.gen.xml", "org.eclipse.cmf.occi.core.gen.xml.main.Generate", modelURI.toString(), targetFolder.getFullPath().toString(), new ArrayList<String>());
gen0.setGenerationID(generationID);
gen0.doGenerate(BasicMonitor.toMonitor(monitor));
}
示例13: fillContentProvider
import org.eclipse.core.runtime.IProgressMonitor; //导入方法依赖的package包/类
@Override
protected void fillContentProvider(AbstractContentProvider contentProvider, ItemsFilter itemsFilter, IProgressMonitor progressMonitor) throws CoreException {
progressMonitor.beginTask("Searching", paths.size());
for (Iterator<VFUnit> iter = paths.iterator(); iter.hasNext();) {
contentProvider.add(((VFUnit)iter.next()), itemsFilter);
progressMonitor.worked(1);
}
progressMonitor.done();
}
示例14: doGenerate
import org.eclipse.core.runtime.IProgressMonitor; //导入方法依赖的package包/类
/**
* Launches the generation.
*
* @param monitor
* This will be used to display progress information to the user.
* @throws IOException
* Thrown when the output cannot be saved.
* @generated
*/
public void doGenerate(IProgressMonitor monitor) throws IOException {
if (!targetFolder.getLocation().toFile().exists()) {
targetFolder.getLocation().toFile().mkdirs();
}
monitor.subTask("Loading...");
org.eclipse.cmf.occi.core.gen.connector.main.Main gen0 = new org.eclipse.cmf.occi.core.gen.connector.main.Main(modelURI, targetFolder.getLocation().toFile(), arguments);
monitor.worked(1);
String generationID = org.eclipse.acceleo.engine.utils.AcceleoLaunchingUtil.computeUIProjectID("org.eclipse.cmf.occi.core.gen.connector", "org.eclipse.cmf.occi.core.gen.connector.main.Main", modelURI.toString(), targetFolder.getFullPath().toString(), new ArrayList<String>());
gen0.setGenerationID(generationID);
gen0.doGenerate(BasicMonitor.toMonitor(monitor));
}
示例15: doGenerate
import org.eclipse.core.runtime.IProgressMonitor; //导入方法依赖的package包/类
/**
* Launches the generation.
*
* @param monitor
* This will be used to display progress information to the user.
* @throws IOException
* Thrown when the output cannot be saved.
* @generated
*/
public void doGenerate(IProgressMonitor monitor) throws IOException {
if (!targetFolder.getLocation().toFile().exists()) {
targetFolder.getLocation().toFile().mkdirs();
}
monitor.subTask("Loading...");
org.eclipse.cmf.occi.core.gen.latex.main.Generate gen0 = new org.eclipse.cmf.occi.core.gen.latex.main.Generate(modelURI, targetFolder.getLocation().toFile(), arguments);
monitor.worked(1);
String generationID = org.eclipse.acceleo.engine.utils.AcceleoLaunchingUtil.computeUIProjectID("org.eclipse.cmf.occi.core.gen.latex", "org.eclipse.cmf.occi.core.gen.latex.main.Generate", modelURI.toString(), targetFolder.getFullPath().toString(), new ArrayList<String>());
gen0.setGenerationID(generationID);
gen0.doGenerate(BasicMonitor.toMonitor(monitor));
}