public AlternativeSourceNotificationPanel(
     ComboBoxClassElement[] alternatives,
     final PsiClass aClass,
     final Project project,
     final VirtualFile file) {
   setText(
       DebuggerBundle.message(
           "editor.notification.alternative.source", aClass.getQualifiedName()));
   final ComboBox switcher = new ComboBox(alternatives);
   switcher.addActionListener(
       new ActionListener() {
         @Override
         public void actionPerformed(ActionEvent e) {
           FileEditorManager.getInstance(project).closeFile(file);
           PsiClass item = ((ComboBoxClassElement) switcher.getSelectedItem()).myClass;
           item = (PsiClass) item.getNavigationElement(); // go through compiled
           DebuggerUtilsEx.setAlternativeSource(file, item.getContainingFile().getVirtualFile());
           item.navigate(true);
           XDebugSession session = XDebuggerManager.getInstance(project).getCurrentSession();
           if (session != null) {
             session.updateExecutionPosition();
           }
         }
       });
   myLinksPanel.add(switcher);
 }
 public FrameworkGroupOptionsComponent(
     final FrameworkGroup<?> group, final FrameworkSupportModelBase model) {
   JPanel panel = new JPanel(new VerticalFlowLayout());
   List<? extends FrameworkGroupVersion> versions = group.getGroupVersions();
   if (!versions.isEmpty()) {
     final ComboBox versionsBox = new ComboBox();
     versionsBox.setRenderer(
         new ListCellRendererWrapper<FrameworkGroupVersion>() {
           @Override
           public void customize(
               JList list,
               FrameworkGroupVersion value,
               int index,
               boolean selected,
               boolean hasFocus) {
             setText(value != null ? value.getPresentableName() : "");
           }
         });
     versionsBox.addActionListener(
         new ActionListener() {
           @Override
           public void actionPerformed(ActionEvent e) {
             model.setSelectedVersion(
                 group, (FrameworkGroupVersion) versionsBox.getSelectedItem());
           }
         });
     for (FrameworkGroupVersion version : versions) {
       versionsBox.addItem(version);
     }
     panel.add(
         FormBuilder.createFormBuilder().addLabeledComponent("Version:", versionsBox).getPanel());
   }
   myMainPanel = panel;
 }
  public GoBuildTargetConfigurable(@NotNull Project project, boolean dialogMode) {
    if (dialogMode) {
      myPanel.setPreferredSize(new Dimension(400, -1));
    }

    myBuildTargetSettings = GoBuildTargetSettings.getInstance(project);

    myDefaultOSValue = "Default (" + GoUtil.systemOS() + ")";
    myDefaultArchValue = "Default (" + GoUtil.systemArch() + ")";
    myDefaultGoVersion =
        "Project SDK ("
            + StringUtil.notNullize(GoSdkService.getInstance(project).getSdkVersion(null), "any")
            + ")";
    myDefaultCgo = "Default (" + cgo(GoUtil.systemCgo(myDefaultOSValue, myDefaultArchValue)) + ")";

    myOSCombo.setModel(createModel(GoConstants.KNOWN_OS, myDefaultOSValue));
    myArchCombo.setModel(createModel(GoConstants.KNOWN_ARCH, myDefaultArchValue));
    myCgoComboModel = createModel(ContainerUtil.newArrayList(ENABLED, DISABLED), myDefaultCgo);
    myCgoCombo.setModel(myCgoComboModel);
    myCompilerCombo.setModel(
        createModel(GoConstants.KNOWN_COMPILERS, GoBuildTargetSettings.ANY_COMPILER));
    myGoVersionCombo.setModel(createModel(GoConstants.KNOWN_VERSIONS, myDefaultGoVersion));

    ActionListener updateCgoListener =
        new ActionListener() {
          @Override
          public void actionPerformed(@NotNull ActionEvent event) {
            String selected = StringUtil.notNullize(myCgoComboModel.getSelected(), myDefaultCgo);
            String oldDefault = myDefaultCgo;
            String os = expandDefault(selected(myOSCombo, myDefaultOSValue), GoUtil.systemOS());
            String arch =
                expandDefault(selected(myArchCombo, myDefaultArchValue), GoUtil.systemArch());

            myDefaultCgo = "Default (" + cgo(GoUtil.systemCgo(os, arch)) + ")";
            myCgoComboModel.update(ContainerUtil.newArrayList(myDefaultCgo, ENABLED, DISABLED));
            myCgoComboModel.setSelectedItem(oldDefault.equals(selected) ? myDefaultCgo : selected);
          }
        };
    myOSCombo.addActionListener(updateCgoListener);
    myArchCombo.addActionListener(updateCgoListener);
  }
  @Nullable
  private DependencyOnPlugin editPluginDependency(
      @NotNull JComponent parent, @NotNull final DependencyOnPlugin original) {
    List<String> pluginIds = new ArrayList<String>(getPluginNameByIdMap().keySet());
    if (!original.getPluginId().isEmpty() && !pluginIds.contains(original.getPluginId())) {
      pluginIds.add(original.getPluginId());
    }
    Collections.sort(
        pluginIds,
        new Comparator<String>() {
          @Override
          public int compare(String o1, String o2) {
            return getPluginNameById(o1).compareToIgnoreCase(getPluginNameById(o2));
          }
        });

    final ComboBox pluginChooser = new ComboBox(ArrayUtilRt.toStringArray(pluginIds), 250);
    pluginChooser.setRenderer(
        new ListCellRendererWrapper<String>() {
          @Override
          public void customize(
              JList list, String value, int index, boolean selected, boolean hasFocus) {
            setText(getPluginNameById(value));
          }
        });
    new ComboboxSpeedSearch(pluginChooser) {
      @Override
      protected String getElementText(Object element) {
        return getPluginNameById((String) element);
      }
    };
    pluginChooser.setSelectedItem(original.getPluginId());

    final JBTextField minVersionField =
        new JBTextField(StringUtil.notNullize(original.getMinVersion()));
    final JBTextField maxVersionField =
        new JBTextField(StringUtil.notNullize(original.getMaxVersion()));
    final JBTextField channelField = new JBTextField(StringUtil.notNullize(original.getChannel()));
    minVersionField.getEmptyText().setText("<any>");
    minVersionField.setColumns(10);
    maxVersionField.getEmptyText().setText("<any>");
    maxVersionField.setColumns(10);
    channelField.setColumns(10);
    JPanel panel =
        FormBuilder.createFormBuilder()
            .addLabeledComponent("Plugin:", pluginChooser)
            .addLabeledComponent("Minimum version:", minVersionField)
            .addLabeledComponent("Maximum version:", maxVersionField)
            .addLabeledComponent("Channel:", channelField)
            .getPanel();
    final DialogBuilder dialogBuilder =
        new DialogBuilder(parent).title("Required Plugin").centerPanel(panel);
    dialogBuilder.setPreferredFocusComponent(pluginChooser);
    pluginChooser.addActionListener(
        new ActionListener() {
          @Override
          public void actionPerformed(ActionEvent e) {
            dialogBuilder.setOkActionEnabled(
                !StringUtil.isEmpty((String) pluginChooser.getSelectedItem()));
          }
        });
    if (dialogBuilder.show() == DialogWrapper.OK_EXIT_CODE) {
      return new DependencyOnPlugin(
          ((String) pluginChooser.getSelectedItem()),
          StringUtil.nullize(minVersionField.getText().trim()),
          StringUtil.nullize(maxVersionField.getText().trim()),
          StringUtil.nullize(channelField.getText().trim()));
    }
    return null;
  }