本文整理匯總了Java中org.eclipse.core.runtime.IProgressMonitor.setTaskName方法的典型用法代碼示例。如果您正苦於以下問題:Java IProgressMonitor.setTaskName方法的具體用法?Java IProgressMonitor.setTaskName怎麽用?Java IProgressMonitor.setTaskName使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.eclipse.core.runtime.IProgressMonitor
的用法示例。
在下文中一共展示了IProgressMonitor.setTaskName方法的12個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: installUninstallNPMs
import org.eclipse.core.runtime.IProgressMonitor; //導入方法依賴的package包/類
private void installUninstallNPMs(final Map<String, String> versionedNPMs, final IProgressMonitor monitor,
final MultiStatus status, final Set<String> requestedNPMs, final Set<String> oldNPMs) {
logger.logInfo(LINE_SINGLE);
logger.logInfo("Installing packages... [step 1 of 4]");
monitor.setTaskName("Installing packages... [step 1 of 4]");
// calculate already installed to skip
final Set<String> npmNamesToInstall = difference(requestedNPMs, oldNPMs);
final Set<String> npmsToInstall = versionedNPMs.entrySet().stream()
// skip already installed
.filter(e -> npmNamesToInstall.contains(e.getKey()))
// [name, @">=1.0.0 <2.0.0"] to [[email protected]">=1.0.0 <2.0.0"]
.map(e -> e.getKey() + Strings.emptyIfNull(e.getValue()))
.collect(Collectors.toSet());
IStatus installStatus = batchInstallUninstall(monitor, npmsToInstall, true);
// log possible errors, but proceed with the process
// assume that at least some packages were installed correctly and can be adapted
if (!installStatus.isOK()) {
logger.logInfo("Some packages could not be installed due to errors, see log for details.");
status.merge(installStatus);
}
monitor.worked(2);
}
示例2: adaptNPMPackages
import org.eclipse.core.runtime.IProgressMonitor; //導入方法依賴的package包/類
private Collection<File> adaptNPMPackages(final IProgressMonitor monitor, final MultiStatus status,
final Collection<String> addedDependencies) {
logger.logInfo(LINE_SINGLE);
logger.logInfo("Adapting npm package structure to N4JS project structure... [step 3 of 4]");
monitor.setTaskName("Adapting npm package structure to N4JS project structure... [step 3 of 4]");
final Pair<IStatus, Collection<File>> result = npmPackageToProjectAdapter.adaptPackages(addedDependencies);
final IStatus adaptionStatus = result.getFirst();
// log possible errors, but proceed with the process
// assume that at least some packages were installed correctly and can be adapted
if (!adaptionStatus.isOK()) {
logger.logError(adaptionStatus);
status.merge(adaptionStatus);
}
final Collection<File> adaptedPackages = result.getSecond();
logger.logInfo("Packages structures has been adapted to N4JS project structure.");
monitor.worked(2);
logger.logInfo(LINE_SINGLE);
return adaptedPackages;
}
示例3: getChangedDependencies
import org.eclipse.core.runtime.IProgressMonitor; //導入方法依賴的package包/類
private Pair<Collection<String>, Iterable<java.net.URI>> getChangedDependencies(final IProgressMonitor monitor,
Set<String> oldNPMs) {
logger.logInfo(LINE_SINGLE);
logger.logInfo("Calculating dependency changes... [step 2 of 4]");
monitor.setTaskName("Calculating dependency changes... [step 2 of 4]");
externalLibraryWorkspace.updateState();
URI targetPlatformNodeModulesLocation = locationProvider.getTargetPlatformNodeModulesLocation();
Map<String, String> afterDependencies = locationProvider.getTargetPlatformContent().dependencies;
if (null == afterDependencies) {
afterDependencies = newHashMap();
}
final Set<String> newDependencies = new HashSet<>(afterDependencies.keySet());
Set<String> newNpmProjectNames = new HashSet<>();
Iterable<IProject> newNPMs = externalLibraryWorkspace.getProjects(targetPlatformNodeModulesLocation);
for (IProject newNPM : newNPMs) {
newNpmProjectNames.add(newNPM.getName());
}
Set<String> overwrittenShippedLibNames = getOverwrittenShippedLibs(newNpmProjectNames);
newDependencies.addAll(overwrittenShippedLibNames);
final Collection<String> addedDependencies = difference(newDependencies, oldNPMs);
final Collection<String> deletedDependencies = difference(oldNPMs, newDependencies);
final File nodeModulesFolder = new File(targetPlatformNodeModulesLocation);
final Iterable<java.net.URI> toBeDeleted = from(deletedDependencies)
.transform(name -> new File(nodeModulesFolder, name).toURI());
monitor.worked(1);
logger.logInfo("Dependency changes have been successfully calculated.");
Pair<Collection<String>, Iterable<java.net.URI>> changedDeps = Tuples.pair(addedDependencies, toBeDeleted);
return changedDeps;
}
示例4: cleanBuildDependencies
import org.eclipse.core.runtime.IProgressMonitor; //導入方法依賴的package包/類
private void cleanBuildDependencies(final IProgressMonitor monitor, final MultiStatus status,
final Iterable<java.net.URI> toBeDeleted, final Collection<File> adaptedPackages,
boolean triggerCleanbuild) {
logger.logInfo("Registering new projects... [step 4 of 4]");
monitor.setTaskName("Registering new projects... [step 4 of 4]");
// nothing to do in the headless case. TODO inject logic instead?
if (Platform.isRunning()) {
logger.logInfo("Platform is running.");
final Iterable<java.net.URI> toBeUpdated = from(adaptedPackages).transform(file -> file.toURI());
final NpmProjectAdaptionResult adaptionResult = NpmProjectAdaptionResult.newOkResult(toBeUpdated,
toBeDeleted);
logger.logInfo("Call " + externalLibraryWorkspace + " to register " + toBeUpdated + " and de-register "
+ toBeDeleted);
externalLibraryWorkspace.registerProjects(adaptionResult, monitor, triggerCleanbuild);
} else {
logger.logInfo("Platform is not running.");
}
logger.logInfo("Finished registering projects.");
if (status.isOK())
logger.logInfo("Successfully finished installing packages.");
else
logger.logInfo("There were errors during installation, see logs for details.");
logger.logInfo(LINE_DOUBLE);
}
示例5: execute
import org.eclipse.core.runtime.IProgressMonitor; //導入方法依賴的package包/類
public void execute ( final IProgressMonitor monitor ) throws Exception
{
monitor.setTaskName ( "Mapping nodes" );
new TypeWalker<Node> ( Node.class ).walk ( this.worldModel, new TypeVisitor<Node> () {
@Override
public void visit ( final Node node ) throws Exception
{
replaceName ( node, WorldPackage.Literals.NODE__HOST_NAME );
}
} );
}
示例6: execute
import org.eclipse.core.runtime.IProgressMonitor; //導入方法依賴的package包/類
public void execute ( final IProgressMonitor monitor ) throws Exception
{
monitor.setTaskName ( "Mapping elements" );
this.parsedMappings = parse ();
final TreeIterator<EObject> i = this.model.eAllContents ();
while ( i.hasNext () )
{
final EObject o = i.next ();
final String className = o.eClass ().getName ();
final Set<String> features = this.parsedMappings.get ( className );
if ( features == null )
{
continue;
}
for ( final String f : features )
{
final EStructuralFeature sf = o.eClass ().getEStructuralFeature ( f );
if ( sf == null )
{
throw new RuntimeException ( String.format ( "Class %s does not have feature %s", className, f ) );
}
replaceName ( o, sf );
}
}
}
示例7: doFinish
import org.eclipse.core.runtime.IProgressMonitor; //導入方法依賴的package包/類
private void doFinish(
String targetProjectPath,
String analysisProjectName,
IProgressMonitor monitor)
throws CoreException, IOException {
monitor.beginTask("Creating " +analysisProjectName, 2);
IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
ProjectGenerator projectGen = new ProjectGenerator();
IJavaProject sourceProject = projectGen.createProject(wizardInput);
IResource resourceTarget = root.findMember(new Path(targetProjectPath));
IJavaProject targetProject = JavaCore.create(resourceTarget.getProject());
GlobalSettings.put("Target_Path",resourceTarget.getLocation().toOSString()+ File.separator + targetProject.getOutputLocation().lastSegment());
GlobalSettings.put("AnalysisProject", sourceProject.getProject().getName());
GlobalSettings.put("TargetProject", targetProject.getProject().getName());
ProjectPreferences projPref = new ProjectPreferences();
projPref.createPreferences();
AddRemoveVisuFlowNatureHandler addNature = new AddRemoveVisuFlowNatureHandler();
try {
if(!sourceProject.getProject().isNatureEnabled("JimpleBuilder.VisuFlowNature"))
addNature.toggleNature(sourceProject.getProject());
} catch (CoreException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
ServiceUtil.getService(DataModel.class).triggerProjectRebuild();
monitor.worked(1);
monitor.setTaskName("Opening file for editing...");
getShell().getDisplay().asyncExec(new Runnable() {
@Override
public void run() {
}
});
monitor.worked(1);
}
示例8: run
import org.eclipse.core.runtime.IProgressMonitor; //導入方法依賴的package包/類
/**
* Runs the operation in a blocking fashion.
*
* @param helper
* the build helper to get the injected services.
* @param project
* the project to clean/build.
* @param monitor
* monitor for the operation.
*/
private void run(final ExternalLibraryBuilderHelper helper, IProject project, IProgressMonitor monitor) {
checkArgument(project instanceof ExternalProject, "Expected external project: " + project);
final SubMonitor subMonitor = SubMonitor.convert(monitor, 2);
final ToBeBuiltComputer computer = helper.builtComputer;
final IProgressMonitor computeMonitor = subMonitor.newChild(1, SUPPRESS_BEGINTASK);
monitor.setTaskName("Collecting resource for '" + project.getName() + "'...");
final ToBeBuilt toBeBuilt = getToBeBuilt(computer, project, computeMonitor);
if (toBeBuilt.getToBeDeleted().isEmpty() && toBeBuilt.getToBeUpdated().isEmpty()) {
subMonitor.newChild(1, SUPPRESS_NONE).worked(1);
return;
}
try {
final IN4JSCore core = helper.core;
final QueuedBuildData queuedBuildData = helper.queuedBuildData;
final IBuilderState builderState = helper.builderState;
final ExternalProject externalProject = (ExternalProject) project;
final String path = externalProject.getExternalResource().getAbsolutePath();
final URI uri = URI.createFileURI(path);
final IN4JSProject n4Project = core.findProject(uri).orNull();
ResourceSet resourceSet = null;
try {
resourceSet = core.createResourceSet(Optional.of(n4Project));
if (!resourceSet.getLoadOptions().isEmpty()) {
resourceSet.getLoadOptions().clear();
}
resourceSet.getLoadOptions().put(ResourceDescriptionsProvider.NAMED_BUILDER_SCOPE, Boolean.TRUE);
if (resourceSet instanceof ResourceSetImpl) {
((ResourceSetImpl) resourceSet).setURIResourceMap(newHashMap());
}
final BuildData buildData = new BuildData(
project.getName(),
resourceSet,
toBeBuilt,
queuedBuildData,
true /* indexingOnly */);
monitor.setTaskName("Building '" + project.getName() + "'...");
final IProgressMonitor buildMonitor = subMonitor.newChild(1, SUPPRESS_BEGINTASK);
builderState.update(buildData, buildMonitor);
} finally {
if (null != resourceSet) {
resourceSet.getResources().clear();
resourceSet.eAdapters().clear();
}
}
} catch (Exception e) {
final String message = "Error occurred while " + toString().toLowerCase() + "ing external library "
+ project.getName() + ".";
LOGGER.error(message, e);
throw new RuntimeException(message, e);
}
}
示例9: storeExcel
import org.eclipse.core.runtime.IProgressMonitor; //導入方法依賴的package包/類
private IStatus storeExcel ( final File file, final List<Event> events, final List<Field> columns, final IProgressMonitor monitor ) throws IOException
{
final HSSFWorkbook workbook = new HSSFWorkbook ();
final HSSFDataFormat dateFormat = workbook.createDataFormat ();
final HSSFCellStyle dateCellStyle = workbook.createCellStyle ();
dateCellStyle.setDataFormat ( dateFormat.getFormat ( "YYYY-MM-DD hh:mm:ss.000" ) );
try
{
monitor.beginTask ( Messages.ExportImpl_Progress_ExportingEvents, events.size () + 3 + columns.size () );
try
{
monitor.subTask ( Messages.ExportImpl_Progress_CreateWorkbook );
monitor.worked ( 1 );
final HSSFSheet sheet = createSheet ( events, workbook, columns );
monitor.worked ( 1 );
monitor.setTaskName ( Messages.ExportImpl_Progress_ExportEvents );
for ( int i = 0; i < events.size (); i++ )
{
final HSSFRow row = sheet.createRow ( i + 1 );
final Event e = events.get ( i );
for ( int j = 0; j < columns.size (); j++ )
{
final Field field = columns.get ( j );
final ExcelCell cell = new ExcelCell ( row, j, dateCellStyle );
field.render ( e, cell );
}
monitor.worked ( 1 );
if ( monitor.isCanceled () )
{
return Status.CANCEL_STATUS;
}
}
sheet.setRepeatingRows ( new CellRangeAddress ( 0, 1, -1, -1 ) );
monitor.setTaskName ( "Auto sizing" );
for ( int i = 0; i < columns.size (); i++ )
{
monitor.subTask ( String.format ( "Auto sizing column: %s", columns.get ( i ).getHeader () ) );
sheet.autoSizeColumn ( i );
monitor.worked ( 1 );
if ( monitor.isCanceled () )
{
return Status.CANCEL_STATUS;
}
}
}
finally
{
monitor.subTask ( Messages.ExportImpl_Progress_CloseFile );
if ( workbook != null )
{
makeDocInfo ( workbook );
final FileOutputStream stream = new FileOutputStream ( file );
workbook.write ( stream );
stream.close ();
}
monitor.worked ( 1 );
}
}
finally
{
monitor.done ();
}
return Status.OK_STATUS;
}
示例10: process
import org.eclipse.core.runtime.IProgressMonitor; //導入方法依賴的package包/類
public World process ( final URI input, final URI output, final IProgressMonitor monitor ) throws Exception
{
logger.debug ( "Processing file: {}", input );
monitor.setTaskName ( "Loading model" );
final ComponentWorld system = new ModelLoader<ComponentWorld> ( ComponentWorld.class ).load ( input );
final WorldGenerator gen = new WorldGenerator ( system.getInfrastructure () );
gen.generate ( monitor );
final GlobalizationProcessor gb = createGlobalizationProcessor ( gen.getGlobalize () );
if ( gb != null )
{
gb.preProcess ( monitor );
}
new GeneratorProcessor ( system, gen ).process ( monitor );
new SummariesProcessor ( system, gen ).process ( monitor );
new SummariesCompressor ( system, gen ).process ( monitor );
new SummariesItemsGenerator ( system, gen ).process ( monitor );
new MarkerGroupGeneratorProcessor ( system, gen ).process ( monitor );
new AlarmsInformationProcessor ( system, gen ).process ( monitor );
if ( gb != null )
{
gb.postProcess ( monitor );
}
if ( output != null )
{
monitor.subTask ( "Writing model" );
final ResourceSet rs = new ResourceSetImpl ();
final Resource r1 = rs.createResource ( URI.createURI ( output + "/result.eswm" ) );
r1.getContents ().add ( gen.getWorld () );
final Resource r2 = rs.createResource ( URI.createURI ( output + "/result.globalize" ) );
r2.getContents ().add ( gen.getGlobalize () );
r1.save ( null );
r2.save ( null );
}
return gen.getWorld ();
}
示例11: doFinish
import org.eclipse.core.runtime.IProgressMonitor; //導入方法依賴的package包/類
private void doFinish(IProgressMonitor monitor) throws CoreException {
String dboName, name;
boolean bContinue = true;
int index = 0;
try {
newBean = getCreatedBean();
if (newBean != null) {
monitor.setTaskName("Object created");
monitor.worked(1);
dboName = newBean.getName();
if (!StringUtils.isNormalized(dboName))
throw new EngineException("Bean name is not normalized : \""+dboName+"\".");
while (bContinue) {
if (index == 0) name = dboName;
else name = dboName + index;
newBean.setName(name);
newBean.hasChanged = true;
newBean.bNew = true;
try {
parentObject.add(newBean);
monitor.setTaskName("Object added");
monitor.worked(1);
ConvertigoPlugin.logInfo("New object class '"+ this.className +"' named '" + newBean.getName() + "' has been added");
monitor.setTaskName("Object setted up");
monitor.worked(1);
bContinue = false;
}
catch(com.twinsoft.convertigo.engine.ObjectWithSameNameException owsne) {
if (newBean instanceof HandlerStatement) {
throw owsne;
}
index++;
}
}
}
else {
throw new Exception("Could not instantiate bean!");
}
}
catch (Exception e) {
String message = "Unable to create a new object from class '"+ this.className +"'.";
ConvertigoPlugin.logException(e, message);
newBean = null;
}
}
示例12: updateProgressMonitor
import org.eclipse.core.runtime.IProgressMonitor; //導入方法依賴的package包/類
private void updateProgressMonitor(IProgressMonitor monitor, String subTaskName) {
monitor.worked(1);
monitor.setTaskName(getTaskName());
monitor.subTask(subTaskName);
}