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


Java SubMonitor.worked方法代碼示例

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


在下文中一共展示了SubMonitor.worked方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: clean

import org.eclipse.core.runtime.SubMonitor; //導入方法依賴的package包/類
@Override
protected void clean(IProgressMonitor monitor) throws CoreException
{
	SubMonitor localmonitor = SubMonitor.convert(monitor, "JPF Manifest validation", 1);
	try
	{
		// clean problem markers on the project
		cleanProblems(getProject(), IResource.DEPTH_ZERO);
		// clean the manifest directory (since errors can be created on
		// manifest files with incorrect casing)
		IFile manifestFile = JPFProject.getManifest(getProject());
		cleanProblems(manifestFile.getParent(), IResource.DEPTH_ONE);
		localmonitor.worked(1);
	}
	finally
	{
		localmonitor.done();
	}
}
 
開發者ID:equella,項目名稱:Equella,代碼行數:20,代碼來源:JPFManifestBuilder.java

示例2: createConfigFiles

import org.eclipse.core.runtime.SubMonitor; //導入方法依賴的package包/類
/**
 * Creates an appengine-web.xml file in the WEB-INF folder if it doesn't exist.
 */
@VisibleForTesting
void createConfigFiles(IProject project, IProgressMonitor monitor)
    throws CoreException {
  SubMonitor progress = SubMonitor.convert(monitor, 10);

  IFile appEngineWebXml = WebProjectUtil.findInWebInf(project, new Path(APPENGINE_WEB_XML));
  if (appEngineWebXml != null && appEngineWebXml.exists()) {
    return;
  }

  // Use the virtual component model decide where to create the appengine-web.xml
  appEngineWebXml = WebProjectUtil.createFileInWebInf(project, new Path(APPENGINE_WEB_XML),
      new ByteArrayInputStream(new byte[0]), progress.newChild(2));
  String configFileLocation = appEngineWebXml.getLocation().toString();
  Map<String, String> parameters = new HashMap<>();
  parameters.put("runtime", "java8");
  Templates.createFileContent(configFileLocation, Templates.APPENGINE_WEB_XML_TEMPLATE,
      parameters);
  progress.worked(4);
  appEngineWebXml.refreshLocal(IFile.DEPTH_ZERO, progress.newChild(1));
}
 
開發者ID:GoogleCloudPlatform,項目名稱:google-cloud-eclipse,代碼行數:25,代碼來源:StandardFacetInstallDelegate.java

示例3: createFolders

import org.eclipse.core.runtime.SubMonitor; //導入方法依賴的package包/類
/**
 * Create the components of the provided folder as required. Assumes the containing project
 * already exists.
 * 
 * @param folder the path to be created if it does not already exist
 * @param monitor may be {@code null}
 * @throws CoreException on error
 */
public static void createFolders(IContainer folder, IProgressMonitor monitor)
    throws CoreException {
  
  IPath path = folder.getProjectRelativePath();
  IContainer current = folder.getProject();
  SubMonitor progress = SubMonitor.convert(monitor, path.segmentCount());
  for (String segment : path.segments()) {
    IFolder child = current.getFolder(new Path(segment));
    if (!child.exists()) {
      child.create(true, true, progress.newChild(1));
    } else {
      progress.worked(1);
    }
    current = child;
  }
}
 
開發者ID:GoogleCloudPlatform,項目名稱:google-cloud-eclipse,代碼行數:25,代碼來源:ResourceUtils.java

示例4: stageFlexible

import org.eclipse.core.runtime.SubMonitor; //導入方法依賴的package包/類
/**
 * @param appEngineDirectory directory containing {@code app.yaml}
 * @param deployArtifact project to be deploy (such as WAR or JAR)
 * @param stagingDirectory where the result of the staging operation will be written
 * @throws AppEngineException when staging fails
 * @throws OperationCanceledException when user cancels the operation
 */
public static void stageFlexible(IPath appEngineDirectory, IPath deployArtifact,
    IPath stagingDirectory, IProgressMonitor monitor) {
  if (monitor.isCanceled()) {
    throw new OperationCanceledException();
  }

  SubMonitor progress = SubMonitor.convert(monitor, 1);
  progress.setTaskName(Messages.getString("task.name.stage.project")); //$NON-NLS-1$

  DefaultStageFlexibleConfiguration stagingConfig = new DefaultStageFlexibleConfiguration();
  stagingConfig.setAppEngineDirectory(appEngineDirectory.toFile());
  stagingConfig.setArtifact(deployArtifact.toFile());
  stagingConfig.setStagingDirectory(stagingDirectory.toFile());

  CloudSdkAppEngineFlexibleStaging staging = new CloudSdkAppEngineFlexibleStaging();
  staging.stageFlexible(stagingConfig);

  progress.worked(1);
}
 
