当前位置: 首页>>代码示例>>Java>>正文


Java PolymorphicDispatcher.invoke方法代码示例

本文整理汇总了Java中org.eclipse.xtext.util.PolymorphicDispatcher.invoke方法的典型用法代码示例。如果您正苦于以下问题:Java PolymorphicDispatcher.invoke方法的具体用法?Java PolymorphicDispatcher.invoke怎么用?Java PolymorphicDispatcher.invoke使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.eclipse.xtext.util.PolymorphicDispatcher的用法示例。


在下文中一共展示了PolymorphicDispatcher.invoke方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: polymorphicFindScopeForReferenceName

import org.eclipse.xtext.util.PolymorphicDispatcher; //导入方法依赖的package包/类
protected IScope polymorphicFindScopeForReferenceName(EObject context, EReference reference) {
	Predicate<Method> predicate = getPredicate(context, reference);
	PolymorphicDispatcher<IScope> dispatcher = new PolymorphicDispatcher<IScope>(Collections
			.singletonList(this), predicate, errorHandler) {
		@Override
		protected IScope handleNoSuchMethod(Object... params) {
			if (PolymorphicDispatcher.NullErrorHandler.class.equals(errorHandler.getClass()))
				return null;
			return super.handleNoSuchMethod(params);
		}
	};
	EObject current = context;
	IScope scope = null;
	while (scope == null && current != null) {
		scope = dispatcher.invoke(current, reference);
		current = current.eContainer();
	}
	return scope;
}
 
开发者ID:eclipse,项目名称:xtext-core,代码行数:20,代码来源:AbstractDeclarativeScopeProvider.java

示例2: invokeMethod

import org.eclipse.xtext.util.PolymorphicDispatcher; //导入方法依赖的package包/类
protected void invokeMethod(String methodName, ICompletionProposalAcceptor acceptor, Object... params) {
	PolymorphicDispatcher<Void> dispatcher = dispatchers.get(methodName);
	if (dispatcher == null) {
		ErrorHandler<Void> errorHandler = WarningErrorHandler.get(log);
		dispatcher = new PolymorphicDispatcher<Void>(methodName, params.length + 1, params.length + 1,
				Collections.singletonList(this), errorHandler) {
			@Override
			public Class<?> getDefaultClass(int paramIndex) {
				if (paramIndex == 0)
					return EObject.class;
				return super.getDefaultClass(paramIndex);
			}
		};
		dispatchers.put(methodName, dispatcher);
	}
	Object[] paramAsArray = new Object[params.length + 1];
	System.arraycopy(params, 0, paramAsArray, 0, params.length);
	paramAsArray[params.length] = acceptor;
	if (handledArguments.add(Lists.asList(methodName, paramAsArray))) {
		dispatcher.invoke(paramAsArray);
	}
}
 
开发者ID:cplutte,项目名称:bts,代码行数:23,代码来源:AbstractJavaBasedContentProposalProvider.java

示例3: getFollowElements

import org.eclipse.xtext.util.PolymorphicDispatcher; //导入方法依赖的package包/类
@Override
protected Collection<FollowElement> getFollowElements(AbstractInternalContentAssistParser parser) {
	if (rule == null || rule.eIsProxy())
		return Collections.emptyList();
	String methodName = "entryRule" + rule.getName();
	PolymorphicDispatcher<Collection<FollowElement>> dispatcher = 
		new PolymorphicDispatcher<Collection<FollowElement>>(methodName, 0, 0, Collections.singletonList(parser));
	dispatcher.invoke();
	return parser.getFollowElements();
}
 
开发者ID:rehne93,项目名称:pokemon-tcgo-deck-generator,代码行数:11,代码来源:PartialPkmntcgoContentAssistParser.java

示例4: polymorphicFindScopeForClassName

import org.eclipse.xtext.util.PolymorphicDispatcher; //导入方法依赖的package包/类
protected IScope polymorphicFindScopeForClassName(EObject context, EReference reference) {
	IScope scope = null;
	PolymorphicDispatcher<IScope> dispatcher = new PolymorphicDispatcher<IScope>(
			Collections.singletonList(this), 
			getPredicate(context, reference.getEReferenceType()),
			errorHandler) {
		@Override
		protected IScope handleNoSuchMethod(Object... params) {
			if (PolymorphicDispatcher.NullErrorHandler.class.equals(errorHandler.getClass()))
				return null;
			return super.handleNoSuchMethod(params);
		}
	};
	EObject current = context;
	while (scope == null && current != null) {
		scope = dispatcher.invoke(current, reference);
		current = current.eContainer();
	}
	current = context;
	while (scope == null && current != null) {
		scope = dispatcher.invoke(current, reference.getEReferenceType());
		if (scope!=null)
			logger.warn("scope_<EClass>(EObject,EClass) is deprecated. Use scope_<EClass>(EObject,EReference) instead.");
		current = current.eContainer();
	}
	return scope;
}
 
开发者ID:eclipse,项目名称:xtext-core,代码行数:28,代码来源:AbstractDeclarativeScopeProvider.java

示例5: execute

import org.eclipse.xtext.util.PolymorphicDispatcher; //导入方法依赖的package包/类
public Object execute(Operation definition, Object[] parameter) {
	PolymorphicDispatcher<Object> dispatcher = new PolymorphicDispatcher<Object>(definition.getName(), definition
			.getParameters().size(), definition.getParameters().size(), callbacks);
	try {
		return dispatcher.invoke(parameter);
	} catch (Exception ex) {
		throw new WrappedException("Error during invocation of operation '" + definition.getName()
				+ "' with params " + definition.getParameters() + " '", ex);
	}
}
 
开发者ID:Yakindu,项目名称:statecharts,代码行数:11,代码来源:JavaOperationMockup.java


注:本文中的org.eclipse.xtext.util.PolymorphicDispatcher.invoke方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。