Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[cdt-patch] cdt.ui a few bug fixes

Index: ChangeLog
===================================================================
RCS file: /home/tools/org.eclipse.cdt.ui/ChangeLog,v
retrieving revision 1.25
diff -u -r1.25 ChangeLog
--- ChangeLog	15 Nov 2002 20:26:08 -0000	1.25
+++ ChangeLog	18 Nov 2002 15:17:48 -0000
@@ -1,3 +1,14 @@
+2002-11-18 Alain Magloire
+
+	* src/.../internal/ui/editor/CEditor.java (createCSourceViewer):
+	Check for null pointer, the file maybe an IStorage.
+	* src/.../internal/ui/cview/CViewSorter.java (category): Expand
+	the category to include member of a translationUnit. 
+	* src/.../internal/ui/cview/CContentProvider.java (processDelta):
+	postRefresh() for IBinary and IArchive files also.
+	* src/.../internal/ui/cview/CElementAdapterFactory.java (getAdapter):
+	Call getResource() instead of getUnderlyingResource().
+
 2002-11-15 Alain Magloire
 
 	* src/.../internal/ui/cview/CView.java (addBookMarkMenu):
Index: src/org/eclipse/cdt/internal/ui/CContentProvider.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/CContentProvider.java,v
retrieving revision 1.3
diff -u -r1.3 CContentProvider.java
--- src/org/eclipse/cdt/internal/ui/CContentProvider.java	29 Oct 2002 21:40:58 -0000	1.3
+++ src/org/eclipse/cdt/internal/ui/CContentProvider.java	18 Nov 2002 15:17:51 -0000
@@ -14,6 +14,7 @@
 import org.eclipse.swt.widgets.Control;
 
 import org.eclipse.cdt.core.model.CoreModel;
+import org.eclipse.cdt.core.model.IArchive;
 import org.eclipse.cdt.core.model.ICElementDelta;
 import org.eclipse.cdt.core.model.IElementChangedListener;
 import org.eclipse.cdt.core.model.ElementChangedEvent;
@@ -122,16 +123,13 @@
 			}
 		}
 
