/******************************************************************************* * Copyright (c) 2009 Red Hat, Inc. * Distributed under license by Red Hat, Inc. All rights reserved. * This program is made available under the terms of the * Eclipse Public License v1.0 which accompanies this distribution, * and is available at http://www.eclipse.org/legal/epl-v10.html * * Contributors: * Red Hat, Inc. - initial API and implementation ******************************************************************************/ package org.jboss.tools.smooks.configuration.editors.csv12; import org.eclipse.emf.ecore.EAttribute; import org.eclipse.emf.ecore.EObject; import org.eclipse.emf.edit.provider.IItemPropertyDescriptor; import org.eclipse.swt.widgets.Composite; import org.eclipse.ui.IEditorPart; import org.eclipse.ui.forms.widgets.FormToolkit; import org.jboss.tools.smooks.configuration.editors.AttributeFieldEditPart; import org.jboss.tools.smooks.configuration.editors.PropertyUICreator; import org.jboss.tools.smooks.configuration.editors.utils.SmooksUIUtils; import org.jboss.tools.smooks.editor.ISmooksModelProvider; import org.jboss.tools.smooks.model.csv12.Csv12Package; /** * @author Dart (dpeng@redhat.com) * <p> * Apr 8, 2009 */ public class Csv12ReaderBindingPropertyUICreator extends PropertyUICreator { /* * (non-Javadoc) * * @see * org.jboss.tools.smooks.configuration.editors.PropertyUICreator#ignoreProperty * (org.eclipse.emf.ecore.EAttribute) */ @Override public boolean ignoreProperty(EAttribute feature) { if (feature == Csv12Package.Literals.BINDING__CLASS) { return false; } return super.ignoreProperty(feature); } /* * (non-Javadoc) * * @seeorg.jboss.tools.smooks.configuration.editors.IPropertyUICreator# * createPropertyUI(org.eclipse.ui.forms.widgets.FormToolkit, * org.eclipse.swt.widgets.Composite, * org.eclipse.emf.edit.provider.IItemPropertyDescriptor, java.lang.Object, * org.eclipse.emf.ecore.EAttribute) */ public AttributeFieldEditPart createPropertyUI(FormToolkit toolkit, Composite parent, IItemPropertyDescriptor propertyDescriptor, Object model, EAttribute feature, ISmooksModelProvider formEditor, IEditorPart part) { if (feature == Csv12Package.Literals.BINDING__CLASS) { return createBeanClassTextWithButton(parent, toolkit, propertyDescriptor, model , formEditor); } return super.createPropertyUI(toolkit, parent, propertyDescriptor, model, feature, formEditor, part); } protected AttributeFieldEditPart createBeanClassTextWithButton(Composite composite, FormToolkit toolkit, final IItemPropertyDescriptor propertyDescriptor, final Object model , ISmooksModelProvider provider) { return SmooksUIUtils.createJavaTypeSearchFieldEditor(composite, toolkit, propertyDescriptor, (EObject) model , provider); } }