Search in sources :

Example 11 with FunctionParameterDefinition

use of eu.esdihumboldt.hale.common.align.extension.function.FunctionParameterDefinition in project hale by halestudio.

the class ParameterEditorFactoryImpl method getAssociatedParameter.

/**
 * @see ParameterEditorFactory#getAssociatedParameter()
 */
@Override
public FunctionParameterDefinition getAssociatedParameter() {
    if (associatedFunctionParameter == null) {
        // get defined parameters
        Collection<FunctionParameterDefinition> definedParameters = FunctionUtil.getFunction(getFunctionId(), HaleUI.getServiceProvider()).getDefinedParameters();
        // search for defined parameter, add it to associated params
        // XXX throw some exception if param name is not defined?
        String name = getParameterName();
        for (FunctionParameterDefinition definedParameter : definedParameters) {
            if (definedParameter.getName().equals(name)) {
                associatedFunctionParameter = definedParameter;
                break;
            }
        }
    }
    return associatedFunctionParameter;
}
Also used : FunctionParameterDefinition(eu.esdihumboldt.hale.common.align.extension.function.FunctionParameterDefinition)

Example 12 with FunctionParameterDefinition

use of eu.esdihumboldt.hale.common.align.extension.function.FunctionParameterDefinition in project hale by halestudio.

the class ParameterPageFactoryImpl method getAssociatedParameters.

/**
 * @see eu.esdihumboldt.hale.ui.function.extension.ParameterPageFactory#getAssociatedParameters()
 */
@Override
public Set<FunctionParameterDefinition> getAssociatedParameters() {
    if (associatedFunctionParameters == null) {
        Set<FunctionParameterDefinition> params = new HashSet<FunctionParameterDefinition>();
        // get defined parameters
        Collection<FunctionParameterDefinition> definedParameters = FunctionUtil.getFunction(getFunctionId(), HaleUI.getServiceProvider()).getDefinedParameters();
        // walk over conf parameters
        IConfigurationElement[] parameterElements = conf.getChildren("parameter");
        for (IConfigurationElement parameterElement : parameterElements) {
            // search for defined parameter, add it to associated params
            // XXX throw some exception if param name is not defined?
            String name = parameterElement.getAttribute("name");
            for (FunctionParameterDefinition definedParameter : definedParameters) if (definedParameter.getName().equals(name)) {
                params.add(definedParameter);
                break;
            }
        }
        associatedFunctionParameters = Collections.unmodifiableSet(params);
    }
    return associatedFunctionParameters;
}
Also used : FunctionParameterDefinition(eu.esdihumboldt.hale.common.align.extension.function.FunctionParameterDefinition) IConfigurationElement(org.eclipse.core.runtime.IConfigurationElement) HashSet(java.util.HashSet)

Aggregations

FunctionParameterDefinition (eu.esdihumboldt.hale.common.align.extension.function.FunctionParameterDefinition)12 ParameterValue (eu.esdihumboldt.hale.common.align.model.ParameterValue)3 HashSet (java.util.HashSet)2 GridData (org.eclipse.swt.layout.GridData)2 Group (org.eclipse.swt.widgets.Group)2 Label (org.eclipse.swt.widgets.Label)2 Category (eu.esdihumboldt.hale.common.align.extension.category.Category)1 FunctionDefinition (eu.esdihumboldt.hale.common.align.extension.function.FunctionDefinition)1 PropertyFunctionDefinition (eu.esdihumboldt.hale.common.align.extension.function.PropertyFunctionDefinition)1 Cell (eu.esdihumboldt.hale.common.align.model.Cell)1 Value (eu.esdihumboldt.hale.common.core.io.Value)1 ParameterValueDescriptor (eu.esdihumboldt.hale.common.core.parameter.ParameterValueDescriptor)1 PropertyDefinition (eu.esdihumboldt.hale.common.schema.model.PropertyDefinition)1 TypeDefinition (eu.esdihumboldt.hale.common.schema.model.TypeDefinition)1 AttributeEditorFactory (eu.esdihumboldt.hale.ui.common.definition.AttributeEditorFactory)1 DefinitionLabelFactory (eu.esdihumboldt.hale.ui.common.definition.DefinitionLabelFactory)1 ParameterPageFactory (eu.esdihumboldt.hale.ui.function.extension.ParameterPageFactory)1 GenericParameterPage (eu.esdihumboldt.hale.ui.function.generic.pages.GenericParameterPage)1 ParameterPage (eu.esdihumboldt.hale.ui.function.generic.pages.ParameterPage)1 Pair (eu.esdihumboldt.util.Pair)1