blob: a43245f7dc1fb402de73ae566fdcdc40d55108ba [file] [log] [blame]
/*******************************************************************************
* Copyright (c) 2011-2015 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:
* Johannes Faltermeier - initial API and implementation
******************************************************************************/
package org.eclipse.emfforms.internal.view.control.multiattribute.celleditor;
import java.util.Date;
import org.eclipse.emf.ecore.EAttribute;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecp.view.spi.context.ViewModelContext;
import org.eclipse.emfforms.spi.view.control.multiattribute.celleditor.MultiAttributeSWTRendererCellEditorTester;
/**
* {@link MultiAttributeSWTRendererCellEditorTester Tester} for DateCellEditor.
*
* @author Johannes Faltermeier
*
*/
public class DateCellEditorTester implements MultiAttributeSWTRendererCellEditorTester {
@Override
public double isApplicable(EObject eObject, EAttribute multiAttribute,
ViewModelContext viewModelContext) {
final Class<?> instanceClass = multiAttribute.getEAttributeType().getInstanceClass();
if (instanceClass == null) {
return NOT_APPLICABLE;
}
if (!Date.class.isAssignableFrom(instanceClass)) {
return NOT_APPLICABLE;
}
return 1d;
}
}