Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
RE: [cdt-dev] CEditor bombs in M5 - Ed's Patch

Thanks Ed,

Unfortunately, the Resource patch isn't going to work.  The
IResourceProxyVisitor class is only available in M5.  Applying the patch
will cause all other releases to break.  It is really looking like the
functionality provided by the Resource class and subclasses is going to have
to be implemented differently.

Doug Schaefer
Senior Staff Software Engineer
Rational - the software development company
Ottawa (Kanata), Ontario, Canada

-----Original Message-----
From: Ed Burnette [mailto:Ed.Burnette@xxxxxxx] 
Sent: Tuesday, February 11, 2003 5:29 PM
To: cdt-dev@xxxxxxxxxxx
Subject: RE: [cdt-dev] CEditor bombs in M5

Here are a couple of stop-gap patches to get CDT up under M5. This first one
lets the C editor run without bombing with that NPE:

Index: CEditor.java
===================================================================
RCS file:
/home/tools/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/CEdito
r.java,v
retrieving revision 1.15
diff -u -r1.15 CEditor.java
--- CEditor.java	4 Feb 2003 20:00:45 -0000	1.15
+++ CEditor.java	11 Feb 2003 22:21:26 -0000
@@ -89,9 +89,9 @@
 import org.eclipse.ui.PartInitException;
 import org.eclipse.ui.actions.WorkspaceModifyOperation;
 import org.eclipse.ui.dialogs.SaveAsDialog;
-import org.eclipse.ui.editors.text.TextEditor;
 import org.eclipse.ui.part.EditorActionBarContributor;
 import org.eclipse.ui.part.FileEditorInput;
+import org.eclipse.ui.texteditor.AbstractTextEditor;
 import org.eclipse.ui.texteditor.DefaultRangeIndicator;
 import org.eclipse.ui.texteditor.ITextEditorActionConstants;
 import org.eclipse.ui.texteditor.MarkerAnnotation;
@@ -102,7 +102,7 @@
 /**
  * C specific text editor.
  */
-public class CEditor extends TextEditor implements
ISelectionChangedListener {
+public class CEditor extends AbstractTextEditor implements
ISelectionChangedListener {
 
 
 	/** The outline page */



and here's an ugly one to get org.eclipse.cdt.core to compile:


Index: org/eclipse/cdt/internal/core/model/Resource.java
===================================================================
RCS file:
/home/tools/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/R
esource.java,v
retrieving revision 1.3
diff -u -r1.3 Resource.java
--- org/eclipse/cdt/internal/core/model/Resource.java	20 Dec 2002 14:59:11
-0000	1.3
+++ org/eclipse/cdt/internal/core/model/Resource.java	11 Feb 2003 22:22:39
-0000
@@ -12,6 +12,7 @@
 import org.eclipse.core.resources.IProject;
 import org.eclipse.core.resources.IProjectDescription;
 import org.eclipse.core.resources.IResource;
+import org.eclipse.core.resources.IResourceProxyVisitor;
 import org.eclipse.core.resources.IResourceVisitor;
 import org.eclipse.core.resources.IWorkspace;
 import org.eclipse.core.resources.IWorkspaceRoot;
@@ -99,6 +100,49 @@
 		}
 	}
 
+	/* (non-Javadoc)
+	 * @see
org.eclipse.core.resources.IResource#accept(org.eclipse.core.resources.IReso
urceProxyVisitor, int)
+	 */
+	public void accept(IResourceProxyVisitor visitor, int memberFlags)
+		throws CoreException {
+			final boolean includePhantoms = (memberFlags &
IContainer.INCLUDE_PHANTOMS) != 0;
+			final boolean includeTeamPrivateMember =
+				(memberFlags &
IContainer.INCLUDE_TEAM_PRIVATE_MEMBERS) != 0;
+
+			// The INCLUDE_PHANTOMS flag is not specified and
this resource does not exist. 
+			if (!includePhantoms && !exists()) {
+				throw new CoreException(new
CModelStatus(ICModelStatus.ERROR));
+			}
+
+				// The INCLUDE_PHANTOMS flag is not
specified and this resource is
+			// a project that is not open. 
+			if (!includePhantoms && !getProject().isOpen()) {
+				throw new CoreException(new
CModelStatus(ICModelStatus.ERROR));
+			}
+
+			if ((!isPhantom() && !isTeamPrivateMember()) ||
+				(includePhantoms && isPhantom()) ||
+				(includeTeamPrivateMember &&
isTeamPrivateMember())) {
+				// If the visitor returns false, this
resource's members are not visited. 
+				//if (!visitor.visit(this)) {
+				//	return;
+				//}
+			}
+
+
+			// Bail out here if not a container.
+			if (getType() == IResource.FILE) {
+				return;
+			}
+
+			IResource[] members =
((IContainer)this).members(memberFlags);
+			for (int i = 0; i < members.length; i++) {
+				members[i].accept(visitor, memberFlags);
+			}
+
+	}
+
+
 	/**
 	 * @see org.eclipse.core.resources.IResource#copy(IPath, boolean,
IProgressMonitor)
 	 */
@@ -269,7 +313,7 @@
 	/**
 	 * @see
org.eclipse.core.resources.IResource#getSessionProperty(QualifiedName)
 	 */
-	public Object getSessionProperty(QualifiedName key) throws
CoreException {
+	public Object getSessionProperty(QualifiedName key)  {
 		if (sessionProperties != null) {
 			return sessionProperties.get(key);
 		}

Sorry I don't have more time right now to investigate better patches.
Hopefully Alain or Doug can take a look at it soon.
--Ed

_______________________________________________
cdt-dev mailing list
cdt-dev@xxxxxxxxxxx
http://dev.eclipse.org/mailman/listinfo/cdt-dev


Back to the top