mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
XValueChildrenProvider: reduce memory usage — avoid names list
WEB-8440 Debugger: Variables view: incorrect folding of variables
This commit is contained in:
@@ -21,7 +21,6 @@ import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Represents a node with children in a debugger tree. This interface isn't supposed to be implemented by a plugin.
|
||||
@@ -36,12 +35,7 @@ public interface XCompositeNode extends Obsolescent {
|
||||
* @param children child nodes to add
|
||||
* @param last <code>true</code> if all children added
|
||||
*/
|
||||
void addChildren(@NotNull XValueChildrenList children, final boolean last);
|
||||
|
||||
/**
|
||||
* @deprecated use {@link #addChildren(XValueChildrenList, boolean)} instead
|
||||
*/
|
||||
void addChildren(List<? extends XValue> children, final boolean last);
|
||||
void addChildren(@NotNull XValueChildrenProvider children, final boolean last);
|
||||
|
||||
/**
|
||||
* Add an ellipsis node ("...") indicating that the node has too many children. If user double-click on that node
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2011 JetBrains s.r.o.
|
||||
* Copyright 2000-2013 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.
|
||||
@@ -26,7 +26,7 @@ import java.util.List;
|
||||
/**
|
||||
* @author nik
|
||||
*/
|
||||
public class XValueChildrenList {
|
||||
public class XValueChildrenList extends XValueChildrenProvider {
|
||||
public static final XValueChildrenList EMPTY = new XValueChildrenList(Collections.<String>emptyList(), Collections.<XValue>emptyList());
|
||||
|
||||
private final List<String> myNames;
|
||||
@@ -56,14 +56,17 @@ public class XValueChildrenList {
|
||||
myValues.add(value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int size() {
|
||||
return myNames.size();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName(int i) {
|
||||
return myNames.get(i);
|
||||
}
|
||||
|
||||
@Override
|
||||
public XValue getValue(int i) {
|
||||
return myValues.get(i);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
/*
|
||||
* Copyright 2000-2013 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 com.intellij.xdebugger.frame;
|
||||
|
||||
public abstract class XValueChildrenProvider {
|
||||
public abstract String getName(int i);
|
||||
|
||||
public abstract XValue getValue(int i);
|
||||
|
||||
public abstract int size();
|
||||
}
|
||||
@@ -22,7 +22,7 @@ import org.jetbrains.annotations.NotNull;
|
||||
*/
|
||||
public abstract class XValueContainer {
|
||||
/**
|
||||
* Start computing children of the value. Call {@link XCompositeNode#addChildren(XValueChildrenList, boolean)} to add child nodes.
|
||||
* Start computing children of the value. Call {@link XCompositeNode#addChildren(XValueChildrenProvider, boolean)} to add child nodes.
|
||||
* Note that this method is called from the Event Dispatch thread so it should return quickly.
|
||||
* @param node node in the tree
|
||||
*/
|
||||
|
||||
@@ -92,13 +92,13 @@ public interface XValueNode extends Obsolescent {
|
||||
|
||||
/**
|
||||
* @deprecated use {@link #setPresentation(javax.swing.Icon, String, String, boolean)} instead. Names for values should be passed to
|
||||
* {@link XCompositeNode#addChildren(com.intellij.xdebugger.frame.XValueChildrenList, boolean)}
|
||||
* {@link XCompositeNode#addChildren(XValueChildrenProvider, boolean)}
|
||||
*/
|
||||
void setPresentation(@NonNls String name, @Nullable Icon icon, @NonNls @Nullable String type, @NonNls @NotNull String value, boolean hasChildren);
|
||||
|
||||
/**
|
||||
* @deprecated use {@link #setPresentation(javax.swing.Icon, String, String, String, boolean)} instead. Names for values should be passed to
|
||||
* {@link XCompositeNode#addChildren(com.intellij.xdebugger.frame.XValueChildrenList, boolean)}
|
||||
* {@link XCompositeNode#addChildren(XValueChildrenProvider, boolean)}
|
||||
*/
|
||||
void setPresentation(@NonNls String name, @Nullable Icon icon, @NonNls @Nullable String type, @NonNls @NotNull String separator, @NonNls @NotNull String value, boolean hasChildren);
|
||||
}
|
||||
|
||||
+5
-11
@@ -19,7 +19,10 @@ import com.intellij.ui.SimpleTextAttributes;
|
||||
import com.intellij.util.SmartList;
|
||||
import com.intellij.util.containers.ContainerUtil;
|
||||
import com.intellij.util.containers.SortedList;
|
||||
import com.intellij.xdebugger.frame.*;
|
||||
import com.intellij.xdebugger.frame.XCompositeNode;
|
||||
import com.intellij.xdebugger.frame.XDebuggerTreeNodeHyperlink;
|
||||
import com.intellij.xdebugger.frame.XValueChildrenProvider;
|
||||
import com.intellij.xdebugger.frame.XValueContainer;
|
||||
import com.intellij.xdebugger.impl.settings.XDebuggerSettingsManager;
|
||||
import com.intellij.xdebugger.impl.ui.DebuggerUIUtil;
|
||||
import com.intellij.xdebugger.impl.ui.XDebuggerUIConstants;
|
||||
@@ -77,7 +80,7 @@ public abstract class XValueContainerNode<ValueContainer extends XValueContainer
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addChildren(@NotNull final XValueChildrenList children, final boolean last) {
|
||||
public void addChildren(@NotNull final XValueChildrenProvider children, final boolean last) {
|
||||
DebuggerUIUtil.invokeLater(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
@@ -109,15 +112,6 @@ public abstract class XValueContainerNode<ValueContainer extends XValueContainer
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addChildren(final List<? extends XValue> children, final boolean last) {
|
||||
final XValueChildrenList list = new XValueChildrenList(children.size());
|
||||
for (XValue child : children) {
|
||||
list.add(null, child);
|
||||
}
|
||||
addChildren(list, last);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void tooManyChildren(final int remaining) {
|
||||
DebuggerUIUtil.invokeLater(new Runnable() {
|
||||
|
||||
@@ -2,7 +2,7 @@ package com.intellij.xdebugger;
|
||||
|
||||
import com.intellij.xdebugger.frame.XCompositeNode;
|
||||
import com.intellij.xdebugger.frame.XValue;
|
||||
import com.intellij.xdebugger.frame.XValueChildrenList;
|
||||
import com.intellij.xdebugger.frame.XValueChildrenProvider;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.ArrayList;
|
||||
@@ -12,7 +12,7 @@ public class XTestCompositeNode extends XTestContainer<XValue> implements XCompo
|
||||
private volatile boolean myAlreadySorted;
|
||||
|
||||
@Override
|
||||
public void addChildren(@NotNull XValueChildrenList children, boolean last) {
|
||||
public void addChildren(@NotNull XValueChildrenProvider children, boolean last) {
|
||||
final List<XValue> list = new ArrayList<XValue>();
|
||||
for (int i = 0; i < children.size(); i++) {
|
||||
list.add(children.getValue(i));
|
||||
|
||||
Reference in New Issue
Block a user