Search in sources :

Example 1 with VcsDescriptor

use of com.intellij.openapi.vcs.impl.VcsDescriptor in project intellij-community by JetBrains.

the class VcsDataWrapper method getVcses.

public Map<String, String> getVcses() {
    if (myVcses == null && myProject != null && !myProject.isDefault()) {
        final VcsDescriptor[] allVcss = myManager.getAllVcss();
        myVcses = new HashMap<>(allVcss.length, 1);
        for (VcsDescriptor vcs : allVcss) {
            myVcses.put(vcs.getDisplayName(), vcs.getName());
        }
    }
    return myVcses;
}
Also used : VcsDescriptor(com.intellij.openapi.vcs.impl.VcsDescriptor)

Example 2 with VcsDescriptor

use of com.intellij.openapi.vcs.impl.VcsDescriptor 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 3 with VcsDescriptor

use of com.intellij.openapi.vcs.impl.VcsDescriptor in project intellij-community by JetBrains.

the class VcsConfigurationsDialog method initList.

private void initList(VcsDescriptor[] names) {
    DefaultListModel model = new DefaultListModel();
    for (VcsDescriptor name : names) {
        model.addElement(name);
    }
    myVcses.setModel(model);
    myVcses.getSelectionModel().addListSelectionListener(new ListSelectionListener() {

        public void valueChanged(ListSelectionEvent e) {
            updateConfiguration();
        }
    });
    myVcses.setCellRenderer(VCS_LIST_RENDERER);
    myVcsesScrollPane.setMinimumSize(myVcsesScrollPane.getPreferredSize());
}
Also used : ListSelectionEvent(javax.swing.event.ListSelectionEvent) VcsDescriptor(com.intellij.openapi.vcs.impl.VcsDescriptor) ListSelectionListener(javax.swing.event.ListSelectionListener)

Example 4 with VcsDescriptor

use of com.intellij.openapi.vcs.impl.VcsDescriptor 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 5 with VcsDescriptor

use of com.intellij.openapi.vcs.impl.VcsDescriptor in project intellij-community by JetBrains.

the class VcsConfigurationsDialog method initVcsConfigurable.

private void initVcsConfigurable(VcsDescriptor[] vcses) {
    myVcsConfigurationPanel.setLayout(new CardLayout());
    MyNullConfigurable nullConfigurable = new MyNullConfigurable();
    myVcsNameToConfigurableMap.put(NONE, nullConfigurable);
    myVcsConfigurationPanel.add(nullConfigurable.createComponent(), NONE);
    for (VcsDescriptor vcs : vcses) {
        addConfigurationPanelFor(vcs);
    }
}
Also used : VcsDescriptor(com.intellij.openapi.vcs.impl.VcsDescriptor)

Aggregations

VcsDescriptor (com.intellij.openapi.vcs.impl.VcsDescriptor)10 UnnamedConfigurable (com.intellij.openapi.options.UnnamedConfigurable)3 ArrayList (java.util.ArrayList)2 NotNull (org.jetbrains.annotations.NotNull)2 BooleanOptionDescription (com.intellij.ide.ui.search.BooleanOptionDescription)1 Configurable (com.intellij.openapi.options.Configurable)1 ConfigurationException (com.intellij.openapi.options.ConfigurationException)1 SearchableConfigurable (com.intellij.openapi.options.SearchableConfigurable)1 VcsConfigurableProvider (com.intellij.openapi.vcs.VcsConfigurableProvider)1 ChangelistConflictConfigurable (com.intellij.openapi.vcs.changes.conflicts.ChangelistConflictConfigurable)1 IgnoredSettingsPanel (com.intellij.openapi.vcs.changes.ui.IgnoredSettingsPanel)1 VcsEP (com.intellij.openapi.vcs.impl.VcsEP)1 GitRepositoryManager (git4idea.repo.GitRepositoryManager)1 ListSelectionEvent (javax.swing.event.ListSelectionEvent)1 ListSelectionListener (javax.swing.event.ListSelectionListener)1