1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-08-01 05:15:43 +02:00

Cosmetics.

This commit is contained in:
Sergey Prigogin 2011-06-29 21:19:53 -07:00
parent a9f41ac547
commit 3d7537fca6
3 changed files with 11 additions and 18 deletions

View file

@ -6,7 +6,7 @@
* http://www.eclipse.org/legal/epl-v10.html * http://www.eclipse.org/legal/epl-v10.html
* *
* Contributors: * Contributors:
* Markus Schorn - initial API and implementation * Markus Schorn - initial API and implementation
*******************************************************************************/ *******************************************************************************/
package org.eclipse.cdt.internal.ui.callhierarchy; package org.eclipse.cdt.internal.ui.callhierarchy;
@ -42,7 +42,6 @@ import org.eclipse.cdt.internal.ui.viewsupport.WorkingSetFilterUI;
* This is the content provider for the call hierarchy. * This is the content provider for the call hierarchy.
*/ */
public class CHContentProvider extends AsyncTreeContentProvider { public class CHContentProvider extends AsyncTreeContentProvider {
private static final IProgressMonitor NPM = new NullProgressMonitor(); private static final IProgressMonitor NPM = new NullProgressMonitor();
private boolean fComputeReferencedBy = true; private boolean fComputeReferencedBy = true;
private WorkingSetFilterUI fFilter; private WorkingSetFilterUI fFilter;
@ -79,13 +78,12 @@ public class CHContentProvider extends AsyncTreeContentProvider {
if (node.isInitializer()) { if (node.isInitializer()) {
return NO_CHILDREN; return NO_CHILDREN;
} }
} } else if (node.isVariableOrEnumerator() || node.isMacro()) {
else if (node.isVariableOrEnumerator() || node.isMacro()) {
return NO_CHILDREN; return NO_CHILDREN;
} }
} }
// allow for async computation // Allow for async computation
return null; return null;
} }
@ -122,8 +120,7 @@ public class CHContentProvider extends AsyncTreeContentProvider {
fView.reportNotIndexed(input); fView.reportNotIndexed(input);
} }
}); });
} } else {
else {
element= IndexUI.attemptConvertionToHandle(index, input); element= IndexUI.attemptConvertionToHandle(index, input);
final ICElement finalElement= element; final ICElement finalElement= element;
getDisplay().asyncExec(new Runnable() { getDisplay().asyncExec(new Runnable() {
@ -146,8 +143,7 @@ public class CHContentProvider extends AsyncTreeContentProvider {
} }
} }
return new Object[] { new CHNode(null, tu, 0, element, -1) }; return new Object[] { new CHNode(null, tu, 0, element, -1) };
} } finally {
finally {
index.releaseReadLock(); index.releaseReadLock();
} }
} }
@ -158,8 +154,7 @@ public class CHContentProvider extends AsyncTreeContentProvider {
index.acquireReadLock(); index.acquireReadLock();
try { try {
return CHQueries.findCalledBy(this, parent, index, NPM); return CHQueries.findCalledBy(this, parent, index, NPM);
} } finally {
finally {
index.releaseReadLock(); index.releaseReadLock();
} }
} }
@ -170,8 +165,7 @@ public class CHContentProvider extends AsyncTreeContentProvider {
index.acquireReadLock(); index.acquireReadLock();
try { try {
return CHQueries.findCalls(this, parent, index, NPM); return CHQueries.findCalls(this, parent, index, NPM);
} } finally {
finally {
index.releaseReadLock(); index.releaseReadLock();
} }
} }

View file

@ -35,7 +35,6 @@ import org.eclipse.cdt.internal.core.model.ext.ICElementHandle;
import org.eclipse.cdt.internal.ui.viewsupport.IndexUI; import org.eclipse.cdt.internal.ui.viewsupport.IndexUI;
/** /**
* Access to high level queries in the index. * Access to high level queries in the index.
* @since 4.0 * @since 4.0
@ -100,7 +99,6 @@ public class CHQueries {
} }
} }
private static void findCalledBy2(IIndex index, IBinding callee, boolean includeOrdinaryCalls, private static void findCalledBy2(IIndex index, IBinding callee, boolean includeOrdinaryCalls,
ICProject project, CalledByResult result) throws CoreException { ICProject project, CalledByResult result) throws CoreException {
IIndexName[] names= index.findNames(callee, IIndex.FIND_REFERENCES | IIndex.SEARCH_ACROSS_LANGUAGE_BOUNDARIES); IIndexName[] names= index.findNames(callee, IIndex.FIND_REFERENCES | IIndex.SEARCH_ACROSS_LANGUAGE_BOUNDARIES);
@ -130,7 +128,7 @@ public class CHQueries {
for (IIndexName name : refs) { for (IIndexName name : refs) {
IBinding binding= index.findBinding(name); IBinding binding= index.findBinding(name);
if (CallHierarchyUI.isRelevantForCallHierarchy(binding)) { if (CallHierarchyUI.isRelevantForCallHierarchy(binding)) {
for(;;) { while (true) {
ICElement[] defs= null; ICElement[] defs= null;
if (binding instanceof ICPPMethod) { if (binding instanceof ICPPMethod) {
defs = findOverriders(index, (ICPPMethod) binding); defs = findOverriders(index, (ICPPMethod) binding);
@ -154,7 +152,8 @@ public class CHQueries {
} }
/** /**
* Searches for overriders of method and converts them to ICElement, returns null, if there are none. * Searches for overriders of method and converts them to ICElement, returns null,
* if there are none.
*/ */
static ICElement[] findOverriders(IIndex index, ICPPMethod binding) throws CoreException { static ICElement[] findOverriders(IIndex index, ICPPMethod binding) throws CoreException {
IBinding[] virtualOverriders= ClassTypeHelper.findOverriders(index, binding); IBinding[] virtualOverriders= ClassTypeHelper.findOverriders(index, binding);

View file

@ -80,7 +80,7 @@ public class CallHierarchyUI {
private static CHViewPart internalOpen(IWorkbenchWindow window, ICElement input) { private static CHViewPart internalOpen(IWorkbenchWindow window, ICElement input) {
IWorkbenchPage page= window.getActivePage(); IWorkbenchPage page= window.getActivePage();
try { try {
CHViewPart result= (CHViewPart)page.showView(CUIPlugin.ID_CALL_HIERARCHY); CHViewPart result= (CHViewPart) page.showView(CUIPlugin.ID_CALL_HIERARCHY);
result.setInput(input); result.setInput(input);
return result; return result;
} catch (CoreException e) { } catch (CoreException e) {