本文整理匯總了Java中org.eclipse.core.runtime.SubProgressMonitor類的典型用法代碼示例。如果您正苦於以下問題:Java SubProgressMonitor類的具體用法?Java SubProgressMonitor怎麽用?Java SubProgressMonitor使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
SubProgressMonitor類屬於org.eclipse.core.runtime包,在下文中一共展示了SubProgressMonitor類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: execute
import org.eclipse.core.runtime.SubProgressMonitor; //導入依賴的package包/類
@Override
protected void execute ( final IProgressMonitor monitor ) throws CoreException, InvocationTargetException, InterruptedException
{
monitor.beginTask ( "Creating project", 3 );
createProject ( new SubProgressMonitor ( monitor, 1 ) );
try
{
createContent ( new SubProgressMonitor ( monitor, 1 ) );
}
catch ( final IOException e )
{
throw new CoreException ( StatusHelper.convertStatus ( Activator.PLUGIN_ID, e ) );
}
this.info.getProject ().refreshLocal ( IResource.DEPTH_INFINITE, new SubProgressMonitor ( monitor, 1 ) );
}
示例2: createProject
import org.eclipse.core.runtime.SubProgressMonitor; //導入依賴的package包/類
protected void createProject ( final IProgressMonitor monitor ) throws CoreException
{
monitor.beginTask ( "Create project", 2 );
final IProject project = this.info.getProject ();
final IProjectDescription desc = project.getWorkspace ().newProjectDescription ( project.getName () );
desc.setLocation ( this.info.getProjectLocation () );
desc.setNatureIds ( new String[] { Constants.PROJECT_NATURE_CONFIGURATION, PROJECT_NATURE_JS } );
final ICommand jsCmd = desc.newCommand ();
jsCmd.setBuilderName ( BUILDER_JS_VALIDATOR );
final ICommand localBuilder = desc.newCommand ();
localBuilder.setBuilderName ( Constants.PROJECT_BUILDER );
desc.setBuildSpec ( new ICommand[] { jsCmd, localBuilder } );
if ( !project.exists () )
{
project.create ( desc, new SubProgressMonitor ( monitor, 1 ) );
project.open ( new SubProgressMonitor ( monitor, 1 ) );
}
monitor.done ();
}
示例3: execute
import org.eclipse.core.runtime.SubProgressMonitor; //導入依賴的package包/類
@Override
public void execute ( final IProject project, final IPluginModelBase model, final IProgressMonitor monitor ) throws CoreException
{
monitor.beginTask ( "Creating client", 5 );
super.execute ( project, model, new SubProgressMonitor ( monitor, 1 ) ); // COUNT:1
final Map<String, String> properties = new HashMap<> ();
properties.put ( "pluginId", this.pluginId ); //$NON-NLS-1$
properties.put ( "version", this.version ); //$NON-NLS-1$
properties.put ( "mavenVersion", this.version.replaceFirst ( "\\.qualifier$", "-SNAPSHOT" ) ); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
createParentProject ( project, properties, new SubProgressMonitor ( monitor, 1 ) ); // COUNT:1
createProductProject ( project, properties, new SubProgressMonitor ( monitor, 1 ) ); // COUNT:1
createFeatureProject ( project, properties, new SubProgressMonitor ( monitor, 1 ) ); // COUNT:1
addFilteredResource ( project, "pom.xml", getResource ( "app-pom.xml" ), "UTF-8", properties, new SubProgressMonitor ( monitor, 1 ) ); // COUNT:1
}
示例4: createFeatureProject
import org.eclipse.core.runtime.SubProgressMonitor; //導入依賴的package包/類
private void createFeatureProject ( final IProject project, final Map<String, String> properties, final IProgressMonitor monitor ) throws CoreException
{
monitor.beginTask ( "Creating feature project", 6 );
final String name = this.pluginId + ".feature"; //$NON-NLS-1$
final IProjectDescription desc = project.getWorkspace ().newProjectDescription ( name );
final ICommand featureBuilder = desc.newCommand ();
featureBuilder.setBuilderName ( "org.eclipse.pde.FeatureBuilder" ); //$NON-NLS-1$
desc.setNatureIds ( new String[] { "org.eclipse.pde.FeatureNature" } ); //$NON-NLS-1$
desc.setBuildSpec ( new ICommand[] {
featureBuilder
} );
final IProject newProject = project.getWorkspace ().getRoot ().getProject ( name );
newProject.create ( desc, new SubProgressMonitor ( monitor, 1 ) ); // COUNT:1
newProject.open ( new SubProgressMonitor ( monitor, 1 ) ); // COUNT:1
addFilteredResource ( newProject, "pom.xml", getResource ( "feature-pom.xml" ), "UTF-8", properties, new SubProgressMonitor ( monitor, 1 ) ); // COUNT:1
addFilteredResource ( newProject, "feature.xml", getResource ( "feature/feature.xml" ), "UTF-8", properties, new SubProgressMonitor ( monitor, 1 ) ); // COUNT:1
addFilteredResource ( newProject, "feature.properties", getResource ( "feature/feature.properties" ), "ISO-8859-1", properties, new SubProgressMonitor ( monitor, 1 ) ); // COUNT:1
addFilteredResource ( newProject, "build.properties", getResource ( "feature/build.properties" ), "ISO-8859-1", properties, new SubProgressMonitor ( monitor, 1 ) ); // COUNT:1
monitor.done ();
}
示例5: process
import org.eclipse.core.runtime.SubProgressMonitor; //導入依賴的package包/類
public void process (
@Named ( "phase" )
final String phase,
final World world, final IContainer output, final IProgressMonitor monitor ) throws Exception
{
monitor.beginTask ( "Processing world", world.getNodes ().size () );
for ( final Node node : world.getNodes () )
{
monitor.subTask ( String.format ( "Processing node: %s", Nodes.makeName ( node ) ) );
if ( node instanceof ApplicationNode )
{
processNode ( phase, world, (ApplicationNode)node, output, new SubProgressMonitor ( monitor, 1 ) );
}
}
monitor.done ();
}
示例6: processFile
import org.eclipse.core.runtime.SubProgressMonitor; //導入依賴的package包/類
public static void processFile ( final IContainer parent, final Definition definition, final Profile profile, final IProgressMonitor monitor ) throws Exception
{
monitor.beginTask ( makeJobLabel ( definition, profile ), 100 );
final IFolder output = parent.getFolder ( new Path ( "output" ) ); //$NON-NLS-1$
if ( output.exists () )
{
output.delete ( true, new SubProgressMonitor ( monitor, 9 ) );
}
output.create ( true, true, new SubProgressMonitor ( monitor, 1 ) );
final Builder builder = new Builder ( definition, profile );
final Recipe recipe = builder.build ();
try
{
final Map<String, Object> initialContent = new HashMap<String, Object> ();
initialContent.put ( "output", output ); //$NON-NLS-1$
recipe.execute ( initialContent, new SubProgressMonitor ( monitor, 90 ) );
}
finally
{
monitor.done ();
}
}
示例7: run
import org.eclipse.core.runtime.SubProgressMonitor; //導入依賴的package包/類
public void run ( final RunnerContext ctx, final IProgressMonitor monitor )
{
monitor.beginTask ( "Executing task", this.task.getExecute ().size () );
for ( final Execute execute : this.task.getExecute () )
{
final Executable runnable = convert ( execute, ctx );
// inject sub progress monitor
final SubProgressMonitor sm = new SubProgressMonitor ( monitor, 1 );
ctx.getMap ().put ( KEY_PROGRESS_MONITOR, sm );
runnable.run ( ctx );
// remove sub progress monitor
ctx.getMap ().remove ( KEY_PROGRESS_MONITOR );
// step is complete
sm.done ();
}
monitor.done ();
}
示例8: execute
import org.eclipse.core.runtime.SubProgressMonitor; //導入依賴的package包/類
@Override
public void execute ( final Map<String, Object> initialContext, final IProgressMonitor monitor )
{
final RunnerContext ctx = new RunnerContext ( this.properties );
ctx.getMap ().putAll ( this.initialContent );
ctx.getMap ().putAll ( initialContext );
monitor.beginTask ( "Running recipe", this.tasks.size () * MONITOR_AMOUNT );
try
{
for ( final TaskRunner task : this.tasks )
{
monitor.subTask ( task.getName () );
task.run ( ctx, new SubProgressMonitor ( monitor, MONITOR_AMOUNT ) );
}
}
finally
{
monitor.done ();
}
}
示例9: performFinish
import org.eclipse.core.runtime.SubProgressMonitor; //導入依賴的package包/類
/**
* Implements the interface method by looping through template sections and
* executing them sequentially.
*
* @param project
* the project
* @param monitor
* the progress monitor to track the execution progress as part
* of the overall new project creation operation
* @return <code>true</code> if the wizard completed the operation with
* success, <code>false</code> otherwise.
*/
public boolean performFinish(IProject project, IProgressMonitor monitor) {
try {
ITemplateSection[] sections = getTemplateSections();
monitor.beginTask("", sections.length); //$NON-NLS-1$
for (int i = 0; i < sections.length; i++) {
sections[i].execute(project, new SubProgressMonitor(monitor, 1));
}
//No reason to do this any more with the new editors
//saveTemplateFile(project, null);
} catch (CoreException e) {
PDEPlugin.logException(e);
return false;
} finally {
monitor.done();
}
return true;
}
示例10: updateTasks
import org.eclipse.core.runtime.SubProgressMonitor; //導入依賴的package包/類
/**
* Refreshes the list of {@link Task}s.
*/
private void updateTasks(IProgressMonitor monitor) {
monitor.subTask("Looking For Tasks");
// clear out the items
collector.reset();
scanner.scan(collector);
monitor.subTask("Evaluating Tasks");
monitor.worked(1);
// test tasks and figure out which ones are blocked
updateTaskStatus(new SubProgressMonitor(monitor, collector.getTasks().size()));
monitor.worked(1);
}
示例11: doRun
import org.eclipse.core.runtime.SubProgressMonitor; //導入依賴的package包/類
/**
* {@inheritDoc}
*/
@Override
protected IStatus doRun(final IProgressMonitor progressMonitor) throws Exception {
progressMonitor.beginTask(getName(), projects.length);
for (int i = 0; i < projects.length; i++) {
final IProgressMonitor projectMonitor = new SubProgressMonitor(progressMonitor, 1);
projectMonitor.setTaskName(
MessageFormat.format(
Messages.getString("CloseProjectsCommand.ClosingProjectFormat"), //$NON-NLS-1$
projects[i].getName()));
try {
projects[i].close(projectMonitor);
} catch (final OperationCanceledException e) {
return Status.CANCEL_STATUS;
}
if (progressMonitor.isCanceled()) {
return Status.CANCEL_STATUS;
}
}
return Status.OK_STATUS;
}
示例12: queryItem
import org.eclipse.core.runtime.SubProgressMonitor; //導入依賴的package包/類
private Item queryItem(final IProgressMonitor progressMonitor, final String title, final String serverPath)
throws Exception {
final SubProgressMonitor queryMonitor = new SubProgressMonitor(progressMonitor, 1);
final QueryItemsCommand queryCommand = new QueryItemsCommand(repository, new ItemSpec[] {
new ItemSpec(serverPath, RecursionType.NONE)
}, LatestVersionSpec.INSTANCE, DeletedState.NON_DELETED, ItemType.ANY, GetItemsOptions.UNSORTED);
queryCommand.setName(title);
final IStatus queryStatus = queryCommand.run(queryMonitor);
if (!queryStatus.isOK()) {
throw new CoreException(queryStatus);
}
if (queryCommand.getItemSets() == null || queryCommand.getItemSets().length != 1) {
return null;
}
final Item[] subItems = queryCommand.getItemSets()[0].getItems();
if (subItems == null || subItems.length != 1) {
return null;
}
return subItems[0];
}
示例13: process
import org.eclipse.core.runtime.SubProgressMonitor; //導入依賴的package包/類
/**
* Processes all types and methods reporting all types found to the given
* {@link ITypeVisitor} instance.
*
* @param visitor
* type visitor
* @param monitor
* progress monitor to report progress and allow cancelation
* @throws JavaModelException
* thrown by the underlying Java model
*/
public void process(ITypeVisitor visitor, IProgressMonitor monitor)
throws JavaModelException {
if (isOnClasspath(root)) {
IJavaElement[] children = root.getChildren();
monitor.beginTask("", children.length); //$NON-NLS-1$
for (final IJavaElement element : children) {
if (monitor.isCanceled()) {
break;
}
IProgressMonitor submonitor = new SubProgressMonitor(monitor, 1);
processPackageFragment(visitor, (IPackageFragment) element, submonitor);
}
} else {
TRACER.trace("Package fragment root {0} not on classpath.", //$NON-NLS-1$
root.getPath());
}
monitor.done();
}
示例14: importExistingProject
import org.eclipse.core.runtime.SubProgressMonitor; //導入依賴的package包/類
/**
* Imports a existing SVN Project to the workbench
*
* @param monitor
* project monitor
* @return true if loaded, else false
* @throws TeamException
*/
boolean importExistingProject(IProgressMonitor monitor)
throws TeamException {
if (directory == null) {
return false;
}
try {
monitor.beginTask("Importing", 3 * 1000);
createExistingProject(new SubProgressMonitor(monitor, 1000));
monitor.subTask("Refreshing " + project.getName());
RepositoryProvider.map(project, SVNProviderPlugin.getTypeId());
monitor.worked(1000);
SVNWorkspaceRoot.setSharing(project, new SubProgressMonitor(
monitor, 1000));
return true;
} catch (CoreException ce) {
throw new SVNException("Failed to import External SVN Project"
+ ce, ce);
} finally {
monitor.done();
}
}
示例15: createExistingProject
import org.eclipse.core.runtime.SubProgressMonitor; //導入依賴的package包/類
/**
* Creates a new project in the workbench from an existing one
*
* @param monitor
* @throws CoreException
*/
void createExistingProject(IProgressMonitor monitor)
throws CoreException {
String projectName = project.getName();
IProjectDescription description;
try {
monitor.beginTask("Creating " + projectName, 2 * 1000);
description = ResourcesPlugin.getWorkspace()
.loadProjectDescription(
new Path(directory + File.separatorChar
+ ".project")); //$NON-NLS-1$
description.setName(projectName);
project.create(description, new SubProgressMonitor(monitor,
1000));
project.open(new SubProgressMonitor(monitor, 1000));
} finally {
monitor.done();
}
}