Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarkus Schorn2008-03-03 12:56:38 +0000
committerMarkus Schorn2008-03-03 12:56:38 +0000
commit4aa04977c3f65d67dfa55325bb248fe5f6fb30af (patch)
treec8bf6e660c1bf8f292d086d29b7c6d1bda454188 /core/org.eclipse.cdt.ui.tests
parent90846e6bfa87c27ceef67ade5c5e3eecd24784d6 (diff)
downloadorg.eclipse.cdt-4aa04977c3f65d67dfa55325bb248fe5f6fb30af.tar.gz
org.eclipse.cdt-4aa04977c3f65d67dfa55325bb248fe5f6fb30af.tar.xz
org.eclipse.cdt-4aa04977c3f65d67dfa55325bb248fe5f6fb30af.zip
Combines IASTTranslationUnit.selectNodeForLocation() and ILanguage.getSelectedNodes() into new API.
Diffstat (limited to 'core/org.eclipse.cdt.ui.tests')
-rw-r--r--core/org.eclipse.cdt.ui.tests/src/org/eclipse/cdt/ui/tests/DOMAST/ShowInDOMViewAction.java8
-rw-r--r--core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/HyperlinkTest.java1
-rw-r--r--core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/selection/BaseSelectionTestsIndexer.java7
-rw-r--r--core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/selection/CPPSelectionTestsAnyIndexer.java2
-rw-r--r--core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/selection/CPPSelectionTestsNoIndexer.java9
-rw-r--r--core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/selection/CSelectionTestsNoIndexer.java5
-rw-r--r--core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/selection/ResolveBindingTests.java8
7 files changed, 16 insertions, 24 deletions
diff --git a/core/org.eclipse.cdt.ui.tests/src/org/eclipse/cdt/ui/tests/DOMAST/ShowInDOMViewAction.java b/core/org.eclipse.cdt.ui.tests/src/org/eclipse/cdt/ui/tests/DOMAST/ShowInDOMViewAction.java
index 72936f09539..403442511f1 100644
--- a/core/org.eclipse.cdt.ui.tests/src/org/eclipse/cdt/ui/tests/DOMAST/ShowInDOMViewAction.java
+++ b/core/org.eclipse.cdt.ui.tests/src/org/eclipse/cdt/ui/tests/DOMAST/ShowInDOMViewAction.java
@@ -1,13 +1,13 @@
/*******************************************************************************
- * Copyright (c) 2005, 2007 IBM Corporation and others.
+ * Copyright (c) 2005, 2008 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
- * IBM Rational Software - Initial API and implementation
- * Anton Leherbauer (Wind River Systems)
+ * IBM Rational Software - Initial API and implementation
+ * Anton Leherbauer (Wind River Systems)
*******************************************************************************/
package org.eclipse.cdt.ui.tests.DOMAST;
@@ -180,7 +180,7 @@ public class ShowInDOMViewAction extends ActionDelegate implements
// the selection is within a file currently shown in the DOM AST View
if (tu != null && file != null && view instanceof DOMAST) {
- IASTNode node = tu.selectNodeForLocation(file, offset, length);
+ IASTNode node = tu.getNodeSelector(file).findNode(offset, length);
if (node != null && ((DOMAST)view).getContentProvider() instanceof DOMAST.ViewContentProvider) {
boolean success = ((DOMAST.ViewContentProvider)((DOMAST)view).getContentProvider()).findAndSelect(node, true); // use offsets when searching for node equality
if( ! success )
diff --git a/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/HyperlinkTest.java b/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/HyperlinkTest.java
index 551153337d5..5ebadb7b674 100644
--- a/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/HyperlinkTest.java
+++ b/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/HyperlinkTest.java
@@ -122,6 +122,7 @@ public class HyperlinkTest extends TestCase {
assertHyperlink(CPP_CODE.indexOf("#include") + 2, 0, "#include <stdio.h>".length());
assertHyperlink(CPP_CODE.indexOf("<stdio.h>") + 2, 0, "#include <stdio.h>".length());
+ assertHyperlink(CPP_CODE.indexOf("<stdio.h>") + "<stdio.h".length(), 0, "#include <stdio.h>".length());
// hovering over the whitspace inside an include still results in a hyperlink
assertHyperlink(CPP_CODE.indexOf("<stdio.h>") - 1, 0, "#include <stdio.h>".length());
diff --git a/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/selection/BaseSelectionTestsIndexer.java b/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/selection/BaseSelectionTestsIndexer.java
index af9d0e082fb..d17454d6f25 100644
--- a/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/selection/BaseSelectionTestsIndexer.java
+++ b/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/selection/BaseSelectionTestsIndexer.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2005, 2007 IBM Corporation and others.
+ * Copyright (c) 2005, 2008 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -220,10 +220,7 @@ public class BaseSelectionTestsIndexer extends BaseUITestCase {
ITranslationUnit tu = (ITranslationUnit)CoreModel.getDefault().create(file);
IStatus ok= ASTProvider.getASTProvider().runOnAST(tu, ASTProvider.WAIT_YES, monitor, new ASTRunnable() {
public IStatus runOnAST(ILanguage language, IASTTranslationUnit ast) throws CoreException {
- IASTName[] names = language.getSelectedNames(ast, textSel.getOffset(), textSel.getLength());
- if (names != null && names.length > 0)
- result[0]= names[0];
-
+ result[0]= ast.getNodeSelector(null).findName(textSel.getOffset(), textSel.getLength());
return Status.OK_STATUS;
}
});
diff --git a/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/selection/CPPSelectionTestsAnyIndexer.java b/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/selection/CPPSelectionTestsAnyIndexer.java
index 12b7445dbf4..7d6ea99fa42 100644
--- a/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/selection/CPPSelectionTestsAnyIndexer.java
+++ b/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/selection/CPPSelectionTestsAnyIndexer.java
@@ -111,7 +111,7 @@ public abstract class CPPSelectionTestsAnyIndexer extends BaseSelectionTestsInde
// (2);
// return (0);
// }
- public void _testBug93281() throws Exception {
+ public void testBug93281() throws Exception {
StringBuffer[] buffers= getContents(2);
String hcode= buffers[0].toString();
String scode= buffers[1].toString();
diff --git a/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/selection/CPPSelectionTestsNoIndexer.java b/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/selection/CPPSelectionTestsNoIndexer.java
index 245a43909e4..54614ad3eb5 100644
--- a/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/selection/CPPSelectionTestsNoIndexer.java
+++ b/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/selection/CPPSelectionTestsNoIndexer.java
@@ -265,10 +265,7 @@ public class CPPSelectionTestsNoIndexer extends BaseUITestCase {
ITranslationUnit tu= CUIPlugin.getDefault().getWorkingCopyManager().getWorkingCopy(editor.getEditorInput());
IStatus ok= ASTProvider.getASTProvider().runOnAST(tu, ASTProvider.WAIT_YES, monitor, new ASTRunnable() {
public IStatus runOnAST(ILanguage language, IASTTranslationUnit ast) throws CoreException {
- IASTName[] names = language.getSelectedNames(ast, textSel.getOffset(), textSel.getLength());
- if (names != null && names.length > 0)
- result[0]= names[0];
-
+ result[0]= ast.getNodeSelector(null).findName(textSel.getOffset(), textSel.getLength());
return Status.OK_STATUS;
}
});
@@ -280,7 +277,7 @@ public class CPPSelectionTestsNoIndexer extends BaseUITestCase {
return null;
}
- public void _testBug93281() throws Exception {
+ public void testBug93281() throws Exception {
StringBuffer buffer = new StringBuffer();
buffer.append("class Point{ \n"); //$NON-NLS-1$
buffer.append("public: \n"); //$NON-NLS-1$
@@ -900,7 +897,7 @@ public class CPPSelectionTestsNoIndexer extends BaseUITestCase {
assertEquals(((ASTNode)decl).getLength(), 1);
}
- public void _testBug95229() throws Exception {
+ public void testBug95229() throws Exception {
StringBuffer buffer = new StringBuffer();
buffer.append("struct A {\n"); //$NON-NLS-1$
buffer.append("operator short(); // F3 on operator causes an infinite loop\n"); //$NON-NLS-1$
diff --git a/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/selection/CSelectionTestsNoIndexer.java b/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/selection/CSelectionTestsNoIndexer.java
index a08bdf1b6ae..8a6a92f345b 100644
--- a/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/selection/CSelectionTestsNoIndexer.java
+++ b/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/selection/CSelectionTestsNoIndexer.java
@@ -287,10 +287,7 @@ public class CSelectionTestsNoIndexer extends BaseUITestCase {
ITranslationUnit tu = (ITranslationUnit)CoreModel.getDefault().create(file);
IStatus ok= ASTProvider.getASTProvider().runOnAST(tu, ASTProvider.WAIT_YES, monitor, new ASTRunnable() {
public IStatus runOnAST(ILanguage language, IASTTranslationUnit ast) throws CoreException {
- IASTName[] names = language.getSelectedNames(ast, textSel.getOffset(), textSel.getLength());
- if (names != null && names.length > 0)
- result[0]= names[0];
-
+ result[0]= ast.getNodeSelector(null).findName(textSel.getOffset(), textSel.getLength());
return Status.OK_STATUS;
}
});
diff --git a/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/selection/ResolveBindingTests.java b/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/selection/ResolveBindingTests.java
index eb7b2c646a0..acac50cd312 100644
--- a/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/selection/ResolveBindingTests.java
+++ b/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/selection/ResolveBindingTests.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006, 2007 Wind River Systems, Inc. and others.
+ * Copyright (c) 2006, 2008 Wind River Systems, Inc. and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -76,9 +76,9 @@ public class ResolveBindingTests extends BaseUITestCase {
assertNotNull("No language for file " + astTU.getFilePath().toString(), language);
- IASTName[] names= language.getSelectedNames(astTU, offset, len);
- assertEquals(1, names.length);
- return names[0];
+ IASTName name= astTU.getNodeSelector(null).findName(offset, len);
+ assertNotNull(name);
+ return name;
}
private void checkBinding(IASTName name, Class clazz) {

Back to the top