mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-29 19:45:01 +02:00
- Added support for search name grouping.
- Handled the case of CContainer in both updateIndexAddResource and updateIndexRemoveResource. - Added timing for merge operations - controlled by Indexer tracing option - Modified removeSourceFolderFromIndex in IndexManager to take an IProject
This commit is contained in:
parent
cc22c316de
commit
41c9d0faec
12 changed files with 213 additions and 40 deletions
|
@ -1,3 +1,10 @@
|
||||||
|
2004-07-06 Bogdan Gheorghe
|
||||||
|
Handled the case of CContainer in both updateIndexAddResource and
|
||||||
|
updateIndexRemoveResource.
|
||||||
|
|
||||||
|
* model/org/eclipse/cdt/internal/core/model/DeltaProcessor.java
|
||||||
|
|
||||||
|
|
||||||
2004-07-06 Hoda Amer
|
2004-07-06 Hoda Amer
|
||||||
Fix for PR 68933 : [Content Assist] removes asterisks from parameter prompt
|
Fix for PR 68933 : [Content Assist] removes asterisks from parameter prompt
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,10 @@
|
||||||
|
2004-07-06 Bogdan Gheorghe
|
||||||
|
Added timing for merge operations - controlled by Indexer tracing option
|
||||||
|
Modified removeSourceFolderFromIndex in IndexManager to take an IProject
|
||||||
|
|
||||||
|
* index/org/eclipse/cdt/internal/core/search/indexing/IndexManager.java
|
||||||
|
* index/org/eclipse/cdt/internal/core/index/impl/MergeFactory.java
|
||||||
|
|
||||||
2004-06-28 Bogdan Gheorghe
|
2004-06-28 Bogdan Gheorghe
|
||||||
Fix for Bug 60948: indexer should pick up all headers in include path
|
Fix for Bug 60948: indexer should pick up all headers in include path
|
||||||
|
|
||||||
|
|
|
@ -72,6 +72,11 @@ public class MergeFactory {
|
||||||
* Merges the 2 indexes into a new one on the disk.
|
* Merges the 2 indexes into a new one on the disk.
|
||||||
*/
|
*/
|
||||||
public void merge() throws IOException {
|
public void merge() throws IOException {
|
||||||
|
long startTime = 0;
|
||||||
|
if (IndexManager.VERBOSE){
|
||||||
|
JobManager.verbose("-> starting merge"); //$NON-NLS-1$
|
||||||
|
startTime = System.currentTimeMillis();
|
||||||
|
}
|
||||||
try {
|
try {
|
||||||
//init
|
//init
|
||||||
addsInput.open();
|
addsInput.open();
|
||||||
|
@ -106,6 +111,11 @@ public class MergeFactory {
|
||||||
oldInput.close();
|
oldInput.close();
|
||||||
addsInput.close();
|
addsInput.close();
|
||||||
mergeOutput.close();
|
mergeOutput.close();
|
||||||
|
|
||||||
|
if (IndexManager.VERBOSE){
|
||||||
|
long elapsedTime = System.currentTimeMillis() - startTime;
|
||||||
|
JobManager.verbose("-> merge complete: " + (elapsedTime > 0 ? elapsedTime : 0) + "ms"); //$NON-NLS-1$ //$NON-NLS-2$
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -34,7 +34,6 @@ import org.eclipse.cdt.internal.core.Util;
|
||||||
import org.eclipse.cdt.internal.core.index.IIndex;
|
import org.eclipse.cdt.internal.core.index.IIndex;
|
||||||
import org.eclipse.cdt.internal.core.index.impl.Index;
|
import org.eclipse.cdt.internal.core.index.impl.Index;
|
||||||
import org.eclipse.cdt.internal.core.index.impl.IndexDelta;
|
import org.eclipse.cdt.internal.core.index.impl.IndexDelta;
|
||||||
import org.eclipse.cdt.internal.core.model.CProject;
|
|
||||||
import org.eclipse.cdt.internal.core.search.CWorkspaceScope;
|
import org.eclipse.cdt.internal.core.search.CWorkspaceScope;
|
||||||
import org.eclipse.cdt.internal.core.search.IndexSelector;
|
import org.eclipse.cdt.internal.core.search.IndexSelector;
|
||||||
import org.eclipse.cdt.internal.core.search.SimpleLookupTable;
|
import org.eclipse.cdt.internal.core.search.SimpleLookupTable;
|
||||||
|
@ -539,8 +538,7 @@ public class IndexManager extends JobManager implements IIndexConstants {
|
||||||
/**
|
/**
|
||||||
* Remove the content of the given source folder from the index.
|
* Remove the content of the given source folder from the index.
|
||||||
*/
|
*/
|
||||||
public void removeSourceFolderFromIndex(CProject cProject, IPath sourceFolder, char[][] exclusionPatterns) {
|
public void removeSourceFolderFromIndex(IProject project, IPath sourceFolder, char[][] exclusionPatterns) {
|
||||||
IProject project = cProject.getProject();
|
|
||||||
|
|
||||||
if( !isIndexEnabled( project ) )
|
if( !isIndexEnabled( project ) )
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -572,6 +572,10 @@ public class DeltaProcessor {
|
||||||
this.indexManager.indexAll(element.getCProject().getProject());
|
this.indexManager.indexAll(element.getCProject().getProject());
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case ICElement.C_CCONTAINER:
|
||||||
|
indexManager.indexSourceFolder(element.getCProject().getProject(),element.getPath(),null);
|
||||||
|
break;
|
||||||
|
|
||||||
case ICElement.C_UNIT:
|
case ICElement.C_UNIT:
|
||||||
IFile file = (IFile) delta.getResource();
|
IFile file = (IFile) delta.getResource();
|
||||||
IProject filesProject = file.getProject();
|
IProject filesProject = file.getProject();
|
||||||
|
@ -588,19 +592,23 @@ public class DeltaProcessor {
|
||||||
|
|
||||||
switch (element.getElementType()) {
|
switch (element.getElementType()) {
|
||||||
case ICElement.C_PROJECT :
|
case ICElement.C_PROJECT :
|
||||||
IPath fullPath = element.getCProject().getProject().getFullPath();
|
IPath fullPath = element.getCProject().getProject().getFullPath();
|
||||||
if( delta.getKind() == IResourceDelta.CHANGED )
|
if( delta.getKind() == IResourceDelta.CHANGED )
|
||||||
indexManager.discardJobs(fullPath.segment(0));
|
indexManager.discardJobs(fullPath.segment(0));
|
||||||
indexManager.removeIndexFamily(fullPath);
|
indexManager.removeIndexFamily(fullPath);
|
||||||
// NB: Discarding index jobs belonging to this project was done during PRE_DELETE
|
// NB: Discarding index jobs belonging to this project was done during PRE_DELETE
|
||||||
break;
|
break;
|
||||||
// NB: Update of index if project is opened, closed, or its c nature is added or removed
|
// NB: Update of index if project is opened, closed, or its c nature is added or removed
|
||||||
// is done in updateCurrentDeltaAndIndex
|
// is done in updateCurrentDeltaAndIndex
|
||||||
|
|
||||||
|
case ICElement.C_CCONTAINER:
|
||||||
|
indexManager.removeSourceFolderFromIndex(element.getCProject().getProject(),element.getPath(),null);
|
||||||
|
break;
|
||||||
|
|
||||||
case ICElement.C_UNIT:
|
case ICElement.C_UNIT:
|
||||||
IFile file = (IFile) delta.getResource();
|
IFile file = (IFile) delta.getResource();
|
||||||
indexManager.remove(file.getFullPath().toString(), file.getProject().getFullPath());
|
indexManager.remove(file.getFullPath().toString(), file.getProject().getFullPath());
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,14 @@
|
||||||
|
2004-07-06 Bogdan Gheorghe
|
||||||
|
|
||||||
|
Added support for search name grouping.
|
||||||
|
|
||||||
|
* src/org/eclipse/cdt/internal/ui/search/CSearchMatch.java
|
||||||
|
* src/org/eclipse/cdt/internal/ui/search/CSearchResult.java
|
||||||
|
* src/org/eclipse/cdt/internal/ui/search/CSearchResultPage.java
|
||||||
|
* src/org/eclipse/cdt/internal/ui/search/LevelTreeContentProvider.java
|
||||||
|
* src/org/eclipse/cdt/internal/ui/search/NewSearchResultCollector.java
|
||||||
|
* src/org/eclipse/cdt/ui/CSearchResultLabelProvider.java
|
||||||
|
|
||||||
2004-07-06 Chris Wiebe
|
2004-07-06 Chris Wiebe
|
||||||
|
|
||||||
This patch prevents some NPEs from happening in the class browser. I
|
This patch prevents some NPEs from happening in the class browser. I
|
||||||
|
|
|
@ -0,0 +1,39 @@
|
||||||
|
/*
|
||||||
|
* Created on Jun 27, 2004
|
||||||
|
*
|
||||||
|
* TODO To change the template for this generated file go to
|
||||||
|
* Window - Preferences - Java - Code Style - Code Templates
|
||||||
|
*/
|
||||||
|
package org.eclipse.cdt.internal.ui.search;
|
||||||
|
|
||||||
|
import org.eclipse.cdt.core.search.BasicSearchMatch;
|
||||||
|
import org.eclipse.cdt.core.search.IMatch;
|
||||||
|
import org.eclipse.search.ui.text.Match;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author bgheorgh
|
||||||
|
*
|
||||||
|
* TODO To change the template for this generated type comment go to
|
||||||
|
* Window - Preferences - Java - Code Style - Code Templates
|
||||||
|
*/
|
||||||
|
public class CSearchMatch extends Match {
|
||||||
|
|
||||||
|
private BasicSearchMatch searchMatch;
|
||||||
|
/**
|
||||||
|
* @param element
|
||||||
|
* @param offset
|
||||||
|
* @param length
|
||||||
|
*/
|
||||||
|
public CSearchMatch(Object element, int offset, int length, IMatch match) {
|
||||||
|
super(element, offset, length);
|
||||||
|
if (match instanceof BasicSearchMatch)
|
||||||
|
searchMatch = (BasicSearchMatch)match;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return Returns the searchMatch.
|
||||||
|
*/
|
||||||
|
public BasicSearchMatch getSearchMatch() {
|
||||||
|
return searchMatch;
|
||||||
|
}
|
||||||
|
}
|
|
@ -117,6 +117,16 @@ public class CSearchResult extends AbstractTextSearchResult implements IEditorMa
|
||||||
else
|
else
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
} else if (match instanceof CSearchMatch) {
|
||||||
|
BasicSearchMatch searchMatch = ((CSearchMatch) match).getSearchMatch();
|
||||||
|
if (editorInput instanceof IFileEditorInput){
|
||||||
|
IFile inputFile= ((IFileEditorInput)editorInput).getFile();
|
||||||
|
IResource matchFile = searchMatch.getResource();
|
||||||
|
if (matchFile != null)
|
||||||
|
return inputFile.equals(matchFile);
|
||||||
|
else
|
||||||
|
return false;
|
||||||
|
}
|
||||||
} else if (match.getElement() instanceof IFile) {
|
} else if (match.getElement() instanceof IFile) {
|
||||||
if (editorInput instanceof IFileEditorInput) {
|
if (editorInput instanceof IFileEditorInput) {
|
||||||
return ((IFileEditorInput)editorInput).getFile().equals(match.getElement());
|
return ((IFileEditorInput)editorInput).getFile().equals(match.getElement());
|
||||||
|
@ -231,15 +241,10 @@ public class CSearchResult extends AbstractTextSearchResult implements IEditorMa
|
||||||
private void collectMatches(Set matches, Object[] test, IFile file) {
|
private void collectMatches(Set matches, Object[] test, IFile file) {
|
||||||
|
|
||||||
for (int i=0; i<test.length; i++){
|
for (int i=0; i<test.length; i++){
|
||||||
BasicSearchMatch tempMatch = (BasicSearchMatch) test[i];
|
Match[]testMatches=this.getMatches(test[i]);
|
||||||
if (tempMatch.getResource().equals(file)){
|
for (int k=0;k<testMatches.length;k++){
|
||||||
Match[] m= getMatches(tempMatch);
|
if (((CSearchMatch) testMatches[k]).getSearchMatch().getResource().equals(file))
|
||||||
|
matches.add(testMatches[k]);
|
||||||
if (m.length != 0) {
|
|
||||||
for (int j= 0; j < m.length; j++) {
|
|
||||||
matches.add(m[j]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -119,8 +119,8 @@ public class CSearchResultPage extends AbstractTextSearchViewPage {
|
||||||
}
|
}
|
||||||
} else if (element instanceof IFile) {
|
} else if (element instanceof IFile) {
|
||||||
editor= IDE.openEditor(CUIPlugin.getActivePage(), getCanonicalFile((IFile) element), false);
|
editor= IDE.openEditor(CUIPlugin.getActivePage(), getCanonicalFile((IFile) element), false);
|
||||||
} else if (element instanceof BasicSearchMatch){
|
} else if (match instanceof CSearchMatch){
|
||||||
BasicSearchMatch searchMatch = (BasicSearchMatch) element;
|
BasicSearchMatch searchMatch = ((CSearchMatch) match).getSearchMatch();
|
||||||
if (searchMatch.resource != null){
|
if (searchMatch.resource != null){
|
||||||
editor = IDE.openEditor(CUIPlugin.getActivePage(), getCanonicalFile((IFile) searchMatch.resource), false);
|
editor = IDE.openEditor(CUIPlugin.getActivePage(), getCanonicalFile((IFile) searchMatch.resource), false);
|
||||||
showWithMarker(editor, getCanonicalFile((IFile) searchMatch.resource), currentOffset, currentLength);
|
showWithMarker(editor, getCanonicalFile((IFile) searchMatch.resource), currentOffset, currentLength);
|
||||||
|
@ -157,7 +157,7 @@ public class CSearchResultPage extends AbstractTextSearchViewPage {
|
||||||
viewer.setSorter(new ViewerSorter());
|
viewer.setSorter(new ViewerSorter());
|
||||||
CSearchResultLabelProvider labelProvider = new CSearchResultLabelProvider();
|
CSearchResultLabelProvider labelProvider = new CSearchResultLabelProvider();
|
||||||
labelProvider.setOrder(CSearchResultLabelProvider.SHOW_NAME_ONLY);
|
labelProvider.setOrder(CSearchResultLabelProvider.SHOW_NAME_ONLY);
|
||||||
viewer.setLabelProvider(labelProvider);
|
viewer.setLabelProvider(new CountLabelProvider(this, labelProvider));
|
||||||
_contentProvider= new LevelTreeContentProvider(viewer, _currentGrouping);
|
_contentProvider= new LevelTreeContentProvider(viewer, _currentGrouping);
|
||||||
viewer.setContentProvider(_contentProvider);
|
viewer.setContentProvider(_contentProvider);
|
||||||
|
|
||||||
|
|
|
@ -25,6 +25,7 @@ import org.eclipse.cdt.ui.CElementContentProvider;
|
||||||
import org.eclipse.core.resources.IResource;
|
import org.eclipse.core.resources.IResource;
|
||||||
import org.eclipse.jface.viewers.AbstractTreeViewer;
|
import org.eclipse.jface.viewers.AbstractTreeViewer;
|
||||||
import org.eclipse.jface.viewers.ITreeContentProvider;
|
import org.eclipse.jface.viewers.ITreeContentProvider;
|
||||||
|
import org.eclipse.search.ui.text.Match;
|
||||||
import org.eclipse.swt.widgets.Control;
|
import org.eclipse.swt.widgets.Control;
|
||||||
|
|
||||||
public class LevelTreeContentProvider extends CSearchContentProvider implements ITreeContentProvider {
|
public class LevelTreeContentProvider extends CSearchContentProvider implements ITreeContentProvider {
|
||||||
|
@ -63,8 +64,9 @@ public class LevelTreeContentProvider extends CSearchContentProvider implements
|
||||||
|
|
||||||
public Object getParent(Object child) {
|
public Object getParent(Object child) {
|
||||||
Object possibleParent= null;
|
Object possibleParent= null;
|
||||||
if (child instanceof BasicSearchMatch){
|
|
||||||
BasicSearchMatch tempMatch = (BasicSearchMatch)child;
|
if (child instanceof CSearchMatch){
|
||||||
|
BasicSearchMatch tempMatch = ((CSearchMatch) child).getSearchMatch();
|
||||||
ICElement cTransUnit = CCorePlugin.getDefault().getCoreModel().create(tempMatch.getResource());
|
ICElement cTransUnit = CCorePlugin.getDefault().getCoreModel().create(tempMatch.getResource());
|
||||||
|
|
||||||
if (cTransUnit instanceof ITranslationUnit){
|
if (cTransUnit instanceof ITranslationUnit){
|
||||||
|
@ -123,7 +125,7 @@ public class LevelTreeContentProvider extends CSearchContentProvider implements
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void insert(Object child, boolean refreshViewer) {
|
protected void insert(Object child, boolean refreshViewer) {
|
||||||
Object parent= getParent(child);
|
Object parent= getMatchParent(child);
|
||||||
while (parent != null) {
|
while (parent != null) {
|
||||||
if (insertChild(parent, child)) {
|
if (insertChild(parent, child)) {
|
||||||
if (refreshViewer)
|
if (refreshViewer)
|
||||||
|
@ -143,6 +145,22 @@ public class LevelTreeContentProvider extends CSearchContentProvider implements
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param child
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
private Object getMatchParent(Object child) {
|
||||||
|
Match[]m=null;
|
||||||
|
if (child instanceof String){
|
||||||
|
m=this._result.getMatches(child);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (m.length > 0)
|
||||||
|
return getParent(m[0]);
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* returns true if the child already was a child of parent.
|
* returns true if the child already was a child of parent.
|
||||||
*
|
*
|
||||||
|
|
|
@ -28,6 +28,21 @@ import org.eclipse.jface.preference.IPreferenceStore;
|
||||||
import org.eclipse.search.ui.text.Match;
|
import org.eclipse.search.ui.text.Match;
|
||||||
|
|
||||||
public class NewSearchResultCollector extends BasicSearchResultCollector {
|
public class NewSearchResultCollector extends BasicSearchResultCollector {
|
||||||
|
public static final int PARENT_LENGTH = 7;
|
||||||
|
public static final String PARENT = "PARENT:"; //$NON-NLS-1$
|
||||||
|
|
||||||
|
public static final int NAME_LENGTH = 5;
|
||||||
|
public static final String NAME = "NAME:"; //$NON-NLS-1$
|
||||||
|
|
||||||
|
public static final int LOCATION_LENGTH = 9;
|
||||||
|
public static final String LOCATION = "LOCATION:"; //$NON-NLS-1$
|
||||||
|
|
||||||
|
public static final int ELEMENTTYPE_LENGTH = 12;
|
||||||
|
public static final String ELEMENTTYPE = "ELEMENTTYPE:"; //$NON-NLS-1$
|
||||||
|
|
||||||
|
public static final int VISIBILITY_LENGTH = 11;
|
||||||
|
public static final String VISIBILITY = "VISIBILITY:"; //$NON-NLS-1$
|
||||||
|
|
||||||
private CSearchResult fSearch;
|
private CSearchResult fSearch;
|
||||||
private IProgressMonitor fProgressMonitor;
|
private IProgressMonitor fProgressMonitor;
|
||||||
private int fMatchCount;
|
private int fMatchCount;
|
||||||
|
@ -77,7 +92,9 @@ public class NewSearchResultCollector extends BasicSearchResultCollector {
|
||||||
fMatchCount++;
|
fMatchCount++;
|
||||||
int start = match.getStartOffset();
|
int start = match.getStartOffset();
|
||||||
int end = match.getEndOffset();
|
int end = match.getEndOffset();
|
||||||
fSearch.addMatch(new Match(match,start,end-start));
|
String classifier = PARENT + match.getParentName() + NAME + match.getName() + LOCATION + match.getLocation().toOSString() + ELEMENTTYPE + match.getElementType() + VISIBILITY + match.getVisibility();
|
||||||
|
fSearch.addMatch(new CSearchMatch(classifier,start,end-start, match));
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
|
@ -19,6 +19,7 @@ import org.eclipse.cdt.internal.ui.CPluginImages;
|
||||||
import org.eclipse.cdt.internal.ui.search.CSearchMessages;
|
import org.eclipse.cdt.internal.ui.search.CSearchMessages;
|
||||||
import org.eclipse.cdt.internal.ui.search.CSearchResultCollector;
|
import org.eclipse.cdt.internal.ui.search.CSearchResultCollector;
|
||||||
import org.eclipse.cdt.internal.ui.search.CSearchResultPage;
|
import org.eclipse.cdt.internal.ui.search.CSearchResultPage;
|
||||||
|
import org.eclipse.cdt.internal.ui.search.NewSearchResultCollector;
|
||||||
import org.eclipse.core.resources.IMarker;
|
import org.eclipse.core.resources.IMarker;
|
||||||
import org.eclipse.core.resources.IResource;
|
import org.eclipse.core.resources.IResource;
|
||||||
import org.eclipse.core.runtime.CoreException;
|
import org.eclipse.core.runtime.CoreException;
|
||||||
|
@ -58,6 +59,7 @@ public class CSearchResultLabelProvider extends LabelProvider {
|
||||||
public Image getImage( Object element ) {
|
public Image getImage( Object element ) {
|
||||||
IMatch match = null;
|
IMatch match = null;
|
||||||
int elementType = -1;
|
int elementType = -1;
|
||||||
|
int visibility = -1;
|
||||||
if( element instanceof ISearchResultViewEntry ){
|
if( element instanceof ISearchResultViewEntry ){
|
||||||
ISearchResultViewEntry viewEntry = (ISearchResultViewEntry)element;
|
ISearchResultViewEntry viewEntry = (ISearchResultViewEntry)element;
|
||||||
IMarker marker = viewEntry.getSelectedMarker();
|
IMarker marker = viewEntry.getSelectedMarker();
|
||||||
|
@ -66,6 +68,7 @@ public class CSearchResultLabelProvider extends LabelProvider {
|
||||||
if( match == null )
|
if( match == null )
|
||||||
return null;
|
return null;
|
||||||
elementType = match.getElementType();
|
elementType = match.getElementType();
|
||||||
|
visibility = match.getVisibility();
|
||||||
} catch (CoreException e) {
|
} catch (CoreException e) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
@ -74,9 +77,19 @@ public class CSearchResultLabelProvider extends LabelProvider {
|
||||||
if( match == null )
|
if( match == null )
|
||||||
return null;
|
return null;
|
||||||
elementType = match.getElementType();
|
elementType = match.getElementType();
|
||||||
|
visibility = match.getVisibility();
|
||||||
} else if (element instanceof ICElement){
|
} else if (element instanceof ICElement){
|
||||||
elementType = ((ICElement) element).getElementType();
|
elementType = ((ICElement) element).getElementType();
|
||||||
|
} else if (element instanceof String){
|
||||||
|
String eleString = (String) element;
|
||||||
|
int elIndex = eleString.indexOf(NewSearchResultCollector.ELEMENTTYPE);
|
||||||
|
int vizIndex = eleString.indexOf(NewSearchResultCollector.VISIBILITY);
|
||||||
|
|
||||||
|
String elType = eleString.substring(elIndex+NewSearchResultCollector.ELEMENTTYPE_LENGTH,vizIndex);
|
||||||
|
String elViz = eleString.substring(vizIndex+NewSearchResultCollector.VISIBILITY_LENGTH,eleString.length());
|
||||||
|
|
||||||
|
elementType = new Integer(elType).intValue();
|
||||||
|
visibility = new Integer(elViz).intValue();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -99,7 +112,7 @@ public class CSearchResultLabelProvider extends LabelProvider {
|
||||||
case ICElement.C_UNIT: imageDescriptor = CPluginImages.DESC_OBJS_TUNIT; break;
|
case ICElement.C_UNIT: imageDescriptor = CPluginImages.DESC_OBJS_TUNIT; break;
|
||||||
case ICElement.C_FIELD:
|
case ICElement.C_FIELD:
|
||||||
{
|
{
|
||||||
switch( match.getVisibility() ){
|
switch( visibility ){
|
||||||
case ICElement.CPP_PUBLIC: imageDescriptor = CPluginImages.DESC_OBJS_PUBLIC_FIELD; break;
|
case ICElement.CPP_PUBLIC: imageDescriptor = CPluginImages.DESC_OBJS_PUBLIC_FIELD; break;
|
||||||
case ICElement.CPP_PRIVATE: imageDescriptor = CPluginImages.DESC_OBJS_PRIVATE_FIELD; break;
|
case ICElement.CPP_PRIVATE: imageDescriptor = CPluginImages.DESC_OBJS_PRIVATE_FIELD; break;
|
||||||
default: imageDescriptor = CPluginImages.DESC_OBJS_PROTECTED_FIELD; break;
|
default: imageDescriptor = CPluginImages.DESC_OBJS_PROTECTED_FIELD; break;
|
||||||
|
@ -108,7 +121,7 @@ public class CSearchResultLabelProvider extends LabelProvider {
|
||||||
}
|
}
|
||||||
case ICElement.C_METHOD:
|
case ICElement.C_METHOD:
|
||||||
{
|
{
|
||||||
switch( match.getVisibility() ){
|
switch( visibility ){
|
||||||
case ICElement.CPP_PUBLIC: imageDescriptor = CPluginImages.DESC_OBJS_PUBLIC_METHOD; break;
|
case ICElement.CPP_PUBLIC: imageDescriptor = CPluginImages.DESC_OBJS_PUBLIC_METHOD; break;
|
||||||
case ICElement.CPP_PRIVATE: imageDescriptor = CPluginImages.DESC_OBJS_PRIVATE_METHOD; break;
|
case ICElement.CPP_PRIVATE: imageDescriptor = CPluginImages.DESC_OBJS_PRIVATE_METHOD; break;
|
||||||
default: imageDescriptor = CPluginImages.DESC_OBJS_PROTECTED_METHOD; break;
|
default: imageDescriptor = CPluginImages.DESC_OBJS_PROTECTED_METHOD; break;
|
||||||
|
@ -147,9 +160,21 @@ public class CSearchResultLabelProvider extends LabelProvider {
|
||||||
}
|
}
|
||||||
} else if( element instanceof IMatch ){
|
} else if( element instanceof IMatch ){
|
||||||
match = (IMatch) element;
|
match = (IMatch) element;
|
||||||
}
|
} else if ( element instanceof ICElement){
|
||||||
else if ( element instanceof ICElement){
|
|
||||||
return getElementText((ICElement) element);
|
return getElementText((ICElement) element);
|
||||||
|
} else if (element instanceof String){
|
||||||
|
String elString = (String) element;
|
||||||
|
|
||||||
|
int parentIndex = elString.indexOf(NewSearchResultCollector.PARENT);
|
||||||
|
int nameIndex = elString.indexOf(NewSearchResultCollector.NAME);
|
||||||
|
int locationIndex = elString.indexOf(NewSearchResultCollector.LOCATION);
|
||||||
|
int elementIndex = elString.indexOf(NewSearchResultCollector.ELEMENTTYPE);
|
||||||
|
|
||||||
|
String elParent = elString.substring(parentIndex+NewSearchResultCollector.PARENT_LENGTH,nameIndex);
|
||||||
|
String elName = elString.substring(nameIndex+NewSearchResultCollector.NAME_LENGTH,locationIndex);
|
||||||
|
String elPath = elString.substring(locationIndex+NewSearchResultCollector.LOCATION_LENGTH, elementIndex);
|
||||||
|
|
||||||
|
return getCSearchSortElementText(elParent, elName, elPath);
|
||||||
}
|
}
|
||||||
|
|
||||||
if( match == null )
|
if( match == null )
|
||||||
|
@ -189,6 +214,34 @@ public class CSearchResultLabelProvider extends LabelProvider {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param element
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
private String getCSearchSortElementText(String parentName, String name, String path) {
|
||||||
|
String result = ""; //$NON-NLS-1$
|
||||||
|
|
||||||
|
switch( getOrder() ){
|
||||||
|
case SHOW_NAME_ONLY:
|
||||||
|
result = name;
|
||||||
|
case SHOW_ELEMENT_CONTAINER:
|
||||||
|
if( !parentName.equals("") ) //$NON-NLS-1$
|
||||||
|
result = name + " - " + parentName + " ( " + path + " )"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
|
||||||
|
else
|
||||||
|
result = name+ " ( " + path + " )"; //$NON-NLS-1$ //$NON-NLS-2$
|
||||||
|
|
||||||
|
break;
|
||||||
|
case SHOW_PATH:
|
||||||
|
result = path + " - " + parentName + "::" + name; //$NON-NLS-1$ //$NON-NLS-2$
|
||||||
|
break;
|
||||||
|
case SHOW_CONTAINER_ELEMENT:
|
||||||
|
result = parentName + "::" + name + " ( " + path + " )"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
private String getElementText(ICElement element){
|
private String getElementText(ICElement element){
|
||||||
|
|
||||||
String result=""; //$NON-NLS-1$
|
String result=""; //$NON-NLS-1$
|
||||||
|
|
Loading…
Add table
Reference in a new issue