Lines 1-5
Link Here
|
1 |
/******************************************************************************* |
1 |
/******************************************************************************* |
2 |
* Copyright (c) 2000, 2009 IBM Corporation and others. |
2 |
* Copyright (c) 2000, 2010 IBM Corporation and others. |
3 |
* All rights reserved. This program and the accompanying materials |
3 |
* All rights reserved. This program and the accompanying materials |
4 |
* are made available under the terms of the Eclipse Public License v1.0 |
4 |
* are made available under the terms of the Eclipse Public License v1.0 |
5 |
* which accompanies this distribution, and is available at |
5 |
* which accompanies this distribution, and is available at |
Lines 16-21
Link Here
|
16 |
|
16 |
|
17 |
import org.eclipse.core.resources.*; |
17 |
import org.eclipse.core.resources.*; |
18 |
import org.eclipse.core.runtime.CoreException; |
18 |
import org.eclipse.core.runtime.CoreException; |
|
|
19 |
import org.eclipse.core.runtime.IPath; |
19 |
import org.eclipse.core.runtime.IProgressMonitor; |
20 |
import org.eclipse.core.runtime.IProgressMonitor; |
20 |
import org.eclipse.core.runtime.Path; |
21 |
import org.eclipse.core.runtime.Path; |
21 |
import org.eclipse.jdt.core.*; |
22 |
import org.eclipse.jdt.core.*; |
Lines 1334-1339
Link Here
|
1334 |
} |
1335 |
} |
1335 |
} |
1336 |
} |
1336 |
/** |
1337 |
/** |
|
|
1338 |
* @bug 316654: ITypeHierarchyChangedListener receive spurious callbacks |
1339 |
* |
1340 |
* Test that a non-Java resource added to a folder package fragment root doesn't |
1341 |
* result in a type hierarchy changed event. |
1342 |
* |
1343 |
* @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=316654" |
1344 |
* @throws CoreException |
1345 |
*/ |
1346 |
public void testAddNonJavaToPackageFragmentRoot() throws CoreException { |
1347 |
IJavaProject project = getJavaProject("TypeHierarchyNotification"); |
1348 |
ICompilationUnit cu = getCompilationUnit("TypeHierarchyNotification", "src", "p", "X.java"); |
1349 |
IType type= cu.getType("X"); |
1350 |
ITypeHierarchy h = type.newTypeHierarchy(project, null); |
1351 |
h.addTypeHierarchyChangedListener(this); |
1352 |
|
1353 |
try { |
1354 |
createFile(project.getProject().getFullPath().append("src").append("simplefile.txt").toOSString(), "A simple text file"); |
1355 |
assertTrue("Should not receive change", !this.changeReceived); |
1356 |
} finally { |
1357 |
h.removeTypeHierarchyChangedListener(this); |
1358 |
} |
1359 |
} |
1360 |
public void testAddNonJavaToPackageFragmentRoot1() throws CoreException { |
1361 |
IJavaProject project = getJavaProject("TypeHierarchyNotification"); |
1362 |
ICompilationUnit cu = getCompilationUnit("TypeHierarchyNotification", "src", "p", "X.java"); |
1363 |
IType type= cu.getType("X"); |
1364 |
ITypeHierarchy h = type.newTypeHierarchy(project, null); |
1365 |
h.addTypeHierarchyChangedListener(this); |
1366 |
IPath filePath = project.getProject().getFullPath().append("src").append("p").append("Y.java"); |
1367 |
try { |
1368 |
createFile(filePath.toOSString(), |
1369 |
"package p;\n" + |
1370 |
"class Y extends X{\n" + |
1371 |
"}"); |
1372 |
assertOneChange(h); |
1373 |
} finally { |
1374 |
deleteFile(filePath.toOSString()); |
1375 |
h.removeTypeHierarchyChangedListener(this); |
1376 |
} |
1377 |
} |
1378 |
/** |
1337 |
* Make a note of the change |
1379 |
* Make a note of the change |
1338 |
*/ |
1380 |
*/ |
1339 |
public void typeHierarchyChanged(ITypeHierarchy typeHierarchy) { |
1381 |
public void typeHierarchyChanged(ITypeHierarchy typeHierarchy) { |