Skip to content

Package: MultiAttributeSWTRendererCellEditorTester

MultiAttributeSWTRendererCellEditorTester

Coverage

1: /*******************************************************************************
2: * Copyright (c) 2011-2015 EclipseSource Muenchen GmbH and others.
3: *
4: * All rights reserved. This program and the accompanying materials
5: * are made available under the terms of the Eclipse Public License 2.0
6: * which accompanies this distribution, and is available at
7: * https://www.eclipse.org/legal/epl-2.0/
8: *
9: * SPDX-License-Identifier: EPL-2.0
10: *
11: * Contributors:
12: * Johannes Faltermeier - initial API and implementation
13: ******************************************************************************/
14: package org.eclipse.emfforms.spi.view.control.multiattribute.celleditor;
15:
16: import org.eclipse.emf.ecore.EAttribute;
17: import org.eclipse.emf.ecore.EObject;
18: import org.eclipse.emf.ecp.view.spi.context.ViewModelContext;
19:
20: /**
21: * This interface defines a {@link #isApplicable(EObject, EAttribute, ViewModelContext)} method which is used to
22: * determine the priority of a celleditor. The celleditor with the highest priority for a combination of an
23: * {@link EObject} and a feature will be used.
24: *
25: * @author Johannes Faltermeier
26: */
27: public interface MultiAttributeSWTRendererCellEditorTester {
28:
29:         /**
30:          * Return this whenever the renderer should not be used for the tested {@link ViewModelContext}.
31:          */
32:         double NOT_APPLICABLE = Double.NaN;
33:
34:         /**
35:          * Returns the priority of the corresponding celleditor for the combination of the {@link EObject} and the
36:          * multi-valued {@link EAttribute}.
37:          *
38:          * @param multiAttribute the {@link EAttribute} to test
39:          * @param eObject the {@link EObject} to test
40:          * @param viewModelContext the {@link ViewModelContext} to check
41:          * @return {@link #NOT_APPLICABLE} if the corresponding celleditor should not be used, a positive integer value
42:          * otherwise. The celleditor with the highest priority will be taken.
43:          */
44:         double isApplicable(EObject eObject, EAttribute multiAttribute, ViewModelContext viewModelContext);
45: }