Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlain Magloire2003-06-05 18:18:32 +0000
committerAlain Magloire2003-06-05 18:18:32 +0000
commit8022dcf572d4c5da1a53ca3217e9e11288150f9a (patch)
tree79b3a70a8060290e7c2d6a71369645c9d2d46652
parente55bdc56da094d6de93ae52ab3908b80c7327805 (diff)
downloadorg.eclipse.cdt-8022dcf572d4c5da1a53ca3217e9e11288150f9a.tar.gz
org.eclipse.cdt-8022dcf572d4c5da1a53ca3217e9e11288150f9a.tar.xz
org.eclipse.cdt-8022dcf572d4c5da1a53ca3217e9e11288150f9a.zip
Fix PR 38047
-rw-r--r--core/org.eclipse.cdt.ui/ChangeLog8
-rw-r--r--core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/CDocumentProvider.java37
-rw-r--r--debug/org.eclipse.cdt.debug.ui/ChangeLog7
-rw-r--r--debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/editors/CDebugDocumentProvider.java108
-rw-r--r--debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/editors/CDebugEditor.java2
-rw-r--r--debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/editors/EditorInputDelegate.java3
-rw-r--r--debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/ui/CDebugUIPlugin.java16
7 files changed, 48 insertions, 133 deletions
diff --git a/core/org.eclipse.cdt.ui/ChangeLog b/core/org.eclipse.cdt.ui/ChangeLog
index 7a693734ba8..919dae8c29d 100644
--- a/core/org.eclipse.cdt.ui/ChangeLog
+++ b/core/org.eclipse.cdt.ui/ChangeLog
@@ -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.
diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/CDocumentProvider.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/CDocumentProvider.java
index 543070aba0b..836cb443677 100644
--- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/CDocumentProvider.java
+++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/CDocumentProvider.java
@@ -18,6 +18,7 @@ import org.eclipse.cdt.internal.core.model.IBufferFactory;
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 @@ public class CDocumentProvider extends FileDocumentProvider {
* @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 @@ public class CDocumentProvider extends FileDocumentProvider {
* @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 @@ public class CDocumentProvider extends FileDocumentProvider {
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);
+ }
}
diff --git a/debug/org.eclipse.cdt.debug.ui/ChangeLog b/debug/org.eclipse.cdt.debug.ui/ChangeLog
index fb3538ad946..b45c745760b 100644
--- a/debug/org.eclipse.cdt.debug.ui/ChangeLog
+++ b/debug/org.eclipse.cdt.debug.ui/ChangeLog
@@ -1,3 +1,10 @@
+2003-05-23 Mikhail Khodjaiants
+ Fix for PR 38047: Unable to save changes in C/C++ debug editor.
+ * CDebugEditor.java
+ * EditorInputDelegate.java
+ * CDebugUIPlugin.java
+ * CDebugDocumentProvider.java: removed
+
2003-04-29 Alain Magloire
* src/org/eclipse/cdt/debug/internal/ui/editor/CDebugDocumentProvider.java (doSetInput):
diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/editors/CDebugDocumentProvider.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/editors/CDebugDocumentProvider.java
deleted file mode 100644
index 6c66cccb8cd..00000000000
--- a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/editors/CDebugDocumentProvider.java
+++ /dev/null
@@ -1,108 +0,0 @@
-/*
- *(c) Copyright QNX Software Systems Ltd. 2002.
- * All Rights Reserved.
- *
- */
-package org.eclipse.cdt.debug.internal.ui.editors;
-
-import org.eclipse.cdt.debug.ui.CDebugUIPlugin;
-import org.eclipse.cdt.internal.core.model.IBufferFactory;
-import org.eclipse.cdt.internal.ui.editor.CDocumentProvider;
-import org.eclipse.cdt.ui.CUIPlugin;
-import org.eclipse.core.resources.IStorage;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.jface.text.IDocument;
-import org.eclipse.jface.text.IDocumentPartitioner;
-import org.eclipse.jface.text.source.IAnnotationModel;
-
-/**
- *
- * Enter type comment.
- *
- * @since Mar 4, 2003
- */
-public class CDebugDocumentProvider extends CDocumentProvider
-{
- /**
- * @see org.eclipse.ui.texteditor.AbstractDocumentProvider#createDocument(Object)
- */
- protected IDocument createDocument( Object element ) throws CoreException
- {
- if ( element instanceof EditorInputDelegate )
- {
- if ( ((EditorInputDelegate)element).getDelegate() != null )
- {
- return super.createDocument( ((EditorInputDelegate)element).getDelegate() );
- }
- else
- {
- IDocument document = null;
- IStorage storage = ((EditorInputDelegate)element).getStorage();
- if ( storage != null )
- {
- document = new CDocument();
- setDocumentContent( document, storage.getContents(), getDefaultEncoding() );
- }
- else
- {
- return null;
- }
- if ( document != null)
- {
- IDocumentPartitioner partitioner= CUIPlugin.getDefault().getTextTools().createDocumentPartitioner();
- partitioner.connect( document );
- document.setDocumentPartitioner( partitioner );
- }
- return document;
- }
- }
- return super.createDocument( element );
- }
-
- /**
- * @see org.eclipse.ui.texteditor.IDocumentProviderExtension#getStatus(Object)
- */
- public IStatus getStatus( Object element )
- {
- if ( element instanceof EditorInputDelegate )
- {
- if ( ((EditorInputDelegate)element).getDelegate() != null )
- {
- return super.getStatus( ((EditorInputDelegate)element).getDelegate() );
- }
- else
- {
- return createFileNotFoundStatus( ((EditorInputDelegate)element).getElement() );
- }
- }
- return super.getStatus( element );
- }
-
- private IStatus createFileNotFoundStatus( FileNotFoundElement element )
- {
- return new Status( IStatus.INFO, CDebugUIPlugin.getUniqueIdentifier(), 0, "", null );
- }
-
- protected IAnnotationModel createAnnotationModel( Object element ) throws CoreException
- {
- if ( element instanceof EditorInputDelegate && ((EditorInputDelegate)element).getDelegate() != null )
- return super.createAnnotationModel( ((EditorInputDelegate)element).getDelegate() );
- return super.createAnnotationModel( element );
- }
-
- /* (non-Javadoc)
- * This hack is important for the the outliner to work correctly.
- * The outliner looks at the working copy and it is maintain by
- * CUIPlugin.getDefault().getWorkingCopyManager()
- * CUIPlugin.getDefault().getDocumentProvider();
- * They are singletons.
- *
- * @see org.eclipse.cdt.internal.ui.editor.CDocumentProvider#getBufferFactory()
- */
- public IBufferFactory getBufferFactory() {
- return CUIPlugin.getDefault().getDocumentProvider().getBufferFactory();
- }
-
-}
diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/editors/CDebugEditor.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/editors/CDebugEditor.java
index 4ed8ac7c339..f5da1d06294 100644
--- a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/editors/CDebugEditor.java
+++ b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/editors/CDebugEditor.java
@@ -369,7 +369,7 @@ public class CDebugEditor extends CEditor
public CDebugEditor()
{
super();
- setDocumentProvider( CDebugUIPlugin.getDefault().getDocumentProvider() );
+ setDocumentProvider( CUIPlugin.getDefault().getDocumentProvider() );
}
/* (non-Javadoc)
diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/editors/EditorInputDelegate.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/editors/EditorInputDelegate.java
index 9cce600f72a..2a7dba26943 100644
--- a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/editors/EditorInputDelegate.java
+++ b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/editors/EditorInputDelegate.java
@@ -8,6 +8,7 @@ package org.eclipse.cdt.debug.internal.ui.editors;
import java.io.ByteArrayInputStream;
import java.io.InputStream;
+import org.eclipse.cdt.ui.IEditorInputDelegate;
import org.eclipse.core.resources.IStorage;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IPath;
@@ -22,7 +23,7 @@ import org.eclipse.ui.IStorageEditorInput;
*
* @since Mar 4, 2003
*/
-public class EditorInputDelegate implements IEditorInput
+public class EditorInputDelegate implements IEditorInputDelegate
{
public static final int TYPE_ATTACH_SOURCE = 0;
public static final int TYPE_WORKSPACE_FILE = 1;
diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/ui/CDebugUIPlugin.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/ui/CDebugUIPlugin.java
index 93a5461290c..9deb4521e26 100644
--- a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/ui/CDebugUIPlugin.java
+++ b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/ui/CDebugUIPlugin.java
@@ -13,7 +13,6 @@ import org.eclipse.cdt.debug.core.sourcelookup.IDisassemblyStorage;
import org.eclipse.cdt.debug.internal.ui.CDTDebugModelPresentation;
import org.eclipse.cdt.debug.internal.ui.CDebugImageDescriptorRegistry;
import org.eclipse.cdt.debug.internal.ui.ColorManager;
-import org.eclipse.cdt.debug.internal.ui.editors.CDebugDocumentProvider;
import org.eclipse.cdt.debug.internal.ui.editors.DisassemblyDocumentProvider;
import org.eclipse.cdt.debug.internal.ui.editors.DisassemblyEditorInput;
import org.eclipse.cdt.debug.internal.ui.preferences.CDebugPreferencePage;
@@ -76,9 +75,6 @@ public class CDebugUIPlugin extends AbstractUIPlugin
// Document provider for disassembly editor
private DisassemblyDocumentProvider fDisassemblyDocumentProvider = null;
- // Document provider for C/C++ debug editor
- private CDebugDocumentProvider fDocumentProvider;
-
/**
* The constructor.
*/
@@ -512,16 +508,4 @@ public class CDebugUIPlugin extends AbstractUIPlugin
display.asyncExec( runnable );
}
}
-
- /**
- * Returns the used document provider
- */
- public CDebugDocumentProvider getDocumentProvider()
- {
- if (fDocumentProvider == null)
- {
- fDocumentProvider = new CDebugDocumentProvider();
- }
- return fDocumentProvider;
- }
}

Back to the top