mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-29 19:45:01 +02:00
Fixes warnings.
This commit is contained in:
parent
ccd10d94bf
commit
234a13b0e1
3 changed files with 19 additions and 54 deletions
|
@ -13,9 +13,11 @@ package org.eclipse.cdt.internal.pdom.tests;
|
|||
|
||||
import java.io.File;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import junit.framework.Assert;
|
||||
import junit.framework.AssertionFailedError;
|
||||
import junit.framework.Test;
|
||||
|
||||
import org.eclipse.cdt.core.CCorePlugin;
|
||||
import org.eclipse.cdt.core.dom.IName;
|
||||
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.ITextFileBufferManager;
|
||||
import org.eclipse.core.runtime.CoreException;
|
||||
import org.eclipse.core.runtime.IPath;
|
||||
import org.eclipse.core.runtime.NullProgressMonitor;
|
||||
import org.eclipse.core.runtime.Path;
|
||||
import org.eclipse.jface.text.BadLocationException;
|
||||
|
@ -42,8 +43,6 @@ import org.eclipse.jface.text.BadLocationException;
|
|||
*
|
||||
*/
|
||||
public class DefDeclTests extends PDOMTestBase {
|
||||
static IPath rootPath = new Path("resources/pdomtests");
|
||||
|
||||
private String projectName = null;
|
||||
|
||||
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.
|
||||
*
|
||||
|
|
|
@ -66,7 +66,7 @@ public class CallHierarchyBaseTest extends BaseUITestCase {
|
|||
protected void openCallHierarchy(CEditor editor) {
|
||||
CallHierarchyUI.setIsJUnitTest(true);
|
||||
CallHierarchyUI.open(editor, (ITextSelection) editor.getSelectionProvider().getSelection());
|
||||
runEventQueue(0);
|
||||
runEventQueue(200);
|
||||
}
|
||||
|
||||
protected Tree getCHTree(IWorkbenchPage page) {
|
||||
|
|
|
@ -96,38 +96,25 @@ public class CallHierarchyUI {
|
|||
final IEditorInput editorInput = editor.getEditorInput();
|
||||
final Display display= Display.getCurrent();
|
||||
|
||||
if (!sIsJUnitTest) {
|
||||
Job job= new Job(CHMessages.CallHierarchyUI_label) {
|
||||
protected IStatus run(IProgressMonitor monitor) {
|
||||
try {
|
||||
final ICElement[] elems= findDefinitions(project, editorInput, sel);
|
||||
if (elems != null && elems.length > 0) {
|
||||
display.asyncExec(new Runnable() {
|
||||
public void run() {
|
||||
openInViewPart(editor.getSite().getWorkbenchWindow(), elems);
|
||||
}});
|
||||
}
|
||||
return Status.OK_STATUS;
|
||||
}
|
||||
catch (CoreException e) {
|
||||
return e.getStatus();
|
||||
Job job= new Job(CHMessages.CallHierarchyUI_label) {
|
||||
protected IStatus run(IProgressMonitor monitor) {
|
||||
try {
|
||||
final ICElement[] elems= findDefinitions(project, editorInput, sel);
|
||||
if (elems != null && elems.length > 0) {
|
||||
display.asyncExec(new Runnable() {
|
||||
public void run() {
|
||||
openInViewPart(editor.getSite().getWorkbenchWindow(), elems);
|
||||
}});
|
||||
}
|
||||
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();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue