1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-29 19:45:01 +02:00

Fixes warnings.

This commit is contained in:
Markus Schorn 2006-10-19 14:01:49 +00:00
parent ccd10d94bf
commit 234a13b0e1
3 changed files with 19 additions and 54 deletions

View file

@ -13,9 +13,11 @@ package org.eclipse.cdt.internal.pdom.tests;
import java.io.File; import java.io.File;
import java.util.regex.Pattern; import java.util.regex.Pattern;
import junit.framework.Assert; import junit.framework.Assert;
import junit.framework.AssertionFailedError; import junit.framework.AssertionFailedError;
import junit.framework.Test; import junit.framework.Test;
import org.eclipse.cdt.core.CCorePlugin; import org.eclipse.cdt.core.CCorePlugin;
import org.eclipse.cdt.core.dom.IName; import org.eclipse.cdt.core.dom.IName;
import org.eclipse.cdt.core.dom.ast.IASTFileLocation; import org.eclipse.cdt.core.dom.ast.IASTFileLocation;
@ -29,7 +31,6 @@ import org.eclipse.core.filebuffers.FileBuffers;
import org.eclipse.core.filebuffers.ITextFileBuffer; import org.eclipse.core.filebuffers.ITextFileBuffer;
import org.eclipse.core.filebuffers.ITextFileBufferManager; import org.eclipse.core.filebuffers.ITextFileBufferManager;
import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.NullProgressMonitor; import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.core.runtime.Path; import org.eclipse.core.runtime.Path;
import org.eclipse.jface.text.BadLocationException; import org.eclipse.jface.text.BadLocationException;
@ -42,8 +43,6 @@ import org.eclipse.jface.text.BadLocationException;
* *
*/ */
public class DefDeclTests extends PDOMTestBase { public class DefDeclTests extends PDOMTestBase {
static IPath rootPath = new Path("resources/pdomtests");
private String projectName = null; private String projectName = null;
protected PDOM pdom; protected PDOM pdom;
@ -122,27 +121,6 @@ public class DefDeclTests extends PDOMTestBase {
} }
} }
private IName getReference(IBinding binding, int k) throws CoreException {
return getFirstUsage(binding, k, IIndex.FIND_REFERENCES);
}
private IName getDefinition(IBinding binding, int k) throws CoreException {
return getFirstUsage(binding, k, IIndex.FIND_DEFINITIONS);
}
/**
* Get declaration. If k>0 check that there are k of them.
*
* @param binding
* @param k -
* number of declarations, if k==-1 no check
* @return first declaration or null of non
* @throws CoreException
*/
private IName getDeclaration(IBinding binding, int k) throws CoreException {
return getFirstUsage(binding, k, IIndex.FIND_DECLARATIONS);
}
/** /**
* Get references defined by flags. If k>0 check that there are k of them. * Get references defined by flags. If k>0 check that there are k of them.
* *

View file

@ -66,7 +66,7 @@ public class CallHierarchyBaseTest extends BaseUITestCase {
protected void openCallHierarchy(CEditor editor) { protected void openCallHierarchy(CEditor editor) {
CallHierarchyUI.setIsJUnitTest(true); CallHierarchyUI.setIsJUnitTest(true);
CallHierarchyUI.open(editor, (ITextSelection) editor.getSelectionProvider().getSelection()); CallHierarchyUI.open(editor, (ITextSelection) editor.getSelectionProvider().getSelection());
runEventQueue(0); runEventQueue(200);
} }
protected Tree getCHTree(IWorkbenchPage page) { protected Tree getCHTree(IWorkbenchPage page) {

View file

@ -96,38 +96,25 @@ public class CallHierarchyUI {
final IEditorInput editorInput = editor.getEditorInput(); final IEditorInput editorInput = editor.getEditorInput();
final Display display= Display.getCurrent(); final Display display= Display.getCurrent();
if (!sIsJUnitTest) { Job job= new Job(CHMessages.CallHierarchyUI_label) {
Job job= new Job(CHMessages.CallHierarchyUI_label) { protected IStatus run(IProgressMonitor monitor) {
protected IStatus run(IProgressMonitor monitor) { try {
try { final ICElement[] elems= findDefinitions(project, editorInput, sel);
final ICElement[] elems= findDefinitions(project, editorInput, sel); if (elems != null && elems.length > 0) {
if (elems != null && elems.length > 0) { display.asyncExec(new Runnable() {
display.asyncExec(new Runnable() { public void run() {
public void run() { openInViewPart(editor.getSite().getWorkbenchWindow(), elems);
openInViewPart(editor.getSite().getWorkbenchWindow(), elems); }});
}});
}
return Status.OK_STATUS;
}
catch (CoreException e) {
return e.getStatus();
} }
return Status.OK_STATUS;
}
catch (CoreException e) {
return e.getStatus();
} }
};
job.setUser(true);
job.schedule();
}
else {
ICElement[] elems;
try {
elems = findDefinitions(project, editorInput, sel);
if (elems != null && elems.length > 0) {
openInViewPart(editor.getSite().getWorkbenchWindow(), elems);
}
} catch (CoreException e) {
CUIPlugin.getDefault().log(e);
} }
} };
job.setUser(true);
job.schedule();
} }
} }