本文整理匯總了Java中org.eclipse.core.runtime.IProgressMonitor.beginTask方法的典型用法代碼示例。如果您正苦於以下問題:Java IProgressMonitor.beginTask方法的具體用法?Java IProgressMonitor.beginTask怎麽用?Java IProgressMonitor.beginTask使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.eclipse.core.runtime.IProgressMonitor
的用法示例。
在下文中一共展示了IProgressMonitor.beginTask方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: execute
import org.eclipse.core.runtime.IProgressMonitor; //導入方法依賴的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 ();
}
}
示例2: fillContentProvider
import org.eclipse.core.runtime.IProgressMonitor; //導入方法依賴的package包/類
@Override
protected void fillContentProvider(final AbstractContentProvider contentProvider, final ItemsFilter itemsFilter,
final IProgressMonitor monitor) throws CoreException {
monitor.beginTask("Searching for N4JS types...", UNKNOWN);
final Iterable<IEObjectDescription> types = filter(indexSupplier.get().getExportedObjects(),
desc -> searchKind.matches(desc.getEClass()));
monitor.beginTask("Searching for N4JS types...", size(types));
types.forEach(desc -> {
contentProvider.add(desc, itemsFilter);
monitor.worked(1);
});
monitor.done();
}
示例3: performFinish
import org.eclipse.core.runtime.IProgressMonitor; //導入方法依賴的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;
}
示例4: 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);
}
}
示例5: execute
import org.eclipse.core.runtime.IProgressMonitor; //導入方法依賴的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
}
示例6: createFeatureProject
import org.eclipse.core.runtime.IProgressMonitor; //導入方法依賴的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 ();
}
示例7: run
import org.eclipse.core.runtime.IProgressMonitor; //導入方法依賴的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: 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;
}
示例9: preProcess
import org.eclipse.core.runtime.IProgressMonitor; //導入方法依賴的package包/類
public void preProcess ( final IProgressMonitor monitor )
{
monitor.beginTask ( "Globalizing world - Phase 1/2", countJobs () );
try
{
for ( final Global global : this.globalizationModel.getGlobals () )
{
for ( final Local local : global.getLocals () )
{
preProcessRule ( global, local );
monitor.worked ( 1 );
}
}
}
finally
{
monitor.done ();
}
}
示例10: postProcess
import org.eclipse.core.runtime.IProgressMonitor; //導入方法依賴的package包/類
public void postProcess ( final IProgressMonitor monitor )
{
monitor.beginTask ( "Globalizing world - Phase 2/2", this.entries.size () + this.globalizationModel.getGlobals ().size () );
try
{
postProcessGlobal ( monitor );
// process after since we need the AE module
for ( final Entry entry : this.entries )
{
postProcessEntry ( entry );
monitor.worked ( 1 );
}
}
finally
{
monitor.done ();
}
}
示例11: setComparison
import org.eclipse.core.runtime.IProgressMonitor; //導入方法依賴的package包/類
/**
* Like {@link #setComparison()}, but a custom progress monitor can be provided (may be <code>null</code> if no
* progress monitor should be used).
*/
public void setComparison(IProgressMonitor monitor) {
if (monitor != null) {
monitor.beginTask("Building comparison for API / implementation projects in workspace ...",
IProgressMonitor.UNKNOWN);
monitor.worked(1);
}
final List<String> errorMessages = new ArrayList<>();
if (monitor != null) {
monitor.subTask("Comparing projects in workspace ...");
monitor.worked(1);
}
final ProjectComparison newComparison = projectCompareTreeHelper.createComparison(true, errorMessages);
if (errorMessages.isEmpty()) {
// if there is exactly one implementation, then focus on that; otherwise do not focus on an
// implementation (i.e. show all implementations side-by-side)
final String newFocusImplId;
if (newComparison != null && newComparison.getImplCount() == 1)
newFocusImplId = newComparison.getImplId(0);
else
newFocusImplId = null;
setComparison(newComparison, newFocusImplId, monitor);
} else {
setComparison(null, null, null);
MessageDialog.openError(
getTree().getShell(),
"Setup Invalid",
"The API / implementation setup is invalid:\n" + Joiner.on('\n').join(errorMessages));
}
if (monitor != null)
monitor.done();
}
示例12: writeAdocFiles
import org.eclipse.core.runtime.IProgressMonitor; //導入方法依賴的package包/類
private void writeAdocFiles(IProgressMonitor monitor)
throws IOException, InterruptedException {
Set<SpecFile> specChangeSet = taskGenAdoc.getSpecChangeSet();
monitor.beginTask("Write adoc files", specChangeSet.size() + 1);
for (SpecFile specChangeFile : specChangeSet) {
File file = specChangeFile.getFile();
String newContent = specChangeFile.getNewContent();
if (file.exists()) {
file.delete();
}
File parent = file.getParentFile();
if (!parent.exists() && !parent.mkdirs()) {
throw new IllegalStateException("Couldn't create dir: " + parent);
}
file.createNewFile();
Files.write(newContent, file, Charsets.UTF_8);
monitor.worked(1);
CheckCanceled.checkUserCanceled(monitor);
}
monitor.worked(1);
monitor.done();
}
示例13: run
import org.eclipse.core.runtime.IProgressMonitor; //導入方法依賴的package包/類
@Override
public void run(IProgressMonitor monitor, CancellationToken token) {
monitor.beginTask("Init Gluon project", IProgressMonitor.UNKNOWN);
try {
File projectDir = new File(projectData.projectLocation);
if (!projectDir.exists()) {
if (projectDir.mkdir()) {
operation.perform(monitor, projectDir);
}
}
} finally {
monitor.done();
}
}
示例14: createProjectContents
import org.eclipse.core.runtime.IProgressMonitor; //導入方法依賴的package包/類
private void createProjectContents(IProgressMonitor mon, File projectDir) {
mon.beginTask("Create project contents", 1);
try {
Map<String, Object> parameters = projectData.asParameters();
parameters.put(ProjectConstants.PARAM_PROJECT_NAME, projectData.projectName);
parameters.put(ProjectConstants.PARAM_GLUON_DESKTOP_VERSION, ProjectConstants.getDesktopVersion());
parameters.put(ProjectConstants.PARAM_GLUON_MOBILE_VERSION, ProjectConstants.getMobileVersion());
parameters.put(ProjectConstants.PARAM_GLUON_MOBILE_GVM_VERSION, ProjectConstants.getMobileGvmVersion());
parameters.put(ProjectConstants.PARAM_GLUON_DOWN_VERSION, ProjectConstants.getDownVersion());
parameters.put(ProjectConstants.PARAM_GLUON_MOBILE_PLUGIN, ProjectConstants.getPluginVersion());
parameters.put(ProjectConstants.PARAM_GLUON_MOBILE_GVM_PLUGIN, ProjectConstants.getPluginGvmVersion());
parameters.put(ProjectConstants.PARAM_GLUON_GLISTEN_AFTERBURNER_VERSION, ProjectConstants.getGlistenAfterburnerVersion());
List<File> filesToOpen = new ArrayList<>();
if (projectTemplate != null) {
projectTemplate.render(projectDir, parameters);
filesToOpen.addAll(projectTemplate.getFilesToOpen());
if (sourceTemplate != null) {
sourceTemplate.render(projectDir, parameters);
filesToOpen.addAll(sourceTemplate.getFilesToOpen());
}
}
// TODO: open files
} finally {
mon.done();
}
}
示例15: run
import org.eclipse.core.runtime.IProgressMonitor; //導入方法依賴的package包/類
@Override
public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
int totalUnitsOfWork = IProgressMonitor.UNKNOWN;
monitor.beginTask("Performing read. Please wait...", totalUnitsOfWork);
// This only performs the tasks
try {
client.setCredentials(Constants.USERNAME, Constants.PASSWORD);
System.out.println(getClient().getUser());
issues = loadRequirements();
} catch (IOException e) {
e.printStackTrace();
}
monitor.done();
}