Java 类com.intellij.lang.ant.config.impl.AntReference 实例源码

项目:intellij-ce-playground    文件:RunWithAntBinding.java   
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));
}
项目:intellij-ce-playground    文件:RunWithAntBinding.java   
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;
}
项目:intellij-ce-playground    文件:RunWithAntBinding.java   
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);
}
项目:intellij-ce-playground    文件:AntUIUtil.java   
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);
  }
}
项目:tools-idea    文件:RunWithAntBinding.java   
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));
}
项目:tools-idea    文件:RunWithAntBinding.java   
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;
}
项目:tools-idea    文件:RunWithAntBinding.java   
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);
}
项目:tools-idea    文件:AntUIUtil.java   
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);
  }
}
项目:consulo-apache-ant    文件:RunWithAntBinding.java   
@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;
}
项目:consulo-apache-ant    文件:RunWithAntBinding.java   
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);
}
项目:consulo-apache-ant    文件:AntUIUtil.java   
@Override
protected void customizeCellRenderer(JList list, Object value, int index, boolean selected, boolean hasFocus)
{
    if(value == null)
    {
        return;
    }
    customizeReference((AntReference) value, this, myConfiguration);
}
项目:consulo-apache-ant    文件:AntUIUtil.java   
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);
    }
}
项目:intellij-ce-playground    文件:RunWithAntBinding.java   
public void apply(AbstractProperty.AbstractPropertyContainer container) {
  AntReference antReference = myUseDefaultAnt.isSelected() ?
                              AntReference.PROJECT_DEFAULT :
                              myAntsController.getSelectedItem();
  AntBuildFileImpl.ANT_REFERENCE.set(container, antReference);
}
项目:intellij-ce-playground    文件:AntUIUtil.java   
protected void customizeCellRenderer(JList list, Object value, int index, boolean selected, boolean hasFocus) {
  if (value == null) return;
  customizeReference((AntReference)value, this, myConfiguration);
}
项目:tools-idea    文件:RunWithAntBinding.java   
public void apply(AbstractProperty.AbstractPropertyContainer container) {
  AntReference antReference = myUseDefaultAnt.isSelected() ?
                              AntReference.PROJECT_DEFAULT :
                              myAntsController.getSelectedItem();
  AntBuildFileImpl.ANT_REFERENCE.set(container, antReference);
}
项目:tools-idea    文件:AntUIUtil.java   
protected void customizeCellRenderer(JList list, Object value, int index, boolean selected, boolean hasFocus) {
  if (value == null) return;
  customizeReference((AntReference)value, this, myConfiguration);
}
项目:consulo-apache-ant    文件:RunWithAntBinding.java   
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));
}
项目:consulo-apache-ant    文件:RunWithAntBinding.java   
@Override
public void apply(AbstractProperty.AbstractPropertyContainer container)
{
    AntReference antReference = myUseDefaultAnt.isSelected() ? AntReference.PROJECT_DEFAULT : myAntsController.getSelectedItem();
    AntBuildFileImpl.ANT_REFERENCE.set(container, antReference);
}