org.eclipse.emf.mwe.core.monitor.ProgressMonitor Java Examples

The following examples show how to use org.eclipse.emf.mwe.core.monitor.ProgressMonitor. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: Reader.java    From xtext-core with Eclipse Public License 2.0 6 votes vote down vote up
@Override
protected void invokeInternal(WorkflowContext ctx, ProgressMonitor monitor, Issues issues) {
	ResourceSet resourceSet = getResourceSet();
	Multimap<String, URI> uris = getPathTraverser().resolvePathes(pathes, new Predicate<URI>() {
		@Override
		public boolean apply(URI input) {
			boolean result = true;
			if (getUriFilter() != null)
				result = getUriFilter().matches(input);
			if (result)
				result = getRegistry().getResourceServiceProvider(input) != null;
			return result;
		}
	});
	IAllContainersState containersState = containersStateFactory.getContainersState(pathes, uris);
	installAsAdapter(resourceSet, containersState);
	populateResourceSet(resourceSet, uris);
	getValidator().validate(resourceSet, getRegistry(), issues);
	addModelElementsToContext(ctx, resourceSet);
}
 
Example #2
Source File: XcoreReader.java    From n4js with Eclipse Public License 1.0 5 votes vote down vote up
@Override
protected void invokeInternal(WorkflowContext ctx, ProgressMonitor monitor,
		Issues issues) {
	ResourceSet resourceSet = getResourceSet();

	// due to some Xcore peculiarity we have to access the IAllContainerState here
	// to trigger some lazy init logic
	IAllContainersState allContainerState = (IAllContainersState) EcoreUtil.getAdapter(resourceSet.eAdapters(),
			IAllContainersState.class);
	allContainerState.isEmpty("");

	Multimap<String, URI> uris = getPathTraverser().resolvePathes(pathes,
			new Predicate<URI>() {
		@Override
		public boolean apply(URI input) {
			return input.fileExtension().equals(XCORE_FILE_EXT);
		}
	});
	List<Resource> resources = new ArrayList<>();
	for (URI uri : uris.values()) {
		LOGGER.info(uri);
		try {
			resources.add(parse(uri, resourceSet));
		} catch (Exception e) {
			LOGGER.error("Problem during loading of resource @ " + uri, e);
		}
	}
	installIndex(resourceSet);
	for (Resource r : resources) {
		EcoreUtil.resolveAll(r);
		for (Diagnostic x : r.getErrors()) {
			issues.addError(x.getMessage(), x);
		}

	}
	ctx.set(slot, resources);
}
 
Example #3
Source File: Ecore2XtextGenerator.java    From xtext-eclipse with Eclipse Public License 2.0 5 votes vote down vote up
@Override
protected void invokeInternal(final WorkflowContext ctx, ProgressMonitor monitor, final Issues issues) {
	createXtextProjectInfo(issues);
	CharSequence grammar = xtextProjectInfo.getRuntimeProject().grammar();
	try {
		Files.asCharSink(new File(genPath, xtextProjectInfo.getRuntimeProject().getGrammarFilePath()), Charsets.ISO_8859_1).write(grammar);
	} catch (IOException e) {
		String message = "Can't create grammar file";
		log.error(message, e);
		issues.addError(Ecore2XtextGenerator.this, message, this, e, null);
	}
}
 
Example #4
Source File: UriBasedReader.java    From xtext-core with Eclipse Public License 2.0 5 votes vote down vote up
@Override
protected void invokeInternal(WorkflowContext ctx, ProgressMonitor monitor, Issues issues) {
	ResourceSet resourceSet = getResourceSet();
	for (URI uri : uris2) {
		Resource resource = resourceSet.getResource(uri, true);
		int numberResources;
		do {
			numberResources = resourceSet.getResources().size();
			EcoreUtil.resolveAll(resource);
		} while (numberResources!=resourceSet.getResources().size());
	}
	getValidator().validate(resourceSet, getRegistry(), issues);
	addModelElementsToContext(ctx, resourceSet);
}
 
Example #5
Source File: LazyStandaloneSetup.java    From openhab-core with Eclipse Public License 2.0 5 votes vote down vote up
@Override
protected void invokeInternal(WorkflowContext ctx, ProgressMonitor monitor, Issues issues) {
    for (String generatedEPackage : allgeneratedEPackages) {
        addRegisterGeneratedEPackage(generatedEPackage);
    }
    for (String genModelFile : allGenModelFiles) {
        addRegisterGenModelFile(genModelFile);
    }
    for (String ecoreFile : allEcoreFiles) {
        addRegisterEcoreFile(ecoreFile);
    }
}
 
Example #6
Source File: LazyStandaloneSetup.java    From smarthome with Eclipse Public License 2.0 5 votes vote down vote up
@Override
protected void invokeInternal(WorkflowContext ctx, ProgressMonitor monitor, Issues issues) {
    for (String generatedEPackage : allgeneratedEPackages) {
        addRegisterGeneratedEPackage(generatedEPackage);
    }
    for (String genModelFile : allGenModelFiles) {
        addRegisterGenModelFile(genModelFile);
    }
    for (String ecoreFile : allEcoreFiles) {
        addRegisterEcoreFile(ecoreFile);
    }
}
 
Example #7
Source File: AbstractReaderTest.java    From xtext-core with Eclipse Public License 2.0 4 votes vote down vote up
protected ProgressMonitor monitor() {
	return new NullProgressMonitor();
}
 
Example #8
Source File: LazyGenerator.java    From openhab-core with Eclipse Public License 2.0 4 votes vote down vote up
@Override
protected void invokeInternal(WorkflowContext ctx, ProgressMonitor monitor, Issues issues) {
    super.checkConfigurationInternal(issues);
    super.invokeInternal(ctx, monitor, issues);
}
 
Example #9
Source File: LazyGenerator.java    From smarthome with Eclipse Public License 2.0 4 votes vote down vote up
@Override
protected void invokeInternal(WorkflowContext ctx, ProgressMonitor monitor, Issues issues) {
    super.checkConfigurationInternal(issues);
    super.invokeInternal(ctx, monitor, issues);
}