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


Java SubMonitor.subTask方法代碼示例

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


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

示例1: configureResourceSet

import org.eclipse.core.runtime.SubMonitor; //導入方法依賴的package包/類
private static void configureResourceSet(ResourceSet rs, URI modelURI, HashMap<String, String> nsURIMapping,
		SubMonitor subMonitor) {

	subMonitor.subTask("Configuring ResourceSet");
	subMonitor.newChild(1);

	final String fileExtension = modelURI.fileExtension();
	// indicates which melange query should be added to the xml uri handler
	// for a given extension
	// use to resolve cross ref URI during XMI parsing
	final XMLURIHandler handler = new XMLURIHandler(modelURI.query(), fileExtension);
	handler.setResourceSet(rs);
	rs.getLoadOptions().put(XMLResource.OPTION_URI_HANDLER, handler);

	final MelangeURIConverter converter = new MelangeURIConverter(nsURIMapping);
	rs.setURIConverter(converter);
	// fix sirius to prevent non intentional model savings
	converter.getURIHandlers().add(0, new DebugURIHandler(converter.getURIHandlers()));
}
 
開發者ID:eclipse,項目名稱:gemoc-studio-modeldebugging,代碼行數:20,代碼來源:DefaultModelLoader.java

示例2: generateOffline

import org.eclipse.core.runtime.SubMonitor; //導入方法依賴的package包/類
public static void generateOffline(final IResource resource, IPackageFragment pkg, String classfile , BuildPolicy[]  generators, int timeout, IWorkbenchWindow aww) {
	Job job = new Job("GW4E Offline Generation Source Job") {
		@Override
		public IStatus run(IProgressMonitor monitor) {
			try {
				if (resource instanceof IFile) {
					SubMonitor subMonitor = SubMonitor.convert(monitor, 120);
					IFile file = (IFile) resource;
					if (PreferenceManager.isGraphModelFile(file)) {
						AbstractPostConversion converter = getOfflineConversion(file,pkg,classfile,generators,timeout);
						ConversionRunnable runnable = converter.createConversionRunnable(aww);
						subMonitor.subTask("Processing converter ");
						SubMonitor child = subMonitor.split(1);
						runnable.run(child);
					}						
				}
			} catch (Exception e) {
				e.printStackTrace();
				ResourceManager.logException(e);
			}
			return Status.OK_STATUS;
		}
	};
	job.setUser(true);
	job.schedule();
}
 
開發者ID:gw4e,項目名稱:gw4e.project,代碼行數:27,代碼來源:GraphWalkerContextManager.java

示例3: loadInternal

import org.eclipse.core.runtime.SubMonitor; //導入方法依賴的package包/類
@Override
protected PgDatabase loadInternal(SubMonitor monitor)
        throws IOException, InterruptedException, CoreException {
    String charset = proj.getProjectCharset();
    monitor.subTask(Messages.dbSource_loading_tree);
    IProject project = proj.getProject();

    int filesCount = PgUIDumpLoader.countFiles(project);
    monitor.setWorkRemaining(filesCount);

    IEclipsePreferences pref = proj.getPrefs();
    return PgUIDumpLoader.loadDatabaseSchemaFromIProject(
            project.getProject(),
            getPgDiffArgs(charset, pref.getBoolean(PROJ_PREF.FORCE_UNIX_NEWLINES, true)),
            monitor, null, errors);
}
 
開發者ID:pgcodekeeper,項目名稱:pgcodekeeper,代碼行數:17,代碼來源:DbSource.java

示例4: earlyStartup

import org.eclipse.core.runtime.SubMonitor; //導入方法依賴的package包/類
@Override
public void earlyStartup() {
  workbench = PlatformUI.getWorkbench();
  workspace = ResourcesPlugin.getWorkspace();

  Job projectUpdater = new WorkspaceJob(Messages.getString("updating.projects.jobname")) { //$NON-NLS-1$
    @Override
    public IStatus runInWorkspace(IProgressMonitor monitor) throws CoreException {
      SubMonitor progress = SubMonitor.convert(monitor, 40);
      progress.subTask(Messages.getString("searching.for.projects")); //$NON-NLS-1$
      Collection<IProject> projects = findCandidates(progress.newChild(10));
      if (projects.isEmpty()) {
        return Status.OK_STATUS;
      }
      projects = promptUser(projects, progress.newChild(5));
      if (projects.isEmpty()) {
        return Status.OK_STATUS;
      }
      progress.subTask(Messages.getString("updating.projects")); //$NON-NLS-1$
      return upgradeProjects(projects, progress.newChild(25));
    }
  };
  projectUpdater.setRule(workspace.getRoot());
  projectUpdater.setUser(true);
  projectUpdater.schedule(500);
}
 
