org.eclipse.emf.ecore.util.Switch Java Examples

The following examples show how to use org.eclipse.emf.ecore.util.Switch. 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: ExtendedEarlyExitComputer.java    From xtext-extras with Eclipse Public License 2.0 5 votes vote down vote up
@Override
public IThrownExceptionDelegate catchExceptions(List<LightweightTypeReference> caughtExceptions) {
	if (caughtExceptions.isEmpty()) {
		return this;
	}
	FilteringThrownExceptionDelegate delegate = new FilteringThrownExceptionDelegate(this, caughtExceptions);
	Switch<Boolean> collector = createThrownExceptionCollector(delegate);
	delegate.collectWith(collector);
	return delegate;
}
 
Example #2
Source File: ExtendedEarlyExitComputer.java    From xtext-extras with Eclipse Public License 2.0 5 votes vote down vote up
public List<LightweightTypeReference> getThrownExceptions(XExpression obj, IResolvedTypes types, ITypeReferenceOwner owner) {
	if (obj == null) {
		return Collections.emptyList();
	}
	final List<LightweightTypeReference> result = Lists.newArrayListWithExpectedSize(2);
	ThrownExceptionDelegate delegate = createDelegate(result, types, owner);
	Switch<Boolean> collector = createThrownExceptionCollector(delegate);
	delegate.collectWith(collector);
	delegate.collectThrownExceptions(obj);
	return result;
}
 
Example #3
Source File: ExtendedEarlyExitComputer.java    From xtext-extras with Eclipse Public License 2.0 4 votes vote down vote up
public void collectWith(Switch<Boolean> collector) {
	this.collector = collector;
}
 
Example #4
Source File: ExtendedEarlyExitComputer.java    From xtext-extras with Eclipse Public License 2.0 4 votes vote down vote up
protected Switch<Boolean> createThrownExceptionCollector(IThrownExceptionDelegate delegate) {
	return new ThrownExceptionSwitch(delegate);
}
 
Example #5
Source File: GrammarCallHierarchyHelperTest.java    From xtext-eclipse with Eclipse Public License 2.0 4 votes vote down vote up
private Switch<Boolean> newHelper() {
	AbstractElement previous = grammarAccess.getChild1_1Access().getEndKeyword_5();
	AbstractElement next = grammarAccess.getChild1_3Access().getNameIDTerminalRuleCall_0_0();
	Switch<Boolean> helper = createHelper(previous, "end", next);
	return helper;
}
 
Example #6
Source File: GrammarCallHierarchyHelperTest.java    From xtext-eclipse with Eclipse Public License 2.0 4 votes vote down vote up
protected Switch<Boolean> createHelper(AbstractElement previous, String previousText, AbstractElement next) {
	return new ParserBasedContentAssistContextFactory.CallHierarchyHelper(next, previousText, previous);
}
 
Example #7
Source File: IDEGrammarCallHierarchyHelperTest.java    From xtext-eclipse with Eclipse Public License 2.0 4 votes vote down vote up
@Override
protected Switch<Boolean> createHelper(AbstractElement previous, String previousText, AbstractElement next) {
	return new CallHierarchyHelper(next, previousText, previous);
}