/*******************************************************************************
* Copyright (c) 2012 - 2013 GoPivotal, Inc.
* All rights reserved. This program and the accompanying materials
* are 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:
* GoPivotal, Inc. - initial API and implementation
*******************************************************************************/
package org.springframework.ide.eclipse.webflow.ui.editor.faces;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.ui.forms.widgets.FormToolkit;
import org.eclipse.wst.xml.core.internal.provisional.document.IDOMElement;
import org.springframework.ide.eclipse.config.core.contentassist.providers.BeanReferenceContentProposalProvider;
import org.springframework.ide.eclipse.config.core.schemas.FacesSchemaConstants;
import org.springframework.ide.eclipse.config.ui.editors.AbstractConfigEditor;
import org.springframework.ide.eclipse.config.ui.editors.SpringConfigDetailsSectionPart;
import org.springframework.ide.eclipse.config.ui.widgets.TextAttribute;
import org.springframework.ide.eclipse.config.ui.widgets.TextAttributeProposalAdapter;
/**
* @author Leo Dos Santos
*/
@SuppressWarnings("restriction")
public class FacesDetailsSectionPart extends SpringConfigDetailsSectionPart {
public FacesDetailsSectionPart(AbstractConfigEditor editor, IDOMElement input, Composite parent, FormToolkit toolkit) {
super(editor, input, parent, toolkit);
}
@Override
protected boolean addCustomAttribute(Composite client, String attr, boolean required) {
// FacesConfigContentAssistProcessor and FacesConfigHyperLinkDetector
String elem = getInput().getLocalName();
if (FacesSchemaConstants.ELEM_FLOW_BUILDER_SERVICES.equals(elem)
&& (FacesSchemaConstants.ATTR_EXPRESSION_PARSER.equals(attr)
|| FacesSchemaConstants.ATTR_FORMATTER_REGISTRY.equals(attr)
|| FacesSchemaConstants.ATTR_VIEW_FACTORY_CREATOR.equals(attr) || FacesSchemaConstants.ATTR_CONVERSION_SERVICE
.equals(attr))) {
TextAttribute attrControl = createBeanAttribute(client, attr, required);
addWidget(attrControl);
addAdapter(new TextAttributeProposalAdapter(attrControl, new BeanReferenceContentProposalProvider(
getInput(), attr, true)));
return true;
}
return super.addCustomAttribute(client, attr, required);
}
}