mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
Inspections UI: removing nonexistence scope throws exception fixed
This commit is contained in:
+4
-4
@@ -885,13 +885,13 @@ public class InspectionProfileImpl extends ProfileEx implements ModifiableModel,
|
||||
getTools(toolId, project).removeScope(scopeIdx);
|
||||
}
|
||||
|
||||
public void removeScope(@NotNull String toolId, @NotNull NamedScope scope, Project project) {
|
||||
getTools(toolId, project).removeScope(scope);
|
||||
public void removeScope(@NotNull String toolId, @NotNull String scopeName, Project project) {
|
||||
getTools(toolId, project).removeScope(scopeName);
|
||||
}
|
||||
|
||||
public void removeScopes(@NotNull List<String> toolIds, @NotNull NamedScope scope, Project project) {
|
||||
public void removeScopes(@NotNull List<String> toolIds, @NotNull String scopeName, Project project) {
|
||||
for (final String toolId : toolIds) {
|
||||
removeScope(toolId, scope, project);
|
||||
removeScope(toolId, scopeName, project);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -267,25 +267,26 @@ public class ToolsImpl implements Tools {
|
||||
public void removeScope(int scopeIdx) {
|
||||
if (myTools != null && scopeIdx >= 0 && myTools.size() > scopeIdx) {
|
||||
myTools.remove(scopeIdx);
|
||||
if (myTools.isEmpty()) {
|
||||
myTools = null;
|
||||
setEnabled(myDefaultState.isEnabled());
|
||||
}
|
||||
checkToolsIsEmpty();
|
||||
}
|
||||
}
|
||||
|
||||
public void removeScope(final NamedScope scope) {
|
||||
public void removeScope(final @NotNull String scopeName) {
|
||||
if (myTools != null) {
|
||||
for (final ScopeToolState tool : myTools) {
|
||||
if (Comparing.equal(tool.getScopeName(), scope.getName())) {
|
||||
for (ScopeToolState tool : myTools) {
|
||||
if (scopeName.equals(tool.getScopeName())) {
|
||||
myTools.remove(tool);
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (myTools.isEmpty()) {
|
||||
myTools = null;
|
||||
setEnabled(myDefaultState.isEnabled());
|
||||
}
|
||||
checkToolsIsEmpty();
|
||||
}
|
||||
}
|
||||
|
||||
private void checkToolsIsEmpty() {
|
||||
if (myTools.isEmpty()) {
|
||||
myTools = null;
|
||||
setEnabled(myDefaultState.isEnabled());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+4
-1
@@ -357,6 +357,9 @@ public class ScopesAndSeveritiesTable extends JBTable {
|
||||
}
|
||||
else if (columnIndex == SCOPE_ENABLED_COLUMN) {
|
||||
final NamedScope scope = getScope(rowIndex);
|
||||
if (scope == null) {
|
||||
return;
|
||||
}
|
||||
if ((Boolean)value) {
|
||||
if (rowIndex == lastRowIndex()) {
|
||||
myInspectionProfile.enableToolsByDefault(myKeyNames, myProject);
|
||||
@@ -381,7 +384,7 @@ public class ScopesAndSeveritiesTable extends JBTable {
|
||||
@Override
|
||||
public void removeRow(final int idx) {
|
||||
if (idx != lastRowIndex()) {
|
||||
myInspectionProfile.removeScopes(myKeyNames, getScope(idx), myProject);
|
||||
myInspectionProfile.removeScopes(myKeyNames, getScopeName(idx), myProject);
|
||||
refreshAggregatedScopes();
|
||||
myTableSettings.onScopeRemoved(getRowCount());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user