copyright: filter out custom scopes not acceptable for settings

This commit is contained in:
Anna Kozlova
2012-08-08 21:34:40 +04:00
parent 039edf0858
commit 3def4c0ea8
2 changed files with 12 additions and 2 deletions
@@ -155,7 +155,7 @@ public class PackageSetChooserCombo extends ComponentWithBrowseButton<JComponent
}
}
private NamedScope[] createModel() {
protected NamedScope[] createModel() {
final Collection<NamedScope> model = new ArrayList<NamedScope>();
final DependencyValidationManager manager = DependencyValidationManager.getInstance(myProject);
model.addAll(Arrays.asList(manager.getScopes()));
@@ -16,6 +16,7 @@
package com.maddyhome.idea.copyright.ui;
import com.intellij.ide.DataManager;
import com.intellij.psi.search.scope.packageSet.CustomScopesProviderEx;
import com.intellij.ui.ListCellRendererWrapper;
import com.intellij.ide.util.scopeChooser.PackageSetChooserCombo;
import com.intellij.ide.util.scopeChooser.ScopeChooserConfigurable;
@@ -345,7 +346,16 @@ public class ProjectSettingsPanel {
}
public Component getTableCellEditorComponent(final JTable table, Object value, boolean isSelected, int row, int column) {
myScopeChooser = new PackageSetChooserCombo(myProject, value == null ? null : ((NamedScope)value).getName(), false, false);
myScopeChooser = new PackageSetChooserCombo(myProject, value == null ? null : ((NamedScope)value).getName(), false, false){
@Override
protected NamedScope[] createModel() {
final NamedScope[] model = super.createModel();
final ArrayList<NamedScope> filteredScopes = new ArrayList<NamedScope>(Arrays.asList(model));
CustomScopesProviderEx.filterNoSettingsScopes(myProject, filteredScopes);
return filteredScopes.toArray(new NamedScope[filteredScopes.size()]);
}
};
((JBComboBoxTableCellEditorComponent)myScopeChooser.getChildComponent()).setCell(table, row, column);
return myScopeChooser;
}