Java 类com.intellij.ui.components.editors.JBComboBoxTableCellEditorComponent 实例源码

项目:intellij-ce-playground    文件:PackageSetChooserCombo.java   
private void rebuild() {
  final JComponent component = getChildComponent();
  final NamedScope[] model = createModel();
  if (component instanceof JComboBox) {
    ((JComboBox)component).setModel(new DefaultComboBoxModel(model));
  }
  else {
    ((JBComboBoxTableCellEditorComponent)component).setOptions(model);
  }
}
项目:intellij-ce-playground    文件:PackageSetChooserCombo.java   
@Nullable
public NamedScope getSelectedScope() {
  final JComponent component = getChildComponent();
  if (component instanceof JComboBox) {
    int idx = ((JComboBox)component).getSelectedIndex();
    if (idx < 0) return null;
    return (NamedScope)((JComboBox)component).getSelectedItem();
  }
  else {
    return (NamedScope)((JBComboBoxTableCellEditorComponent)component).getEditorValue();
  }
}
项目:intellij-ce-playground    文件:ProjectSettingsPanel.java   
public TableCellEditor getEditor(final ScopeSetting scopeSetting) {
  return new AbstractTableCellEditor() {
    private final JBComboBoxTableCellEditorComponent myProfilesChooser = new JBComboBoxTableCellEditorComponent();

    public Object getCellEditorValue() {
      return myProfilesChooser.getEditorValue();
    }

    public Component getTableCellEditorComponent(JTable table, Object value, boolean isSelected, int row, int column) {
      final List<CopyrightProfile> copyrights = new ArrayList<CopyrightProfile>(myProfilesModel.getAllProfiles().values());
      Collections.sort(copyrights, new Comparator<CopyrightProfile>() {
        @Override
        public int compare(CopyrightProfile o1, CopyrightProfile o2) {
          return o1.getName().compareToIgnoreCase(o2.getName());
        }
      });
      myProfilesChooser.setCell(table, row, column);
      myProfilesChooser.setOptions(copyrights.toArray());
      myProfilesChooser.setDefaultValue(scopeSetting.getProfile());
      myProfilesChooser.setToString(new Function<Object, String>() {
        @Override
        public String fun(Object o) {
          return ((CopyrightProfile)o).getName();
        }
      });
      return myProfilesChooser;
    }
  };
}
项目:tools-idea    文件:PackageSetChooserCombo.java   
private void rebuild() {
  final JComponent component = getChildComponent();
  final NamedScope[] model = createModel();
  if (component instanceof JComboBox) {
    ((JComboBox)component).setModel(new DefaultComboBoxModel(model));
  }
  else {
    ((JBComboBoxTableCellEditorComponent)component).setOptions(model);
  }
}
项目:tools-idea    文件:PackageSetChooserCombo.java   
@Nullable
public NamedScope getSelectedScope() {
  final JComponent component = getChildComponent();
  if (component instanceof JComboBox) {
    int idx = ((JComboBox)component).getSelectedIndex();
    if (idx < 0) return null;
    return (NamedScope)((JComboBox)component).getSelectedItem();
  }
  else {
    return (NamedScope)((JBComboBoxTableCellEditorComponent)component).getEditorValue();
  }
}
项目:tools-idea    文件:ProjectSettingsPanel.java   
public TableCellEditor getEditor(final ScopeSetting scopeSetting) {
  return new AbstractTableCellEditor() {
    private final JBComboBoxTableCellEditorComponent myProfilesChooser = new JBComboBoxTableCellEditorComponent();

    public Object getCellEditorValue() {
      return myProfilesChooser.getEditorValue();
    }

    public Component getTableCellEditorComponent(JTable table, Object value, boolean isSelected, int row, int column) {
      final List<CopyrightProfile> copyrights = new ArrayList<CopyrightProfile>(myProfilesModel.getAllProfiles().values());
      Collections.sort(copyrights, new Comparator<CopyrightProfile>() {
        @Override
        public int compare(CopyrightProfile o1, CopyrightProfile o2) {
          return o1.getName().compareToIgnoreCase(o2.getName());
        }
      });
      myProfilesChooser.setCell(table, row, column);
      myProfilesChooser.setOptions(copyrights.toArray());
      myProfilesChooser.setDefaultValue(scopeSetting.getProfile());
      myProfilesChooser.setToString(new Function<Object, String>() {
        @Override
        public String fun(Object o) {
          return ((CopyrightProfile)o).getName();
        }
      });
      return myProfilesChooser;
    }
  };
}
项目:consulo    文件:ProjectSettingsPanel.java   
public TableCellEditor getEditor(final ScopeSetting scopeSetting) {
  return new AbstractTableCellEditor() {
    private final JBComboBoxTableCellEditorComponent myProfilesChooser = new JBComboBoxTableCellEditorComponent();

    public Object getCellEditorValue() {
      return myProfilesChooser.getEditorValue();
    }

    public Component getTableCellEditorComponent(JTable table, Object value, boolean isSelected, int row, int column) {
      final List<CopyrightProfile> copyrights = new ArrayList<CopyrightProfile>(myProfilesModel.getAllProfiles().values());
      Collections.sort(copyrights, new Comparator<CopyrightProfile>() {
        @Override
        public int compare(CopyrightProfile o1, CopyrightProfile o2) {
          return o1.getName().compareToIgnoreCase(o2.getName());
        }
      });
      myProfilesChooser.setCell(table, row, column);
      myProfilesChooser.setOptions(copyrights.toArray());
      myProfilesChooser.setDefaultValue(scopeSetting.getProfile());
      myProfilesChooser.setToString(new Function<Object, String>() {
        @Override
        public String fun(Object o) {
          return ((CopyrightProfile)o).getName();
        }
      });
      return myProfilesChooser;
    }
  };
}
项目:consulo    文件:PackageSetChooserCombo.java   
private void rebuild() {
  final JComponent component = getChildComponent();
  final NamedScope[] model = createModel();
  if (component instanceof JComboBox) {
    ((JComboBox)component).setModel(new DefaultComboBoxModel(model));
  }
  else {
    ((JBComboBoxTableCellEditorComponent)component).setOptions(model);
  }
}
项目:consulo    文件:PackageSetChooserCombo.java   
@Nullable
public NamedScope getSelectedScope() {
  final JComponent component = getChildComponent();
  if (component instanceof JComboBox) {
    int idx = ((JComboBox)component).getSelectedIndex();
    if (idx < 0) return null;
    return (NamedScope)((JComboBox)component).getSelectedItem();
  }
  else {
    return (NamedScope)((JBComboBoxTableCellEditorComponent)component).getEditorValue();
  }
}