当前位置: 首页>>代码示例>>Java>>正文


Java IProgressMonitor类代码示例

本文整理汇总了Java中org.eclipse.core.runtime.IProgressMonitor的典型用法代码示例。如果您正苦于以下问题:Java IProgressMonitor类的具体用法?Java IProgressMonitor怎么用?Java IProgressMonitor使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


IProgressMonitor类属于org.eclipse.core.runtime包,在下文中一共展示了IProgressMonitor类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: progress

import org.eclipse.core.runtime.IProgressMonitor; //导入依赖的package包/类
@Override
public void progress(String progressGroup, String msg, String msgGroup, int workedUnit) {
	boolean mustLog = false;
	IProgressMonitor progressMonitor = getProgressMonitor(progressGroup);		
	if(progressMonitor != null){
		progressMonitor.subTask(msg);
		progressMonitor.worked(workedUnit*progressBarScale);
	}
	else{
		mustLog = true;
	}
	
	// for the moment forward all messages to usual log
	Kind logLevel;
	if(mustLog){
		logLevel = Kind.UserINFO;
	}
	else logLevel = Kind.DevINFO;
	this.log(logLevel, "["+progressGroup+"]"+ msg+getIntermediateElapsedTime(progressGroup), msgGroup);
	
}
 
开发者ID:eclipse,项目名称:gemoc-studio,代码行数:22,代码来源:EclipseMessagingSystem.java

示例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;
}
 
开发者ID:eclipse,项目名称:n4js,代码行数:24,代码来源:NpmManager.java

示例3: update

import org.eclipse.core.runtime.IProgressMonitor; //导入依赖的package包/类
/**
 * @param project
 * @param buildPolicyFile
 * @param graphFilePath
 * @param updatedGenerators
 * @throws IOException
 * @throws CoreException
 * @throws InterruptedException
 */
public static void update(IProject project, IFile buildPolicyFile, String graphFilePath,
		List<String> updatedGenerators) throws IOException, CoreException, InterruptedException {
	Job job = new WorkspaceJob("Updating policies") {
		public IStatus runInWorkspace(IProgressMonitor monitor) throws CoreException {
			try {
				_update(project, buildPolicyFile, graphFilePath, updatedGenerators, monitor);
			} catch (FileNotFoundException e) {
				ResourceManager.logException(e);
			}
			return Status.OK_STATUS;
		}
	};
	job.setRule(buildPolicyFile.getProject());
	job.setUser(true);
	job.schedule();
}
 
开发者ID:gw4e,项目名称:gw4e.project,代码行数:26,代码来源:BuildPolicyManager.java

示例4: addStringCoupleIfNeeded

import org.eclipse.core.runtime.IProgressMonitor; //导入依赖的package包/类
public static void addStringCoupleIfNeeded(IFile classFile, String languageName,
		String layerName, IProgressMonitor monitor) throws IOException,
		CoreException {
	String content = getContent(classFile.getContents(), "UTF8");
	final String statement = "res.add(new StringCouple(\"" + languageName
			+ "\", \"" + layerName + "\"));";
	if (!content.contains(statement)) {
		int index = content.lastIndexOf("res.add(new StringCouple(");
		if (index >= 0) {
			index = index + "res.add(new StringCouple(".length();
			while (content.charAt(index) != ';') {
				++index;
			}
			String newContent = content.substring(0, index) + "\n\t\t"
					+ statement + "\n"
					+ content.substring(index, content.length());
			setContent(classFile.getFullPath().toFile(), "UTF8", newContent);
			classFile.refreshLocal(1, monitor);
		} else {
			// TODO notify : add statement manually
		}
	}
}
 
开发者ID:eclipse,项目名称:gemoc-studio-modeldebugging,代码行数:24,代码来源:AddDebugLayerHandler.java

示例5: createFileDeleteIfExists

import org.eclipse.core.runtime.IProgressMonitor; //导入依赖的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;
}
 
开发者ID:gw4e,项目名称:gw4e.project,代码行数:32,代码来源:ResourceManager.java

示例6: build