開發者ID:GoogleCloudPlatform,項目名稱:google-cloud-eclipse,代碼行數:27,代碼來源:CloudToolsEclipseProjectNotifier.java

示例5: 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

示例6: buildOtherParticipants

import org.eclipse.core.runtime.SubMonitor; //導入方法依賴的package包/類
/**
 * Builds all other registered (non-language specific) {@link IXtextBuilderParticipant}s.
 *
 * @param buildContext
 *          the {@link IBuildContext}, must not be {@code null}
 * @param monitor
 *          the {@link IProgressMonitor}, must not be {@code null}
 * @throws CoreException
 *           caused by an {@link IXtextBuilderParticipant}
 */
protected void buildOtherParticipants(final IBuildContext buildContext, final IProgressMonitor monitor) throws CoreException {
  ImmutableList<IXtextBuilderParticipant> otherBuilderParticipants = getParticipants();
  if (otherBuilderParticipants.isEmpty()) {
    return;
  }
  SubMonitor progress = SubMonitor.convert(monitor, otherBuilderParticipants.size());
  progress.subTask(Messages.RegistryBuilderParticipant_InvokingBuildParticipants);
  for (final IXtextBuilderParticipant participant : otherBuilderParticipants) {
    if (progress.isCanceled()) {
      throw new OperationCanceledException();
    }
    try {
      if (initializeParticipant(participant)) {
        participant.build(buildContext, progress.newChild(1));
      }
      // 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 builder participant: " //$NON-NLS-1$
          + participant.getClass().getName(), throwable);
    }
  }
}
 
開發者ID:dsldevkit,項目名稱:dsl-devkit,代碼行數:34,代碼來源:RegistryBuilderParticipant.java

示例7: performTasks

import org.eclipse.core.runtime.SubMonitor; //導入方法依賴的package包/類
public void performTasks(IProgressMonitor monitor) throws IOException, InterruptedException {
	File rootDir = configAdoc.getDocRootDir();
	FileSystem.ensureFileStructure(rootDir);
	int workload = 1;

	SubMonitor subMonitor = SubMonitor.convert(monitor, workload);

	if (configOutput.writeAdocFiles) {
		writeAdocFiles(subMonitor);
	}

	subMonitor.subTask("Finished.");
	subMonitor.done();
	monitor.done();
}
 
開發者ID:eclipse,項目名稱:n4js,代碼行數:16,代碼來源:TaskWriteFiles.java

示例8: 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

示例9: generateInterface

import org.eclipse.core.runtime.SubMonitor; //導入方法依賴的package包/類
public static void generateInterface(final IResource resource, IWorkbenchWindow aww) {
	Job job = new Job("GW4E Generation Source Job") {
		@Override
		public IStatus run(IProgressMonitor monitor) {
			try {
				if (resource instanceof IFile) {
					SubMonitor subMonitor = SubMonitor.convert(monitor, 120);
					IFile file = (IFile) resource;
					if (PreferenceManager.isGraphModelFile(file)) {
						AbstractPostConversion converter = getDefaultGraphConversion(file, true);
						ConversionRunnable runnable = converter.createConversionRunnable(aww);
						subMonitor.subTask("Processing converter ");
						SubMonitor child = subMonitor.split(1);
						runnable.run(child);
					}						
				} else {
					if (resource instanceof IFolder) {
						generateFromFolder(resource, true, aww);
					}
				}

			} catch (Exception e) {
				e.printStackTrace();
				ResourceManager.logException(e);
			}
			return Status.OK_STATUS;
		}
	};
	job.setUser(true);
	job.schedule();
}
 
開發者ID:gw4e,項目名稱:gw4e.project,代碼行數:32,代碼來源:GraphWalkerContextManager.java

示例10: upgradeProjects

import org.eclipse.core.runtime.SubMonitor; //導入方法依賴的package包/類
/**
 * Perform the upgrade.
 */
private IStatus upgradeProjects(Collection<IProject> projects, SubMonitor progress) {
  progress.setWorkRemaining(projects.size());
  MultiStatus status = StatusUtil.multi(this, Messages.getString("updating.projects.jobname")); //$NON-NLS-1$
  for (IProject project : projects) {
    progress.subTask(Messages.getString("updating.project", project.getName())); //$NON-NLS-1$
    IStatus result = CloudToolsEclipseProjectUpdater.updateProject(project, progress.newChild(1));
    status.merge(result);
  }
  // rewrite if OK as otherwise Progress View shows the "Updating projects for..." message
  return StatusUtil.filter(status);
}
 
開發者ID:GoogleCloudPlatform,項目名稱:google-cloud-eclipse,代碼行數:15,代碼來源:CloudToolsEclipseProjectNotifier.java

