mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-09-10 03:53:21 +02:00
Patch for Hoda Amer:
-Add C Model elements for templates, enumerations, TypeDefs, Using and Namespaces. -Skip showing the type for fields and variables in the outline view.
This commit is contained in:
parent
daa99a3066
commit
441247f095
6 changed files with 227 additions and 9 deletions
|
@ -0,0 +1,75 @@
|
|||
package org.eclipse.cdt.internal.core.model;
|
||||
|
||||
/**********************************************************************
|
||||
* Copyright (c) 2002,2003 Rational Software Corporation and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Common Public License v0.5
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/cpl-v05.html
|
||||
*
|
||||
* Contributors:
|
||||
* Rational Software - Initial API and implementation
|
||||
***********************************************************************/
|
||||
|
||||
import org.eclipse.cdt.core.model.ICElement;
|
||||
import org.eclipse.cdt.core.model.IEnumeration;
|
||||
|
||||
public class Enumeration extends SourceManipulation implements IEnumeration{
|
||||
|
||||
public Enumeration(ICElement parent, String name) {
|
||||
super(parent, name, CElement.C_ENUMERATION);
|
||||
}
|
||||
|
||||
protected CElementInfo createElementInfo () {
|
||||
return new SourceManipulationInfo(this);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see org.eclipse.cdt.core.model.IVariable#getInitializer()
|
||||
*/
|
||||
public String getInitializer() {
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see org.eclipse.cdt.core.model.IVariableDeclaration#getTypeName()
|
||||
*/
|
||||
public String getTypeName() {
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see org.eclipse.cdt.core.model.IVariableDeclaration#setTypeName(java.lang.String)
|
||||
*/
|
||||
public void setTypeName(String type) {
|
||||
}
|
||||
|
||||
/**
|
||||
* @see org.eclipse.cdt.core.model.IDeclaration#getAccessControl()
|
||||
*/
|
||||
public int getAccessControl() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see org.eclipse.cdt.core.model.IDeclaration#isConst()
|
||||
*/
|
||||
public boolean isConst() {
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see org.eclipse.cdt.core.model.IDeclaration#isStatic()
|
||||
*/
|
||||
public boolean isStatic() {
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see org.eclipse.cdt.core.model.IDeclaration#isVolatile()
|
||||
*/
|
||||
public boolean isVolatile() {
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,27 @@
|
|||
package org.eclipse.cdt.internal.core.model;
|
||||
|
||||
/**********************************************************************
|
||||
* Copyright (c) 2002,2003 Rational Software Corporation and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Common Public License v0.5
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/cpl-v05.html
|
||||
*
|
||||
* Contributors:
|
||||
* Rational Software - Initial API and implementation
|
||||
***********************************************************************/
|
||||
|
||||
import org.eclipse.cdt.core.model.ICElement;
|
||||
import org.eclipse.cdt.core.model.INamespace;
|
||||
|
||||
public class Namespace extends SourceManipulation implements INamespace{
|
||||
|
||||
public Namespace(ICElement parent, String name) {
|
||||
super(parent, name, CElement.C_NAMESPACE);
|
||||
}
|
||||
|
||||
protected CElementInfo createElementInfo () {
|
||||
return new SourceManipulationInfo(this);
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,62 @@
|
|||
package org.eclipse.cdt.internal.core.model;
|
||||
|
||||
/**********************************************************************
|
||||
* Copyright (c) 2002,2003 Rational Software Corporation and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Common Public License v0.5
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/cpl-v05.html
|
||||
*
|
||||
* Contributors:
|
||||
* Rational Software - Initial API and implementation
|
||||
***********************************************************************/
|
||||
|
||||
import org.eclipse.cdt.core.model.ICElement;
|
||||
import org.eclipse.cdt.core.model.ITemplate;
|
||||
|
||||
public class Template extends SourceManipulation implements ITemplate{
|
||||
|
||||
public Template(ICElement parent, String name) {
|
||||
super(parent, name, CElement.C_TEMPLATE);
|
||||
}
|
||||
|
||||
protected CElementInfo createElementInfo () {
|
||||
return new SourceManipulationInfo(this);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see org.eclipse.cdt.core.model.IMember#getVisibility()
|
||||
*/
|
||||
public int getVisibility() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see org.eclipse.cdt.core.model.IDeclaration#getAccessControl()
|
||||
*/
|
||||
public int getAccessControl() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see org.eclipse.cdt.core.model.IDeclaration#isConst()
|
||||
*/
|
||||
public boolean isConst() {
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see org.eclipse.cdt.core.model.IDeclaration#isStatic()
|
||||
*/
|
||||
public boolean isStatic() {
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see org.eclipse.cdt.core.model.IDeclaration#isVolatile()
|
||||
*/
|
||||
public boolean isVolatile() {
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,36 @@
|
|||
package org.eclipse.cdt.internal.core.model;
|
||||
|
||||
/**********************************************************************
|
||||
* Copyright (c) 2002,2003 Rational Software Corporation and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Common Public License v0.5
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/cpl-v05.html
|
||||
*
|
||||
* Contributors:
|
||||
* Rational Software - Initial API and implementation
|
||||
***********************************************************************/
|
||||
|
||||
import org.eclipse.cdt.core.model.CModelException;
|
||||
import org.eclipse.cdt.core.model.ICElement;
|
||||
import org.eclipse.cdt.core.model.ITypeDef;
|
||||
|
||||
public class TypeDef extends SourceManipulation implements ITypeDef{
|
||||
|
||||
public TypeDef(ICElement parent, String name) {
|
||||
super(parent, name, CElement.C_TYPEDEF);
|
||||
}
|
||||
|
||||
protected CElementInfo createElementInfo () {
|
||||
return new SourceManipulationInfo(this);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @see org.eclipse.cdt.core.model.ITypeDef#getType()
|
||||
*/
|
||||
public String getType() throws CModelException {
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,27 @@
|
|||
package org.eclipse.cdt.internal.core.model;
|
||||
|
||||
/**********************************************************************
|
||||
* Copyright (c) 2002,2003 Rational Software Corporation and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Common Public License v0.5
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/cpl-v05.html
|
||||
*
|
||||
* Contributors:
|
||||
* Rational Software - Initial API and implementation
|
||||
***********************************************************************/
|
||||
|
||||
import org.eclipse.cdt.core.model.ICElement;
|
||||
import org.eclipse.cdt.core.model.IUsing;
|
||||
|
||||
public class Using extends SourceManipulation implements IUsing{
|
||||
|
||||
public Using(ICElement parent, String name) {
|
||||
super(parent, name, CElement.C_USING);
|
||||
}
|
||||
|
||||
protected CElementInfo createElementInfo () {
|
||||
return new SourceManipulationInfo(this);
|
||||
}
|
||||
|
||||
}
|
|
@ -68,15 +68,6 @@ public class CElementLabelProvider extends LabelProvider {
|
|||
IFunctionDeclaration fdecl = (IFunctionDeclaration) celem;
|
||||
name = fdecl.getSignature();
|
||||
break;
|
||||
case ICElement.C_VARIABLE:
|
||||
IVariable var = (IVariable) celem;
|
||||
name = var.getTypeName() + " " + var.getElementName();
|
||||
break;
|
||||
case ICElement.C_VARIABLE_DECLARATION:
|
||||
case ICElement.C_FIELD:
|
||||
IVariableDeclaration vdecl = (IVariableDeclaration) celem;
|
||||
name = vdecl.getTypeName() + " " + vdecl.getElementName();
|
||||
break;
|
||||
default:
|
||||
name= celem.getElementName();
|
||||
break;
|
||||
|
|
Loading…
Add table
Reference in a new issue