-		if (element instanceof ITranslationUnit) {
+		if (element instanceof ITranslationUnit ||
+		    element instanceof IBinary || element instanceof IArchive) {
 			if (kind == ICElementDelta.CHANGED) {
 				postRefresh(element);
 				return;
 			}
 		}
-
-		// we don't show the contents of a compilation or IClassFile, so don't go any deeper
-		//if (element instanceof ITranslationUnit)
-		//	return;
 
 		//if (isBuildPathChange(delta)) {
 			// throw the towel and do a full refresh of the affected C project. 
Index: src/org/eclipse/cdt/internal/ui/CElementAdapterFactory.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/CElementAdapterFactory.java,v
retrieving revision 1.2
diff -u -r1.2 CElementAdapterFactory.java
--- src/org/eclipse/cdt/internal/ui/CElementAdapterFactory.java	26 Jul 2002 19:15:14 -0000	1.2
+++ src/org/eclipse/cdt/internal/ui/CElementAdapterFactory.java	18 Nov 2002 15:17:49 -0000
@@ -74,7 +74,7 @@
 				if (res != null)
 					return res.getWorkspace().getRoot();
 			} else if (IProject.class.equals(key)) {
-				res = celem.getUnderlyingResource();
+				res = celem.getResource();
 				if (res != null)
 					return res.getProject();
 			} else if (IResource.class.equals(key)) {
Index: src/org/eclipse/cdt/internal/ui/cview/CViewSorter.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/cview/CViewSorter.java,v
retrieving revision 1.1
diff -u -r1.1 CViewSorter.java
--- src/org/eclipse/cdt/internal/ui/cview/CViewSorter.java	26 Jun 2002 20:55:44 -0000	1.1
+++ src/org/eclipse/cdt/internal/ui/cview/CViewSorter.java	18 Nov 2002 15:17:58 -0000
@@ -5,19 +5,25 @@
  * All Rights Reserved.
  */
  
-import org.eclipse.jface.viewers.ViewerSorter;
-
-import org.eclipse.core.resources.IResource;
-
-import org.eclipse.cdt.core.model.ICRoot;
-import org.eclipse.cdt.core.model.ICProject;
-import org.eclipse.cdt.core.model.ICFolder;
+import org.eclipse.cdt.core.model.CModelException;
 import org.eclipse.cdt.core.model.IArchive;
-import org.eclipse.cdt.core.model.IBinaryContainer;
 import org.eclipse.cdt.core.model.IArchiveContainer;
-import org.eclipse.cdt.core.model.ICFile;
+import org.eclipse.cdt.core.model.IBinaryContainer;
 import org.eclipse.cdt.core.model.ICElement;
-import org.eclipse.cdt.core.model.CModelException;
+import org.eclipse.cdt.core.model.ICFile;
+import org.eclipse.cdt.core.model.ICFolder;
+import org.eclipse.cdt.core.model.ICProject;
+import org.eclipse.cdt.core.model.ICRoot;
+import org.eclipse.cdt.core.model.IFunction;
+import org.eclipse.cdt.core.model.IFunctionDeclaration;
+import org.eclipse.cdt.core.model.IInclude;
+import org.eclipse.cdt.core.model.IMacro;
+import org.eclipse.cdt.core.model.INamespace;
+import org.eclipse.cdt.core.model.IUsing;
+import org.eclipse.cdt.core.model.IVariable;
+import org.eclipse.cdt.core.model.IVariableDeclaration;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.jface.viewers.ViewerSorter;
 
 /**
  *	A sorter to sort the file and the folders in the C viewer in the following order:
@@ -51,27 +57,57 @@
 				String ext = res.getFileExtension();
 				if (ext != null) {
 					if (ext.equals("h") || ext.equals("hh")) {
-						return 50;
+						return 42;
 					}
 					if (ext.equals("c") || ext.equals("C") || ext.equals("cc") || ext.equals("cpp")) {
-						return 51;
+						return 44;
 					}
-					return 52;
+					return 48;
 				}
-				return 53;
+				return 49;
+			}
+			return 50;
+		} else if (element instanceof IInclude) {
+			return 60;
+		} else if (element instanceof IMacro) {
+			return 70;
+		} else if (element instanceof INamespace) {
+			return 80;
+		} else if (element instanceof IUsing) {
+			return 90;
+		} else if (element instanceof IFunctionDeclaration) {
+			return 100;
+		} else if (element instanceof IVariableDeclaration) {
+			return 110;
+		} else if (element instanceof IVariable) {
+			String name = ((ICElement)element).getElementName();
+			if (name.startsWith("__")) {
+				return 112;
+			}
+			if (name.charAt(0) == '_') {
+				return 114;
+			}
+			return 120;
+		} else if (element instanceof IFunction) {
+			String name = ((ICElement)element).getElementName();
+			if (name.startsWith("__")) {
+				return 122;
 			}
-			return 54;
+			if (name.charAt(0) == '_') {
+				return 124;
+			}
+			return 130;
 		} else if (element instanceof ICElement) {
 			String name = ((ICElement)element).getElementName();
 			if (name.startsWith("__")) {
-				return 68;
+				return 132;
 			}
 			if (name.charAt(0) == '_') {
-				return 67;
+				return 134;
 			}
-			return 60;
+			return 140;
 		} else if (element instanceof IArchive) {
-			return 70;
+			return 150;
 		}
 		return 80;
 	}
Index: src/org/eclipse/cdt/internal/ui/editor/CEditor.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/CEditor.java,v
retrieving revision 1.11
diff -u -r1.11 CEditor.java
--- src/org/eclipse/cdt/internal/ui/editor/CEditor.java	5 Nov 2002 15:01:54 -0000	1.11
+++ src/org/eclipse/cdt/internal/ui/editor/CEditor.java	18 Nov 2002 15:17:57 -0000
@@ -1417,8 +1417,11 @@
 		if (!c_file && filename.endsWith(".h")){
 			// ensure that this .h file is part of a C project & not a CPP project
 		
-			IProject project = getInputFile().getProject();
-			c_file = !CoreModel.getDefault().hasCCNature(project);
+			IFile file = getInputFile();
+			if (file != null) {
+				IProject project = file.getProject();
+				c_file = !CoreModel.getDefault().hasCCNature(project);
+			}
 		}
 
 		return new AdaptedSourceViewer(parent, ruler, styles, c_file ? LANGUAGE_C : LANGUAGE_CPP);



Back to the top