Java Code Examples for org.eclipse.emf.mwe.core.issues.Issues#addWarning()

The following examples show how to use org.eclipse.emf.mwe.core.issues.Issues#addWarning() . 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: GeneratorFragment.java    From xtext-extras with Eclipse Public License 2.0 5 votes vote down vote up
@Override
public void checkConfiguration(Issues issues) {
	super.checkConfiguration(issues);
	if(generateJavaMain && generateXtendMain) {
		issues.addWarning("Options 'generateJavaMain' and 'generateXtendMain' are mutually exclusive. Generating Xtend only.");
		generateJavaMain = false;
	}
}
 
Example 2
Source File: Junit4Fragment.java    From xtext-extras with Eclipse Public License 2.0 5 votes vote down vote up
@Override
public void checkConfiguration(Issues issues) {
	super.checkConfiguration(issues);
	if (getNaming().getPathTestProject()==null) {
		issues.addWarning("Missing test project path configuration 'Generator#pathTestProject' required for fragment '"+getClass().getName()+"'.");
	}
}
 
Example 3
Source File: DelegatingGeneratorFragment.java    From xtext-extras with Eclipse Public License 2.0 5 votes vote down vote up
@Override
public void checkConfiguration(Issues issues) {
	if (delegate == null && message != null) {
		issues.addWarning("---- ATTENTION----\n\t" + "\n\n\t" + message);
	}
	if (fallback instanceof NamingAware)
		((NamingAware) fallback).registerNaming(getNaming());
	if (delegate instanceof NamingAware)
		((NamingAware) delegate).registerNaming(getNaming());
	if (delegate != null)
		delegate.checkConfiguration(issues);
	else
		fallback.checkConfiguration(issues);
}
 
Example 4
Source File: Generator.java    From xtext-extras with Eclipse Public License 2.0 5 votes vote down vote up
private boolean handleWarnings(Issues issues, CompositeGeneratorException e) {
	for (Exception ex : e.getExceptions()) {
		if (ex instanceof CompositeGeneratorException) {
			if (!handleWarnings(issues, (CompositeGeneratorException) ex)) {
				return false;
			}
		} else if (ex instanceof GeneratorWarning) {
			issues.addWarning(this, "Warning: " + ex.getMessage(), null, null, null);
		} else {
			return false;
		}
	}
	return true;
}
 
Example 5
Source File: BasicUiGeneratorFragment.java    From xtext-extras with Eclipse Public License 2.0 5 votes vote down vote up
@Override
public void checkConfiguration(Issues issues) {
	issues.addWarning("Fragment org.eclipse.xtext.ui.generator.BasicUiGeneratorFragment is deprecated and not needed anymore. Just remove it from the mwe configuration.");
	if (fileExtensions!=null)
		issues.addError("the fileExtensions property has been moved to the main language configuration. \n\tPlease change your *.mwe file to something like \n\n\t"
					+ "<language uri='${grammarURI}' fileExtensions='" + fileExtensions + "'> \n\t\t <-- fragments go here ... --> \n\t</languageConfig>\n\n",this);
}
 
Example 6
Source File: Validator.java    From xtext-core with Eclipse Public License 2.0 5 votes vote down vote up
public void validate(ResourceSet resourceSet, IResourceServiceProvider.Registry registry, Issues issues) {
	List<Resource> resources = Lists.newArrayList(resourceSet.getResources());
	for (Resource resource : resources) {
		try {
			resource.load(null);
			IResourceServiceProvider provider = registry.getResourceServiceProvider(resource.getURI());
			if (provider != null) {
				List<Issue> result = provider.getResourceValidator().validate(resource, CheckMode.ALL, null);
				for (Issue issue : result) {
					switch (issue.getSeverity()) {
						case ERROR:
							issues.addError(issue.getMessage(), issue);
							break;
						case WARNING:
							issues.addWarning(issue.getMessage(), issue);
							break;
						case INFO:
							issues.addInfo(issue.getMessage(), issue);
							break;
						case IGNORE:
							break;
					}
				}
			}
		} catch (IOException e) {
			throw new WorkflowInterruptedException("Couldn't load resource (" + resource.getURI() + ")", e);
		}
	}
	if (isStopOnError() && issues.hasErrors()) {
		String errorMessage = toString(issues);
		throw new WorkflowInterruptedException("Validation problems: \n" + errorMessage);
	}
}
 
Example 7
Source File: Reader.java    From xtext-core with Eclipse Public License 2.0 5 votes vote down vote up
@Override
protected void checkConfigurationInternal(Issues issues) {
	super.checkConfigurationInternal(issues);
	if (pathes.isEmpty()) {
		issues.addWarning("No path set, using java class path entries (useJavaClassPath='true').");
		setUseJavaClassPath(true);
	}
	if (log.isDebugEnabled()) {
		log.debug("Resource Pathes : " + pathes);
	}
	for (String path : pathes) {
		if (!new File(path).exists())
			issues.addWarning("Skipping the path '" + path + "', because it does not exist.");
	}
}
 
Example 8
Source File: ValidatorTest.java    From xtext-core with Eclipse Public License 2.0 5 votes vote down vote up
/**
 * https://bugs.eclipse.org/bugs/show_bug.cgi?id=322645
 */
@Test public void testBugFix322645() throws Exception {
	Issues issues = issues();
	Issue a = new Issue.IssueImpl();
	Issue b = new Issue.IssueImpl();
	issues.addError("foo", a);
	issues.addWarning(null, a);
	issues.addError(null, b);
	MWEDiagnostic[] errors = issues.getErrors();
	assertEquals(2, errors.length);
	final Validator validator = new Validator();
	final String string = validator.toString(issues);
	assert(string.contains("foo"));
}