import org.eclipse.core.runtime.IProgressMonitor; //导入依赖的package包/类
@Override
public void build(IBuildContext context, IProgressMonitor monitor) throws CoreException {
	SubMonitor progress = SubMonitor.convert(monitor);
	if (!prefs.isCompilerEnabled()) {
		return;
	}
	final List<IResourceDescription.Delta> deltas = getRelevantDeltas(context);
	if (deltas.isEmpty()) {
		return;
	}
	if (progress.isCanceled()) {
		throw new OperationCanceledException();
	}
	progress.beginTask("Compiling solidity...", deltas.size());

	List<URI> uris = deltas.stream().map(delta -> delta.getUri()).collect(Collectors.toList());
	compiler.compile(uris, progress);
	context.getBuiltProject().refreshLocal(IProject.DEPTH_INFINITE, progress);
	progress.done();

}
 
开发者ID:Yakindu,项目名称:solidity-ide,代码行数:22,代码来源:SolidityBuilderParticipant.java

示例7: resolveCodeLens

import org.eclipse.core.runtime.IProgressMonitor; //导入依赖的package包/类
@Override
public CompletableFuture<ICodeLens> resolveCodeLens(ICodeLensContext context, ICodeLens codeLens,
		IProgressMonitor monitor) {
	ITextEditor textEditor = ((IEditorCodeLensContext) context).getTextEditor();

	LSPDocumentInfo info = null;
	Collection<LSPDocumentInfo> infos = LanguageServiceAccessor.getLSPDocumentInfosFor(
			LSPEclipseUtils.getDocument((ITextEditor) textEditor),
			capabilities -> capabilities.getCodeLensProvider() != null
					&& capabilities.getCodeLensProvider().isResolveProvider());
	if (!infos.isEmpty()) {
		info = infos.iterator().next();
	} else {
		info = null;
	}
	if (info != null) {
		LSPCodeLens lscl = ((LSPCodeLens) codeLens);
		CodeLens unresolved = lscl.getCl();
		return info.getLanguageClient().getTextDocumentService().resolveCodeLens(unresolved).thenApply(resolved -> {
			lscl.update(resolved);
			return lscl;
		});
	}
	return null;
}
 
开发者ID:angelozerr,项目名称:codelens-eclipse,代码行数:26,代码来源:LSPCodeLensProvider.java

示例8: addMarkers

import org.eclipse.core.runtime.IProgressMonitor; //导入依赖的package包/类
private void addMarkers(IFile file, Resource resource, CheckMode mode, IProgressMonitor monitor)
		throws OperationCanceledException {
	try {
		List<Issue> list = getValidator(resource).validate(resource, mode, getCancelIndicator(monitor));
		if (monitor.isCanceled()) {
			throw new OperationCanceledException();
		}
		deleteMarkers(file, mode, monitor);
		if (monitor.isCanceled()) {
			throw new OperationCanceledException();
		}
		createMarkers(file, list, getMarkerCreator(resource), getMarkerTypeProvider(resource));
	} catch (OperationCanceledError error) {
		throw error.getWrapped();
	} catch (CoreException e) {
		LOGGER.error(e.getMessage(), e);
	}
}
 
开发者ID:eclipse,项目名称:n4js,代码行数:19,代码来源:ResourceUIValidatorExtension.java

示例9: processContext

import org.eclipse.core.runtime.IProgressMonitor; //导入依赖的package包/类
@Override
protected void processContext ( final MasterContext masterContext, final IProgressMonitor monitor ) throws Exception
{
    // FIXME: this must be set from external

    if ( masterContext.getImplementation ().getAeServerInformationPrefix () == null || masterContext.getImplementation ().getAeServerInformationPrefix ().isEmpty () )
    {
        return;
    }

    createInternalItem ( masterContext, "ae.server.info.ALERT_ACTIVE", "Alert active" );
    createInternalItem ( masterContext, "ae.server.info.ALERT_DISABLED", "Alert disabled" );
    createInternalItem ( masterContext, "ae.server.info.OK", "Summarized state OK" );
    createInternalItem ( masterContext, "ae.server.info.NOT_OK", "Summarized state NOT_OK_AKN" );
    createInternalItem ( masterContext, "ae.server.info.UNSAFE", "Summarized state UNSAFE" );
    createInternalItem ( masterContext, "ae.server.info.INACTIVE", "Summarized state INACTIVE" );
    createInternalItem ( masterContext, "ae.server.info.INIT", "Summarized state INIT" );
    createInternalItem ( masterContext, "ae.server.info.NOT_OK_AKN", "Summarized state NOT_OK_AKN" );
    createInternalItem ( masterContext, "ae.server.info.NOT_OK_NOT_AKN", "Summarized state NOT_OK_NOT_AKN" );
    createInternalItem ( masterContext, "ae.server.info.NOT_AKN", "Summarized state NOT_OK_AKN" );
}
 
