/*
 * Copyright 2014 Red Hat, Inc. and/or its affiliates.
 *
 * Licensed under the Eclipse Public License version 1.0, available at
 * http://www.eclipse.org/legal/epl-v10.html
 */
package org.jboss.forge.plugin.idea.ui.component;

import org.jboss.forge.addon.ui.input.InputComponent;

/**
 * A factory for {@link ComponentBuilder} instances.
 *
 * @author <a href="mailto:ggastald@redhat.com">George Gastaldi</a>
 */
public enum ComponentBuilderRegistry
{
    INSTANCE;

    private ComponentBuilder[] componentBuilders = {
            new CheckboxComponentBuilder(),
            new ComboComponentBuilder(),
            new RadioComponentBuilder(),
            new FileChooserComponentBuilder(),
            new DirectoryChooserComponentBuilder(),
            new JavaClassChooserComponentBuilder(),
            new JavaPackageChooserComponentBuilder(),
            new TextBoxComponentBuilder(),
            new PasswordComponentBuilder(),
            new TextAreaComponentBuilder(),
            new FallbackTextBoxComponentBuilder()};

    public ComponentBuilder getBuilderFor(InputComponent<?, ?> input)
    {
        for (ComponentBuilder builder : componentBuilders)
        {
            if (builder.handles(input))
            {
                return builder;
            }
        }
        throw new IllegalArgumentException(
                "No UI component found for input type of "
                        + input.getValueType()
        );
    }
}

@@ -637,32 +637,163 @@
 onentBuilder(),%0A
+            new TextBoxComponentBuilder(),%0A            new PasswordComponentBuilder(),%0A            new TextAreaComponentBuilder(),%0A
             new 
@@ -985,139 +985,8 @@
 (),%0A
-            new TextBoxComponentBuilder(),%0A            new PasswordComponentBuilder(),%0A            new TextAreaComponentBuilder(),%0A
     

Fix ComponentBuilder order in registry