開發者ID:GoogleCloudPlatform,項目名稱:google-cloud-eclipse,代碼行數:27,代碼來源:CloudSdkStagingHelper.java

示例5: runInUIThread

import org.eclipse.core.runtime.SubMonitor; //導入方法依賴的package包/類
@Override
public IStatus runInUIThread(final IProgressMonitor monitor) {
  List<ReferenceSearchViewTreeNode> nodes;
  synchronized (batchAddNodes) {
    nodes = Lists.newArrayList(batchAddNodes);
    batchAddNodes.clear();
  }
  SubMonitor progress = SubMonitor.convert(monitor, nodes.size());
  for (ReferenceSearchViewTreeNode node : nodes) {
    viewer.add(viewer.getInput(), node);
    progress.worked(1);
  }
  viewer.refresh();
  if (!batchAddNodes.isEmpty()) {
    schedule(JOB_RESCHEDULE_DELAY);
  } else {
    isUIUpdateScheduled = false;
  }
  return Status.OK_STATUS;
}
 
開發者ID:dsldevkit,項目名稱:dsl-devkit,代碼行數:21,代碼來源:FastReferenceSearchResultContentProvider.java

示例6: removeObsoleteGpeRemnants

import org.eclipse.core.runtime.SubMonitor; //導入方法依賴的package包/類
/**
 * Removes various GPE-related remnants: classpath entries, nature, runtime, and facets. Any error
 * during operation is logged but ignored.
 *
 * @return true if this was a GPE project
 * @throws CoreException if the project is unusable (e.g., not open, doesn't exist, out of sync)
 */
public static boolean removeObsoleteGpeRemnants(
    final IFacetedProject facetedProject, IProgressMonitor monitor) throws CoreException {
  SubMonitor subMonitor = SubMonitor.convert(monitor, 40);
  IProject project = facetedProject.getProject();
  boolean wasGpeProject = false;

  wasGpeProject |= removeGpeClasspathEntries(project, subMonitor.newChild(10));
  if (subMonitor.isCanceled()) {
    return wasGpeProject;
  }

  wasGpeProject |= removeGpeNature(project, subMonitor.newChild(10));
  if (subMonitor.isCanceled()) {
    return wasGpeProject;
  }

  wasGpeProject |= removeGpeRuntimeAndFacets(facetedProject);
  subMonitor.worked(20);

  return wasGpeProject;
}
 
開發者ID:GoogleCloudPlatform,項目名稱:google-cloud-eclipse,代碼行數:29,代碼來源:GpeMigrator.java

示例7: loadLibraryList

import org.eclipse.core.runtime.SubMonitor; //導入方法依賴的package包/類
/**
 * Load the list of library dependencies saved for this project.
 */
public static List<Library> loadLibraryList(IJavaProject project, IProgressMonitor monitor)
    throws CoreException {
  SubMonitor progress = SubMonitor.convert(monitor, 10);
  LibraryClasspathContainerSerializer serializer = new LibraryClasspathContainerSerializer();
  List<String> savedLibraryIds;
  try {
    savedLibraryIds = serializer.loadLibraryIds(project);
    progress.worked(3);
  } catch (IOException ex) {
    throw new CoreException(
        StatusUtil.error(BuildPath.class, "Error retrieving project library list", ex)); //$NON-NLS-1$
  }
  List<Library> selectedLibraries = new ArrayList<>();
  progress.setWorkRemaining(savedLibraryIds.size());
  for (String libraryId : savedLibraryIds) {
    Library library = CloudLibraries.getLibrary(libraryId);
    if (library != null) {
      selectedLibraries.add(library);
    }
    progress.worked(1);
  }
  return selectedLibraries;
}
 
開發者ID:GoogleCloudPlatform,項目名稱:google-cloud-eclipse,代碼行數:27,代碼來源:BuildPath.java

示例8: saveLibraryList

import org.eclipse.core.runtime.SubMonitor; //導入方法依賴的package包/類
/**
 * Save the list of library dependencies for this project.
 */
