mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-08-04 23:05:47 +02:00
Cosmetics.
This commit is contained in:
parent
8241b40ddb
commit
774de9a0ea
11 changed files with 64 additions and 84 deletions
|
@ -50,7 +50,7 @@ import com.ibm.icu.text.MessageFormat;
|
||||||
* 0 | version number
|
* 0 | version number
|
||||||
* INT_SIZE | pointer to head of linked list of blocks of size MIN_BLOCK_DELTAS*BLOCK_SIZE_DELTA
|
* INT_SIZE | pointer to head of linked list of blocks of size MIN_BLOCK_DELTAS*BLOCK_SIZE_DELTA
|
||||||
* .. | ...
|
* .. | ...
|
||||||
* INT_SIZE * m (1) | pointer to head of linked list of blocks of size (m+MIN_BLOCK_DELTAS) * BLOCK_SIZE_DELTA
|
* INT_SIZE * m (1) | pointer to head of linked list of blocks of size (m + MIN_BLOCK_DELTAS) * BLOCK_SIZE_DELTA
|
||||||
* DATA_AREA | undefined (PDOM stores its own house-keeping data in this area)
|
* DATA_AREA | undefined (PDOM stores its own house-keeping data in this area)
|
||||||
*
|
*
|
||||||
* (1) where 2 <= m <= CHUNK_SIZE/BLOCK_SIZE_DELTA - MIN_BLOCK_DELTAS + 1
|
* (1) where 2 <= m <= CHUNK_SIZE/BLOCK_SIZE_DELTA - MIN_BLOCK_DELTAS + 1
|
||||||
|
@ -60,7 +60,7 @@ import com.ibm.icu.text.MessageFormat;
|
||||||
* offset content
|
* offset content
|
||||||
* _____________________________
|
* _____________________________
|
||||||
* 0 | size of block (negative indicates in use, positive unused) (2 bytes)
|
* 0 | size of block (negative indicates in use, positive unused) (2 bytes)
|
||||||
* PREV_OFFSET | pointer to prev block (of same size) (only in free blocks)
|
* PREV_OFFSET | pointer to previous block (of same size) (only in free blocks)
|
||||||
* NEXT_OFFSET | pointer to next block (of same size) (only in free blocks)
|
* NEXT_OFFSET | pointer to next block (of same size) (only in free blocks)
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
@ -68,7 +68,7 @@ public class Database {
|
||||||
// Public for tests only, you shouldn't need these.
|
// Public for tests only, you shouldn't need these.
|
||||||
public static final int INT_SIZE = 4;
|
public static final int INT_SIZE = 4;
|
||||||
public static final int CHUNK_SIZE = 1024 * 4;
|
public static final int CHUNK_SIZE = 1024 * 4;
|
||||||
public static final int OFFSET_IN_CHUNK_MASK= CHUNK_SIZE-1;
|
public static final int OFFSET_IN_CHUNK_MASK= CHUNK_SIZE - 1;
|
||||||
public static final int BLOCK_HEADER_SIZE= 2;
|
public static final int BLOCK_HEADER_SIZE= 2;
|
||||||
public static final int BLOCK_SIZE_DELTA_BITS = 3;
|
public static final int BLOCK_SIZE_DELTA_BITS = 3;
|
||||||
public static final int BLOCK_SIZE_DELTA= 1 << BLOCK_SIZE_DELTA_BITS;
|
public static final int BLOCK_SIZE_DELTA= 1 << BLOCK_SIZE_DELTA_BITS;
|
||||||
|
|
|
@ -93,8 +93,7 @@ class PDOMCTypedef extends PDOMBinding implements ITypedef, ITypeContainer, IInd
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,9 +6,9 @@
|
||||||
* http://www.eclipse.org/legal/epl-v10.html
|
* http://www.eclipse.org/legal/epl-v10.html
|
||||||
*
|
*
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* Doug Schaefer (QNX) - Initial API and implementation
|
* Doug Schaefer (QNX) - Initial API and implementation
|
||||||
* IBM Corporation
|
* IBM Corporation
|
||||||
* Markus Schorn (Wind River Systems)
|
* Markus Schorn (Wind River Systems)
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.cdt.internal.core.pdom.dom.c;
|
package org.eclipse.cdt.internal.core.pdom.dom.c;
|
||||||
|
|
||||||
|
@ -31,7 +31,6 @@ import org.eclipse.core.runtime.CoreException;
|
||||||
* Database representation for c-variables
|
* Database representation for c-variables
|
||||||
*/
|
*/
|
||||||
class PDOMCVariable extends PDOMBinding implements IVariable {
|
class PDOMCVariable extends PDOMBinding implements IVariable {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Offset of pointer to type information for this variable
|
* Offset of pointer to type information for this variable
|
||||||
* (relative to the beginning of the record).
|
* (relative to the beginning of the record).
|
||||||
|
|
|
@ -48,7 +48,8 @@ class PDOMCPPFriend extends PDOMNode {
|
||||||
|
|
||||||
public PDOMName getSpecifierName() throws CoreException {
|
public PDOMName getSpecifierName() throws CoreException {
|
||||||
long rec = getDB().getRecPtr(record + FRIEND_SPECIFIER);
|
long rec = getDB().getRecPtr(record + FRIEND_SPECIFIER);
|
||||||
if (rec != 0) return new PDOMName(getLinkage(), rec);
|
if (rec != 0)
|
||||||
|
return new PDOMName(getLinkage(), rec);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -6,16 +6,15 @@
|
||||||
* http://www.eclipse.org/legal/epl-v10.html
|
* http://www.eclipse.org/legal/epl-v10.html
|
||||||
*
|
*
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* Markus Schorn - initial API and implementation
|
* Markus Schorn - initial API and implementation
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
|
|
||||||
package org.eclipse.cdt.internal.ui.typehierarchy;
|
package org.eclipse.cdt.internal.ui.typehierarchy;
|
||||||
|
|
||||||
import org.eclipse.jface.viewers.ITreeContentProvider;
|
import org.eclipse.jface.viewers.ITreeContentProvider;
|
||||||
import org.eclipse.jface.viewers.Viewer;
|
import org.eclipse.jface.viewers.Viewer;
|
||||||
|
|
||||||
public class THContentProvider implements ITreeContentProvider {
|
public class THContentProvider implements ITreeContentProvider {
|
||||||
private static final Object[] NO_CHILDREN= new Object[0];
|
private static final Object[] NO_CHILDREN= {};
|
||||||
private THHierarchyModel fModel;
|
private THHierarchyModel fModel;
|
||||||
|
|
||||||
public THContentProvider() {
|
public THContentProvider() {
|
||||||
|
|
|
@ -39,10 +39,10 @@ import org.eclipse.cdt.internal.ui.viewsupport.IndexUI;
|
||||||
|
|
||||||
class THGraph {
|
class THGraph {
|
||||||
private static final ICElement[] NO_MEMBERS = {};
|
private static final ICElement[] NO_MEMBERS = {};
|
||||||
private THGraphNode fInputNode= null;
|
private THGraphNode fInputNode;
|
||||||
private HashSet<THGraphNode> fRootNodes= new HashSet<THGraphNode>();
|
private HashSet<THGraphNode> fRootNodes= new HashSet<>();
|
||||||
private HashSet<THGraphNode> fLeaveNodes= new HashSet<THGraphNode>();
|
private HashSet<THGraphNode> fLeafNodes= new HashSet<>();
|
||||||
private HashMap<ICElement, THGraphNode> fNodes= new HashMap<ICElement, THGraphNode>();
|
private HashMap<ICElement, THGraphNode> fNodes= new HashMap<>();
|
||||||
private boolean fFileIsIndexed;
|
private boolean fFileIsIndexed;
|
||||||
|
|
||||||
public THGraph() {
|
public THGraph() {
|
||||||
|
@ -63,7 +63,7 @@ class THGraph {
|
||||||
node= new THGraphNode(input);
|
node= new THGraphNode(input);
|
||||||
fNodes.put(input, node);
|
fNodes.put(input, node);
|
||||||
fRootNodes.add(node);
|
fRootNodes.add(node);
|
||||||
fLeaveNodes.add(node);
|
fLeafNodes.add(node);
|
||||||
}
|
}
|
||||||
return node;
|
return node;
|
||||||
}
|
}
|
||||||
|
@ -76,7 +76,7 @@ class THGraph {
|
||||||
from.startEdge(edge);
|
from.startEdge(edge);
|
||||||
to.endEdge(edge);
|
to.endEdge(edge);
|
||||||
fRootNodes.remove(to);
|
fRootNodes.remove(to);
|
||||||
fLeaveNodes.remove(from);
|
fLeafNodes.remove(from);
|
||||||
return edge;
|
return edge;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -88,8 +88,8 @@ class THGraph {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
HashSet<THGraphNode> checked= new HashSet<THGraphNode>();
|
HashSet<THGraphNode> checked= new HashSet<>();
|
||||||
ArrayList<THGraphNode> stack= new ArrayList<THGraphNode>();
|
ArrayList<THGraphNode> stack= new ArrayList<>();
|
||||||
stack.add(to);
|
stack.add(to);
|
||||||
|
|
||||||
while (!stack.isEmpty()) {
|
while (!stack.isEmpty()) {
|
||||||
|
@ -119,8 +119,8 @@ class THGraph {
|
||||||
return fRootNodes;
|
return fRootNodes;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Collection<THGraphNode> getLeaveNodes() {
|
public Collection<THGraphNode> getLeafNodes() {
|
||||||
return fLeaveNodes;
|
return fLeafNodes;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void defineInputNode(IIndex index, ICElement input) {
|
public void defineInputNode(IIndex index, ICElement input) {
|
||||||
|
@ -141,8 +141,8 @@ class THGraph {
|
||||||
if (fInputNode == null) {
|
if (fInputNode == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
HashSet<ICElement> handled= new HashSet<ICElement>();
|
HashSet<ICElement> handled= new HashSet<>();
|
||||||
ArrayList<ICElement> stack= new ArrayList<ICElement>();
|
ArrayList<ICElement> stack= new ArrayList<>();
|
||||||
stack.add(fInputNode.getElement());
|
stack.add(fInputNode.getElement());
|
||||||
handled.add(fInputNode.getElement());
|
handled.add(fInputNode.getElement());
|
||||||
while (!stack.isEmpty()) {
|
while (!stack.isEmpty()) {
|
||||||
|
@ -204,8 +204,8 @@ class THGraph {
|
||||||
if (fInputNode == null) {
|
if (fInputNode == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
HashSet<ICElement> handled= new HashSet<ICElement>();
|
HashSet<ICElement> handled= new HashSet<>();
|
||||||
ArrayList<ICElement> stack= new ArrayList<ICElement>();
|
ArrayList<ICElement> stack= new ArrayList<>();
|
||||||
ICElement element = fInputNode.getElement();
|
ICElement element = fInputNode.getElement();
|
||||||
stack.add(element);
|
stack.add(element);
|
||||||
handled.add(element);
|
handled.add(element);
|
||||||
|
@ -249,7 +249,7 @@ class THGraph {
|
||||||
|
|
||||||
private void addMembers(IIndex index, THGraphNode graphNode, IBinding binding) throws CoreException {
|
private void addMembers(IIndex index, THGraphNode graphNode, IBinding binding) throws CoreException {
|
||||||
if (graphNode.getMembers(false) == null) {
|
if (graphNode.getMembers(false) == null) {
|
||||||
ArrayList<ICElement> memberList= new ArrayList<ICElement>();
|
ArrayList<ICElement> memberList= new ArrayList<>();
|
||||||
if (binding instanceof ICPPClassType) {
|
if (binding instanceof ICPPClassType) {
|
||||||
ICPPClassType ct= (ICPPClassType) binding;
|
ICPPClassType ct= (ICPPClassType) binding;
|
||||||
IBinding[] members= ClassTypeHelper.getDeclaredFields(ct, null);
|
IBinding[] members= ClassTypeHelper.getDeclaredFields(ct, null);
|
||||||
|
@ -285,7 +285,7 @@ class THGraph {
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isTrivial() {
|
public boolean isTrivial() {
|
||||||
return fNodes.size() < 2;
|
return fNodes.size() <= 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isFileIndexed() {
|
public boolean isFileIndexed() {
|
||||||
|
|
|
@ -11,10 +11,8 @@
|
||||||
package org.eclipse.cdt.internal.ui.typehierarchy;
|
package org.eclipse.cdt.internal.ui.typehierarchy;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.Iterator;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.eclipse.cdt.core.model.ICElement;
|
import org.eclipse.cdt.core.model.ICElement;
|
||||||
|
@ -23,7 +21,7 @@ class THGraphNode {
|
||||||
private List<THGraphEdge> fOutgoing= Collections.emptyList();
|
private List<THGraphEdge> fOutgoing= Collections.emptyList();
|
||||||
private List<THGraphEdge> fIncoming= Collections.emptyList();
|
private List<THGraphEdge> fIncoming= Collections.emptyList();
|
||||||
private ICElement fElement;
|
private ICElement fElement;
|
||||||
private ICElement[] fMembers= null;
|
private ICElement[] fMembers;
|
||||||
|
|
||||||
THGraphNode(ICElement element) {
|
THGraphNode(ICElement element) {
|
||||||
fElement= element;
|
fElement= element;
|
||||||
|
@ -46,7 +44,7 @@ class THGraphNode {
|
||||||
case 0:
|
case 0:
|
||||||
return Collections.singletonList(elem);
|
return Collections.singletonList(elem);
|
||||||
case 1:
|
case 1:
|
||||||
list= new ArrayList<THGraphEdge>(list);
|
list= new ArrayList<>(list);
|
||||||
list.add(elem);
|
list.add(elem);
|
||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
|
@ -70,7 +68,7 @@ class THGraphNode {
|
||||||
if (!addInherited) {
|
if (!addInherited) {
|
||||||
return fMembers;
|
return fMembers;
|
||||||
}
|
}
|
||||||
ArrayList<ICElement> list= new ArrayList<ICElement>();
|
ArrayList<ICElement> list= new ArrayList<>();
|
||||||
collectMembers(new HashSet<THGraphNode>(), list);
|
collectMembers(new HashSet<THGraphNode>(), list);
|
||||||
return list.toArray(new ICElement[list.size()]);
|
return list.toArray(new ICElement[list.size()]);
|
||||||
}
|
}
|
||||||
|
@ -78,11 +76,10 @@ class THGraphNode {
|
||||||
private void collectMembers(HashSet<THGraphNode> visited, List<ICElement> list) {
|
private void collectMembers(HashSet<THGraphNode> visited, List<ICElement> list) {
|
||||||
if (visited.add(this)) {
|
if (visited.add(this)) {
|
||||||
if (fMembers != null) {
|
if (fMembers != null) {
|
||||||
list.addAll(Arrays.asList(fMembers));
|
Collections.addAll(list, fMembers);
|
||||||
}
|
}
|
||||||
List<THGraphEdge> bases= getOutgoing();
|
List<THGraphEdge> bases= getOutgoing();
|
||||||
for (Iterator<THGraphEdge> iterator = bases.iterator(); iterator.hasNext();) {
|
for (THGraphEdge edge : bases) {
|
||||||
THGraphEdge edge = iterator.next();
|
|
||||||
edge.getEndNode().collectMembers(visited, list);
|
edge.getEndNode().collectMembers(visited, list);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -179,15 +179,15 @@ class THHierarchyModel {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
boolean fwd= fHierarchyKind == SUPER_TYPE_HIERARCHY;
|
boolean fwd= fHierarchyKind == SUPER_TYPE_HIERARCHY;
|
||||||
ArrayList<THNode> stack= new ArrayList<THNode>();
|
ArrayList<THNode> stack= new ArrayList<>();
|
||||||
ArrayList<THNode> roots= new ArrayList<THNode>();
|
ArrayList<THNode> roots= new ArrayList<>();
|
||||||
ArrayList<THNode> leafs= new ArrayList<THNode>();
|
ArrayList<THNode> leafs= new ArrayList<>();
|
||||||
|
|
||||||
THGraphNode inputNode= fGraph.getInputNode();
|
THGraphNode inputNode= fGraph.getInputNode();
|
||||||
Collection<THGraphNode> groots;
|
Collection<THGraphNode> groots;
|
||||||
|
|
||||||
if (fHierarchyKind == TYPE_HIERARCHY) {
|
if (fHierarchyKind == TYPE_HIERARCHY) {
|
||||||
groots= fGraph.getLeaveNodes();
|
groots= fGraph.getLeafNodes();
|
||||||
} else {
|
} else {
|
||||||
THGraphNode node= fGraph.getInputNode();
|
THGraphNode node= fGraph.getInputNode();
|
||||||
if (node != null) {
|
if (node != null) {
|
||||||
|
@ -204,7 +204,7 @@ class THHierarchyModel {
|
||||||
}
|
}
|
||||||
|
|
||||||
while (!stack.isEmpty()) {
|
while (!stack.isEmpty()) {
|
||||||
THNode node= stack.remove(stack.size()-1);
|
THNode node= stack.remove(stack.size() - 1);
|
||||||
THGraphNode gnode= fGraph.getNode(node.getElement());
|
THGraphNode gnode= fGraph.getNode(node.getElement());
|
||||||
List<THGraphEdge> edges= fwd ? gnode.getOutgoing() : gnode.getIncoming();
|
List<THGraphEdge> edges= fwd ? gnode.getOutgoing() : gnode.getIncoming();
|
||||||
if (edges.isEmpty()) {
|
if (edges.isEmpty()) {
|
||||||
|
@ -219,7 +219,7 @@ class THHierarchyModel {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
fRootNodes= roots.toArray(new THNode[roots.size()]);
|
fRootNodes= roots.toArray(new THNode[roots.size()]);
|
||||||
removeFilteredLeafs(fRootNodes);
|
removeFilteredLeaves(fRootNodes);
|
||||||
fSelectedTypeNode= findSelection(fRootNodes);
|
fSelectedTypeNode= findSelection(fRootNodes);
|
||||||
if (fSelectedTypeNode != null) {
|
if (fSelectedTypeNode != null) {
|
||||||
fTypeToSelect= fSelectedTypeNode.getElement();
|
fTypeToSelect= fSelectedTypeNode.getElement();
|
||||||
|
@ -231,15 +231,15 @@ class THHierarchyModel {
|
||||||
removeNonImplementorLeaves(fRootNodes);
|
removeNonImplementorLeaves(fRootNodes);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void removeFilteredLeafs(THNode[] rootNodes) {
|
private void removeFilteredLeaves(THNode[] rootNodes) {
|
||||||
for (THNode node : rootNodes) {
|
for (THNode node : rootNodes) {
|
||||||
node.removeFilteredLeafs();
|
node.removeFilteredLeaves();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void removeNonImplementorLeaves(THNode[] rootNodes) {
|
private void removeNonImplementorLeaves(THNode[] rootNodes) {
|
||||||
for (THNode node : rootNodes) {
|
for (THNode node : rootNodes) {
|
||||||
node.removeNonImplementorLeafs();
|
node.removeNonImplementorLeaves();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -394,8 +394,7 @@ class THHierarchyModel {
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean isImplementor(ICElement element) {
|
private boolean isImplementor(ICElement element) {
|
||||||
if (element == null
|
if (element == null || fSelectedMember == null || fMemberSignatureToSelect == null) {
|
||||||
|| fSelectedMember == null || fMemberSignatureToSelect == null) {
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
THGraphNode gnode= fGraph.getNode(element);
|
THGraphNode gnode= fGraph.getNode(element);
|
||||||
|
|
|
@ -9,7 +9,6 @@
|
||||||
* Markus Schorn - initial API and implementation
|
* Markus Schorn - initial API and implementation
|
||||||
* Patrick Hofer [bug 325488]
|
* Patrick Hofer [bug 325488]
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
|
|
||||||
package org.eclipse.cdt.internal.ui.typehierarchy;
|
package org.eclipse.cdt.internal.ui.typehierarchy;
|
||||||
|
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
|
@ -47,11 +46,10 @@ import org.eclipse.cdt.internal.ui.text.AbstractInformationControl;
|
||||||
import org.eclipse.cdt.internal.ui.viewsupport.EditorOpener;
|
import org.eclipse.cdt.internal.ui.viewsupport.EditorOpener;
|
||||||
|
|
||||||
public class THInformationControl extends AbstractInformationControl implements ITHModelPresenter {
|
public class THInformationControl extends AbstractInformationControl implements ITHModelPresenter {
|
||||||
|
|
||||||
private THHierarchyModel fModel;
|
private THHierarchyModel fModel;
|
||||||
private THLabelProvider fHierarchyLabelProvider;
|
private THLabelProvider fHierarchyLabelProvider;
|
||||||
private TreeViewer fHierarchyTreeViewer;
|
private TreeViewer fHierarchyTreeViewer;
|
||||||
private boolean fDisposed= false;
|
private boolean fDisposed;
|
||||||
private KeyAdapter fKeyAdapter;
|
private KeyAdapter fKeyAdapter;
|
||||||
|
|
||||||
public THInformationControl(Shell parent, int shellStyle, int treeStyle) {
|
public THInformationControl(Shell parent, int shellStyle, int treeStyle) {
|
||||||
|
@ -265,10 +263,11 @@ public class THInformationControl extends AbstractInformationControl implements
|
||||||
protected void selectFirstMatch() {
|
protected void selectFirstMatch() {
|
||||||
Tree tree= fHierarchyTreeViewer.getTree();
|
Tree tree= fHierarchyTreeViewer.getTree();
|
||||||
Object element= findElement(tree.getItems());
|
Object element= findElement(tree.getItems());
|
||||||
if (element != null)
|
if (element != null) {
|
||||||
fHierarchyTreeViewer.setSelection(new StructuredSelection(element), true);
|
fHierarchyTreeViewer.setSelection(new StructuredSelection(element), true);
|
||||||
else
|
} else {
|
||||||
fHierarchyTreeViewer.setSelection(StructuredSelection.EMPTY);
|
fHierarchyTreeViewer.setSelection(StructuredSelection.EMPTY);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void toggleHierarchy() {
|
protected void toggleHierarchy() {
|
||||||
|
@ -301,7 +300,7 @@ public class THInformationControl extends AbstractInformationControl implements
|
||||||
Object item= item2.getData();
|
Object item= item2.getData();
|
||||||
THNode element= null;
|
THNode element= null;
|
||||||
if (item instanceof THNode) {
|
if (item instanceof THNode) {
|
||||||
element= (THNode)item;
|
element= (THNode) item;
|
||||||
if (fStringMatcher == null)
|
if (fStringMatcher == null)
|
||||||
return element;
|
return element;
|
||||||
|
|
||||||
|
|
|
@ -20,8 +20,6 @@ import org.eclipse.core.runtime.IAdaptable;
|
||||||
|
|
||||||
import org.eclipse.cdt.core.model.ICElement;
|
import org.eclipse.cdt.core.model.ICElement;
|
||||||
|
|
||||||
import org.eclipse.cdt.internal.ui.util.CoreUtility;
|
|
||||||
|
|
||||||
public class THNode implements IAdaptable {
|
public class THNode implements IAdaptable {
|
||||||
private THNode fParent;
|
private THNode fParent;
|
||||||
private ICElement fElement;
|
private ICElement fElement;
|
||||||
|
@ -32,26 +30,15 @@ public class THNode implements IAdaptable {
|
||||||
private boolean fIsImplementor;
|
private boolean fIsImplementor;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a new node for the include browser
|
* Creates a new node for the type hierarchy browser.
|
||||||
*/
|
*/
|
||||||
public THNode(THNode parent, ICElement decl) {
|
public THNode(THNode parent, ICElement decl) {
|
||||||
fParent= parent;
|
fParent= parent;
|
||||||
fElement= decl;
|
fElement= decl;
|
||||||
fHashCode= computeHashCode();
|
fHashCode= Objects.hash(fParent, fElement);
|
||||||
}
|
}
|
||||||
|
|
||||||
private int computeHashCode() {
|
@Override
|
||||||
int hashCode= 0;
|
|
||||||
if (fParent != null) {
|
|
||||||
hashCode= fParent.hashCode() * 31;
|
|
||||||
}
|
|
||||||
if (fElement != null) {
|
|
||||||
hashCode+= fElement.hashCode();
|
|
||||||
}
|
|
||||||
return hashCode;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int hashCode() {
|
public int hashCode() {
|
||||||
return fHashCode;
|
return fHashCode;
|
||||||
}
|
}
|
||||||
|
@ -71,7 +58,7 @@ public class THNode implements IAdaptable {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the parent node or <code>null</code> for the root node.
|
* Returns the parent node or {@code null} for the root node.
|
||||||
*/
|
*/
|
||||||
public THNode getParent() {
|
public THNode getParent() {
|
||||||
return fParent;
|
return fParent;
|
||||||
|
@ -100,7 +87,7 @@ public class THNode implements IAdaptable {
|
||||||
|
|
||||||
public void addChild(THNode childNode) {
|
public void addChild(THNode childNode) {
|
||||||
if (fChildren.isEmpty()) {
|
if (fChildren.isEmpty()) {
|
||||||
fChildren= new ArrayList<THNode>();
|
fChildren= new ArrayList<>();
|
||||||
}
|
}
|
||||||
fChildren.add(childNode);
|
fChildren.add(childNode);
|
||||||
}
|
}
|
||||||
|
@ -121,20 +108,20 @@ public class THNode implements IAdaptable {
|
||||||
return fIsImplementor;
|
return fIsImplementor;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void removeFilteredLeafs() {
|
public void removeFilteredLeaves() {
|
||||||
for (Iterator<THNode> iterator = fChildren.iterator(); iterator.hasNext();) {
|
for (Iterator<THNode> iterator = fChildren.iterator(); iterator.hasNext();) {
|
||||||
THNode child = iterator.next();
|
THNode child = iterator.next();
|
||||||
child.removeFilteredLeafs();
|
child.removeFilteredLeaves();
|
||||||
if (child.isFiltered() && !child.hasChildren()) {
|
if (child.isFiltered() && !child.hasChildren()) {
|
||||||
iterator.remove();
|
iterator.remove();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void removeNonImplementorLeafs() {
|
public void removeNonImplementorLeaves() {
|
||||||
for (Iterator<THNode> iterator = fChildren.iterator(); iterator.hasNext();) {
|
for (Iterator<THNode> iterator = fChildren.iterator(); iterator.hasNext();) {
|
||||||
THNode child = iterator.next();
|
THNode child = iterator.next();
|
||||||
child.removeNonImplementorLeafs();
|
child.removeNonImplementorLeaves();
|
||||||
if (!child.isImplementor() && !child.hasChildren()) {
|
if (!child.isImplementor() && !child.hasChildren()) {
|
||||||
iterator.remove();
|
iterator.remove();
|
||||||
}
|
}
|
||||||
|
|
|
@ -98,7 +98,7 @@ public class LRCPPTests extends AST2CPPTests {
|
||||||
|
|
||||||
//DeclType
|
//DeclType
|
||||||
@Override
|
@Override
|
||||||
public void testDeclType_294730() throws Exception {}
|
public void testDecltype_294730() throws Exception {}
|
||||||
|
|
||||||
//Defaulted and deleted functions
|
//Defaulted and deleted functions
|
||||||
@Override
|
@Override
|
||||||
|
|
Loading…
Add table
Reference in a new issue