Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[cdt-patch] PR38047 fix in branch-11

Bonjour,
	at QNX request, the fix was move to the branch.
============================================================
Index: ChangeLog
===================================================================
RCS file: /home/tools/org.eclipse.cdt.ui/ChangeLog,v
retrieving revision 1.94.2.4
diff -u -r1.94.2.4 ChangeLog
--- ChangeLog	29 Apr 2003 19:24:49 -0000	1.94.2.4
+++ ChangeLog	5 Jun 2003 18:15:53 -0000
@@ -1,3 +1,11 @@
+2003-05-23 Mikhail Khodjaiants
+	PR 38047: Unable to save changes in C/C++ debug editor.
+	* src/org/eclipse/cdt/ui/IEditorInputDelegate.java: new
+	This interface is added to provide support for more flexible editor inputs.
+
+	* src/org/eclipse/cdt/internal/ui/editor/CDocumentProvider.java:
+	Support of the "IEditorInputDelegate" interface.
+
 2003-04-29 Alain Magloire
 
 	PR 36759, Outliner did not update.
Index: src/org/eclipse/cdt/internal/ui/editor/CDocumentProvider.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/CDocumentProvider.java,v
retrieving revision 1.13.2.1
diff -u -r1.13.2.1 CDocumentProvider.java
--- src/org/eclipse/cdt/internal/ui/editor/CDocumentProvider.java	29 Apr 2003 19:24:14 -0000	1.13.2.1
+++ src/org/eclipse/cdt/internal/ui/editor/CDocumentProvider.java	5 Jun 2003 18:15:55 -0000
@@ -18,6 +18,7 @@
 import org.eclipse.cdt.internal.core.model.IWorkingCopy;
 import org.eclipse.cdt.internal.ui.CStatusConstants;
 import org.eclipse.cdt.ui.CUIPlugin;
+import org.eclipse.cdt.ui.IEditorInputDelegate;
 import org.eclipse.core.resources.IFile;
 import org.eclipse.core.resources.IResource;
 import org.eclipse.core.resources.IStorage;
@@ -140,16 +141,24 @@
 	 * @see AbstractDocumentProvider#createDocument(Object)
 	 */ 
 	protected IDocument createDocument(Object element) throws CoreException {
-		IDocument document;
-			
-		if (element instanceof IStorageEditorInput) {
-			IStorage storage= ((IStorageEditorInput) element).getStorage();
+		IDocument document = null;
+		IStorage storage = null;
+
+		if (element instanceof IEditorInputDelegate) {
+			if (((IEditorInputDelegate) element).getDelegate() != null)
+				return createDocument(((IEditorInputDelegate) element).getDelegate());
+			else
+				storage = ((IEditorInputDelegate) element).getStorage();
+		}
 			
-			document= new CDocument();
+		if (element instanceof IStorageEditorInput)
+			storage= ((IStorageEditorInput) element).getStorage();
+		
+		if ( storage != null ) {
+			document = new CDocument();
 			setDocumentContent(document, storage.getContents(), getDefaultEncoding());
-		} else {
-			return null;
 		}
+
 		//IDocument document= super.createDocument(element);
 		initializeDocument(document);
 		return document;
@@ -159,6 +168,8 @@
 	 * @see AbstractDocumentProvider#createAnnotationModel(Object)
 	 */
 	protected IAnnotationModel createAnnotationModel(Object element) throws CoreException {
+		if ( element instanceof IEditorInputDelegate && ((IEditorInputDelegate)element).getDelegate() != null )
+			return createAnnotationModel( ((IEditorInputDelegate)element).getDelegate() );
 		if (element instanceof IFileEditorInput) {
 			IFileEditorInput input= (IFileEditorInput) element;
 			return new CMarkerAnnotationModel(input.getFile());
@@ -399,4 +410,16 @@
 		return getElementInfo(input) != null;
 	}
 	
+	/**
+	 * @see org.eclipse.ui.texteditor.IDocumentProviderExtension#getStatus(Object)
+	 */
+	public IStatus getStatus(Object element) {
+		if (element instanceof IEditorInputDelegate) {
+			if (((IEditorInputDelegate) element).getDelegate() != null)
+				return super.getStatus(((IEditorInputDelegate) element).getDelegate());
+			else
+				return new Status(IStatus.INFO,CUIPlugin.getPluginId(),0,"",null);
+		}
+		return super.getStatus(element);
+	}
 }
Index: src/org/eclipse/cdt/ui/IEditorInputDelegate.java
===================================================================
RCS file: src/org/eclipse/cdt/ui/IEditorInputDelegate.java
diff -N src/org/eclipse/cdt/ui/IEditorInputDelegate.java
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ src/org/eclipse/cdt/ui/IEditorInputDelegate.java	5 Jun 2003 18:15:55 -0000
@@ -0,0 +1,33 @@
+/*
+ *(c) Copyright QNX Software Systems Ltd. 2002.
+ * All Rights Reserved.
+ * 
+ */
+
+package org.eclipse.cdt.ui;
+
+import org.eclipse.core.resources.IStorage;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.ui.IEditorInput;
+
+/**
+ * This interface allows to create flexible editor inputs.
+ * 
+ * @since May 21, 2003
+ */
+public interface IEditorInputDelegate extends IEditorInput {
+	/**
+	 * Returns the editor input delegate for this editor input.
+	 * 
+	 * @return editor input delegate
+	 */
+	IEditorInput getDelegate();
+
+	/**
+	 * Returns the storage associated with this editor input.
+	 * 
+	 * @return stirage associated with this editor input
+	 * @throws CoreException on failure. Reasons include:
+	 */
+	IStorage getStorage() throws CoreException;
+}



Back to the top