From fae118c182f36db83851e8c6f6cafca27e828284 Mon Sep 17 00:00:00 2001 From: Bogdan Gheorghe Date: Tue, 14 Jun 2005 19:52:17 +0000 Subject: [PATCH] Patch for Dave Daoust: Fixes up the string demangling in IEntryResult + IndexerView --- .../cdt/internal/core/index/IEntryResult.java | 2 ++ .../core/index/cindexstorage/EntryResult.java | 33 +++++++++++++++++++ .../ui/tests/IndexerView/IndexerNodeLeaf.java | 11 +++++-- .../IndexerView/IndexerViewPluginImages.java | 3 -- 4 files changed, 43 insertions(+), 6 deletions(-) diff --git a/core/org.eclipse.cdt.core/index/org/eclipse/cdt/internal/core/index/IEntryResult.java b/core/org.eclipse.cdt.core/index/org/eclipse/cdt/internal/core/index/IEntryResult.java index b447f4ccb06..b39b5f255ea 100644 --- a/core/org.eclipse.cdt.core/index/org/eclipse/cdt/internal/core/index/IEntryResult.java +++ b/core/org.eclipse.cdt.core/index/org/eclipse/cdt/internal/core/index/IEntryResult.java @@ -28,6 +28,8 @@ public interface IEntryResult { public int getRefKind(); public String getName(); + public String getDisplayString(); + public String getStringMetaKind(); public String getStringKind(); public String getStringRefKind(); diff --git a/core/org.eclipse.cdt.core/index/org/eclipse/cdt/internal/core/index/cindexstorage/EntryResult.java b/core/org.eclipse.cdt.core/index/org/eclipse/cdt/internal/core/index/cindexstorage/EntryResult.java index 0aaa9da5a33..06a0e938a04 100644 --- a/core/org.eclipse.cdt.core/index/org/eclipse/cdt/internal/core/index/cindexstorage/EntryResult.java +++ b/core/org.eclipse.cdt.core/index/org/eclipse/cdt/internal/core/index/cindexstorage/EntryResult.java @@ -196,5 +196,38 @@ public String getStringRefKind() { return String.valueOf(ICIndexStorageConstants.encodingTypes[reftype]); } +public String getDisplayString() { + switch (meta_type) { + case IIndex.FUNCTION: + case IIndex.METHOD: + int startReturn = longname.indexOf(")R/"); //$NON-NLS-1$ + int finishReturn = longname.indexOf("/R("); //$NON-NLS-1$ + int startParam = longname.indexOf(")/"); //$NON-NLS-1$ + int finishParam = longname.indexOf("/("); //$NON-NLS-1$ + + String functionName; + String arguments = longname.substring(startParam + 2, finishParam); + + // TODO: flip arguments + arguments = arguments.replace('/',','); + + arguments = '(' + arguments + ')'; + + if (startReturn == -1 || finishReturn == -1) { + // there is no return type !!! + functionName = longname.substring(0, startParam -1); + return functionName + arguments ; + } + else { + String returnType = longname.substring(startReturn + 3, finishReturn); + functionName = longname.substring(0, startReturn -1); + return functionName + arguments + ':' + returnType; + } + + default: + return longname; + } +} + } diff --git a/core/org.eclipse.cdt.ui.tests/src/org/eclipse/cdt/ui/tests/IndexerView/IndexerNodeLeaf.java b/core/org.eclipse.cdt.ui.tests/src/org/eclipse/cdt/ui/tests/IndexerView/IndexerNodeLeaf.java index a36b91929f0..2eaa488ff25 100644 --- a/core/org.eclipse.cdt.ui.tests/src/org/eclipse/cdt/ui/tests/IndexerView/IndexerNodeLeaf.java +++ b/core/org.eclipse.cdt.ui.tests/src/org/eclipse/cdt/ui/tests/IndexerView/IndexerNodeLeaf.java @@ -59,7 +59,8 @@ public class IndexerNodeLeaf implements IAdaptable { private class IndexerPropertySource implements IPropertySource { private static final String IENTRYRESULT = "IEntryResult"; //$NON-NLS-1$ - private static final String NAME = "Name"; //$NON-NLS-1$ + private static final String NAME = "Encoded Name"; //$NON-NLS-1$ + private static final String DNAME = "Display Name"; //$NON-NLS-1$ private static final String IENTRYRESULT_GETWORD__ = "IEntryResult#getWord()"; //$NON-NLS-1$ private static final String REFS = "References"; //$NON-NLS-1$ private static final String OFFSETS_LINE = "Line "; //$NON-NLS-1$ @@ -111,7 +112,11 @@ public class IndexerNodeLeaf implements IAdaptable { text = new TextPropertyDescriptor(new TextDescriptorId(NAME, entryResult.getName()), NAME); text.setCategory(IENTRYRESULT); descriptors = (IPropertyDescriptor[])ArrayUtil.append(IPropertyDescriptor.class, descriptors, text); - + + text = new TextPropertyDescriptor(new TextDescriptorId(DNAME, entryResult.getDisplayString()), DNAME); + text.setCategory(IENTRYRESULT); + descriptors = (IPropertyDescriptor[])ArrayUtil.append(IPropertyDescriptor.class, descriptors, text); + // add IEntryResult text = new TextPropertyDescriptor(new TextDescriptorId("MetaKind", entryResult.getStringMetaKind()), "MetaKind"); text.setCategory(IENTRYRESULT); @@ -174,7 +179,7 @@ public class IndexerNodeLeaf implements IAdaptable { if (!parent.isDisplayFullName()) return getShortName(); - return getName(); + return result.getDisplayString(); } public int getFiltersType() { diff --git a/core/org.eclipse.cdt.ui.tests/src/org/eclipse/cdt/ui/tests/IndexerView/IndexerViewPluginImages.java b/core/org.eclipse.cdt.ui.tests/src/org/eclipse/cdt/ui/tests/IndexerView/IndexerViewPluginImages.java index 4efe6e72398..6136fb0aed9 100644 --- a/core/org.eclipse.cdt.ui.tests/src/org/eclipse/cdt/ui/tests/IndexerView/IndexerViewPluginImages.java +++ b/core/org.eclipse.cdt.ui.tests/src/org/eclipse/cdt/ui/tests/IndexerView/IndexerViewPluginImages.java @@ -73,9 +73,6 @@ public class IndexerViewPluginImages { "union_obj.gif", "derived.gif", "friend.gif", - "fwd_class.gif", - "fwd_struct.gif", - "fwd_union.gif", "include_obj.gif" };