Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
Copyright (c) 2000, 2009 IBM Corporation and others. All rights reserved. This program and the accompanying materials are made available under the terms of the Eclipse Public License v1.0 which accompanies this distribution, and is available at http://www.eclipse.org/legal/epl-v10.html Contributors: IBM Corporation - initial API and implementation /
 
 package org.eclipse.jdt.internal.core;
 
This operation creates an ITypeHierarchy for a specific type within a specified region, or for all types within a region. The specified region limits the number of resolved subtypes (to the subset of types in the specified region). The resolved supertypes may go outside of the specified region in order to reach the root(s) of the type hierarchy. A Java Project is required to provide a context (classpath) to use while resolving supertypes and subtypes.

 
 
 public class CreateTypeHierarchyOperation extends JavaModelOperation {
The generated type hierarchy
 
Constructs an operation to create a type hierarchy for the given type within the specified region, in the context of the given project.
 
 public CreateTypeHierarchyOperation(IRegion regionICompilationUnit[] workingCopiesIType elementboolean computeSubtypes) {
 	super(element);
 	this. = new RegionBasedTypeHierarchy(regionworkingCopieselementcomputeSubtypes);
 }
Constructs an operation to create a type hierarchy for the given type and working copies.
 
 public CreateTypeHierarchyOperation(IType elementICompilationUnit[] workingCopiesIJavaSearchScope scopeboolean computeSubtypes) {
 	super(element);
 	ICompilationUnit[] copies;
 	if (workingCopies != null) {
 		int length = workingCopies.length;
 		copies = new ICompilationUnit[length];
 		System.arraycopy(workingCopies, 0, copies, 0, length);
 	} else {
 		copies = null;
 	}
 	this. = new TypeHierarchy(elementcopiesscopecomputeSubtypes);
 }
Constructs an operation to create a type hierarchy for the given type and working copies.
 
 public CreateTypeHierarchyOperation(IType elementICompilationUnit[] workingCopiesIJavaProject projectboolean computeSubtypes) {
 	super(element);
 	ICompilationUnit[] copies;
 	if (workingCopies != null) {
 		int length = workingCopies.length;
 		copies = new ICompilationUnit[length];
 		System.arraycopy(workingCopies, 0, copies, 0, length);
 	} else {
 		copies = null;
 	}
 	this. = new TypeHierarchy(elementcopiesprojectcomputeSubtypes);
 }
Performs the operation - creates the type hierarchy

Throws:
org.eclipse.jdt.core.JavaModelException The operation has failed.
 
 protected void executeOperation() throws JavaModelException {
 	this..refresh(this);
 }
Returns the generated type hierarchy.
 
 public ITypeHierarchy getResult() {
 	return this.;
 }
public boolean isReadOnly() {
	return true;
Possible failures:
  • NO_ELEMENTS_TO_PROCESS - at least one of a type or region must be provided to generate a type hierarchy.
  • ELEMENT_NOT_PRESENT - the provided type or type's project does not exist
	IJavaElement elementToProcessgetElementToProcess();
	if (elementToProcess == null && !(this. instanceof RegionBasedTypeHierarchy)) {
	}
	if (elementToProcess != null && !elementToProcess.exists()) {
	}
	if (project != null && !project.exists()) {
	}
New to GrepCode? Check out our FAQ X