Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[cdt-patch] A small C Model Update

Title: Not Applied: [cdt-patch] C Model Update - show the static elements in outline view

 

A small patch to:

-Add C Model elements for templates, enumerations, TypeDefs, Using and Namespaces.

-Skip showing the type for fields and variables in the outline view.

 

            Thanks

Hoda

 

Index: model/org/eclipse/cdt/internal/core/model/Enumeration.java
===================================================================
RCS file: model/org/eclipse/cdt/internal/core/model/Enumeration.java
diff -N model/org/eclipse/cdt/internal/core/model/Enumeration.java
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ model/org/eclipse/cdt/internal/core/model/Enumeration.java	31 Mar 2003 16:13:14 -0000
@@ -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;
+	}
+
+}
Index: model/org/eclipse/cdt/internal/core/model/Namespace.java
===================================================================
RCS file: model/org/eclipse/cdt/internal/core/model/Namespace.java
diff -N model/org/eclipse/cdt/internal/core/model/Namespace.java
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ model/org/eclipse/cdt/internal/core/model/Namespace.java	31 Mar 2003 16:13:14 -0000
@@ -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);
+	}
+
+}
Index: model/org/eclipse/cdt/internal/core/model/Template.java
===================================================================
RCS file: model/org/eclipse/cdt/internal/core/model/Template.java
diff -N model/org/eclipse/cdt/internal/core/model/Template.java
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ model/org/eclipse/cdt/internal/core/model/Template.java	31 Mar 2003 16:13:14 -0000
@@ -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;
+	}
+
+}
Index: model/org/eclipse/cdt/internal/core/model/TypeDef.java
===================================================================
RCS file: model/org/eclipse/cdt/internal/core/model/TypeDef.java
diff -N model/org/eclipse/cdt/internal/core/model/TypeDef.java
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ model/org/eclipse/cdt/internal/core/model/TypeDef.java	31 Mar 2003 16:13:14 -0000
@@ -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;
+	}
+
+}
Index: model/org/eclipse/cdt/internal/core/model/Using.java
===================================================================
RCS file: model/org/eclipse/cdt/internal/core/model/Using.java
diff -N model/org/eclipse/cdt/internal/core/model/Using.java
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ model/org/eclipse/cdt/internal/core/model/Using.java	31 Mar 2003 16:13:14 -0000
@@ -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);
+	}
+
+}
Index: src/org/eclipse/cdt/ui/CElementLabelProvider.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/CElementLabelProvider.java,v
retrieving revision 1.4
diff -u -r1.4 CElementLabelProvider.java
--- src/org/eclipse/cdt/ui/CElementLabelProvider.java	27 Mar 2003 16:11:56 -0000	1.4
+++ src/org/eclipse/cdt/ui/CElementLabelProvider.java	31 Mar 2003 16:12:51 -0000
@@ -68,15 +68,6 @@
 					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;				

Back to the top