mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-08-04 14:55:41 +02:00
Cosmetics.
This commit is contained in:
parent
ac11501703
commit
bf5f005736
2 changed files with 13 additions and 14 deletions
|
@ -112,8 +112,8 @@ public abstract class CSearchQuery implements ISearchQuery {
|
||||||
}
|
}
|
||||||
projects = ArrayUtil.removeNulls(ICProject.class, allProjects);
|
projects = ArrayUtil.removeNulls(ICProject.class, allProjects);
|
||||||
} else {
|
} else {
|
||||||
Map<String, ICProject> projectMap = new HashMap<String, ICProject>();
|
Map<String, ICProject> projectMap = new HashMap<>();
|
||||||
Set<String> pathFilter = new HashSet<String>();
|
Set<String> pathFilter = new HashSet<>();
|
||||||
boolean needFilter= false;
|
boolean needFilter= false;
|
||||||
for (int i = 0; i < scope.length; ++i) {
|
for (int i = 0; i < scope.length; ++i) {
|
||||||
ICProject project = scope[i].getCProject();
|
ICProject project = scope[i].getCProject();
|
||||||
|
@ -195,8 +195,7 @@ public abstract class CSearchQuery implements ISearchQuery {
|
||||||
label, scope);
|
label, scope);
|
||||||
}
|
}
|
||||||
|
|
||||||
String countLabel = Messages.format(CSearchMessages.CSearchResultCollector_matches,
|
String countLabel = Messages.format(CSearchMessages.CSearchResultCollector_matches, matchCount);
|
||||||
new Integer(matchCount));
|
|
||||||
return label + " " + countLabel; //$NON-NLS-1$
|
return label + " " + countLabel; //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -238,7 +237,7 @@ public abstract class CSearchQuery implements ISearchQuery {
|
||||||
IIndexFile file = name.getFile();
|
IIndexFile file = name.getFile();
|
||||||
Set<Match> matches = fileMatches.get(file);
|
Set<Match> matches = fileMatches.get(file);
|
||||||
if (matches == null) {
|
if (matches == null) {
|
||||||
matches = new HashSet<Match>();
|
matches = new HashSet<>();
|
||||||
fileMatches.put(file, matches);
|
fileMatches.put(file, matches);
|
||||||
}
|
}
|
||||||
int nodeOffset = loc.getNodeOffset();
|
int nodeOffset = loc.getNodeOffset();
|
||||||
|
@ -269,7 +268,7 @@ public abstract class CSearchQuery implements ISearchQuery {
|
||||||
long timestamp = file.getTimestamp();
|
long timestamp = file.getTimestamp();
|
||||||
IPositionConverter converter = CCorePlugin.getPositionTrackerManager().findPositionConverter(path, timestamp);
|
IPositionConverter converter = CCorePlugin.getPositionTrackerManager().findPositionConverter(path, timestamp);
|
||||||
if (converter != null) {
|
if (converter != null) {
|
||||||
Set<Match> convertedMatches = new HashSet<Match>();
|
Set<Match> convertedMatches = new HashSet<>();
|
||||||
for (Match match : matches) {
|
for (Match match : matches) {
|
||||||
IRegion region = new Region(match.getOffset(), match.getLength());
|
IRegion region = new Region(match.getOffset(), match.getLength());
|
||||||
region = converter.historicToActual(region);
|
region = converter.historicToActual(region);
|
||||||
|
@ -288,12 +287,12 @@ public abstract class CSearchQuery implements ISearchQuery {
|
||||||
private void collectNames(IIndex index, Collection<IIndexName> names,
|
private void collectNames(IIndex index, Collection<IIndexName> names,
|
||||||
Collection<IIndexName> polymorphicNames) throws CoreException {
|
Collection<IIndexName> polymorphicNames) throws CoreException {
|
||||||
// group all matched names by files
|
// group all matched names by files
|
||||||
Map<IIndexFile, Set<Match>> fileMatches = new HashMap<IIndexFile, Set<Match>>();
|
Map<IIndexFile, Set<Match>> fileMatches = new HashMap<>();
|
||||||
createMatchesFromNames(index, fileMatches, names, false);
|
createMatchesFromNames(index, fileMatches, names, false);
|
||||||
createMatchesFromNames(index, fileMatches, polymorphicNames, true);
|
createMatchesFromNames(index, fileMatches, polymorphicNames, true);
|
||||||
// compute mapping from paths to dirty text editors
|
// compute mapping from paths to dirty text editors
|
||||||
IEditorPart[] dirtyEditors = CUIPlugin.getDirtyEditors();
|
IEditorPart[] dirtyEditors = CUIPlugin.getDirtyEditors();
|
||||||
Map<IPath, ITextEditor> pathsDirtyEditors = new HashMap<IPath, ITextEditor>();
|
Map<IPath, ITextEditor> pathsDirtyEditors = new HashMap<>();
|
||||||
for (IEditorPart editorPart : dirtyEditors) {
|
for (IEditorPart editorPart : dirtyEditors) {
|
||||||
if (editorPart instanceof ITextEditor) {
|
if (editorPart instanceof ITextEditor) {
|
||||||
ITextEditor textEditor = (ITextEditor)editorPart;
|
ITextEditor textEditor = (ITextEditor)editorPart;
|
||||||
|
@ -348,9 +347,9 @@ public abstract class CSearchQuery implements ISearchQuery {
|
||||||
protected void createMatches(IIndex index, IBinding[] bindings) throws CoreException {
|
protected void createMatches(IIndex index, IBinding[] bindings) throws CoreException {
|
||||||
if (bindings == null)
|
if (bindings == null)
|
||||||
return;
|
return;
|
||||||
List<IIndexName> names= new ArrayList<IIndexName>();
|
List<IIndexName> names= new ArrayList<>();
|
||||||
List<IIndexName> polymorphicNames= null;
|
List<IIndexName> polymorphicNames= null;
|
||||||
HashSet<IBinding> handled= new HashSet<IBinding>();
|
HashSet<IBinding> handled= new HashSet<>();
|
||||||
|
|
||||||
for (IBinding binding : bindings) {
|
for (IBinding binding : bindings) {
|
||||||
if (binding != null && handled.add(binding)) {
|
if (binding != null && handled.add(binding)) {
|
||||||
|
@ -374,7 +373,7 @@ public abstract class CSearchQuery implements ISearchQuery {
|
||||||
ICPPMethod[] msInBases = ClassTypeHelper.findOverridden(m, point);
|
ICPPMethod[] msInBases = ClassTypeHelper.findOverridden(m, point);
|
||||||
if (msInBases.length > 0) {
|
if (msInBases.length > 0) {
|
||||||
if (polymorphicNames == null) {
|
if (polymorphicNames == null) {
|
||||||
polymorphicNames= new ArrayList<IIndexName>();
|
polymorphicNames= new ArrayList<>();
|
||||||
}
|
}
|
||||||
for (ICPPMethod mInBase : msInBases) {
|
for (ICPPMethod mInBase : msInBases) {
|
||||||
if (mInBase != null && handled.add(mInBase)) {
|
if (mInBase != null && handled.add(mInBase)) {
|
||||||
|
@ -425,13 +424,13 @@ public abstract class CSearchQuery implements ISearchQuery {
|
||||||
|
|
||||||
protected void createLocalMatches(IASTTranslationUnit ast, IBinding binding) throws CoreException {
|
protected void createLocalMatches(IASTTranslationUnit ast, IBinding binding) throws CoreException {
|
||||||
if (binding != null) {
|
if (binding != null) {
|
||||||
Set<IASTName> names= new HashSet<IASTName>();
|
Set<IASTName> names= new HashSet<>();
|
||||||
names.addAll(Arrays.asList(ast.getDeclarationsInAST(binding)));
|
names.addAll(Arrays.asList(ast.getDeclarationsInAST(binding)));
|
||||||
names.addAll(Arrays.asList(ast.getDefinitionsInAST(binding)));
|
names.addAll(Arrays.asList(ast.getDefinitionsInAST(binding)));
|
||||||
names.addAll(Arrays.asList(ast.getReferences(binding)));
|
names.addAll(Arrays.asList(ast.getReferences(binding)));
|
||||||
// Collect local matches from AST
|
// Collect local matches from AST
|
||||||
IIndexFileLocation fileLocation = null;
|
IIndexFileLocation fileLocation = null;
|
||||||
Set<Match> localMatches = new HashSet<Match>();
|
Set<Match> localMatches = new HashSet<>();
|
||||||
for (IASTName name : names) {
|
for (IASTName name : names) {
|
||||||
if (((flags & FIND_DECLARATIONS) != 0 && name.isDeclaration()) ||
|
if (((flags & FIND_DECLARATIONS) != 0 && name.isDeclaration()) ||
|
||||||
((flags & FIND_DEFINITIONS) != 0 && name.isDefinition()) ||
|
((flags & FIND_DEFINITIONS) != 0 && name.isDefinition()) ||
|
||||||
|
|
|
@ -112,7 +112,7 @@ public class CSearchResult extends AbstractTextSearchResult implements IEditorMa
|
||||||
|
|
||||||
private Match[] computeContainedMatches(AbstractTextSearchResult result, String filename) throws CoreException {
|
private Match[] computeContainedMatches(AbstractTextSearchResult result, String filename) throws CoreException {
|
||||||
IPath pfilename= new Path(filename);
|
IPath pfilename= new Path(filename);
|
||||||
List<Match> list = new ArrayList<Match>();
|
List<Match> list = new ArrayList<>();
|
||||||
Object[] elements = result.getElements();
|
Object[] elements = result.getElements();
|
||||||
for (int i = 0; i < elements.length; ++i) {
|
for (int i = 0; i < elements.length; ++i) {
|
||||||
if (pfilename.equals(IndexLocationFactory.getAbsolutePath(((CSearchElement) elements[i]).getLocation()))) {
|
if (pfilename.equals(IndexLocationFactory.getAbsolutePath(((CSearchElement) elements[i]).getLocation()))) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue