RunWithAntBinding(JRadioButton useDefaultAnt, JRadioButton useCustomAnt, ComboboxWithBrowseButton ants, final GlobalAntConfiguration antConfiguration) { myAntConfiguration = antConfiguration; myComponents.add(useDefaultAnt); myUseCustomAnt = useCustomAnt; myComponents.add(myUseCustomAnt); myAnts = ants; myUseDefaultAnt = useDefaultAnt; ButtonGroup group = new ButtonGroup(); group.add(useDefaultAnt); group.add(myUseCustomAnt); myUseCustomAnt.addItemListener(new ItemListener() { public void itemStateChanged(ItemEvent e) { updateEnableCombobox(); if (myUseCustomAnt.isSelected() && !myLoadingValues) myAnts.getComboBox().requestFocusInWindow(); } }); myAntsController = new ChooseAndEditComboBoxController<AntReference, AntReference>(myAnts, new ConvertingIterator.IdConvertor<AntReference>(), AntReference.COMPARATOR) { public Iterator<AntReference> getAllListItems() { return antConfiguration.getConfiguredAnts().keySet().iterator(); } public AntReference openConfigureDialog(AntReference reference, JComponent parent) { AntSetPanel antSetPanel = new AntSetPanel(); AntInstallation installation = myAntConfiguration.getConfiguredAnts().get(reference); if (installation == null) installation = myAntConfiguration.getConfiguredAnts().get(AntReference.BUNDLED_ANT); antSetPanel.reset(); antSetPanel.setSelection(installation); AntInstallation antInstallation = antSetPanel.showDialog(parent); return antInstallation != null ? antInstallation.getReference() : null; } }; myAntsController.setRenderer(new AntUIUtil.AntReferenceRenderer(myAntConfiguration)); }
public void loadValues(AbstractProperty.AbstractPropertyContainer container) { myLoadingValues = true; AntReference antReference = AntBuildFileImpl.ANT_REFERENCE.get(container); boolean isDefault = AntReference.PROJECT_DEFAULT == antReference; myUseDefaultAnt.setSelected(isDefault); myUseCustomAnt.setSelected(!isDefault); AntReference selection = isDefault ? null : antReference; myAntsController.resetList(selection); updateEnableCombobox(); myLoadingValues = false; }
private void updateEnableCombobox() { boolean enabled = myEnabled && myUseCustomAnt.isSelected(); myAnts.setEnabled(enabled); if (!enabled) myAnts.getComboBox().setSelectedItem(null); if (!enabled || myLoadingValues) return; myAntsController.resetList(AntReference.BUNDLED_ANT); }
public static void customizeReference(AntReference antReference, SimpleColoredComponent component, GlobalAntConfiguration configuration) { AntInstallation antInstallation = antReference.find(configuration); if (antInstallation != null) customizeAnt(antInstallation.getProperties(), component); else { component.setIcon(PlatformIcons.INVALID_ENTRY_ICON); component.append(antReference.getName(), SimpleTextAttributes.ERROR_ATTRIBUTES); } }
@Override public void loadValues(AbstractProperty.AbstractPropertyContainer container) { myLoadingValues = true; AntReference antReference = AntBuildFileImpl.ANT_REFERENCE.get(container); boolean isDefault = AntReference.PROJECT_DEFAULT == antReference; myUseDefaultAnt.setSelected(isDefault); myUseCustomAnt.setSelected(!isDefault); AntReference selection = isDefault ? null : antReference; myAntsController.resetList(selection); updateEnableCombobox(); myLoadingValues = false; }
private void updateEnableCombobox() { boolean enabled = myEnabled && myUseCustomAnt.isSelected(); myAnts.setEnabled(enabled); if(!enabled) { myAnts.getComboBox().setSelectedItem(null); } if(!enabled || myLoadingValues) { return; } myAntsController.resetList(AntReference.BUNDLED_ANT); }
@Override protected void customizeCellRenderer(JList list, Object value, int index, boolean selected, boolean hasFocus) { if(value == null) { return; } customizeReference((AntReference) value, this, myConfiguration); }
public static void customizeReference(AntReference antReference, SimpleColoredComponent component, GlobalAntConfiguration configuration) { Sdk antInstallation = antReference.find(configuration); if(antInstallation != null) { customizeAnt(antInstallation, component); } else { component.setIcon(PlatformIcons.INVALID_ENTRY_ICON); component.append(antReference.getName(), SimpleTextAttributes.ERROR_ATTRIBUTES); } }
public void apply(AbstractProperty.AbstractPropertyContainer container) { AntReference antReference = myUseDefaultAnt.isSelected() ? AntReference.PROJECT_DEFAULT : myAntsController.getSelectedItem(); AntBuildFileImpl.ANT_REFERENCE.set(container, antReference); }
protected void customizeCellRenderer(JList list, Object value, int index, boolean selected, boolean hasFocus) { if (value == null) return; customizeReference((AntReference)value, this, myConfiguration); }
RunWithAntBinding(JRadioButton useDefaultAnt, JRadioButton useCustomAnt, ComboboxWithBrowseButton ants, final GlobalAntConfiguration antConfiguration) { myAntConfiguration = antConfiguration; myComponents.add(useDefaultAnt); myUseCustomAnt = useCustomAnt; myComponents.add(myUseCustomAnt); myAnts = ants; myUseDefaultAnt = useDefaultAnt; ButtonGroup group = new ButtonGroup(); group.add(useDefaultAnt); group.add(myUseCustomAnt); myUseCustomAnt.addItemListener(new ItemListener() { @Override public void itemStateChanged(ItemEvent e) { updateEnableCombobox(); if(myUseCustomAnt.isSelected() && !myLoadingValues) { myAnts.getComboBox().requestFocusInWindow(); } } }); myAntsController = new ChooseAndEditComboBoxController<AntReference, AntReference>(myAnts, new ConvertingIterator.IdConvertor<AntReference> (), AntReference.COMPARATOR) { @Override public Iterator<AntReference> getAllListItems() { return antConfiguration.getConfiguredAnts().keySet().iterator(); } @Override public AntReference openConfigureDialog(AntReference reference, JComponent parent) { Sdk sdk = myAntConfiguration.getConfiguredAnts().get(reference); SingleSdkEditor editor = new SingleSdkEditor(sdk, parent); editor.show(); Sdk selectedSdk = editor.getSelectedSdk(); if(selectedSdk != null) { if(selectedSdk.isPredefined()) { return AntReference.BUNDLED_ANT; } return new AntReference.BindedReference(sdk); } else { return AntReference.BUNDLED_ANT; } } }; myAntsController.setRenderer(new AntUIUtil.AntReferenceRenderer(myAntConfiguration)); }
@Override public void apply(AbstractProperty.AbstractPropertyContainer container) { AntReference antReference = myUseDefaultAnt.isSelected() ? AntReference.PROJECT_DEFAULT : myAntsController.getSelectedItem(); AntBuildFileImpl.ANT_REFERENCE.set(container, antReference); }