本文整理匯總了Java中org.eclipse.core.runtime.SubMonitor.setTaskName方法的典型用法代碼示例。如果您正苦於以下問題:Java SubMonitor.setTaskName方法的具體用法?Java SubMonitor.setTaskName怎麽用?Java SubMonitor.setTaskName使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.eclipse.core.runtime.SubMonitor
的用法示例。
在下文中一共展示了SubMonitor.setTaskName方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: cleanCacheInternal
import org.eclipse.core.runtime.SubMonitor; //導入方法依賴的package包/類
private IStatus cleanCacheInternal(final IProgressMonitor monitor) {
checkNotNull(monitor, "monitor");
final SubMonitor subMonitor = SubMonitor.convert(monitor, 1);
try {
subMonitor.setTaskName("Cleaning npm cache");
performGitPull(subMonitor.newChild(1, SubMonitor.SUPPRESS_ALL_LABELS));
final File targetInstallLocation = new File(locationProvider.getTargetPlatformInstallLocation());
return clean(targetInstallLocation);
} finally {
subMonitor.done();
}
}
示例2: createFileDeleteIfExists
import org.eclipse.core.runtime.SubMonitor; //導入方法依賴的package包/類
/**
* Create a file in a folder with the specified name and content
*
* @param fullpath
* @param filename
* @param content
* @throws CoreException
* @throws InterruptedException
*/
public static IFile createFileDeleteIfExists(String fullpath, String filename, String content,
IProgressMonitor monitor) throws CoreException, InterruptedException {
SubMonitor subMonitor = SubMonitor.convert(monitor, 100);
subMonitor.setTaskName("Create file delete if it exists " + fullpath);
IFile newFile;
try {
IWorkspaceRoot wroot = ResourcesPlugin.getWorkspace().getRoot();
IContainer container = (IContainer) wroot.findMember(new Path(fullpath));
newFile = container.getFile(new Path(filename));
if (newFile.exists()) {
JDTManager.rename(newFile, new NullProgressMonitor());
newFile.delete(true, new NullProgressMonitor());
}
subMonitor.split(30);
byte[] source = content.getBytes(Charset.forName("UTF-8"));
newFile.create(new ByteArrayInputStream(source), true, new NullProgressMonitor());
subMonitor.split(70);
} finally {
subMonitor.done();
}
return newFile;
}
示例3: createJob
import org.eclipse.core.runtime.SubMonitor; //導入方法依賴的package包/類
/**
* @param jobname
* @param tasks
* @return
*/
public static Job createJob(String jobname, List<UITask.Task> tasks) {
Job job = new Job(jobname) {
@Override
protected IStatus run(IProgressMonitor monitor) {
SubMonitor subMonitor = SubMonitor.convert(monitor, tasks.size());
for (UITask.Task task : tasks) {
try {
subMonitor.setTaskName(task.getSummary());
workOnTask(task, subMonitor.split(1));
} catch (Exception e) {
return Status.CANCEL_STATUS;
}
}
return Status.OK_STATUS;
}
};
job.setUser(true);
return job;
}
示例4: publishExploded
import org.eclipse.core.runtime.SubMonitor; //導入方法依賴的package包/類
public static void publishExploded(IProject project, IPath destination,
IPath safeWorkDirectory, IProgressMonitor monitor) throws CoreException {
Preconditions.checkNotNull(project, "project is null"); //$NON-NLS-1$
Preconditions.checkNotNull(destination, "destination is null"); //$NON-NLS-1$
Preconditions.checkArgument(!destination.isEmpty(), "destination is empty path"); //$NON-NLS-1$
Preconditions.checkNotNull(safeWorkDirectory, "safeWorkDirectory is null"); //$NON-NLS-1$
if (monitor.isCanceled()) {
throw new OperationCanceledException();
}
SubMonitor subMonitor = SubMonitor.convert(monitor, 100);
subMonitor.setTaskName(Messages.getString("task.name.publish.war"));
IModuleResource[] resources =
flattenResources(project, safeWorkDirectory, subMonitor.newChild(10));
PublishUtil.publishFull(resources, destination, subMonitor.newChild(90));
}
示例5: publishWar
import org.eclipse.core.runtime.SubMonitor; //導入方法依賴的package包/類
public static void publishWar(IProject project, IPath destination, IPath safeWorkDirectory,
IProgressMonitor monitor) throws CoreException {
Preconditions.checkNotNull(project, "project is null"); //$NON-NLS-1$
Preconditions.checkNotNull(destination, "destination is null"); //$NON-NLS-1$
Preconditions.checkArgument(!destination.isEmpty(), "destination is empty path"); //$NON-NLS-1$
Preconditions.checkNotNull(safeWorkDirectory, "safeWorkDirectory is null"); //$NON-NLS-1$
if (monitor.isCanceled()) {
throw new OperationCanceledException();
}
SubMonitor subMonitor = SubMonitor.convert(monitor, 100);
subMonitor.setTaskName(Messages.getString("task.name.publish.war"));
IModuleResource[] resources =
flattenResources(project, safeWorkDirectory, subMonitor.newChild(10));
PublishUtil.publishZip(resources, destination, subMonitor.newChild(90));
}
示例6: stageStandard
import org.eclipse.core.runtime.SubMonitor; //導入方法依賴的package包/類
/**
* @param explodedWarDirectory the input of the staging operation
* @param stagingDirectory where the result of the staging operation will be written
* @param cloudSdk executes the staging operation
*/
public static void stageStandard(IPath explodedWarDirectory, IPath stagingDirectory,
CloudSdk cloudSdk, 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$
DefaultStageStandardConfiguration stagingConfig = new DefaultStageStandardConfiguration();
stagingConfig.setSourceDirectory(explodedWarDirectory.toFile());
stagingConfig.setStagingDirectory(stagingDirectory.toFile());
stagingConfig.setEnableJarSplitting(true);
stagingConfig.setDisableUpdateCheck(true);
CloudSdkAppEngineStandardStaging staging = new CloudSdkAppEngineStandardStaging(cloudSdk);
staging.stageStandard(stagingConfig);
progress.worked(1);
}
示例7: 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);
}
示例8: createOrganizingRunnable
import org.eclipse.core.runtime.SubMonitor; //導入方法依賴的package包/類
/** Creates {@link IRunnableWithProgress} that will be organize imports in the provided files. */
private IRunnableWithProgress createOrganizingRunnable(List<IFile> collectedFiles) {
IRunnableWithProgress op = new IRunnableWithProgress() {
@Override
public void run(IProgressMonitor mon) throws InvocationTargetException, InterruptedException {
int totalWork = collectedFiles.size();
SubMonitor subMon = SubMonitor.convert(mon, "Organize imports.", totalWork);
for (int i = 0; !subMon.isCanceled() && i < totalWork; i++) {
IFile currentFile = collectedFiles.get(i);
subMon.setTaskName("Organize imports." + " - File (" + (i + 1) + " of " + totalWork + ")");
try {
OrganizeImportsService.organizeImportsInFile(currentFile, Interaction.breakBuild, subMon);
} catch (CoreException | RuntimeException e) {
String msg = "Exception in file " + currentFile.getFullPath().toString() + ".";
LOGGER.error(msg, e);
boolean errorDialogShowed = ErrorDialogWithStackTraceUtil.showErrorDialogWithStackTrace(
msg + " Hit OK to continue.", e);
if (!errorDialogShowed) {
throw new InvocationTargetException(e);
}
}
}
if (subMon.isCanceled()) {
throw new InterruptedException();
}
}
};
return op;
}
示例9: organizeImportsInFile
import org.eclipse.core.runtime.SubMonitor; //導入方法依賴的package包/類
/** Organize provided file. */
public static void organizeImportsInFile(IFile currentFile, final Interaction interaction, SubMonitor subMon)
throws CoreException {
SubMonitor subSubMon = subMon.split(1, SubMonitor.SUPPRESS_NONE);
subSubMon.setTaskName(currentFile.getName());
DocumentImportsOrganizer imortsOrganizer = getOrganizeImports(currentFile);
imortsOrganizer.organizeFile(currentFile, interaction, subSubMon);
}
示例10: refreshInstalledNpmPackagesInternal
import org.eclipse.core.runtime.SubMonitor; //導入方法依賴的package包/類
private IStatus refreshInstalledNpmPackagesInternal(final IProgressMonitor monitor) {
checkNotNull(monitor, "monitor");
final Collection<String> packageNames = getAllNpmProjectsMapping().keySet();
if (packageNames.isEmpty()) {
return statusHelper.OK();
}
final SubMonitor subMonitor = SubMonitor.convert(monitor, packageNames.size() + 1);
try {
logger.logInfo(LINE_DOUBLE);
logger.logInfo("Refreshing installed npm packages.");
subMonitor.setTaskName("Refreshing cache for type definitions files...");
performGitPull(subMonitor.newChild(1, SubMonitor.SUPPRESS_ALL_LABELS));
final MultiStatus refreshStatus = statusHelper
.createMultiStatus("Status of refreshing definitions for npm packages.");
for (final String packageName : packageNames) {
final IStatus status = refreshInstalledNpmPackage(packageName, false, subMonitor.newChild(1));
if (!status.isOK()) {
logger.logError(status);
refreshStatus.merge(status);
}
}
logger.logInfo("Installed npm packages have been refreshed.");
logger.logInfo(LINE_DOUBLE);
return refreshStatus;
} finally {
subMonitor.done();
}
}
示例11: 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 ();
}
}
示例12: doConversion
import org.eclipse.core.runtime.SubMonitor; //導入方法依賴的package包/類
/**
* Perform the conversion by calling GraphWalker apis
*
* @param monitor
* @return
* @throws IOException
* @throws CoreException
* @throws InterruptedException
* @throws Exception
*/
protected String doConversion(IProgressMonitor monitor) throws IOException, CoreException, InterruptedException {
SubMonitor subMonitor = SubMonitor.convert(monitor, 100);
subMonitor.setTaskName("Converting file...");
String ret = "";
try {
String outputFileName = getSelectedOuputAbsolutePath();
subMonitor.split(20);
ret = GraphWalkerFacade.convert(inputFileName, outputFileName);
subMonitor.split(80);
} finally {
subMonitor.done();
}
return ret;
}
示例13: convert
import org.eclipse.core.runtime.SubMonitor; //導入方法依賴的package包/類
/**
* @param context
* The conversion context
* @throws InterruptedException
* @throws CoreException
* @throws IOException
*/
public List<IFile> convert(IWorkbenchWindow ww,IProgressMonitor monitor) throws IOException, CoreException, InterruptedException {
String contentOfConversion=null;
SubMonitor subMonitor = SubMonitor.convert(monitor, 100);
subMonitor.setTaskName("Processing file " + this.getInputFile().getName());
List<IFile> ret;
try {
try {
contentOfConversion = doConversion(subMonitor.split(80));
if (contentOfConversion==null) {
throw new Exception(("Unable to convert the file "+this.getInputFile()) );
}
} catch (Exception e) {
ResourceManager.logException(e);
return null;
}
convertedFile = ResourceManager.createFileDeleteIfExists(
context.getContainerFullPath().toString(),
getSelectedFilename(),
contentOfConversion,
subMonitor.split(20));
openEditor(convertedFile, ww);
ret = new ArrayList<IFile> ();
ret.add(convertedFile);
} finally {
subMonitor.done();
}
return ret;
}
示例14: run
import org.eclipse.core.runtime.SubMonitor; //導入方法依賴的package包/類
public void run (IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
SubMonitor subMonitor = SubMonitor.convert(monitor, 100);
subMonitor.setTaskName("Processing file ");
try {
generatedFiles = convert(ww,subMonitor.split(80));
afterConversion(subMonitor.split(20));
} catch (Exception e) {
ResourceManager.logException(e);
} finally {
subMonitor.done();
}
}
示例15: deploy
import org.eclipse.core.runtime.SubMonitor; //導入方法依賴的package包/類
/**
* @param optionalConfigurationFilesDirectory if not {@code null}, searches optional configuration
* files (such as {@code cron.yaml}) in this directory and deploys them together
*/
public IStatus deploy(IPath stagingDirectory, Path credentialFile,
DeployPreferences deployPreferences, IPath optionalConfigurationFilesDirectory,
MessageConsoleStream stdoutOutputStream, IProgressMonitor monitor) {
if (monitor.isCanceled()) {
throw new OperationCanceledException();
}
cloudSdkProcessWrapper.setUpDeployCloudSdk(credentialFile, stdoutOutputStream);
CloudSdk cloudSdk = cloudSdkProcessWrapper.getCloudSdk();
SubMonitor progress = SubMonitor.convert(monitor, 1);
progress.setTaskName(Messages.getString("task.name.deploy.project")); //$NON-NLS-1$
try {
List<File> deployables =
computeDeployables(stagingDirectory, optionalConfigurationFilesDirectory);
DefaultDeployConfiguration configuration =
DeployPreferencesConverter.toDeployConfiguration(deployPreferences);
configuration.setDeployables(deployables);
CloudSdkAppEngineDeployment deployment = new CloudSdkAppEngineDeployment(cloudSdk);
try {
deployment.deploy(configuration);
} catch (AppEngineException ex) {
return StatusUtil.error(this, "Error deploying project: " + ex.getMessage(), ex);
}
return cloudSdkProcessWrapper.getExitStatus();
} finally {
progress.worked(1);
}
}