public static void saveLibraryList(IJavaProject project, List<Library> libraries,
    IProgressMonitor monitor) throws CoreException {
  SubMonitor progress = SubMonitor.convert(monitor, libraries.size() + 10);
  LibraryClasspathContainerSerializer serializer = new LibraryClasspathContainerSerializer();
  List<String> libraryIds = new ArrayList<>();
  for (Library library : libraries) {
    libraryIds.add(library.getId());
    progress.worked(1);
  }
  try {
    serializer.saveLibraryIds(project, libraryIds);
    progress.worked(5);
    // in practice, we only ever use the master-container
    IPath containerPath = new Path(LibraryClasspathContainer.CONTAINER_PATH_PREFIX)
        .append(CloudLibraries.MASTER_CONTAINER_ID);
    serializer.resetContainer(project, containerPath);
    progress.worked(5);
  } catch (IOException ex) {
    throw new CoreException(
        StatusUtil.error(BuildPath.class, "Error saving project library list", ex)); //$NON-NLS-1$
  }
}
 
開發者ID:GoogleCloudPlatform,項目名稱:google-cloud-eclipse,代碼行數:26,代碼來源:BuildPath.java

示例9: resolveLibraryFiles

import org.eclipse.core.runtime.SubMonitor; //導入方法依賴的package包/類
private LibraryClasspathContainer resolveLibraryFiles(IJavaProject javaProject,
    IPath containerPath, Library library, List<Job> sourceAttacherJobs, IProgressMonitor monitor)
    throws CoreException {
  
  List<LibraryFile> libraryFiles = library.getAllDependencies();
  SubMonitor subMonitor = SubMonitor.convert(monitor, libraryFiles.size());
  subMonitor.subTask(Messages.getString("TaskResolveArtifacts", getLibraryDescription(library)));
  SubMonitor child = subMonitor.newChild(libraryFiles.size());

  List<IClasspathEntry> entries = new ArrayList<>();
  for (LibraryFile libraryFile : libraryFiles) {
    IClasspathEntry newLibraryEntry = resolveLibraryFileAttachSourceAsync(javaProject,
        containerPath, libraryFile, sourceAttacherJobs, monitor);
    entries.add(newLibraryEntry);
    child.worked(1);
  }
  monitor.done();
  LibraryClasspathContainer container = new LibraryClasspathContainer(
      containerPath, getLibraryDescription(library), entries, libraryFiles);
  
  return container;
}
 
開發者ID:GoogleCloudPlatform,項目名稱:google-cloud-eclipse,代碼行數:23,代碼來源:LibraryClasspathContainerResolverService.java

示例10: findMarker

import org.eclipse.core.runtime.SubMonitor; //導入方法依賴的package包/類
@Override
public IMarker findMarker(BookmarkId bookmarkId, IProgressMonitor monitor) {
	SubMonitor subMonitor = SubMonitor.convert(monitor, "Finding marker", 100);
	try {
		IMarker[] markers = findAllBookmarkMarkers(subMonitor.newChild(50));
		subMonitor.setWorkRemaining(markers.length);
		for (IMarker marker : markers) {
			String attributeBookmarkId = (String) marker.getAttribute(BookmarksMarkers.BOOKMARK_ID);
			if (bookmarkId.toString().equals(attributeBookmarkId)) {
				return marker;
			}
			subMonitor.worked(1);
		}
		return null;
	} catch (CoreException e) {
		return null;
	}
}
 
開發者ID:cchabanois,項目名稱:mesfavoris,代碼行數:19,代碼來源:BookmarksMarkers.java

示例11: visitICompilationUnits

import org.eclipse.core.runtime.SubMonitor; //導入方法依賴的package包/類
private void visitICompilationUnits(SubMonitor subMonitor, IPackageFragment packageFragment, IFolder folder, Set<String> unresolvedTypes) throws JavaModelException {
	for (ICompilationUnit compilationUnit : packageFragment.getCompilationUnits()) {
		try {
			theParser.setSource(compilationUnit);
			theParser.setResolveBindings(true);
			ASTNode entireAST = theParser.createAST(new NullProgressMonitor());
			OutCodeVisitor visitor = new OutCodeVisitor();
			entireAST.accept(visitor);
			String fileName = compilationUnit.getElementName().replace(".java", ".rfm");
			String mappedFile = visitITypes(compilationUnit, visitor, unresolvedTypes);
			createFile(fileName, mappedFile, folder);
			subMonitor.worked(1);
		} catch (JavaModelException e) {
			e.printStackTrace();
		}
	}
}
 
開發者ID:ioanaverebi,項目名稱:Sparrow,代碼行數:18,代碼來源:ModelVisitor.java

示例12: storeUpdated