开发者ID:eclipse,项目名称:neoscada,代码行数:22,代码来源:AlarmsInformationProcessor.java

示例10: customizeManifest

import org.eclipse.core.runtime.IProgressMonitor; //导入依赖的package包/类
public void customizeManifest(Element rootElem, IProject project, IProgressMonitor monitor) throws CoreException
{
	if( equella.isLanguageStrings() )
	{
		Element runtime = rootElem.getChild("runtime");
		addLibrary(runtime, "resources", "resources/", "resources");
		JPFProject.getResourcesFolder(project).create(true, true, monitor);
	}
	Element requires = rootElem.getChild("requires");
	if( equella.isGuiceModule() )
	{
		addImport(requires, "com.tle.core.guice");
		addExtension(rootElem, "com.tle.core.guice", "module", "guiceModules");
	}
	if( equella.isLanguageStrings() )
	{
		addImport(requires, "com.tle.common.i18n");
		Element ext = addExtension(rootElem, "com.tle.common.i18n", "bundle", "strings");
		addParameter(ext, "file", "lang/i18n.properties");
		IFolder langFolder = JPFProject.getResourcesFolder(project).getFolder("lang");
		langFolder.create(true, true, monitor);
		langFolder.getFile("i18n.properties").create(new ByteArrayInputStream("# add your strings".getBytes()),
			true, monitor);
	}

}
 
开发者ID:equella,项目名称:Equella,代码行数:27,代码来源:NewJPFPluginWizardPageOne.java

示例11: build

import org.eclipse.core.runtime.IProgressMonitor; //导入依赖的package包/类
@Override
protected IProject[] build(int kind, @SuppressWarnings("rawtypes") Map args,
		IProgressMonitor monitor) throws CoreException {
	ProjectScope projectScope = new ProjectScope(getProject());
	IEclipsePreferences prefs = projectScope.getNode(BUILDER_ID);
	if (kind == FULL_BUILD) {
		fullBuild(prefs, monitor);
	} else {
		IResourceDelta delta = getDelta(getProject());
		if (delta == null) {
			fullBuild(prefs, monitor);
		} else {
			incrementalBuild(delta, prefs, monitor);
		}
	}
	return null;
}
 
开发者ID:mnlipp,项目名称:EclipseMinifyBuilder,代码行数:18,代码来源:MinifyBuilder.java

示例12: handleAttachments

import org.eclipse.core.runtime.IProgressMonitor; //导入依赖的package包/类
/**
    * make sure that all attachments will be moved to the new project area
    * @param sourceWorkItem the original work item to which the attachments have belonged to
    * @param targetWorkItem work item object is it will be available in the target pa after movement
    * @param workItemCommon common service
    * @param progressMonitor progress monitor
    * @throws TeamRepositoryException whenever an attachment can't be moved
    */