示例11: checkTsv

import org.eclipse.core.runtime.SubMonitor; //導入方法依賴的package包/類
void checkTsv(final Collection<IFile> files, IProgressMonitor monitor) throws CoreException {
	final SubMonitor subMonitor = SubMonitor.convert(monitor, files.size() * 5);
	final ItemsXmlValidator validator = getValidator();
	for (final IFile file : files) {
		if (subMonitor.isCanceled()) {
			throw new OperationCanceledException("TSV Check cancelled");
		}
		subMonitor.subTask("Checking typesystem: " + file.getFullPath());
		
		processResults(file, validator.analyze(file, subMonitor.newChild(4)), subMonitor.newChild(1));
		
	}
}
 
開發者ID:SAP,項目名稱:hybris-commerce-eclipse-plugin,代碼行數:14,代碼來源:TsvBuilder.java

示例12: update

import org.eclipse.core.runtime.SubMonitor; //導入方法依賴的package包/類
@Override
@SuppressWarnings("PMD.AvoidInstanceofChecksInCatchClause")
public synchronized ImmutableList<Delta> update(final BuildData buildData, final IProgressMonitor monitor) {
  ensureLoaded();
  final SubMonitor subMonitor = SubMonitor.convert(monitor, org.eclipse.xtext.builder.builderState.Messages.AbstractBuilderState_0, 1);
  subMonitor.subTask(org.eclipse.xtext.builder.builderState.Messages.AbstractBuilderState_0);

  checkForCancellation(monitor);

  final ResourceDescriptionsData newData = getCopiedResourceDescriptionsData();
  Collection<IResourceDescription.Delta> result = null;
  try {
    result = doUpdate(buildData, newData, subMonitor.newChild(1));
    // update the reference
    setResourceDescriptionsData(newData, monitor);
    // CHECKSTYLE:OFF
  } catch (Throwable t) {
    // CHECKSTYLE:ON
    if (!operationCanceledManager.isOperationCanceledException(t)) {
      LOGGER.error("Failed to update index. Executing rollback.", t); //$NON-NLS-1$
    }
    if (newData instanceof AbstractResourceDescriptionsData) {
      ((AbstractResourceDescriptionsData) newData).rollbackChanges();
    }
    throw t;
  }

  final ResourceDescriptionChangeEvent event = new ResourceDescriptionChangeEvent(result);
  notifyListeners(event);
  return event.getDeltas();
}
 
開發者ID:dsldevkit,項目名稱:dsl-devkit,代碼行數:32,代碼來源:MonitoredClusteringBuilderState.java

示例13: synchronizeBuildPolicies

import org.eclipse.core.runtime.SubMonitor; //導入方法依賴的package包/類
/**
 * @param selectedResource
 * @return
 * @throws CoreException
 * @throws InterruptedException
 */
public static void synchronizeBuildPolicies(final IResource selectedResource, IWorkbenchWindow aww)
		throws CoreException, InterruptedException {
	List<ICompilationUnit> executionContexts = new ArrayList<ICompilationUnit>();

	Job job = new WorkspaceJob("GW4E Synchronization Job") {
		@Override
		public IStatus runInWorkspace(IProgressMonitor monitor) throws CoreException {
			try {
				SubMonitor subMonitor = SubMonitor.convert(monitor, 120);
				selectedResource.accept(new IResourceVisitor() {
					@Override
					public boolean visit(IResource resource) throws CoreException {
						if (resource instanceof IFile) {
							IFile file = (IFile) resource;
							if ("java".equals(file.getFileExtension())) {
								ICompilationUnit cu = JavaCore.createCompilationUnitFrom(file);
								if (cu != null) {
									if (JDTManager.isGraphWalkerExecutionContextClass(cu)) {
										executionContexts.add(cu);
									}
								}
							}
						}
						return true;
					}
				});
				subMonitor.split(20);

				int max = executionContexts.size();
				int index = 1;
				subMonitor.setWorkRemaining(max);
				for (ICompilationUnit executionContext : executionContexts) {
					if (monitor.isCanceled())
						return Status.CANCEL_STATUS;
					subMonitor.subTask("Processing file #" + index++);
					SubMonitor child = subMonitor.split(1);
					ResourceManager.updateBuildPolicyFileForCompilatioUnit(executionContext);
				}
			} catch (Exception e) {
				ResourceManager.logException(e);
			}
			return Status.OK_STATUS;
		}
	};
	job.setRule(selectedResource.getProject());
	job.setUser(true);
	job.schedule();
}
 
開發者ID:gw4e,項目名稱:gw4e.project,代碼行數:55,代碼來源:GraphWalkerContextManager.java


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