/*
 * Copyright 2017 The Chromium Authors. All rights reserved.
 * Use of this source code is governed by a BSD-style license that can be
 * found in the LICENSE file.
 */
package io.flutter.module.settings;

import com.intellij.openapi.ui.ComboBox;
import com.intellij.ui.EnumComboBoxModel;
import io.flutter.FlutterBundle;
import io.flutter.module.FlutterProjectType;
import org.jetbrains.annotations.NotNull;

import javax.swing.*;
import java.awt.event.ItemListener;

public class ProjectType {
  private JPanel projectTypePanel;
  private ComboBox projectTypeCombo;

  private void createUIComponents() {
    projectTypeCombo = new ComboBox<>();
    //noinspection unchecked
    projectTypeCombo.setModel(new EnumComboBoxModel<>(FlutterProjectType.class));
    projectTypeCombo.setToolTipText(FlutterBundle.message("flutter.module.create.settings.type.tip"));
  }

  @NotNull
  public JComponent getComponent() {
    return projectTypePanel;
  }

  public FlutterProjectType getType() {
    return (FlutterProjectType) projectTypeCombo.getSelectedItem();
  }

  public void addListener(ItemListener listener) {
    projectTypeCombo.addItemListener(listener);
  }
}

@@ -247,50 +247,8 @@
 ox;%0A
-import com.intellij.ui.EnumComboBoxModel;%0A
 impo
@@ -426,35 +426,1361 @@
 er;%0A
-%0Apublic class ProjectType %7B
+import java.util.ArrayList;%0Aimport java.util.EnumSet;%0Aimport java.util.List;%0A%0Apublic class ProjectType %7B%0A  // TODO(pq): replace w/ simple EnumComboBoxModel when add-to-app is complete and we no longer need to filter out MODULE types.%0A  private static final class ProjectTypeComboBoxModel extends AbstractListModel%3CFlutterProjectType%3E%0A    implements ComboBoxModel%3CFlutterProjectType%3E %7B%0A    private final List%3CFlutterProjectType%3E myList = new ArrayList%3C%3E(EnumSet.allOf(FlutterProjectType.class));%0A    private FlutterProjectType mySelected;%0A%0A    public ProjectTypeComboBoxModel() %7B%0A      // Remove MODULE type until add-to-app is complete.%0A      if (System.getProperty(%22flutter.experimental.modules%22, null) == null) %7B%0A        myList.remove(FlutterProjectType.MODULE);%0A      %7D%0A      mySelected = myList.get(0);%0A    %7D%0A%0A    @Override%0A    public int getSize() %7B%0A      return myList.size();%0A    %7D%0A%0A    @Override%0A    public FlutterProjectType getElementAt(int index) %7B%0A      return myList.get(index);%0A    %7D%0A%0A    @Override%0A    public void setSelectedItem(Object item) %7B%0A      setSelectedItem((FlutterProjectType)item);%0A    %7D%0A%0A    @Override%0A    public FlutterProjectType getSelectedItem() %7B%0A      return mySelected;%0A    %7D%0A%0A    public void setSelectedItem(FlutterProjectType item) %7B%0A      mySelected = item;%0A      fireContentsChanged(this, 0, getSize());%0A    %7D%0A  %7D%0A
 %0A  p
@@ -1991,20 +1991,27 @@
 del(new 
-Enum
+ProjectType
 ComboBox
@@ -2019,35 +2019,9 @@
 odel
-%3C%3E(FlutterProjectType.class
+(
 ));%0A
@@ -2281,17 +2281,16 @@
 ectType)
- 
 projectT

remove “module” project type (#2525)