mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-08-11 02:05:39 +02:00
Type Hierarchy: support for working-sets
This commit is contained in:
parent
b2b9d11098
commit
7bbaad75fa
12 changed files with 162 additions and 77 deletions
BIN
core/org.eclipse.cdt.ui/icons/obj16/classfo_obj.gif
Normal file
BIN
core/org.eclipse.cdt.ui/icons/obj16/classfo_obj.gif
Normal file
Binary file not shown.
After Width: | Height: | Size: 260 B |
BIN
core/org.eclipse.cdt.ui/icons/obj16/enumfo_obj.gif
Normal file
BIN
core/org.eclipse.cdt.ui/icons/obj16/enumfo_obj.gif
Normal file
Binary file not shown.
After Width: | Height: | Size: 250 B |
BIN
core/org.eclipse.cdt.ui/icons/obj16/structfo_obj.GIF
Normal file
BIN
core/org.eclipse.cdt.ui/icons/obj16/structfo_obj.GIF
Normal file
Binary file not shown.
After Width: | Height: | Size: 959 B |
BIN
core/org.eclipse.cdt.ui/icons/obj16/typedeffo_obj.gif
Normal file
BIN
core/org.eclipse.cdt.ui/icons/obj16/typedeffo_obj.gif
Normal file
Binary file not shown.
After Width: | Height: | Size: 947 B |
BIN
core/org.eclipse.cdt.ui/icons/obj16/unionfo_obj.gif
Normal file
BIN
core/org.eclipse.cdt.ui/icons/obj16/unionfo_obj.gif
Normal file
Binary file not shown.
After Width: | Height: | Size: 957 B |
|
@ -53,12 +53,17 @@ public class CPluginImages {
|
||||||
public static final String IMG_OBJS_VARIABLE= NAME_PREFIX + "variable_obj.gif"; //$NON-NLS-1$
|
public static final String IMG_OBJS_VARIABLE= NAME_PREFIX + "variable_obj.gif"; //$NON-NLS-1$
|
||||||
public static final String IMG_OBJS_LOCAL_VARIABLE= NAME_PREFIX + "variable_local_obj.gif"; //$NON-NLS-1$
|
public static final String IMG_OBJS_LOCAL_VARIABLE= NAME_PREFIX + "variable_local_obj.gif"; //$NON-NLS-1$
|
||||||
public static final String IMG_OBJS_CLASS= NAME_PREFIX + "class_obj.gif"; //$NON-NLS-1$
|
public static final String IMG_OBJS_CLASS= NAME_PREFIX + "class_obj.gif"; //$NON-NLS-1$
|
||||||
|
public static final String IMG_OBJS_CLASS_ALT= NAME_PREFIX + "classfo_obj.gif"; //$NON-NLS-1$
|
||||||
public static final String IMG_OBJS_NAMESPACE= NAME_PREFIX + "namespace_obj.gif"; //$NON-NLS-1$
|
public static final String IMG_OBJS_NAMESPACE= NAME_PREFIX + "namespace_obj.gif"; //$NON-NLS-1$
|
||||||
public static final String IMG_OBJS_USING= NAME_PREFIX + "using_obj.gif"; //$NON-NLS-1$
|
public static final String IMG_OBJS_USING= NAME_PREFIX + "using_obj.gif"; //$NON-NLS-1$
|
||||||
public static final String IMG_OBJS_STRUCT= NAME_PREFIX + "struct_obj.gif"; //$NON-NLS-1$
|
public static final String IMG_OBJS_STRUCT= NAME_PREFIX + "struct_obj.gif"; //$NON-NLS-1$
|
||||||
|
public static final String IMG_OBJS_STRUCT_ALT= NAME_PREFIX + "structfo_obj.gif"; //$NON-NLS-1$
|
||||||
public static final String IMG_OBJS_UNION= NAME_PREFIX + "union_obj.gif"; //$NON-NLS-1$
|
public static final String IMG_OBJS_UNION= NAME_PREFIX + "union_obj.gif"; //$NON-NLS-1$
|
||||||
|
public static final String IMG_OBJS_UNION_ALT= NAME_PREFIX + "unionfo_obj.gif"; //$NON-NLS-1$
|
||||||
public static final String IMG_OBJS_TYPEDEF= NAME_PREFIX + "typedef_obj.gif"; //$NON-NLS-1$
|
public static final String IMG_OBJS_TYPEDEF= NAME_PREFIX + "typedef_obj.gif"; //$NON-NLS-1$
|
||||||
|
public static final String IMG_OBJS_TYPEDEF_ALT= NAME_PREFIX + "typedeffo_obj.gif"; //$NON-NLS-1$
|
||||||
public static final String IMG_OBJS_ENUMERATION= NAME_PREFIX + "enum_obj.gif"; //$NON-NLS-1$
|
public static final String IMG_OBJS_ENUMERATION= NAME_PREFIX + "enum_obj.gif"; //$NON-NLS-1$
|
||||||
|
public static final String IMG_OBJS_ENUMERATION_ALT= NAME_PREFIX + "enumfo_obj.gif"; //$NON-NLS-1$
|
||||||
public static final String IMG_OBJS_UNKNOWN_TYPE= NAME_PREFIX + "unknown_type_obj.gif"; //$NON-NLS-1$
|
public static final String IMG_OBJS_UNKNOWN_TYPE= NAME_PREFIX + "unknown_type_obj.gif"; //$NON-NLS-1$
|
||||||
public static final String IMG_OBJS_ENUMERATOR= NAME_PREFIX + "enumerator_obj.gif"; //$NON-NLS-1$
|
public static final String IMG_OBJS_ENUMERATOR= NAME_PREFIX + "enumerator_obj.gif"; //$NON-NLS-1$
|
||||||
public static final String IMG_OBJS_FUNCTION= NAME_PREFIX + "function_obj.gif"; //$NON-NLS-1$
|
public static final String IMG_OBJS_FUNCTION= NAME_PREFIX + "function_obj.gif"; //$NON-NLS-1$
|
||||||
|
@ -139,7 +144,13 @@ public class CPluginImages {
|
||||||
public static final ImageDescriptor DESC_OBJS_PROTECTED_FIELD= createManaged(T_OBJ, IMG_OBJS_PROTECTED_FIELD);
|
public static final ImageDescriptor DESC_OBJS_PROTECTED_FIELD= createManaged(T_OBJ, IMG_OBJS_PROTECTED_FIELD);
|
||||||
public static final ImageDescriptor DESC_OBJS_PRIVATE_FIELD= createManaged(T_OBJ, IMG_OBJS_PRIVATE_FIELD);
|
public static final ImageDescriptor DESC_OBJS_PRIVATE_FIELD= createManaged(T_OBJ, IMG_OBJS_PRIVATE_FIELD);
|
||||||
public static final ImageDescriptor DESC_OBJS_KEYWORD= createManaged(T_OBJ, IMG_OBJS_KEYWORD);
|
public static final ImageDescriptor DESC_OBJS_KEYWORD= createManaged(T_OBJ, IMG_OBJS_KEYWORD);
|
||||||
|
|
||||||
|
public static final ImageDescriptor DESC_OBJS_CLASS_ALT= createManaged(T_OBJ, IMG_OBJS_CLASS_ALT);
|
||||||
|
public static final ImageDescriptor DESC_OBJS_STRUCT_ALT= createManaged(T_OBJ, IMG_OBJS_STRUCT_ALT);
|
||||||
|
public static final ImageDescriptor DESC_OBJS_UNION_ALT= createManaged(T_OBJ, IMG_OBJS_UNION_ALT);
|
||||||
|
public static final ImageDescriptor DESC_OBJS_TYPEDEF_ALT= createManaged(T_OBJ, IMG_OBJS_TYPEDEF_ALT);
|
||||||
|
public static final ImageDescriptor DESC_OBJS_ENUMERATION_ALT= createManaged(T_OBJ, IMG_OBJS_ENUMERATION_ALT);
|
||||||
|
|
||||||
public static final ImageDescriptor DESC_OBJS_DECLARARION= createManaged(T_OBJ, IMG_OBJS_DECLARATION);
|
public static final ImageDescriptor DESC_OBJS_DECLARARION= createManaged(T_OBJ, IMG_OBJS_DECLARATION);
|
||||||
public static final ImageDescriptor DESC_OBJS_VAR_DECLARARION= createManaged(T_OBJ, IMG_OBJS_VAR_DECLARATION);
|
public static final ImageDescriptor DESC_OBJS_VAR_DECLARARION= createManaged(T_OBJ, IMG_OBJS_VAR_DECLARATION);
|
||||||
public static final ImageDescriptor DESC_OBJS_INCLUDE= createManaged(T_OBJ, IMG_OBJS_INCLUDE);
|
public static final ImageDescriptor DESC_OBJS_INCLUDE= createManaged(T_OBJ, IMG_OBJS_INCLUDE);
|
||||||
|
|
|
@ -168,8 +168,8 @@ class THGraph {
|
||||||
IName name= base.getBaseClassSpecifierName();
|
IName name= base.getBaseClassSpecifierName();
|
||||||
IBinding basecl= name != null ? index.findBinding(name) : base.getBaseClass();
|
IBinding basecl= name != null ? index.findBinding(name) : base.getBaseClass();
|
||||||
ICElementHandle[] baseElems= IndexUI.findRepresentative(index, basecl);
|
ICElementHandle[] baseElems= IndexUI.findRepresentative(index, basecl);
|
||||||
if (baseElems.length > 0) {
|
for (int j = 0; j < baseElems.length; j++) {
|
||||||
ICElementHandle baseElem= baseElems[0];
|
ICElementHandle baseElem = baseElems[j];
|
||||||
THGraphNode baseGraphNode= addNode(baseElem);
|
THGraphNode baseGraphNode= addNode(baseElem);
|
||||||
addMembers(index, baseGraphNode, basecl);
|
addMembers(index, baseGraphNode, basecl);
|
||||||
addEdge(graphNode, baseGraphNode);
|
addEdge(graphNode, baseGraphNode);
|
||||||
|
|
|
@ -33,6 +33,8 @@ import org.eclipse.cdt.core.model.ICElement;
|
||||||
import org.eclipse.cdt.core.model.ICProject;
|
import org.eclipse.cdt.core.model.ICProject;
|
||||||
import org.eclipse.cdt.ui.CUIPlugin;
|
import org.eclipse.cdt.ui.CUIPlugin;
|
||||||
|
|
||||||
|
import org.eclipse.cdt.internal.ui.viewsupport.WorkingSetFilterUI;
|
||||||
|
|
||||||
class THHierarchyModel {
|
class THHierarchyModel {
|
||||||
public class BackgroundJob extends Job {
|
public class BackgroundJob extends Job {
|
||||||
public BackgroundJob() {
|
public BackgroundJob() {
|
||||||
|
@ -67,6 +69,7 @@ class THHierarchyModel {
|
||||||
private Job fJob;
|
private Job fJob;
|
||||||
private Display fDisplay;
|
private Display fDisplay;
|
||||||
private THViewPart fView;
|
private THViewPart fView;
|
||||||
|
private WorkingSetFilterUI fFilter;
|
||||||
|
|
||||||
public THHierarchyModel(THViewPart view, Display display) {
|
public THHierarchyModel(THViewPart view, Display display) {
|
||||||
fDisplay= display;
|
fDisplay= display;
|
||||||
|
@ -103,9 +106,10 @@ class THHierarchyModel {
|
||||||
return fRootNodes;
|
return fRootNodes;
|
||||||
}
|
}
|
||||||
|
|
||||||
// public void setWorkingSetFilter(WorkingSetFilterUI filterUI) {
|
public void setWorkingSetFilter(WorkingSetFilterUI filterUI) {
|
||||||
//
|
fFilter= filterUI;
|
||||||
// }
|
computeNodes();
|
||||||
|
}
|
||||||
|
|
||||||
synchronized public void setInput(ICElement input, ICElement member) {
|
synchronized public void setInput(ICElement input, ICElement member) {
|
||||||
stopGraphComputation();
|
stopGraphComputation();
|
||||||
|
@ -178,10 +182,11 @@ class THHierarchyModel {
|
||||||
boolean fwd= fHierarchyKind == SUPER_TYPE_HIERARCHY;
|
boolean fwd= fHierarchyKind == SUPER_TYPE_HIERARCHY;
|
||||||
ArrayList stack= new ArrayList();
|
ArrayList stack= new ArrayList();
|
||||||
ArrayList roots= new ArrayList();
|
ArrayList roots= new ArrayList();
|
||||||
ArrayList leaves= new ArrayList();
|
ArrayList leafs= new ArrayList();
|
||||||
|
|
||||||
THNode[] newSelection= new THNode[2];
|
THGraphNode inputNode= fGraph.getInputNode();
|
||||||
Collection groots;
|
Collection groots;
|
||||||
|
|
||||||
if (fHierarchyKind == TYPE_HIERARCHY) {
|
if (fHierarchyKind == TYPE_HIERARCHY) {
|
||||||
groots= fGraph.getLeaveNodes();
|
groots= fGraph.getLeaveNodes();
|
||||||
}
|
}
|
||||||
|
@ -197,7 +202,7 @@ class THHierarchyModel {
|
||||||
|
|
||||||
for (Iterator iterator = groots.iterator(); iterator.hasNext();) {
|
for (Iterator iterator = groots.iterator(); iterator.hasNext();) {
|
||||||
THGraphNode gnode = (THGraphNode) iterator.next();
|
THGraphNode gnode = (THGraphNode) iterator.next();
|
||||||
THNode node = createNode(newSelection, null, gnode);
|
THNode node = createNode(null, gnode, inputNode);
|
||||||
roots.add(node);
|
roots.add(node);
|
||||||
stack.add(node);
|
stack.add(node);
|
||||||
}
|
}
|
||||||
|
@ -207,31 +212,68 @@ class THHierarchyModel {
|
||||||
THGraphNode gnode= fGraph.getNode(node.getElement());
|
THGraphNode gnode= fGraph.getNode(node.getElement());
|
||||||
List edges= fwd ? gnode.getOutgoing() : gnode.getIncoming();
|
List edges= fwd ? gnode.getOutgoing() : gnode.getIncoming();
|
||||||
if (edges.isEmpty()) {
|
if (edges.isEmpty()) {
|
||||||
leaves.add(node);
|
leafs.add(node);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
for (Iterator iterator = edges.iterator(); iterator.hasNext();) {
|
for (Iterator iterator = edges.iterator(); iterator.hasNext();) {
|
||||||
THGraphEdge edge = (THGraphEdge) iterator.next();
|
THGraphEdge edge = (THGraphEdge) iterator.next();
|
||||||
THGraphNode gchildNode= fwd ? edge.getEndNode() : edge.getStartNode();
|
THGraphNode gchildNode= fwd ? edge.getEndNode() : edge.getStartNode();
|
||||||
THNode childNode= createNode(newSelection, node, gchildNode);
|
THNode childNode= createNode(node, gchildNode, inputNode);
|
||||||
node.addChild(childNode);
|
node.addChild(childNode);
|
||||||
stack.add(childNode);
|
stack.add(childNode);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
fSelectedTypeNode= newSelection[0];
|
fRootNodes= (THNode[]) roots.toArray(new THNode[roots.size()]);
|
||||||
if (fSelectedTypeNode == null) {
|
removeFilteredLeafs(fRootNodes);
|
||||||
fSelectedTypeNode= newSelection[1];
|
fSelectedTypeNode= findSelection(fRootNodes);
|
||||||
}
|
|
||||||
if (fSelectedTypeNode != null) {
|
if (fSelectedTypeNode != null) {
|
||||||
fTypeToSelect= fSelectedTypeNode.getElement();
|
fTypeToSelect= fSelectedTypeNode.getElement();
|
||||||
updateSelectedMember();
|
updateSelectedMember();
|
||||||
}
|
}
|
||||||
|
|
||||||
fRootNodes= (THNode[]) roots.toArray(new THNode[roots.size()]);
|
|
||||||
updateImplementors();
|
updateImplementors();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void removeFilteredLeafs(THNode[] rootNodes) {
|
||||||
|
for (int i = 0; i < rootNodes.length; i++) {
|
||||||
|
THNode node = rootNodes[i];
|
||||||
|
node.removeFilteredLeafs();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private THNode findSelection(THNode[] searchme) {
|
||||||
|
THNode[] result= new THNode[2];
|
||||||
|
findSelection(searchme, result);
|
||||||
|
if (result[0] != null) {
|
||||||
|
return result[0];
|
||||||
|
}
|
||||||
|
return result[1];
|
||||||
|
}
|
||||||
|
|
||||||
|
private void findSelection(THNode[] seachme, THNode[] result) {
|
||||||
|
for (int i = 0; i < seachme.length; i++) {
|
||||||
|
findSelection(seachme[i], result);
|
||||||
|
if (result[0] != null) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void findSelection(THNode node, THNode[] result) {
|
||||||
|
if (node.equals(fSelectedTypeNode)) {
|
||||||
|
result[0]= node;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
else if (result[1] == null) {
|
||||||
|
if (node.getElement().equals(fTypeToSelect)) {
|
||||||
|
result[1]= node;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
THNode[] children= node.getChildren();
|
||||||
|
findSelection(children, result);
|
||||||
|
}
|
||||||
|
|
||||||
private void updateSelectedMember() {
|
private void updateSelectedMember() {
|
||||||
ICElement oldSelection= fSelectedMember;
|
ICElement oldSelection= fSelectedMember;
|
||||||
fSelectedMember= null;
|
fSelectedMember= null;
|
||||||
|
@ -257,18 +299,11 @@ class THHierarchyModel {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private THNode createNode(THNode[] newSelection, THNode parent, THGraphNode gnode) {
|
private THNode createNode(THNode parent, THGraphNode gnode, THGraphNode inputNode) {
|
||||||
ICElement element = gnode.getElement();
|
ICElement element = gnode.getElement();
|
||||||
THNode node= new THNode(parent, element);
|
THNode node= new THNode(parent, element);
|
||||||
if (newSelection[0] == null) {
|
if (gnode != inputNode && fFilter != null && !fFilter.isPartOfWorkingSet(element)) {
|
||||||
if (node.equals(fSelectedTypeNode)) {
|
node.setIsFiltered(true);
|
||||||
newSelection[0]= node;
|
|
||||||
}
|
|
||||||
else if (newSelection[1] == null) {
|
|
||||||
if (element.equals(fTypeToSelect)) {
|
|
||||||
newSelection[1]= node;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return node;
|
return node;
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,6 +26,7 @@ import org.eclipse.swt.widgets.Display;
|
||||||
import org.eclipse.cdt.core.model.ICElement;
|
import org.eclipse.cdt.core.model.ICElement;
|
||||||
import org.eclipse.cdt.ui.CElementImageDescriptor;
|
import org.eclipse.cdt.ui.CElementImageDescriptor;
|
||||||
|
|
||||||
|
import org.eclipse.cdt.internal.ui.viewsupport.CElementImageProvider;
|
||||||
import org.eclipse.cdt.internal.ui.viewsupport.CElementLabels;
|
import org.eclipse.cdt.internal.ui.viewsupport.CElementLabels;
|
||||||
import org.eclipse.cdt.internal.ui.viewsupport.CUILabelProvider;
|
import org.eclipse.cdt.internal.ui.viewsupport.CUILabelProvider;
|
||||||
import org.eclipse.cdt.internal.ui.viewsupport.ImageImageDescriptor;
|
import org.eclipse.cdt.internal.ui.viewsupport.ImageImageDescriptor;
|
||||||
|
@ -45,11 +46,15 @@ public class THLabelProvider extends LabelProvider implements IColorProvider {
|
||||||
}
|
}
|
||||||
|
|
||||||
public Image getImage(Object element) {
|
public Image getImage(Object element) {
|
||||||
if (element instanceof THNode) {
|
if (element instanceof THNode) {
|
||||||
THNode node= (THNode) element;
|
THNode node= (THNode) element;
|
||||||
ICElement decl= node.getElement();
|
ICElement decl= node.getElement();
|
||||||
if (decl != null) {
|
if (decl != null) {
|
||||||
|
if (node.isFiltered()) {
|
||||||
|
fCLabelProvider.setImageFlags(CElementImageProvider.LIGHT_TYPE_ICONS);
|
||||||
|
}
|
||||||
Image image= fCLabelProvider.getImage(decl);
|
Image image= fCLabelProvider.getImage(decl);
|
||||||
|
fCLabelProvider.setImageFlags(0);
|
||||||
if (image != null) {
|
if (image != null) {
|
||||||
return decorateImage(image, node);
|
return decorateImage(image, node);
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,6 +13,7 @@ package org.eclipse.cdt.internal.ui.typehierarchy;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
|
import java.util.Iterator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.eclipse.core.runtime.IAdaptable;
|
import org.eclipse.core.runtime.IAdaptable;
|
||||||
|
@ -124,5 +125,15 @@ public class THNode implements IAdaptable {
|
||||||
public boolean isImplementor() {
|
public boolean isImplementor() {
|
||||||
return fIsImplementor;
|
return fIsImplementor;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void removeFilteredLeafs() {
|
||||||
|
for (Iterator iterator = fChildren.iterator(); iterator.hasNext();) {
|
||||||
|
THNode child = (THNode) iterator.next();
|
||||||
|
child.removeFilteredLeafs();
|
||||||
|
if (child.isFiltered() && !child.hasChildren()) {
|
||||||
|
iterator.remove();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -89,6 +89,7 @@ import org.eclipse.cdt.internal.ui.viewsupport.CElementLabels;
|
||||||
import org.eclipse.cdt.internal.ui.viewsupport.CUILabelProvider;
|
import org.eclipse.cdt.internal.ui.viewsupport.CUILabelProvider;
|
||||||
import org.eclipse.cdt.internal.ui.viewsupport.EditorOpener;
|
import org.eclipse.cdt.internal.ui.viewsupport.EditorOpener;
|
||||||
import org.eclipse.cdt.internal.ui.viewsupport.SelectionProviderMediator;
|
import org.eclipse.cdt.internal.ui.viewsupport.SelectionProviderMediator;
|
||||||
|
import org.eclipse.cdt.internal.ui.viewsupport.WorkingSetFilterUI;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The view part for the include browser.
|
* The view part for the include browser.
|
||||||
|
@ -96,7 +97,7 @@ import org.eclipse.cdt.internal.ui.viewsupport.SelectionProviderMediator;
|
||||||
public class THViewPart extends ViewPart {
|
public class THViewPart extends ViewPart {
|
||||||
private static final int MAX_HISTORY_SIZE = 10;
|
private static final int MAX_HISTORY_SIZE = 10;
|
||||||
private static final String TRUE = String.valueOf(true);
|
private static final String TRUE = String.valueOf(true);
|
||||||
// private static final String KEY_WORKING_SET_FILTER = "workingSetFilter"; //$NON-NLS-1$
|
private static final String KEY_WORKING_SET_FILTER = "workingSetFilter"; //$NON-NLS-1$
|
||||||
private static final String KEY_SHOW_FILES= "showFilesInLabels"; //$NON-NLS-1$
|
private static final String KEY_SHOW_FILES= "showFilesInLabels"; //$NON-NLS-1$
|
||||||
private static final String KEY_SHOW_INHERITED_MEMBERS= "showInheritedMembers"; //$NON-NLS-1$
|
private static final String KEY_SHOW_INHERITED_MEMBERS= "showInheritedMembers"; //$NON-NLS-1$
|
||||||
private static final String KEY_FILTER_FIELDS= "filterFields"; //$NON-NLS-1$
|
private static final String KEY_FILTER_FIELDS= "filterFields"; //$NON-NLS-1$
|
||||||
|
@ -112,16 +113,19 @@ public class THViewPart extends ViewPart {
|
||||||
private static final int ORIENTATION_HORIZONTAL = 1;
|
private static final int ORIENTATION_HORIZONTAL = 1;
|
||||||
private static final int ORIENTATION_VERTICAL = 2;
|
private static final int ORIENTATION_VERTICAL = 2;
|
||||||
private static final int ORIENTATION_SINGLE = 3;
|
private static final int ORIENTATION_SINGLE = 3;
|
||||||
|
|
||||||
|
// options for label provider
|
||||||
private static final int MEMBER_LABEL_OPTIONS_SIMPLE = CElementLabels.M_PARAMETER_TYPES;
|
private static final int MEMBER_LABEL_OPTIONS_SIMPLE = CElementLabels.M_PARAMETER_TYPES;
|
||||||
private static final int MEMBER_LABEL_OPTIONS_QUALIFIED = MEMBER_LABEL_OPTIONS_SIMPLE | CElementLabels.ALL_POST_QUALIFIED;
|
private static final int MEMBER_LABEL_OPTIONS_QUALIFIED = MEMBER_LABEL_OPTIONS_SIMPLE | CElementLabels.ALL_POST_QUALIFIED;
|
||||||
private static final int MEMBER_ICON_OPTIONS = CElementImageProvider.OVERLAY_ICONS;
|
private static final int MEMBER_ICON_OPTIONS = CElementImageProvider.OVERLAY_ICONS;
|
||||||
|
|
||||||
|
// state information
|
||||||
private IMemento fMemento;
|
private IMemento fMemento;
|
||||||
private boolean fShowsMessage= true;
|
private boolean fShowsMessage= true;
|
||||||
private int fCurrentViewOrientation= -1;
|
private int fCurrentViewOrientation= -1;
|
||||||
private boolean fInComputeOrientation= false;
|
private boolean fInComputeOrientation= false;
|
||||||
|
|
||||||
private ArrayList fHistoryEntries= new ArrayList(MAX_HISTORY_SIZE);
|
private ArrayList fHistoryEntries= new ArrayList(MAX_HISTORY_SIZE);
|
||||||
|
private int fIgnoreSelectionChanges= 0;
|
||||||
|
|
||||||
// widgets
|
// widgets
|
||||||
private PageBook fPagebook;
|
private PageBook fPagebook;
|
||||||
|
@ -132,46 +136,46 @@ public class THViewPart extends ViewPart {
|
||||||
private ViewForm fMemberViewForm;
|
private ViewForm fMemberViewForm;
|
||||||
private CLabel fMemberLabel;
|
private CLabel fMemberLabel;
|
||||||
|
|
||||||
// viewers
|
// viewers and helpers
|
||||||
private THHierarchyModel fModel;
|
private THHierarchyModel fModel;
|
||||||
private THLabelProvider fHierarchyLabelProvider;
|
private THLabelProvider fHierarchyLabelProvider;
|
||||||
private CUILabelProvider fMemberLabelProvider;
|
private CUILabelProvider fMemberLabelProvider;
|
||||||
private TableViewer fMemberViewer;
|
private TableViewer fMemberViewer;
|
||||||
private TreeViewer fHierarchyTreeViewer;
|
private TreeViewer fHierarchyTreeViewer;
|
||||||
|
|
||||||
// filters, sorter
|
// filters
|
||||||
// private WorkingSetFilterUI fWorkingSetFilterUI;
|
private WorkingSetFilterUI fWorkingSetFilterUI;
|
||||||
|
private ViewerFilter fFieldFilter;
|
||||||
|
private ViewerFilter fStaticFilter;
|
||||||
|
private ViewerFilter fNonPublicFilter;
|
||||||
|
|
||||||
// actions
|
// actions
|
||||||
private ToolBarManager fMemberToolbarManager;
|
private ToolBarManager fMemberToolbarManager;
|
||||||
private Action fShowSuperTypeHierarchyAction;
|
|
||||||
|
private Action fShowSuperTypeHierarchyAction;
|
||||||
private Action fShowSubTypeHierarchyAction;
|
private Action fShowSubTypeHierarchyAction;
|
||||||
private Action fShowTypeHierarchyAction;
|
private Action fShowTypeHierarchyAction;
|
||||||
private Action fShowInheritedMembersAction;
|
|
||||||
private Action fShowFilesInLabelsAction;
|
private Action fShowFilesInLabelsAction;
|
||||||
private Action fRefreshAction;
|
private Action fRefreshAction;
|
||||||
private Action fCancelAction;
|
private Action fCancelAction;
|
||||||
private Action fHistoryAction;
|
private Action fHistoryAction;
|
||||||
private Action fOpenElement;
|
private Action fOpenElement;
|
||||||
|
|
||||||
private Action fHorizontalOrientation;
|
private Action fHorizontalOrientation;
|
||||||
private Action fVerticalOrientation;
|
private Action fVerticalOrientation;
|
||||||
private Action fAutomaticOrientation;
|
private Action fAutomaticOrientation;
|
||||||
private Action fSingleOrientation;
|
private Action fSingleOrientation;
|
||||||
|
|
||||||
|
private Action fShowInheritedMembersAction;
|
||||||
private Action fFieldFilterAction;
|
private Action fFieldFilterAction;
|
||||||
private Action fStaticFilterAction;
|
private Action fStaticFilterAction;
|
||||||
private Action fNonPublicFilterAction;
|
private Action fNonPublicFilterAction;
|
||||||
|
|
||||||
private ViewerFilter fFieldFilter;
|
|
||||||
private ViewerFilter fStaticFilter;
|
|
||||||
private ViewerFilter fNonPublicFilter;
|
|
||||||
|
|
||||||
// action groups
|
// action groups
|
||||||
private OpenViewActionGroup fOpenViewActionGroup;
|
private OpenViewActionGroup fOpenViewActionGroup;
|
||||||
private SelectionSearchGroup fSelectionSearchGroup;
|
private SelectionSearchGroup fSelectionSearchGroup;
|
||||||
private CRefactoringActionGroup fRefactoringActionGroup;
|
private CRefactoringActionGroup fRefactoringActionGroup;
|
||||||
private int fIgnoreSelectionChanges= 0;
|
|
||||||
|
|
||||||
|
|
||||||
public void setFocus() {
|
public void setFocus() {
|
||||||
fPagebook.setFocus();
|
fPagebook.setFocus();
|
||||||
|
@ -239,10 +243,10 @@ public class THViewPart extends ViewPart {
|
||||||
fRefactoringActionGroup.dispose();
|
fRefactoringActionGroup.dispose();
|
||||||
fRefactoringActionGroup= null;
|
fRefactoringActionGroup= null;
|
||||||
}
|
}
|
||||||
// if (fWorkingSetFilterUI != null) {
|
if (fWorkingSetFilterUI != null) {
|
||||||
// fWorkingSetFilterUI.dispose();
|
fWorkingSetFilterUI.dispose();
|
||||||
// fWorkingSetFilterUI= null;
|
fWorkingSetFilterUI= null;
|
||||||
// }
|
}
|
||||||
super.dispose();
|
super.dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -304,9 +308,9 @@ public class THViewPart extends ViewPart {
|
||||||
|
|
||||||
|
|
||||||
public void saveState(IMemento memento) {
|
public void saveState(IMemento memento) {
|
||||||
// if (fWorkingSetFilterUI != null) {
|
if (fWorkingSetFilterUI != null) {
|
||||||
// fWorkingSetFilterUI.saveState(memento, KEY_WORKING_SET_FILTER);
|
fWorkingSetFilterUI.saveState(memento, KEY_WORKING_SET_FILTER);
|
||||||
// }
|
}
|
||||||
memento.putString(KEY_SHOW_INHERITED_MEMBERS, String.valueOf(fShowInheritedMembersAction.isChecked()));
|
memento.putString(KEY_SHOW_INHERITED_MEMBERS, String.valueOf(fShowInheritedMembersAction.isChecked()));
|
||||||
memento.putString(KEY_SHOW_FILES, String.valueOf(fShowFilesInLabelsAction.isChecked()));
|
memento.putString(KEY_SHOW_FILES, String.valueOf(fShowFilesInLabelsAction.isChecked()));
|
||||||
memento.putString(KEY_FILTER_FIELDS, String.valueOf(fFieldFilterAction.isChecked()));
|
memento.putString(KEY_FILTER_FIELDS, String.valueOf(fFieldFilterAction.isChecked()));
|
||||||
|
@ -339,7 +343,6 @@ public class THViewPart extends ViewPart {
|
||||||
fHierarchyTreeViewer.getControl().setMenu(menu);
|
fHierarchyTreeViewer.getControl().setMenu(menu);
|
||||||
site.registerContextMenu(CUIPlugin.ID_TYPE_HIERARCHY, manager, fHierarchyTreeViewer);
|
site.registerContextMenu(CUIPlugin.ID_TYPE_HIERARCHY, manager, fHierarchyTreeViewer);
|
||||||
|
|
||||||
|
|
||||||
manager = new MenuManager();
|
manager = new MenuManager();
|
||||||
manager.setRemoveAllWhenShown(true);
|
manager.setRemoveAllWhenShown(true);
|
||||||
manager.addMenuListener(new IMenuListener() {
|
manager.addMenuListener(new IMenuListener() {
|
||||||
|
@ -517,14 +520,14 @@ public class THViewPart extends ViewPart {
|
||||||
fSelectionSearchGroup= new SelectionSearchGroup(getSite());
|
fSelectionSearchGroup= new SelectionSearchGroup(getSite());
|
||||||
fRefactoringActionGroup= new CRefactoringActionGroup(this);
|
fRefactoringActionGroup= new CRefactoringActionGroup(this);
|
||||||
|
|
||||||
// fWorkingSetFilterUI= new WorkingSetFilterUI(this, fMemento, KEY_WORKING_SET_FILTER) {
|
fWorkingSetFilterUI= new WorkingSetFilterUI(this, fMemento, KEY_WORKING_SET_FILTER) {
|
||||||
// protected void onWorkingSetChange() {
|
protected void onWorkingSetChange() {
|
||||||
// updateWorkingSetFilter(this);
|
updateWorkingSetFilter(this);
|
||||||
// }
|
}
|
||||||
// protected void onWorkingSetNameChange() {
|
protected void onWorkingSetNameChange() {
|
||||||
// updateDescription();
|
updateDescription();
|
||||||
// }
|
}
|
||||||
// };
|
};
|
||||||
|
|
||||||
fHorizontalOrientation= new Action(Messages.THViewPart_HorizontalOrientation, IAction.AS_RADIO_BUTTON) {
|
fHorizontalOrientation= new Action(Messages.THViewPart_HorizontalOrientation, IAction.AS_RADIO_BUTTON) {
|
||||||
public void run() {
|
public void run() {
|
||||||
|
@ -728,8 +731,8 @@ public class THViewPart extends ViewPart {
|
||||||
// local menu
|
// local menu
|
||||||
IMenuManager mm = actionBars.getMenuManager();
|
IMenuManager mm = actionBars.getMenuManager();
|
||||||
|
|
||||||
// fWorkingSetFilterUI.fillActionBars(actionBars);
|
fWorkingSetFilterUI.fillActionBars(actionBars);
|
||||||
// mm.add(new Separator(IContextMenuConstants.GROUP_SHOW));
|
mm.add(new Separator(IContextMenuConstants.GROUP_SHOW));
|
||||||
mm.add(fShowTypeHierarchyAction);
|
mm.add(fShowTypeHierarchyAction);
|
||||||
mm.add(fShowSuperTypeHierarchyAction);
|
mm.add(fShowSuperTypeHierarchyAction);
|
||||||
mm.add(fShowSubTypeHierarchyAction);
|
mm.add(fShowSubTypeHierarchyAction);
|
||||||
|
@ -805,8 +808,7 @@ public class THViewPart extends ViewPart {
|
||||||
label= CElementLabels.getElementLabel(elem, 0);
|
label= CElementLabels.getElementLabel(elem, 0);
|
||||||
|
|
||||||
// scope
|
// scope
|
||||||
IWorkingSet workingSet= null;
|
IWorkingSet workingSet= fWorkingSetFilterUI.getWorkingSet();
|
||||||
// workingSet= fWorkingSetFilterUI.getWorkingSet();
|
|
||||||
if (workingSet == null) {
|
if (workingSet == null) {
|
||||||
message= label;
|
message= label;
|
||||||
}
|
}
|
||||||
|
@ -841,10 +843,10 @@ public class THViewPart extends ViewPart {
|
||||||
fShowTypeHierarchyAction.setEnabled(!fShowsMessage);
|
fShowTypeHierarchyAction.setEnabled(!fShowsMessage);
|
||||||
}
|
}
|
||||||
|
|
||||||
// private void updateWorkingSetFilter(WorkingSetFilterUI filterUI) {
|
private void updateWorkingSetFilter(WorkingSetFilterUI filterUI) {
|
||||||
// fModel.setWorkingSetFilter(filterUI);
|
fModel.setWorkingSetFilter(filterUI);
|
||||||
// updateView();
|
updateView();
|
||||||
// }
|
}
|
||||||
|
|
||||||
public void onSetHierarchyKind(int kind) {
|
public void onSetHierarchyKind(int kind) {
|
||||||
if (fModel.getHierarchyKind() != kind) {
|
if (fModel.getHierarchyKind() != kind) {
|
||||||
|
|
|
@ -8,6 +8,7 @@
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* IBM Corporation - initial API and implementation
|
* IBM Corporation - initial API and implementation
|
||||||
* QNX Software System
|
* QNX Software System
|
||||||
|
* Markus Schorn (Wind River Systems)
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.cdt.internal.ui.viewsupport;
|
package org.eclipse.cdt.internal.ui.viewsupport;
|
||||||
|
|
||||||
|
@ -331,21 +332,21 @@ public class CElementImageProvider {
|
||||||
|
|
||||||
case ICElement.C_STRUCT:
|
case ICElement.C_STRUCT:
|
||||||
case ICElement.C_TEMPLATE_STRUCT:
|
case ICElement.C_TEMPLATE_STRUCT:
|
||||||
return getStructImageDescriptor();
|
return getStructImageDescriptor((renderFlags & LIGHT_TYPE_ICONS) != 0);
|
||||||
|
|
||||||
case ICElement.C_CLASS:
|
case ICElement.C_CLASS:
|
||||||
case ICElement.C_TEMPLATE_CLASS:
|
case ICElement.C_TEMPLATE_CLASS:
|
||||||
return getClassImageDescriptor();
|
return getClassImageDescriptor((renderFlags & LIGHT_TYPE_ICONS) != 0);
|
||||||
|
|
||||||
case ICElement.C_UNION:
|
case ICElement.C_UNION:
|
||||||
case ICElement.C_TEMPLATE_UNION:
|
case ICElement.C_TEMPLATE_UNION:
|
||||||
return getUnionImageDescriptor();
|
return getUnionImageDescriptor((renderFlags & LIGHT_TYPE_ICONS) != 0);
|
||||||
|
|
||||||
case ICElement.C_TYPEDEF:
|
case ICElement.C_TYPEDEF:
|
||||||
return getTypedefImageDescriptor();
|
return getTypedefImageDescriptor((renderFlags & LIGHT_TYPE_ICONS) != 0);
|
||||||
|
|
||||||
case ICElement.C_ENUMERATION:
|
case ICElement.C_ENUMERATION:
|
||||||
return getEnumerationImageDescriptor();
|
return getEnumerationImageDescriptor((renderFlags & LIGHT_TYPE_ICONS) != 0);
|
||||||
|
|
||||||
case ICElement.C_ENUMERATOR:
|
case ICElement.C_ENUMERATOR:
|
||||||
return getEnumeratorImageDescriptor();
|
return getEnumeratorImageDescriptor();
|
||||||
|
@ -455,25 +456,45 @@ public class CElementImageProvider {
|
||||||
|
|
||||||
public void dispose() {
|
public void dispose() {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static ImageDescriptor getStructImageDescriptor(){
|
public static ImageDescriptor getStructImageDescriptor(){
|
||||||
return CPluginImages.DESC_OBJS_STRUCT;
|
return getStructImageDescriptor(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static ImageDescriptor getStructImageDescriptor(boolean alt){
|
||||||
|
return alt ? CPluginImages.DESC_OBJS_STRUCT_ALT : CPluginImages.DESC_OBJS_STRUCT;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static ImageDescriptor getClassImageDescriptor(){
|
public static ImageDescriptor getClassImageDescriptor(){
|
||||||
return CPluginImages.DESC_OBJS_CLASS;
|
return getClassImageDescriptor(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static ImageDescriptor getClassImageDescriptor(boolean alt){
|
||||||
|
return alt ? CPluginImages.DESC_OBJS_CLASS_ALT : CPluginImages.DESC_OBJS_CLASS;
|
||||||
|
}
|
||||||
|
|
||||||
public static ImageDescriptor getUnionImageDescriptor(){
|
public static ImageDescriptor getUnionImageDescriptor(){
|
||||||
return CPluginImages.DESC_OBJS_UNION;
|
return getUnionImageDescriptor(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static ImageDescriptor getUnionImageDescriptor(boolean alt){
|
||||||
|
return alt ? CPluginImages.DESC_OBJS_UNION_ALT : CPluginImages.DESC_OBJS_UNION;
|
||||||
|
}
|
||||||
|
|
||||||
public static ImageDescriptor getTypedefImageDescriptor(){
|
public static ImageDescriptor getTypedefImageDescriptor(){
|
||||||
return CPluginImages.DESC_OBJS_TYPEDEF;
|
return getTypedefImageDescriptor(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static ImageDescriptor getTypedefImageDescriptor(boolean alt){
|
||||||
|
return alt ? CPluginImages.DESC_OBJS_TYPEDEF_ALT : CPluginImages.DESC_OBJS_TYPEDEF;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static ImageDescriptor getEnumerationImageDescriptor(){
|
public static ImageDescriptor getEnumerationImageDescriptor(){
|
||||||
return CPluginImages.DESC_OBJS_ENUMERATION;
|
return getEnumerationImageDescriptor(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static ImageDescriptor getEnumerationImageDescriptor(boolean alt){
|
||||||
|
return alt ? CPluginImages.DESC_OBJS_ENUMERATION_ALT : CPluginImages.DESC_OBJS_ENUMERATION;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static ImageDescriptor getEnumeratorImageDescriptor(){
|
public static ImageDescriptor getEnumeratorImageDescriptor(){
|
||||||
|
|
Loading…
Add table
Reference in a new issue