use of org.eclipse.jdt.core.IOrdinaryClassFile in project eclipse.jdt.ls by eclipse.
the class TypeHierarchyCommand method getTypeHierarchy.
private TypeHierarchyItem getTypeHierarchy(String uri, Position position, TypeHierarchyDirection direction, int resolve, TypeHierarchyItem itemInput, IProgressMonitor monitor) {
if (uri == null || position == null || direction == null) {
return null;
}
try {
IType type = null;
if (itemInput == null) {
type = getType(uri, position, monitor);
} else {
String handleIdentifier = JSONUtility.toModel(itemInput.getData(), String.class);
IJavaElement element = JavaCore.create(handleIdentifier);
if (element instanceof IType) {
type = ((IType) element);
} else if (element instanceof IOrdinaryClassFile) {
type = ((IOrdinaryClassFile) element).getType();
} else {
return null;
}
}
TypeHierarchyItem item = TypeHierarchyCommand.toTypeHierarchyItem(type);
if (item == null) {
return null;
}
resolve(item, type, direction, resolve, monitor);
return item;
} catch (JavaModelException e) {
return null;
}
}
Aggregations