[228098] rename some apis to better reflect javascript
diff --git a/tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/model/AbstractJavaSearchTests.java b/tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/model/AbstractJavaSearchTests.java index e4a82a5..62085d3 100644 --- a/tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/model/AbstractJavaSearchTests.java +++ b/tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/model/AbstractJavaSearchTests.java
@@ -122,7 +122,7 @@ line.append("."); } line.append(localVar.getElementName()); - unit = (IJavaScriptUnit)localVar.getAncestor(IJavaScriptElement.COMPILATION_UNIT); + unit = (IJavaScriptUnit)localVar.getAncestor(IJavaScriptElement.JAVASCRIPT_UNIT); } else if (element instanceof ITypeParameter) { line.append(" "); ITypeParameter typeParam = (ITypeParameter)element; @@ -137,16 +137,16 @@ unit = method.getJavaScriptUnit(); } else { line.append("<Unexpected kind of parent for type parameter>"); - unit = (IJavaScriptUnit)typeParam.getAncestor(IJavaScriptElement.COMPILATION_UNIT); + unit = (IJavaScriptUnit)typeParam.getAncestor(IJavaScriptElement.JAVASCRIPT_UNIT); } line.append("."); line.append(typeParam.getElementName()); } else if (element instanceof IImportDeclaration) { IImportDeclaration importDeclaration = (IImportDeclaration)element; - unit = (IJavaScriptUnit)importDeclaration.getAncestor(IJavaScriptElement.COMPILATION_UNIT); + unit = (IJavaScriptUnit)importDeclaration.getAncestor(IJavaScriptElement.JAVASCRIPT_UNIT); } else if (element instanceof IPackageDeclaration) { IPackageDeclaration packageDeclaration = (IPackageDeclaration)element; - unit = (IJavaScriptUnit)packageDeclaration.getAncestor(IJavaScriptElement.COMPILATION_UNIT); + unit = (IJavaScriptUnit)packageDeclaration.getAncestor(IJavaScriptElement.JAVASCRIPT_UNIT); } if (resource instanceof IFile) { char[] contents = getSource(resource, element, unit); @@ -284,7 +284,7 @@ IJavaScriptElement parent = type.getParent(); boolean isLocal = false; switch (parent.getElementType()) { - case IJavaScriptElement.COMPILATION_UNIT: + case IJavaScriptElement.JAVASCRIPT_UNIT: IPackageFragment pkg = type.getPackageFragment(); append(pkg); if (!pkg.getElementName().equals(IPackageFragment.DEFAULT_PACKAGE_NAME)) { @@ -368,7 +368,7 @@ protected char[] getSource(IResource resource, IJavaScriptElement element, IJavaScriptUnit unit) throws CoreException { char[] contents = CharOperation.NO_CHAR; if ("js".equals(resource.getFileExtension())) { - IJavaScriptUnit cu = (IJavaScriptUnit)element.getAncestor(IJavaScriptElement.COMPILATION_UNIT); + IJavaScriptUnit cu = (IJavaScriptUnit)element.getAncestor(IJavaScriptElement.JAVASCRIPT_UNIT); if (cu != null && cu.isWorkingCopy()) { // working copy contents = unit.getBuffer().getCharacters();
diff --git a/tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/model/CopyMoveResourcesTests.java b/tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/model/CopyMoveResourcesTests.java index 146f9d2..b39e4dd 100644 --- a/tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/model/CopyMoveResourcesTests.java +++ b/tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/model/CopyMoveResourcesTests.java
@@ -50,7 +50,7 @@ IJavaScriptElement copy = generateHandle(element, rename, container); assertTrue("Copy should exist", copy.exists()); //ensure correct position - if (element.getElementType() > IJavaScriptElement.COMPILATION_UNIT) { + if (element.getElementType() > IJavaScriptElement.JAVASCRIPT_UNIT) { ensureCorrectPositioning((IParent) container, sibling, copy); } else if (container.getElementType() != IJavaScriptElement.PACKAGE_FRAGMENT_ROOT) { // ensure package name is correct @@ -129,7 +129,7 @@ } // ensure the original element no longer exists, unless moving within the same container, or moving a primary working copy if (!destinations[i].equals(element.getParent())) { - if (element.getElementType() != IJavaScriptElement.COMPILATION_UNIT || !((IJavaScriptUnit) element).isWorkingCopy()) + if (element.getElementType() != IJavaScriptElement.JAVASCRIPT_UNIT || !((IJavaScriptUnit) element).isWorkingCopy()) assertTrue("The original element must not exist", !element.exists()); } assertTrue("Moved element should exist", moved.exists()); @@ -138,7 +138,7 @@ if (container.getElementType() == IJavaScriptElement.PACKAGE_FRAGMENT) { if (container.getElementName().equals("")) { // default package - if (moved.getElementType() == IJavaScriptElement.COMPILATION_UNIT) { + if (moved.getElementType() == IJavaScriptElement.JAVASCRIPT_UNIT) { IJavaScriptElement[] children = ((IJavaScriptUnit) moved).getChildren(); for (int j = 0; j < children.length; j++) { if (children[j].getElementType() == IJavaScriptElement.PACKAGE_DECLARATION) {
diff --git a/tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/model/CopyMoveTests.java b/tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/model/CopyMoveTests.java index 8225202..24ae9fb 100644 --- a/tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/model/CopyMoveTests.java +++ b/tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/model/CopyMoveTests.java
@@ -75,7 +75,7 @@ assertTrue("Copy should exist", copy.exists()); //ensure correct position - if (element.getElementType() > IJavaScriptElement.COMPILATION_UNIT) { + if (element.getElementType() > IJavaScriptElement.JAVASCRIPT_UNIT) { ensureCorrectPositioning((IParent) container, sibling, copy); } else { if (container.getElementType() == IJavaScriptElement.PACKAGE_FRAGMENT_ROOT) { @@ -136,14 +136,14 @@ break; case IJavaScriptElement.PACKAGE_FRAGMENT : switch (original.getElementType()) { - case IJavaScriptElement.COMPILATION_UNIT : + case IJavaScriptElement.JAVASCRIPT_UNIT : return ((IPackageFragment) container).getJavaScriptUnit(name); default : assertTrue("illegal child type", false); break; } break; - case IJavaScriptElement.COMPILATION_UNIT : + case IJavaScriptElement.JAVASCRIPT_UNIT : switch (original.getElementType()) { case IJavaScriptElement.IMPORT_DECLARATION : return ((IJavaScriptUnit) container).getImport(name); @@ -307,7 +307,7 @@ assertTrue("Moved element should exist", moved.exists()); //ensure correct position - if (element.getElementType() > IJavaScriptElement.COMPILATION_UNIT) { + if (element.getElementType() > IJavaScriptElement.JAVASCRIPT_UNIT) { if (siblings != null && siblings.length > 0) { ensureCorrectPositioning((IParent) moved.getParent(), siblings[i], moved); }
diff --git a/tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/model/JavaProjectTests.java b/tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/model/JavaProjectTests.java index 51bc3c2..c374a4c 100644 --- a/tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/model/JavaProjectTests.java +++ b/tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/model/JavaProjectTests.java
@@ -326,7 +326,7 @@ public void testFindElementCompilationUnit() throws JavaScriptModelException { IJavaScriptProject project= getJavaProject("JavaProjectTests"); IJavaScriptElement element= project.findElement(new Path("x/y/Main.js")); - assertTrue("CU not found" , element != null && element.getElementType() == IJavaScriptElement.COMPILATION_UNIT + assertTrue("CU not found" , element != null && element.getElementType() == IJavaScriptElement.JAVASCRIPT_UNIT && element.getElementName().equals("Main.js")); } /** @@ -335,7 +335,7 @@ public void testFindElementCompilationUnitDefaultPackage() throws JavaScriptModelException { IJavaScriptProject project= getJavaProject("JavaProjectTests"); IJavaScriptElement element= project.findElement(new Path("B.js")); - assertTrue("CU not found" , element != null && element.getElementType() == IJavaScriptElement.COMPILATION_UNIT + assertTrue("CU not found" , element != null && element.getElementType() == IJavaScriptElement.JAVASCRIPT_UNIT && element.getElementName().equals("B.js")); } /**
diff --git a/tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/model/JavaSearchBugsTests.java b/tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/model/JavaSearchBugsTests.java index e7e0deb..4be5d3e 100644 --- a/tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/model/JavaSearchBugsTests.java +++ b/tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/model/JavaSearchBugsTests.java
@@ -115,11 +115,11 @@ public void setUpSuite() throws Exception { super.setUpSuite(); JAVA_PROJECT = setUpJavaProject("JavaSearchBugs", "1.5"); -// addLibraryEntry(JAVA_PROJECT, "/JavaSearchBugs/lib/b95152.jar", false); -// addLibraryEntry(JAVA_PROJECT, "/JavaSearchBugs/lib/b123679.jar", false); -// addLibraryEntry(JAVA_PROJECT, "/JavaSearchBugs/lib/b140156.jar", false); -// addLibraryEntry(JAVA_PROJECT, "/JavaSearchBugs/lib/b164791.jar", false); -// addLibraryEntry(JAVA_PROJECT, "/JavaSearchBugs/lib/b166348.jar", false); +// addLibraryEntry(JAVASCRIPT_PROJECT, "/JavaSearchBugs/lib/b95152.jar", false); +// addLibraryEntry(JAVASCRIPT_PROJECT, "/JavaSearchBugs/lib/b123679.jar", false); +// addLibraryEntry(JAVASCRIPT_PROJECT, "/JavaSearchBugs/lib/b140156.jar", false); +// addLibraryEntry(JAVASCRIPT_PROJECT, "/JavaSearchBugs/lib/b164791.jar", false); +// addLibraryEntry(JAVASCRIPT_PROJECT, "/JavaSearchBugs/lib/b166348.jar", false); } public void tearDownSuite() throws Exception { deleteProject("JavaSearchBugs");
diff --git a/tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/model/WorkingCopyTests.java b/tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/model/WorkingCopyTests.java index 6d20a3e..1436f70 100644 --- a/tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/model/WorkingCopyTests.java +++ b/tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/model/WorkingCopyTests.java
@@ -433,7 +433,7 @@ // // Vector hierarchy = new Vector(5); // IJavaScriptElement parent= primary.getParent(); -// while (parent.getElementType() > IJavaScriptElement.COMPILATION_UNIT) { +// while (parent.getElementType() > IJavaScriptElement.JAVASCRIPT_UNIT) { // hierarchy.addElement(parent); // parent = parent.getParent(); // }