mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
[vcs] Listen to scopes changes and update the "filter update project info by scope" combobox, correctly dispose resources.
* rebuild the combobox on scope change. * dispose child configurables. This is needed when user clicks "Edit scopes", navigates to the Scopes configurable, adds a scope there and returns to modify the filter setting.
This commit is contained in:
+2
@@ -561,6 +561,8 @@ public class VcsDirectoryConfigurationPanel extends JPanel implements Configurab
|
||||
}
|
||||
|
||||
public void disposeUIResources() {
|
||||
myLimitHistory.disposeUIResources();
|
||||
myScopeFilterConfig.disposeUIResources();
|
||||
}
|
||||
|
||||
private static class VcsRootErrorLabel extends JPanel {
|
||||
|
||||
+2
@@ -80,6 +80,8 @@ public class VcsManagerConfigurable extends SearchableConfigurable.Parent.Abstra
|
||||
@Override
|
||||
public void disposeUIResources() {
|
||||
super.disposeUIResources();
|
||||
myMappings.disposeUIResources();
|
||||
myGeneralPanel.disposeUIResources();
|
||||
myMappings = null;
|
||||
}
|
||||
|
||||
|
||||
+17
-3
@@ -40,12 +40,13 @@ import java.awt.*;
|
||||
/**
|
||||
* @author Kirill Likhodedov
|
||||
*/
|
||||
class VcsUpdateInfoScopeFilterConfigurable implements Configurable {
|
||||
class VcsUpdateInfoScopeFilterConfigurable implements Configurable, NamedScopesHolder.ScopeListener {
|
||||
|
||||
private final JCheckBox myCheckbox;
|
||||
private final JComboBox myComboBox;
|
||||
private final Project myProject;
|
||||
private final VcsConfiguration myVcsConfiguration;
|
||||
private final NamedScopesHolder[] myNamedScopeHolders;
|
||||
|
||||
VcsUpdateInfoScopeFilterConfigurable(Project project, VcsConfiguration vcsConfiguration) {
|
||||
myProject = project;
|
||||
@@ -60,6 +61,16 @@ class VcsUpdateInfoScopeFilterConfigurable implements Configurable {
|
||||
myComboBox.setEnabled(myCheckbox.isSelected());
|
||||
}
|
||||
});
|
||||
|
||||
myNamedScopeHolders = NamedScopesHolder.getAllNamedScopeHolders(myProject);
|
||||
for (NamedScopesHolder holder : myNamedScopeHolders) {
|
||||
holder.addScopeListener(this);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void scopesChanged() {
|
||||
reset();
|
||||
}
|
||||
|
||||
@Nls
|
||||
@@ -109,7 +120,7 @@ class VcsUpdateInfoScopeFilterConfigurable implements Configurable {
|
||||
public void reset() {
|
||||
myComboBox.removeAllItems();
|
||||
boolean selection = false;
|
||||
for (NamedScopesHolder holder : NamedScopesHolder.getAllNamedScopeHolders(myProject)) {
|
||||
for (NamedScopesHolder holder : myNamedScopeHolders) {
|
||||
for (NamedScope scope : holder.getEditableScopes()) {
|
||||
myComboBox.addItem(scope.getName());
|
||||
if (!selection && scope.getName().equals(myVcsConfiguration.UPDATE_FILTER_SCOPE_NAME)) {
|
||||
@@ -125,6 +136,9 @@ class VcsUpdateInfoScopeFilterConfigurable implements Configurable {
|
||||
|
||||
@Override
|
||||
public void disposeUIResources() {
|
||||
for (NamedScopesHolder holder : myNamedScopeHolders) {
|
||||
holder.removeScopeListener(this);
|
||||
}
|
||||
}
|
||||
|
||||
private String getScopeFilterName() {
|
||||
@@ -133,5 +147,5 @@ class VcsUpdateInfoScopeFilterConfigurable implements Configurable {
|
||||
}
|
||||
return (String)myComboBox.getSelectedItem();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user