Skip to content
Browse files

[228098] rename some apis to better reflect javascript

  • Loading branch information...
1 parent d2d7ef7 commit 1c22652eeda9c7d2cbac8f82cca5792ed282bd76 pberkland committed Apr 30, 2008
View
12 ...t.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/model/AbstractJavaSearchTests.java
@@ -122,7 +122,7 @@ protected void writeLine() throws CoreException {
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 @@ protected void writeLine() throws CoreException {
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 @@ private void append(IType type) throws JavaScriptModelException {
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 String getPathString(IResource resource, IJavaScriptElement element) {
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();
View
6 ...dt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/model/CopyMoveResourcesTests.java
@@ -50,7 +50,7 @@ public IJavaScriptElement copyPositive(IJavaScriptElement element, IJavaScriptEl
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 @@ public void movePositive(IJavaScriptElement[] elements, IJavaScriptElement[] des
}
// 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 @@ public void movePositive(IJavaScriptElement[] elements, IJavaScriptElement[] des
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) {
View
8 ...se.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/model/CopyMoveTests.java
@@ -75,7 +75,7 @@ public IJavaScriptElement copyPositive(IJavaScriptElement element, IJavaScriptEl
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 @@ public IJavaScriptElement generateHandle(IJavaScriptElement original, String ren
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 @@ public void movePositive(IJavaScriptElement[] elements, IJavaScriptElement[] des
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);
}
View
4 ...wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/model/JavaProjectTests.java
@@ -326,7 +326,7 @@ public void testFindElementClassFile() throws JavaScriptModelException {
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 testFindElementCompilationUnit() throws JavaScriptModelException {
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"));
}
/**
View
10 ....jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/model/JavaSearchBugsTests.java
@@ -115,11 +115,11 @@ protected void search(String patternString, int searchFor, int limitTo, int matc
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");
View
2 ...wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/model/WorkingCopyTests.java
@@ -433,7 +433,7 @@ public void testGetPrimaryField() {
//
// 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();
// }

0 comments on commit 1c22652

Please sign in to comment.
Something went wrong with that request. Please try again.