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;
}
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);
}
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());
}
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();
}
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);
}
}
Aggregations