/**
 * Copyright (C) 2006-2018 Talend Inc. - www.talend.com
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package org.talend.sdk.component.studio.model.parameter;

import java.util.List;

import org.talend.core.model.process.EComponentCategory;
import org.talend.core.model.process.EConnectionType;
import org.talend.core.model.process.EParameterFieldType;
import org.talend.core.model.process.IElement;
import org.talend.designer.core.model.components.ElementParameter;

/**
 * Adds schema property on Basic view in the 1st row by default
 */
public class SchemaSettingsCreator extends SettingsCreator {

    /**
     * Creates instance and adds schema property
     *
     * @param iNode Node for which parameters are created
     * @param category Parameter category
     * @param redrawParameter Parameter which defines whether UI should be redrawn
     */
    public SchemaSettingsCreator(final IElement iNode, final EComponentCategory category,
            final ElementParameter redrawParameter) {
        super(iNode, category, redrawParameter);
    }

    @Override
    public List<ElementParameter> getSettings() {
        boolean hasSchema = false;

        for (TaCoKitElementParameter param : settings.values()) {
            if (param.getFieldType() == EParameterFieldType.SCHEMA_TYPE) {
                hasSchema = true;
                break;
            }
        }
        if (!hasSchema) {
            addSchemaProperty();
        }

        return super.getSettings();
    }

    /**
     * FIXME
     */
    private void addSchemaProperty() {
        addSetting(createSchemaParameter(EConnectionType.FLOW_MAIN.getName(), "SCHEMA"));
    }

}

@@ -673,32 +673,8 @@
 r;%0A%0A
-import java.util.List;%0A%0A
 impo
@@ -730,120 +730,8 @@
 ry;%0A
-import org.talend.core.model.process.EConnectionType;%0Aimport org.talend.core.model.process.EParameterFieldType;%0A
 impo
@@ -1427,613 +1427,12 @@
 r);%0A
+
     %7D%0A
-%0A    @Override%0A    public List%3CElementParameter%3E getSettings() %7B%0A        boolean hasSchema = false;%0A%0A        for (TaCoKitElementParameter param : settings.values()) %7B%0A            if (param.getFieldType() == EParameterFieldType.SCHEMA_TYPE) %7B%0A                hasSchema = true;%0A                break;%0A            %7D%0A        %7D%0A        if (!hasSchema) %7B%0A            addSchemaProperty();%0A        %7D%0A%0A        return super.getSettings();%0A    %7D%0A%0A    /**%0A     * FIXME%0A     */%0A    private void addSchemaProperty() %7B%0A        addSetting(createSchemaParameter(EConnectionType.FLOW_MAIN.getName(), %22SCHEMA%22));%0A    %7D%0A%0A
 %7D%0A

fix add schema widget