import org.eclipse.core.runtime.SubMonitor; //導入方法依賴的package包/類
@Override
public void storeUpdated(final ExternalLibraryPreferenceStore store, final IProgressMonitor monitor) {
	final IProject[] projects = getWorkspace().getRoot().getProjects();
	final SubMonitor subMonitor = SubMonitor.convert(monitor, 1).newChild(projects.length);
	virtualNodeCache.clear();
	for (final IProject project : projects) {
		getVirtualNodes(project);
		subMonitor.worked(1);
	}
}
 
開發者ID:eclipse,項目名稱:n4js,代碼行數:11,代碼來源:N4JSProjectExplorerContentProvider.java

示例13: 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 ();
    }

}
 
開發者ID:eclipse,項目名稱:neoscada,代碼行數:41,代碼來源:ImportWizard.java

示例14: builLanguageSpecificContext

import org.eclipse.core.runtime.SubMonitor; //導入方法依賴的package包/類
/**
 * For the given {@link IBuildContext} calls the responsible {@link ILanguageSpecificBuilderParticipant}s.
 *
 * @param buildContext
 *          the {@link IBuildContext}, must not be {@code null}
 * @param progress
 *          the {@link SubMonitor}, must not be {@code null}
 * @param languageIdToBuildContext
 *          the map of which build context should be used with responsible {@link ILanguageSpecificBuilderParticipant}, must not be {@code null}
 */
private void builLanguageSpecificContext(final IBuildContext buildContext, final SubMonitor progress, final Map<String, BuildContext> languageIdToBuildContext) {
  for (final Entry<String, BuildContext> entry : languageIdToBuildContext.entrySet()) {
    final String languageId = entry.getKey();
    final BuildContext entryBuildContext = entry.getValue();
    final Set<ILanguageSpecificBuilderParticipant> languageSpecificBuilderParticipants = serviceProviderToParticipants.get(languageId);
    if (languageSpecificBuilderParticipants != null && !languageSpecificBuilderParticipants.isEmpty()) {
      int workUnits = entryBuildContext.getDeltas().size() * MONITOR_PARTICIPANTS_PER_LANGUAGE / languageSpecificBuilderParticipants.size();
      for (final ILanguageSpecificBuilderParticipant languageSpecificBuilderParticipant : languageSpecificBuilderParticipants) {
        try {
          if (initializeParticipant(languageSpecificBuilderParticipant)) {
            languageSpecificBuilderParticipant.build(entryBuildContext, progress.newChild(workUnits));
            if (entryBuildContext.isRebuildRequired()) {
              buildContext.needRebuild();
            }
          }
          // CHECKSTYLE:CHECK-OFF IllegalCatchCheck we need to recover from any exception and continue the build
        } catch (Throwable throwable) {
          // CHECKSTYLE:CHECK-ON IllegalCatchCheck
          LOG.error("Error occurred during build of an ILanguageSpecificBuilderParticipant: " //$NON-NLS-1$
              + languageSpecificBuilderParticipant.getClass().getName(), throwable);
        }
      }
    } else {
      progress.worked(entryBuildContext.getDeltas().size() * MONITOR_PARTICIPANTS_PER_LANGUAGE);
    }
  }
}
 
開發者ID:dsldevkit,項目名稱:dsl-devkit,代碼行數:38,代碼來源:RegistryBuilderParticipant.java

示例15: findAllIndexedReferences

import org.eclipse.core.runtime.SubMonitor; //導入方法依賴的package包/類
/**
 * Uses IResourceDescriptions2 to find all indexed references.
 *
 * @param targetURIs
 *          the URIs to find references to, must not be {@code null}
 * @param indexData
 *          index to use when finding references, must not be {@code null}
 * @param referenceAcceptor
 *          the reference acceptor, must not be {@code null}
 * @param subMonitor
 *          the progress monitor, can be {@code null}
 */
protected void findAllIndexedReferences(final TargetURIs targetURIs, final IResourceDescriptions indexData, final Acceptor referenceAcceptor, final SubMonitor subMonitor) {
  IResourceDescriptions2 idx = (IResourceDescriptions2) indexData;
  List<IReferenceDescription> refs = uniqueReferences(Lists.newArrayList(idx.findReferencesToObjects(targetURIs.asSet())));
  final SubMonitor monitor = SubMonitor.convert(subMonitor, Messages.ReferenceQuery_monitor, refs.size());
  for (IReferenceDescription desc : refs) {
    if (monitor.isCanceled()) {
      return;
    }
    referenceAcceptor.accept(desc);
    monitor.worked(1);
  }
  monitor.done();
}
 
開發者ID:dsldevkit,項目名稱:dsl-devkit,代碼行數:26,代碼來源:ReferenceFinder2.java


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