Search in sources :

Example 11 with UnnamedConfigurable

use of com.intellij.openapi.options.UnnamedConfigurable in project intellij-community by JetBrains.

the class VcsConfigurationsDialog method updateConfiguration.

private void updateConfiguration() {
    int selectedIndex = myVcses.getSelectionModel().getMinSelectionIndex();
    final VcsDescriptor currentVcs;
    currentVcs = selectedIndex >= 0 ? (VcsDescriptor) (myVcses.getModel()).getElementAt(selectedIndex) : null;
    String currentName = currentVcs == null ? NONE : currentVcs.getName();
    if (currentVcs != null) {
        final UnnamedConfigurable unnamedConfigurable = myVcsNameToConfigurableMap.get(currentName);
        unnamedConfigurable.createComponent();
        unnamedConfigurable.reset();
    }
    final CardLayout cardLayout = (CardLayout) myVcsConfigurationPanel.getLayout();
    cardLayout.show(myVcsConfigurationPanel, currentName);
}
Also used : UnnamedConfigurable(com.intellij.openapi.options.UnnamedConfigurable) VcsDescriptor(com.intellij.openapi.vcs.impl.VcsDescriptor)

Example 12 with UnnamedConfigurable

use of com.intellij.openapi.options.UnnamedConfigurable in project intellij-community by JetBrains.

the class VcsConfigurationsDialog method doOKAction.

protected void doOKAction() {
    for (String vcsName : myVcsNameToConfigurableMap.keySet()) {
        UnnamedConfigurable configurable = myVcsNameToConfigurableMap.get(vcsName);
        if (configurable != null && configurable.isModified()) {
            try {
                configurable.apply();
            } catch (ConfigurationException e) {
                Messages.showErrorDialog(VcsBundle.message("message.text.unable.to.save.settings", e.getMessage()), VcsBundle.message("message.title.unable.to.save.settings"));
            }
        }
    }
    final JComboBox vcsesToUpdate = myVcsesToUpdate;
    if (vcsesToUpdate != null) {
        final VcsDescriptor wrapper = (VcsDescriptor) myVcses.getSelectedValue();
        vcsesToUpdate.setSelectedItem(wrapper);
        final ComboBoxModel model = vcsesToUpdate.getModel();
        for (int i = 0; i < model.getSize(); i++) {
            final Object vcsWrapper = model.getElementAt(i);
            if (vcsWrapper instanceof VcsDescriptor) {
                final VcsDescriptor defaultVcsWrapper = (VcsDescriptor) vcsWrapper;
                if (defaultVcsWrapper.equals(wrapper)) {
                    vcsesToUpdate.setSelectedIndex(i);
                    break;
                }
            }
        }
    }
    super.doOKAction();
}
Also used : ConfigurationException(com.intellij.openapi.options.ConfigurationException) UnnamedConfigurable(com.intellij.openapi.options.UnnamedConfigurable) VcsDescriptor(com.intellij.openapi.vcs.impl.VcsDescriptor)

Example 13 with UnnamedConfigurable

use of com.intellij.openapi.options.UnnamedConfigurable in project intellij-community by JetBrains.

the class VcsMappingConfigurationDialog method updateVcsConfigurable.

private void updateVcsConfigurable() {
    if (myVcsConfigurable != null) {
        myVcsConfigurablePlaceholder.remove(myVcsConfigurableComponent);
        myVcsConfigurable.disposeUIResources();
        myVcsConfigurable = null;
    }
    VcsDescriptor wrapper = (VcsDescriptor) myVCSComboBox.getSelectedItem();
    if (wrapper != null && (!wrapper.isNone())) {
        final AbstractVcs vcs = myVcsManager.findVcsByName(wrapper.getName());
        if (vcs != null) {
            UnnamedConfigurable configurable = vcs.getRootConfigurable(myMappingCopy);
            if (configurable != null) {
                myVcsConfigurable = configurable;
                myVcsConfigurableComponent = myVcsConfigurable.createComponent();
                myVcsConfigurablePlaceholder.add(myVcsConfigurableComponent, BorderLayout.CENTER);
            }
        }
    }
    pack();
}
Also used : UnnamedConfigurable(com.intellij.openapi.options.UnnamedConfigurable) VcsDescriptor(com.intellij.openapi.vcs.impl.VcsDescriptor)

Aggregations

UnnamedConfigurable (com.intellij.openapi.options.UnnamedConfigurable)13 VcsDescriptor (com.intellij.openapi.vcs.impl.VcsDescriptor)3 OptionsContainingConfigurable (com.intellij.application.options.OptionsContainingConfigurable)1 AllFileTemplatesConfigurable (com.intellij.ide.fileTemplates.impl.AllFileTemplatesConfigurable)1 PluginManagerConfigurable (com.intellij.ide.plugins.PluginManagerConfigurable)1 FileChooserDescriptor (com.intellij.openapi.fileChooser.FileChooserDescriptor)1 KeymapPanel (com.intellij.openapi.keymap.impl.ui.KeymapPanel)1 ConfigurationException (com.intellij.openapi.options.ConfigurationException)1 SearchableConfigurable (com.intellij.openapi.options.SearchableConfigurable)1 ConfigurableWrapper (com.intellij.openapi.options.ex.ConfigurableWrapper)1 Splitter (com.intellij.openapi.ui.Splitter)1 DocumentAdapter (com.intellij.ui.DocumentAdapter)1 OptionGroup (com.intellij.ui.OptionGroup)1 TitledSeparator (com.intellij.ui.TitledSeparator)1 GridConstraints (com.intellij.uiDesigner.core.GridConstraints)1 GridLayoutManager (com.intellij.uiDesigner.core.GridLayoutManager)1 File (java.io.File)1 DocumentEvent (javax.swing.event.DocumentEvent)1 Document (org.jdom.Document)1 Element (org.jdom.Element)1