@Override
protected void handleAttachments(IWorkItem sourceWorkItem, IWorkItem targetWorkItem, IWorkItemCommon workItemCommon,
		IProgressMonitor progressMonitor) throws TeamRepositoryException {
	ILinkServiceLibrary lsl = (ILinkServiceLibrary) this.service.getService(ILinkService.class)
               .getServiceLibrary(ILinkServiceLibrary.class);
	IWorkItemReferences references = workItemCommon.resolveWorkItemReferences(sourceWorkItem, monitor);
       for (IReference attachmentReference : references.getReferences(WorkItemEndPoints.ATTACHMENT)) {
           if (!attachmentReference.isItemReference()) continue;
           IAttachmentHandle attachmentHandle = (IAttachmentHandle)((IItemReference)attachmentReference)
                   .getReferencedItem();
           IAttachment attachment = workItemCommon.getAuditableCommon()
                   .resolveAuditable(attachmentHandle, IAttachment.SMALL_PROFILE, monitor);
           if (commitChanges) {
               this.moveAttachment(targetWorkItem, workItemCommon, attachment);
               continue;
           }
           this.checkAttachmentReferences(attachmentReference, lsl.findLinksBySource(attachmentReference), sourceWorkItem);
           this.checkAttachmentReferences(attachmentReference, lsl.findLinksByTarget(attachmentReference), sourceWorkItem);
       }
}
 
开发者ID:jazz-community,项目名称:rtc-workitem-bulk-mover-service,代码行数:29,代码来源:BulkMoveOperation.java

示例13: addResolutionsAsValues

import org.eclipse.core.runtime.IProgressMonitor; //导入依赖的package包/类
static List<AttributeValue> addResolutionsAsValues(IProjectAreaHandle pa,
                                                   IWorkItemServer workItemServer, IProgressMonitor monitor) throws TeamRepositoryException {
    List<AttributeValue> values = new ArrayList<AttributeValue>();
    ICombinedWorkflowInfos workFlowInfo = workItemServer.findCachedCombinedWorkflowInfos(pa);
    if (workFlowInfo == null) {
        workFlowInfo = workItemServer.findCombinedWorkflowInfos(pa, monitor);
    }
    Identifier<IResolution>[] arridentifier = workFlowInfo.getAllResolutionIds();
    int n = arridentifier.length;
    int n2 = 0;
    while (n2 < n) {
        Identifier<IResolution> resolutionId = arridentifier[n2];
        String name = workFlowInfo.getResolutionName(resolutionId);
        String id = resolutionId.getStringIdentifier();
        values.add(new AttributeValue(id, name));
        ++n2;
    }
    return values;
}
 
开发者ID:jazz-community,项目名称:rtc-workitem-bulk-mover-service,代码行数:20,代码来源:ResolutionHelpers.java

示例14: doSave

import org.eclipse.core.runtime.IProgressMonitor; //导入依赖的package包/类
public void doSave(IProgressMonitor monitor) {
	jsEditor.doSave(monitor);
	try {
		// Get the jsEditor content and transfer it to the statement object
		statement.setExpression(IOUtils.toString(file.getContents(), "UTF-8")); 
	} catch (Exception e) {
		ConvertigoPlugin.logWarning("Error writing statement jscript code '" + eInput.getName() + "' : " + e.getMessage());
	}
	
	statement.hasChanged = true;
	// Refresh tree
	ProjectExplorerView projectExplorerView = ConvertigoPlugin.getDefault().getProjectExplorerView();
	if (projectExplorerView != null) {
		projectExplorerView.updateDatabaseObject(statement);
	}
}
 
开发者ID:convertigo,项目名称:convertigo-eclipse,代码行数:17,代码来源:JscriptStatementEditor.java

示例15: process

import org.eclipse.core.runtime.IProgressMonitor; //导入依赖的package包/类
@Override
public void process ( final OscarContext ctx, final EquinoxApplication application, final IProgressMonitor monitor )
{
    try
    {
        final Collection<Object> exporters = EcoreUtil.getObjectsByType ( application.getModules (), ModbusPackage.Literals.MODBUS_EXPORTER );
        for ( final Object exp : exporters )
        {
            assert exp instanceof ModbusExporter;
            processExporter ( ctx, application, (ModbusExporter)exp, monitor );
        }
    }
    finally
    {
        monitor.done ();
    }
}
 
开发者ID:eclipse,项目名称:neoscada,代码行数:18,代码来源:ModbusExporterProcessor.java


注:本文中的org.eclipse.core.runtime.IProgressMonitor类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。