1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-06-06 17:26:01 +02:00

Cosmetics.

This commit is contained in:
Sergey Prigogin 2013-10-21 14:02:13 -07:00
parent b2b2a109f5
commit 1e9005bdc8

View file

@ -6,7 +6,7 @@
* http://www.eclipse.org/legal/epl-v10.html * http://www.eclipse.org/legal/epl-v10.html
* *
* Contributors: * Contributors:
* Markus Schorn - initial API and implementation * Markus Schorn - initial API and implementation
*******************************************************************************/ *******************************************************************************/
package org.eclipse.cdt.internal.core.model.ext; package org.eclipse.cdt.internal.core.model.ext;
@ -38,9 +38,8 @@ import org.eclipse.core.runtime.CoreException;
import org.eclipse.jface.text.IRegion; import org.eclipse.jface.text.IRegion;
/** /**
* Factory for creating CElement handles. These are a minimal implementation * Factory for creating CElement handles. These are a minimal implementation of
* of the ICElement interface and can be used for displaying information about * the ICElement interface and can be used for displaying information about the index.
* the index.
* @since 4.0 * @since 4.0
*/ */
public class CElementHandleFactory { public class CElementHandleFactory {
@ -50,8 +49,7 @@ public class CElementHandleFactory {
IRegion region, long timestamp) throws CoreException { IRegion region, long timestamp) throws CoreException {
try { try {
return internalCreate(tu, binding, isDefinition, region, timestamp); return internalCreate(tu, binding, isDefinition, region, timestamp);
} } catch (DOMException e) {
catch (DOMException e) {
return null; return null;
} }
} }
@ -65,10 +63,8 @@ public class CElementHandleFactory {
return element; return element;
} }
public static ICElementHandle internalCreate(ITranslationUnit tu, IBinding binding, boolean definition, public static ICElementHandle internalCreate(ITranslationUnit tu, IBinding binding, boolean definition,
IRegion region, long timestamp) throws CoreException, DOMException { IRegion region, long timestamp) throws CoreException, DOMException {
ICElement parentElement= createParent(tu, binding); ICElement parentElement= createParent(tu, binding);
if (parentElement == null) { if (parentElement == null) {
return null; return null;
@ -93,29 +89,22 @@ public class CElementHandleFactory {
? new FunctionHandle(parentElement, (IFunction) binding) ? new FunctionHandle(parentElement, (IFunction) binding)
: new FunctionDeclarationHandle(parentElement, (IFunction) binding); : new FunctionDeclarationHandle(parentElement, (IFunction) binding);
} }
} } else if (binding instanceof IField) {
else if (binding instanceof IField) {
element= new FieldHandle(parentElement, (IField) binding); element= new FieldHandle(parentElement, (IField) binding);
} } else if (binding instanceof IVariable) {
else if (binding instanceof IVariable) {
if (binding instanceof IParameter) { if (binding instanceof IParameter) {
return null; return null;
} }
element= new VariableHandle(parentElement, (IVariable) binding); element= new VariableHandle(parentElement, (IVariable) binding);
} } else if (binding instanceof IEnumeration) {
else if (binding instanceof IEnumeration) {
element= new EnumerationHandle(parentElement, (IEnumeration) binding); element= new EnumerationHandle(parentElement, (IEnumeration) binding);
} } else if (binding instanceof IEnumerator) {
else if (binding instanceof IEnumerator) {
element= new EnumeratorHandle(parentElement, (IEnumerator) binding); element= new EnumeratorHandle(parentElement, (IEnumerator) binding);
} } else if (binding instanceof ICompositeType) {
else if (binding instanceof ICompositeType) {
element= createHandleForComposite(parentElement, (ICompositeType) binding); element= createHandleForComposite(parentElement, (ICompositeType) binding);
} } else if (binding instanceof ICPPNamespace) {
else if (binding instanceof ICPPNamespace) {
element= new NamespaceHandle(parentElement, (ICPPNamespace) binding); element= new NamespaceHandle(parentElement, (ICPPNamespace) binding);
} } else if (binding instanceof ITypedef) {
else if (binding instanceof ITypedef) {
element= new TypedefHandle(parentElement, (ITypedef) binding); element= new TypedefHandle(parentElement, (ITypedef) binding);
} }
if (element != null && region != null) { if (element != null && region != null) {
@ -147,7 +136,7 @@ public class CElementHandleFactory {
if (parentBinding instanceof ICPPNamespace) { if (parentBinding instanceof ICPPNamespace) {
char[] scopeName= parentBinding.getNameCharArray(); char[] scopeName= parentBinding.getNameCharArray();
// skip unnamed namespace // Skip unnamed namespace.
if (scopeName.length == 0) { if (scopeName.length == 0) {
return createParent(tu, parentBinding); return createParent(tu, parentBinding);
} }