本文整理汇总了Java中org.eclipse.emf.common.util.Monitor.beginTask方法的典型用法代码示例。如果您正苦于以下问题:Java Monitor.beginTask方法的具体用法?Java Monitor.beginTask怎么用?Java Monitor.beginTask使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.emf.common.util.Monitor
的用法示例。
在下文中一共展示了Monitor.beginTask方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: doComputeEPackages
import org.eclipse.emf.common.util.Monitor; //导入方法依赖的package包/类
@Override
protected Diagnostic doComputeEPackages(Monitor monitor) throws Exception {
Diagnostic diagnostic = Diagnostic.OK_INSTANCE;
List<URI> locationURIs = getModelLocationURIs();
if (locationURIs.isEmpty()) {
diagnostic = new BasicDiagnostic(Diagnostic.ERROR, IMPORTER_ID, 0, "Specify a valid Ecore model and try loading again", null);
}
else {
monitor.beginTask("", 2);
monitor.subTask(MessageFormat.format("Loading {0}", locationURIs));
ResourceSet ecoreResourceSet = createResourceSet();
for (URI ecoreModelLocation : locationURIs) {
ecoreResourceSet.getResource(ecoreModelLocation, true);
}
EcoreUtil.resolveAll(ecoreResourceSet);
for (Resource resource : ecoreResourceSet.getResources()) {
getEPackages().addAll(EcoreUtil.getObjectsByType(resource.getContents(), EcorePackage.Literals.EPACKAGE));
}
BasicDiagnostic diagnosticChain = new BasicDiagnostic(ConverterPlugin.ID, ConverterUtil.ACTION_MESSAGE_NONE, "Problems were detected while validating and converting the Ecore models", null);
for (EPackage ePackage : getEPackages()) {
Diagnostician.INSTANCE.validate(ePackage, diagnosticChain);
}
if (diagnosticChain.getSeverity() != Diagnostic.OK) {
diagnostic = diagnosticChain;
}
}
return diagnostic;
}
示例2: generateModel
import org.eclipse.emf.common.util.Monitor; //导入方法依赖的package包/类
@Override
protected Diagnostic generateModel(Object object, Monitor monitor)
{
GenClass genClass = (GenClass)object;
GenPackage genPackage = genClass.getGenPackage();
monitor.beginTask("", 2);
monitor.subTask(message);
GenModel genModel = genClass.getGenModel();
ensureProjectExists
(genModel.getModelDirectory(), genClass, MODEL_PROJECT_TYPE, genModel.isUpdateClasspath(), createMonitor(monitor, 1));
generateJava
(genModel.getModelDirectory(),
genPackage.getInterfacePackageName() + ".proxy",
genClass.getInterfaceName()+"Proxy",
getJETEmitter(getJETEmitterDescriptors(), REF_ID),
null,
createMonitor(monitor, 1));
generateJava
(genModel.getModelDirectory(),
genPackage.getInterfacePackageName() + ".proxy",
genClass.getInterfaceName()+"Adapter",
getJETEmitter(getJETEmitterDescriptors(), ADAPTER_ID),
null,
createMonitor(monitor, 1));
return Diagnostic.OK_INSTANCE;
}
示例3: generate
import org.eclipse.emf.common.util.Monitor; //导入方法依赖的package包/类
/**
* Launch the documentation generation.
*
* @param generation
* the generation configuration object
* @param classProvider
* the {@link IClassProvider}
* @param templateURI
* the template {@link URI}
* @param generatedURI
* the generated docx {@link URI}
* @param monitor
* used to track the progress will generating.
* @return generated file and validation file if exists
* @throws IOException
* if an I/O problem occurs
* @throws DocumentParserException
* if the document coulnd'nt be parsed.
* @throws DocumentGenerationException
* if the document couldn't be generated
*/
private static List<URI> generate(Generation generation, IClassProvider classProvider, URI templateURI,
URI generatedURI, Monitor monitor)
throws IOException, DocumentParserException, DocumentGenerationException {
final IQueryEnvironment queryEnvironment = GenconfUtils.getQueryEnvironment(generation);
monitor.beginTask("Loading models.", 2);
final List<Exception> exceptions = new ArrayList<Exception>();
final ResourceSet resourceSetForModels = createResourceSetForModels(exceptions, generation);
monitor.worked(1);
// create generated file
try (DocumentTemplate documentTemplate = M2DocUtils.parse(resourceSetForModels.getURIConverter(), templateURI,
queryEnvironment, classProvider)) {
// create definitions
Map<String, Object> definitions = GenconfUtils.getVariables(generation, resourceSetForModels);
monitor.done();
// validate template
monitor.beginTask("Validating template.", 1);
final URI validationURI = validate(resourceSetForModels.getURIConverter(), generatedURI, documentTemplate,
queryEnvironment, generation);
monitor.done();
// launch generation
M2DocUtils.generate(documentTemplate, queryEnvironment, definitions, generatedURI, monitor);
List<URI> generatedFiles = new ArrayList<URI>();
generatedFiles.add(generatedURI);
if (validationURI != null) {
URI validationFile = validationURI;
generatedFiles.add(validationFile);
}
for (IConfigurationProvider provider : ConfigurationProviderService.getInstance().getProviders()) {
provider.postGenerate(generation, templateURI, generatedURI, documentTemplate);
}
return generatedFiles;
}
}
示例4: generateModel
import org.eclipse.emf.common.util.Monitor; //导入方法依赖的package包/类
@Override
protected Diagnostic generateModel(Object object, Monitor monitor)
{
GenPackage genPackage = (GenPackage)object;
monitor.beginTask("", 2);
monitor.subTask(message);
GenModel genModel = genPackage.getGenModel();
ensureProjectExists
(genModel.getModelDirectory(), genPackage, MODEL_PROJECT_TYPE, genModel.isUpdateClasspath(), createMonitor(monitor, 1));
generateJava
(genModel.getModelDirectory(),
genPackage.getInterfacePackageName() + ".proxy",
"ProxyFactory",
getJETEmitter(getJETEmitterDescriptors(), FACTORY_ID),
null,
createMonitor(monitor, 1));
return Diagnostic.OK_INSTANCE;
}