use of org.eclipse.xtext.common.types.access.IMirror in project xtext-eclipse by eclipse.
the class JdtTypeProvider method canLink.
private boolean canLink(JvmType type) {
Resource resource = type.eResource();
if (resource instanceof TypeResource) {
IMirror mirror = ((TypeResource) resource).getMirror();
if (mirror instanceof JdtTypeMirror) {
try {
return canLink(((JdtTypeMirror) mirror).getMirroredType());
} catch (JavaModelException e) {
return false;
}
} else {
return true;
}
}
URI resourceURI = resource.getURI();
if (resourceURI.isPlatformResource() && resourceURI.segment(1).equals(javaProject.getProject().getName())) {
IndexedJvmTypeAccess indexedJvmTypeAccess = this.getIndexedJvmTypeAccess();
if (indexedJvmTypeAccess != null && indexedJvmTypeAccess.isIndexingPhase(getResourceSet())) {
return false;
}
}
return true;
}
use of org.eclipse.xtext.common.types.access.IMirror in project xtext-eclipse by eclipse.
the class JdtTypeProvider method createResource.
private TypeResource createResource(URI resourceURI, IType type) {
TypeResource resource = doCreateResource(resourceURI);
getResourceSet().getResources().add(resource);
if (type.exists()) {
IMirror mirror = createMirror(type);
resource.setMirror(mirror);
}
return resource;
}
use of org.eclipse.xtext.common.types.access.IMirror in project xtext-eclipse by eclipse.
the class JdtTypeProviderTest method testCreateMirror_01.
@Test
public void testCreateMirror_01() {
URI uri = URI.createURI("java:/Objects/java.util.Map");
IMirror mirror = typeProvider.createMirror(uri);
assertNotNull(mirror);
assertTrue(mirror instanceof JdtTypeMirror);
assertEquals("java.util.Map", ((JdtTypeMirror) mirror).getMirroredType().getFullyQualifiedName());
}
use of org.eclipse.xtext.common.types.access.IMirror in project xtext-eclipse by eclipse.
the class JdtTypeProviderTest method testCreateMirror_02.
@Test
public void testCreateMirror_02() {
URI uri = URI.createURI("java:/Primitives");
IMirror mirror = typeProvider.createMirror(uri);
assertNotNull(mirror);
assertTrue(mirror instanceof PrimitiveMirror);
}
Aggregations