| /******************************************************************************* |
| * Copyright (c) 2011-2016 EclipseSource Muenchen GmbH and others. |
| * |
| * All rights reserved. This program and the accompanying materials |
| * are made available under the terms of the Eclipse Public License 2.0 |
| * which accompanies this distribution, and is available at |
| * https://www.eclipse.org/legal/epl-2.0/ |
| * |
| * SPDX-License-Identifier: EPL-2.0 |
| * |
| * Contributors: |
| * Lucas Koehler- initial API and implementation |
| ******************************************************************************/ |
| package org.eclipse.emf.ecp.view.internal.stack.ui.swt; |
| |
| import org.eclipse.emf.ecp.view.spi.context.ViewModelContext; |
| import org.eclipse.emf.ecp.view.spi.model.VElement; |
| import org.eclipse.emf.ecp.view.spi.stack.model.VStackLayout; |
| import org.eclipse.emf.ecp.view.spi.stack.ui.swt.SWTStackLayoutRenderer; |
| import org.eclipse.emfforms.spi.swt.core.AbstractSWTRenderer; |
| import org.eclipse.emfforms.spi.swt.core.di.EMFFormsDIRendererService; |
| import org.osgi.service.component.annotations.Component; |
| |
| /** |
| * {@link EMFFormsDIRendererService DI renderer service} for {@link SWTStackLayoutRenderer}. |
| * |
| * @author Lucas Koehler |
| * |
| */ |
| @Component(name = "SWTStackLayoutRendererService") |
| public class SWTStackLayoutRendererService implements EMFFormsDIRendererService<VStackLayout> { |
| |
| /** |
| * {@inheritDoc} |
| * |
| * @see org.eclipse.emfforms.spi.swt.core.di.EMFFormsDIRendererService#isApplicable(org.eclipse.emf.ecp.view.spi.model.VElement, |
| * org.eclipse.emf.ecp.view.spi.context.ViewModelContext) |
| */ |
| @Override |
| public double isApplicable(VElement vElement, ViewModelContext viewModelContext) { |
| if (VStackLayout.class.isInstance(vElement)) { |
| return 1d; |
| } |
| return NOT_APPLICABLE; |
| } |
| |
| /** |
| * {@inheritDoc} |
| * |
| * @see org.eclipse.emfforms.spi.swt.core.di.EMFFormsDIRendererService#getRendererClass() |
| */ |
| @Override |
| public Class<? extends AbstractSWTRenderer<VStackLayout>> getRendererClass() { |
| return SWTStackLayoutRenderer.class; |
| } |
| |
| } |