Search in sources :

Example 11 with Service

use of org.eclipse.e4.core.di.extensions.Service in project eclipse.platform.runtime by eclipse.

the class ServiceSupplier method get.

@Override
public Object get(IObjectDescriptor descriptor, IRequestor requestor, boolean track, boolean group) {
    Type desiredType = descriptor.getDesiredType();
    Bundle b = FrameworkUtil.getBundle(requestor.getRequestingObjectClass());
    Service qualifier = descriptor.getQualifier(Service.class);
    if (desiredType instanceof ParameterizedType) {
        ParameterizedType t = (ParameterizedType) desiredType;
        if (t.getRawType() == Collections.class || t.getRawType() == List.class) {
            return handleCollection(b, t.getActualTypeArguments()[0], requestor, track && qualifier.dynamic(), qualifier);
        }
    }
    return handleSingle(b, desiredType, requestor, descriptor, track && qualifier.dynamic(), qualifier);
}
Also used : ParameterizedType(java.lang.reflect.ParameterizedType) ParameterizedType(java.lang.reflect.ParameterizedType) Type(java.lang.reflect.Type) Bundle(org.osgi.framework.Bundle) LogService(org.osgi.service.log.LogService) Service(org.eclipse.e4.core.di.extensions.Service) ArrayList(java.util.ArrayList) List(java.util.List) Collections(java.util.Collections)

Aggregations

IEclipseContext (org.eclipse.e4.core.contexts.IEclipseContext)7 Test (org.junit.Test)5 BundleContext (org.osgi.framework.BundleContext)4 MApplication (org.eclipse.e4.ui.model.application.MApplication)3 MPlaceholder (org.eclipse.e4.ui.model.application.ui.advanced.MPlaceholder)2 MPart (org.eclipse.e4.ui.model.application.ui.basic.MPart)2 EModelService (org.eclipse.e4.ui.workbench.modeling.EModelService)2 Bundle (org.osgi.framework.Bundle)2 ParsedAnyData (alma.acs.eventbrowser.parts.ParsedAnyData)1 ParameterizedType (java.lang.reflect.ParameterizedType)1 Type (java.lang.reflect.Type)1 ArrayList (java.util.ArrayList)1 Collections (java.util.Collections)1 List (java.util.List)1 Inject (javax.inject.Inject)1 AlphavantageQuoteFeed (name.abuchen.portfolio.online.impl.AlphavantageQuoteFeed)1 CanExecute (org.eclipse.e4.core.di.annotations.CanExecute)1 Execute (org.eclipse.e4.core.di.annotations.Execute)1 Optional (org.eclipse.e4.core.di.annotations.Optional)1 Service (org.eclipse.e4.core.di.extensions.Service)1