simplify — get rid of "Show functions"

This commit is contained in:
Vladimir Krivosheev
2015-04-14 17:51:21 +02:00
parent 1c046432d4
commit 6583698e7a
4 changed files with 52 additions and 7 deletions
@@ -1,3 +1,18 @@
/*
* Copyright 2000-2015 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jetbrains.debugger;
import org.jetbrains.annotations.NotNull;
@@ -6,7 +21,7 @@ import org.jetbrains.annotations.Nullable;
import java.util.Collection;
public interface MemberFilter {
boolean isMemberVisible(@NotNull Variable variable, boolean filterFunctions);
boolean isMemberVisible(@NotNull Variable variable);
@NotNull
Collection<Variable> getAdditionalVariables();
@@ -1,3 +1,18 @@
/*
* Copyright 2000-2015 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jetbrains.debugger;
import org.jetbrains.annotations.NotNull;
@@ -8,7 +23,7 @@ import java.util.Collections;
public abstract class MemberFilterBase implements MemberFilter {
@Override
public boolean isMemberVisible(@NotNull Variable variable, boolean filterFunctions) {
public boolean isMemberVisible(@NotNull Variable variable) {
return variable.isReadable();
}
@@ -431,7 +431,7 @@ public final class VariableView extends XNamedValue implements VariableContext {
}
private void computeArrayRanges(@NotNull List<Variable> properties, @NotNull XCompositeNode node) {
final List<Variable> variables = Variables.filterAndSort(properties, memberFilter, false);
final List<Variable> variables = Variables.filterAndSort(properties, memberFilter);
int count = variables.size();
int bucketSize = XCompositeNode.MAX_CHILDREN_TO_SHOW;
if (count <= bucketSize) {
@@ -1,3 +1,18 @@
/*
* Copyright 2000-2015 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jetbrains.debugger;
import com.intellij.openapi.util.text.StringUtil;
@@ -65,7 +80,7 @@ public final class Variables {
List<Variable> properties = new ArrayList<Variable>(variables.size() + additionalVariables.size());
List<Variable> functions = new SmartList<Variable>();
for (Variable variable : variables) {
if (memberFilter.isMemberVisible(variable, false)) {
if (memberFilter.isMemberVisible(variable)) {
Value value = variable.getValue();
if (value != null &&
value.getType() == ValueType.FUNCTION &&
@@ -112,7 +127,7 @@ public final class Variables {
@NotNull MemberFilter memberFilter,
int maxChildrenToAdd,
boolean defaultIsLast) {
List<Variable> list = filterAndSort(variables, memberFilter, true);
List<Variable> list = filterAndSort(variables, memberFilter);
if (list.isEmpty()) {
if (defaultIsLast) {
node.addChildren(XValueChildrenList.EMPTY, true);
@@ -133,7 +148,7 @@ public final class Variables {
}
@NotNull
public static List<Variable> filterAndSort(@NotNull List<Variable> variables, @NotNull MemberFilter memberFilter, boolean filterFunctions) {
public static List<Variable> filterAndSort(@NotNull List<Variable> variables, @NotNull MemberFilter memberFilter) {
if (variables.isEmpty()) {
return Collections.emptyList();
}
@@ -141,7 +156,7 @@ public final class Variables {
Collection<Variable> additionalVariables = memberFilter.getAdditionalVariables();
List<Variable> result = new ArrayList<Variable>(variables.size() + additionalVariables.size());
for (Variable variable : variables) {
if (memberFilter.isMemberVisible(variable, filterFunctions)) {
if (memberFilter.isMemberVisible(variable)) {
result.add(variable);
}
}