本文整理汇总了Java中org.eclipse.xtext.diagnostics.Severity.INFO属性的典型用法代码示例。如果您正苦于以下问题:Java Severity.INFO属性的具体用法?Java Severity.INFO怎么用?Java Severity.INFO使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类org.eclipse.xtext.diagnostics.Severity
的用法示例。
在下文中一共展示了Severity.INFO属性的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: quickFixList
/**
* Example: {@code // XPECT quickFixList at 'a.<|>method' --> 'import A','do other things' }
*
* @param expectation
* comma separated strings, which are proposed as quick fix
* @param resource
* injected xtext-file
* @param offset
* cursor position at '<|>'
* @param checkType
* 'display': verify list of provided proposals comparing their user-displayed strings.
* @param selected
* which proposal to pick
* @param mode
* modus of operation
* @param offset2issue
* mapping of offset(!) to issues.
* @throws Exception
* if failing
*/
@Xpect
@ParameterParser(syntax = "('at' (arg2=STRING (arg3=ID (arg4=STRING)? (arg5=ID)? )? )? )?")
@ConsumedIssues({ Severity.INFO, Severity.ERROR, Severity.WARNING })
public void quickFixList(
@CommaSeparatedValuesExpectation(quoted = true, ordered = true) ICommaSeparatedValuesExpectation expectation, // arg0
@ThisResource XtextResource resource, // arg1
RegionWithCursor offset, // arg2
String checkType, // arg3
String selected, // arg4
String mode, // arg5
@IssuesByLine Multimap<Integer, Issue> offset2issue) throws Exception {
List<IssueResolution> resolutions = collectAllResolutions(resource, offset, offset2issue);
List<String> resolutionNames = Lists.newArrayList();
for (IssueResolution resolution : resolutions) {
resolutionNames.add(resolution.getLabel());
}
expectation.assertEquals(resolutionNames);
}
示例2: calculateSeverity
private Severity calculateSeverity(String severety) {
switch (severety) {
case "warning" :
return Severity.WARNING;
case "error" :
return Severity.ERROR;
default :
return Severity.INFO;
}
}
示例3: stringToSeverity
public Severity stringToSeverity(String severityAsString) {
if (severityAsString == null)
throw new IllegalArgumentException("Severity as string was null");
if (severityAsString.equals(SEVERITY_ERROR)) {
return Severity.ERROR;
}
if (severityAsString.equals(SEVERITY_WARNING)) {
return Severity.WARNING;
}
if (severityAsString.equals(SEVERITY_INFO)) {
return Severity.INFO;
}
if (severityAsString.equals(SEVERITY_IGNORE)) {
return Severity.IGNORE;
}
throw new IllegalArgumentException("Unknown severity '"+severityAsString+"'.");
}
示例4: getSeverity
/**
* @since 2.4
*/
protected Severity getSeverity(org.eclipse.emf.common.util.Diagnostic diagnostic) {
if (diagnostic.getSeverity() == org.eclipse.emf.common.util.Diagnostic.OK)
return null;
switch (diagnostic.getSeverity()) {
case org.eclipse.emf.common.util.Diagnostic.WARNING:
return Severity.WARNING;
case org.eclipse.emf.common.util.Diagnostic.INFO:
return Severity.INFO;
default :
return Severity.ERROR;
}
}
示例5: organizeImports
/**
* Give the result as a multiline diff. If cancellation due to multiple possible resolution is expected, provide the
* expected Exception with 'XPECT organizeImports ambiguous "Exception-Message" -->'.
*
* If the parameter is not provided, always the first computed solution in the list will be taken
*
* @param ambiguous
* - String Expectation in {@link BreakException}
*/
@ParameterParser(syntax = "('ambiguous' arg0=STRING)?")
@Xpect
@ConsumedIssues({ Severity.INFO, Severity.ERROR, Severity.WARNING })
public void organizeImports(
String ambiguous, // arg0
@StringDiffExpectation(whitespaceSensitive = false, allowSingleSegmentDiff = false, allowSingleLineDiff = false) IStringDiffExpectation expectation,
@ThisResource XtextResource resource) throws Exception {
logger.info("organize imports ...");
boolean bAmbiguityCheck = ambiguous != null && ambiguous.trim().length() > 0;
Interaction iaMode = bAmbiguityCheck ? Interaction.breakBuild : Interaction.takeFirst;
try {
if (expectation == null /* || expectation.isEmpty() */) {
// TODO throw exception if empty.
// Hey, I want to ask the expectation if it's empty.
// Cannot access the region which could be asked for it's length.
throw new AssertionFailedError(
"The test is missing a diff: // XPECT organizeImports --> [old string replaced|new string expected] ");
}
// capture text for comparison:
String beforeApplication = resource.getParseResult().getRootNode().getText();
N4ContentAssistProcessorTestBuilder fixture = n4ContentAssistProcessorTestBuilderHelper
.createTestBuilderForResource(resource);
IXtextDocument xtextDoc = fixture.getDocument(resource, beforeApplication);
// in case of cross-file hyperlinks, we have to make sure the target resources are fully resolved
final ResourceSet resSet = resource.getResourceSet();
for (Resource currRes : new ArrayList<>(resSet.getResources())) {
N4JSResource.postProcess(currRes);
}
// Calling organize imports
Display.getDefault().syncExec(
() -> imortsOrganizer.unsafeOrganizeDocument(xtextDoc, iaMode));
if (bAmbiguityCheck) {
// should fail if here
assertEquals("Expected ambiguous resolution to break the organize import command.", ambiguous, "");
}
// checking that no errors are left.
String textAfterApplication = xtextDoc.get();
// compare with expectation, it's a multiline-diff expectation.
String before = XpectCommentRemovalUtil.removeAllXpectComments(beforeApplication);
String after = XpectCommentRemovalUtil.removeAllXpectComments(textAfterApplication);
expectation.assertDiffEquals(before, after);
} catch (Exception exc) {
if (exc instanceof RuntimeException && exc.getCause() instanceof BreakException) {
String breakMessage = exc.getCause().getMessage();
assertEquals(ambiguous, breakMessage);
} else {
throw exc;
}
}
}
示例6: quickFix
/**
* Choose quick fix and apply
*
* @param expectation
* from right hand side - expected changes to code, especially cursor position.
* @param resource
* injected resource under test
* @param offset
* parsed arg2 offset cursor position
* @param selected
* parsed arg3 - chosen quick fix to apply
* @param mode
* parsed arg4 if 'fileValid' additional validation check after application
*
* @param specifiedResourcePath
* Specifies the relative path of the resource in which the quickfix applies
* @throws Exception
* in test failure.
*/
@ParameterParser(syntax = "('at' (arg2=STRING ('apply' arg3=STRING)? ('resource=' arg5=STRING)? (arg4=ID)? )? )? )?")
@Xpect
@ConsumedIssues({ Severity.INFO, Severity.ERROR, Severity.WARNING })
public void quickFix(
// @StringDiffExpectation(tokenizer = LineBasedTokenizer) IStringDiffExpectation expectation, // arg0
@StringDiffExpectation(whitespaceSensitive = false) IStringDiffExpectation expectation, // arg0
@ThisResource XtextResource resource, // arg1
RegionWithCursor offset, // arg2
// String checkType, // arg3
String selected, // arg3
String mode, // arg4
String specifiedResourcePath, // arg5
@IssuesByLine Multimap<Integer, Issue> offset2issue) throws Exception {
quickFix(expectation, resource, offset, selected, mode, specifiedResourcePath, offset2issue, true);
}
示例7: quickFixAndRun
/**
* Apply quick fix, compile and run the result. Compares the generated stdout-result to the expectation on the right
* hand side.
*
* @param expectation
* - expected output of running script, just stdout no error-stream. Expecting the error-stream to be
* empty.
* @param resource
* - injected resource
* @param offset
* - parsed arg2 - cursor position
* @param selected
* - parsed arg3 - selection from list of expectations
* @param offset2issue
* - injected Map of issues
* @param init
* - injected xpect-initizalizer
* @param fileSetupContext
* - injected xpect meta-info about file under test.
* @throws Exception
* in failure case
*/
@Xpect
@ParameterParser(syntax = "('at' arg2=STRING)? ('apply' arg3=STRING )?")
@ConsumedIssues({ Severity.INFO, Severity.ERROR, Severity.WARNING })
public void quickFixAndRun(
@StringExpectation(caseSensitive = true) IStringExpectation expectation, // arg0
@ThisResource XtextResource resource, // arg1
RegionWithCursor offset, // arg2
String selected, // arg3
@IssuesByLine Multimap<Integer, Issue> offset2issue,
ISetupInitializer<Object> init,
FileSetupContext fileSetupContext) throws Exception {
try {
long timeStart = System.currentTimeMillis();
logger.info("Execution started: " + new Date(timeStart));
// System.out.println(
// "##-Qr-## we got it selected='" + selected + "' at " + offset + " in " + resource.toString() + "");
String executionResult;
ExecutionResult exRes = new ExecutionResult();
ResourceTweaker resourceTweaker = resourceToTweak -> {
try {
quickFix(null, resourceToTweak, offset, selected, "fileValid", "", offset2issue, false);
} catch (Exception e) {
Exceptions.sneakyThrow(e);
}
};
Display.getDefault().syncExec(
() -> exRes.result = compileAndExecute(resource, init, fileSetupContext, resourceTweaker));
executionResult = exRes.result;
long timeEnd = System.currentTimeMillis();
logger.info("Execution finished: " + new Date(timeEnd));
logger.info("Execution took " + (timeEnd - timeStart + 0.0) / 1000.0 + " seconds.");
expectation.assertEquals(executionResult);
// Reset resource after quick fix application and code execution
resource.reparse(getContentForResourceUri(resource.getURI()));
} finally {
logger.info("Closing all editors");
EditorsUtil.forceCloseAllEditors();
}
logger.info("Successful End of Execution");
}