Search in sources :

Example 1 with ControllerRepositoryValueHander

use of org.talend.designer.core.ui.editor.properties.controllers.ControllerRepositoryValueHander in project tdi-studio-se by Talend.

the class DynamicPropertyGenerator method initController.

/**
     * DOC yzhang Comment method "initController".
     */
public void initController(IDynamicProperty dp) {
    if (!initialized) {
        for (IConfigurationElement element : extensionElements) {
            try {
                //$NON-NLS-1$
                String controllerName = element.getAttribute("mapping");
                EParameterFieldType key = EParameterFieldType.getFieldTypeByName(controllerName);
                if (!dtpControls.containsKey(key)) {
                    if (!controllerName.equals(key.toString())) {
                        throw new RuntimeException(//$NON-NLS-1$
                        "Mapping attribute " + controllerName + //$NON-NLS-1$
                        " not included in eumn EParameterFieldType");
                    }
                    //$NON-NLS-1$
                    IControllerGenerator generator = (IControllerGenerator) element.createExecutableExtension("class");
                    generator.setDynamicProperty(dp);
                    AbstractElementPropertySectionController controller = generator.generate();
                    dtpControls.put(key, controller);
                    if (controller instanceof AbstractRepositoryController) {
                        ControllerRepositoryValueHander repositoryValueHander = ((AbstractRepositoryController) controller).getRepositoryValueHander();
                        ControllerRepositoryValueHander.getRepositoryValueHandlerMap().put(key, repositoryValueHander);
                    }
                }
            } catch (CoreException e) {
                ExceptionHandler.process(e);
            }
        }
        initialized = true;
    }
}
Also used : EParameterFieldType(org.talend.core.model.process.EParameterFieldType) CoreException(org.eclipse.core.runtime.CoreException) IControllerGenerator(org.talend.designer.core.ui.editor.properties.controllers.generator.IControllerGenerator) AbstractElementPropertySectionController(org.talend.designer.core.ui.editor.properties.controllers.AbstractElementPropertySectionController) AbstractRepositoryController(org.talend.designer.core.ui.editor.properties.controllers.AbstractRepositoryController) ControllerRepositoryValueHander(org.talend.designer.core.ui.editor.properties.controllers.ControllerRepositoryValueHander) IConfigurationElement(org.eclipse.core.runtime.IConfigurationElement)

Aggregations

CoreException (org.eclipse.core.runtime.CoreException)1 IConfigurationElement (org.eclipse.core.runtime.IConfigurationElement)1 EParameterFieldType (org.talend.core.model.process.EParameterFieldType)1 AbstractElementPropertySectionController (org.talend.designer.core.ui.editor.properties.controllers.AbstractElementPropertySectionController)1 AbstractRepositoryController (org.talend.designer.core.ui.editor.properties.controllers.AbstractRepositoryController)1 ControllerRepositoryValueHander (org.talend.designer.core.ui.editor.properties.controllers.ControllerRepositoryValueHander)1 IControllerGenerator (org.talend.designer.core.ui.editor.properties.controllers.generator.IControllerGenerator)1