org.eclipse.xtext.util.XtextSwitch Java Examples
The following examples show how to use
org.eclipse.xtext.util.XtextSwitch.
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: XtextRenameStrategyProvider.java From xtext-eclipse with Eclipse Public License 2.0 | 6 votes |
@Override protected IRenameStrategy createRenameStrategy(final EObject targetElement, final IRenameElementContext context) { return new XtextSwitch<IRenameStrategy>() { @Override public IRenameStrategy caseAbstractMetamodelDeclaration(AbstractMetamodelDeclaration metamodelDeclaration) { return metamodelDeclarationProvider.get(); } @Override public IRenameStrategy caseAbstractRule(AbstractRule rule) { return ruleProvider.get(); } @Override public IRenameStrategy caseGrammar(Grammar grammar) { return XtextRenameStrategyProvider.super.createRenameStrategy(targetElement, context); } }.doSwitch(targetElement); }
Example #2
Source File: XtextLinkingDiagnosticMessageProvider.java From xtext-core with Eclipse Public License 2.0 | 5 votes |
@Override public DiagnosticMessage getUnresolvedProxyMessage(final ILinkingDiagnosticContext context) { DiagnosticMessage diagnosticMessage = new XtextSwitch<DiagnosticMessage>() { @Override public DiagnosticMessage caseRuleCall(RuleCall ruleCall) { return new DiagnosticMessage(context.getLinkText()+" cannot be resolved to a rule", Severity.ERROR, UNRESOLVED_RULE, context.getLinkText()); } }.doSwitch(context.getContext()); return diagnosticMessage != null ? diagnosticMessage : super.getUnresolvedProxyMessage(context); }