org.eclipse.xtext.util.PolymorphicDispatcher.ErrorHandler Java Examples
The following examples show how to use
org.eclipse.xtext.util.PolymorphicDispatcher.ErrorHandler.
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: AbstractJavaBasedContentProposalProvider.java From xtext-eclipse with Eclipse Public License 2.0 | 6 votes |
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 (announceProcessing(Lists.asList(methodName, paramAsArray))) { dispatcher.invoke(paramAsArray); } }
Example #2
Source File: XbaseDeclarativeHoverSignatureProvider.java From xtext-eclipse with Eclipse Public License 2.0 | 6 votes |
protected String internalGetSignature(EObject object, boolean typeAtEnd) { PolymorphicDispatcher<String> polymorphicDispatcher = new PolymorphicDispatcher<String>("_signature", 2, 2, Collections.singletonList(this), new ErrorHandler<String>() { @Override public String handle(Object[] params, Throwable throwable) { return null; } }); String result = polymorphicDispatcher.invoke(object, typeAtEnd); if (result != null) return result; if (object instanceof JvmIdentifiableElement) { return getLabel(object); } return getLabelForNonXbaseElement(object); }
Example #3
Source File: SARLLabelProvider.java From sarl with Apache License 2.0 | 5 votes |
/** Constructor. * @param delegate the original provider. */ @Inject public SARLLabelProvider(AdapterFactoryLabelProvider delegate) { super(delegate); this.imageDescriptorDispatcher = new PolymorphicDispatcher<>( "imageDescriptor", //$NON-NLS-1$ 1, 1, Collections.singletonList(this), new ErrorHandler<ImageDescriptor>() { @Override public ImageDescriptor handle(Object[] params, Throwable exception) { return handleImageDescriptorError(params, exception); } }); }