Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 126614

Summary: API request for class SourceType
Product: [Eclipse Project] JDT Reporter: Eugene Chan <ewchan>
Component: CoreAssignee: JDT-Core-Inbox <jdt-core-inbox>
Status: CLOSED DUPLICATE QA Contact:
Severity: blocker    
Priority: P3 CC: popescu
Version: 3.2   
Target Milestone: ---   
Hardware: PC   
OS: Windows 2000   
Whiteboard:
Bug Depends on:    
Bug Blocks: 126587    

Description Eugene Chan CLA 2006-02-06 13:19:17 EST
Internal class org.eclipse.jdt.internal.core.SourceType is required in TPTP for  Source Opening Action. We would like to request that this be made public API.

Here is how it is used:
/**
	 * Returns the specified inner class from the given java element.
	 * 
	 * @param je the java element containing the inner class.
	 * @param innerClassType the inner class to get.
	 * @return an IType representing the inner class.
	 */
	private static IType getInnerType(IJavaElement je, InnerClassType innerClassType) {
		try {
			if (je instanceof SourceType) {
				SourceType type = (SourceType) je;
				if (type.isAnonymous() == innerClassType.isAnonymous()
						&& ((innerClassType.isAnonymous() && innerClassType.getAnonymousNumber() == type.getOccurrenceCount())
								|| (!innerClassType.isAnonymous() && type.getElementName().equals(innerClassType.getName()))))
					return type;
			}
			
			if (je instanceof IParent) {
				IParent parentElement = (IParent)je;
				IJavaElement[] children = parentElement.getChildren();
				
				for (int i = 0; i < children.length; i++) {
					IType result = getInnerType(children[i], innerClassType);
					if (result != null)
						return result;
				}
			}
		}
		catch (Exception e) {
			HyadesUIPlugin.logError(e);
		}
		return null;
	}

This is a blocking defect on TPTP.
Comment 1 Jerome Lanneluc CLA 2006-02-06 13:23:01 EST

*** This bug has been marked as a duplicate of 126613 ***
Comment 2 Eugene Chan CLA 2007-06-21 10:48:33 EDT
close bug.