1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-23 06:32:10 +02:00

Cosmetics.

This commit is contained in:
Sergey Prigogin 2014-02-11 14:10:07 -08:00
parent f584975ffd
commit 15fb26ea6a
5 changed files with 16 additions and 19 deletions

View file

@ -7,7 +7,7 @@
*
* Contributors:
* Markus Schorn - initial API and implementation
*******************************************************************************/
*******************************************************************************/
package org.eclipse.cdt.internal.ui.callhierarchy;
import java.util.ArrayList;
@ -41,13 +41,13 @@ import org.eclipse.cdt.internal.ui.viewsupport.IndexUI;
*/
public class CHQueries {
private static final CHNode[] EMPTY_NODES= {};
private CHQueries() {}
/**
* Searches for functions and methods that call a given element.
*/
public static CHNode[] findCalledBy(CHContentProvider cp, CHNode node, IIndex index, IProgressMonitor pm)
public static CHNode[] findCalledBy(CHContentProvider cp, CHNode node, IIndex index, IProgressMonitor pm)
throws CoreException {
CalledByResult result= new CalledByResult();
ICElement callee= node.getRepresentedDeclaration();
@ -60,7 +60,7 @@ public class CHQueries {
final ITranslationUnit tu = ((ISourceReference) callee).getTranslationUnit();
if (tu == null)
return EMPTY_NODES;
final String ct = tu.getContentTypeId();
if (ct.equals(CCorePlugin.CONTENT_TYPE_CXXHEADER)) {
// Bug 260262: in a header file we need to consider C and C++.
@ -75,7 +75,7 @@ public class CHQueries {
return cp.createNodes(node, result);
}
private static void findCalledBy(ICElement callee, int linkageID, IIndex index, CalledByResult result)
private static void findCalledBy(ICElement callee, int linkageID, IIndex index, CalledByResult result)
throws CoreException {
final ICProject project = callee.getCProject();
IIndexBinding calleeBinding= IndexUI.elementToBinding(index, callee, linkageID);
@ -109,7 +109,7 @@ public class CHQueries {
ICElement elem= IndexUI.getCElementForName(project, index, caller);
if (elem != null) {
result.add(elem, rname);
}
}
}
}
}
@ -118,7 +118,7 @@ public class CHQueries {
/**
* Searches for all calls that are made within a given range.
*/
public static CHNode[] findCalls(CHContentProvider cp, CHNode node, IIndex index, IProgressMonitor pm)
public static CHNode[] findCalls(CHContentProvider cp, CHNode node, IIndex index, IProgressMonitor pm)
throws CoreException {
ICElement caller= node.getRepresentedDeclaration();
CallsToResult result= new CallsToResult();

View file

@ -7,7 +7,7 @@
*
* Contributors:
* Markus Schorn - initial API and implementation
*******************************************************************************/
*******************************************************************************/
package org.eclipse.cdt.internal.ui.callhierarchy;
import java.util.ArrayList;
@ -20,13 +20,13 @@ import org.eclipse.cdt.core.index.IIndexName;
import org.eclipse.cdt.core.model.ICElement;
public class CalledByResult {
private Map<ICElement, List<IIndexName>> fElementToReferences= new HashMap<ICElement, List<IIndexName>>();
private Map<ICElement, List<IIndexName>> fElementToReferences= new HashMap<>();
public ICElement[] getElements() {
Set<ICElement> elements = fElementToReferences.keySet();
return elements.toArray(new ICElement[elements.size()]);
}
public IIndexName[] getReferences(ICElement calledElement) {
List<IIndexName> references= fElementToReferences.get(calledElement);
return references.toArray(new IIndexName[references.size()]);
@ -35,7 +35,7 @@ public class CalledByResult {
public void add(ICElement elem, IIndexName ref) {
List<IIndexName> list= fElementToReferences.get(elem);
if (list == null) {
list= new ArrayList<IIndexName>();
list= new ArrayList<>();
fElementToReferences.put(elem, list);
}
list.add(ref);

View file

@ -7,7 +7,7 @@
*
* Contributors:
* Markus Schorn - initial API and implementation
*******************************************************************************/
*******************************************************************************/
package org.eclipse.cdt.internal.ui.callhierarchy;
import java.util.ArrayList;
@ -20,7 +20,7 @@ import org.eclipse.cdt.core.index.IIndexName;
import org.eclipse.cdt.core.model.ICElement;
public class CallsToResult {
private Map<CElementSet, List<IIndexName>> fElementSetsToReferences= new HashMap<CElementSet, List<IIndexName>>();
private Map<CElementSet, List<IIndexName>> fElementSetsToReferences= new HashMap<>();
public CElementSet[] getElementSets() {
Set<CElementSet> elementSets = fElementSetsToReferences.keySet();
@ -36,7 +36,7 @@ public class CallsToResult {
CElementSet key= new CElementSet(elems);
List<IIndexName> list= fElementSetsToReferences.get(key);
if (list == null) {
list= new ArrayList<IIndexName>();
list= new ArrayList<>();
fElementSetsToReferences.put(key, list);
}
list.add(ref);

View file

@ -14,9 +14,7 @@ package org.eclipse.cdt.internal.ui.search;
import org.eclipse.osgi.util.NLS;
public final class CSearchMessages extends NLS {
private static final String BUNDLE_NAME = "org.eclipse.cdt.internal.ui.search.CSearchMessages"; //$NON-NLS-1$
public static String group_declarations;
public static String group_references;
public static String CSearchResultCollector_matches;
@ -97,7 +95,7 @@ public final class CSearchMessages extends NLS {
public static String PDOMSearchUnresolvedIncludesQuery_title;
static {
NLS.initializeMessages(BUNDLE_NAME, CSearchMessages.class);
NLS.initializeMessages(CSearchMessages.class.getName(), CSearchMessages.class);
}
private CSearchMessages() {

View file

@ -15,7 +15,6 @@
group_declarations=Dec&larations
group_references=Re&ferences
# Examples of the display for the following value are
# "(1 match)", where {0} is 1 and "(5 matches)", where {0} is 2 or more.
CSearchResultCollector_matches= ({0} {0, choice, 0\#matches|1\#match|2\#matches})