Bug 3194 - DCR - JM - Buffer contents is duplicated (1G03HCP)
Summary: DCR - JM - Buffer contents is duplicated (1G03HCP)
Status: RESOLVED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 2.0   Edit
Hardware: All All
: P2 normal (vote)
Target Milestone: 2.0 M1   Edit
Assignee: Jerome Lanneluc CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2001-10-10 22:51 EDT by Erich Gamma CLA
Modified: 2002-01-11 09:13 EST (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Erich Gamma CLA 2001-10-10 22:51:05 EDT
EG (8/22/00 7:22:49 PM)
	when editing a JavaCompilation unit its contents is duplicated in 
memory. Once it is stored
	inside the buffer maintained by the JavaModel and once it is stored in 
the Text infrastructure's 
	document. This could be avoided by having a custom Document implement 
the IBuffer interface and 
	providing a factory mechanism to create Buffers in the BufferManager.

NOTES:

JBL (6/19/2001 2:42:52 PM)
	API change needed.

PM (9/13/2001 11:56:19 AM)
	Buffer is discussed to be moved down into the platform.
Comment 1 Philipe Mulet CLA 2001-10-12 06:00:45 EDT
JUI suggested we would define a factory method allowing them to supply their 
own document.
Comment 2 Erich Gamma CLA 2001-10-12 06:51:23 EDT
pls discuss API addition with Kai before moving ahead.
Comment 3 Philipe Mulet CLA 2001-10-26 06:58:57 EDT
From Kai:

As you know there has been a long lasting recurring discussion about the buffer 
duplication we see when editing a compilation unit in the editor. Here is a 
proposal that would solve our problem and wouldn't hurt you. Only api additions 
would be necessary. Having this issue 
solved would enable us to be less vulnerable when performing code manipulations 
while having open editors.

Here it comes:

ICompilationUnit addition:
	IWorkingCopy getWorkingCopy(IBufferFactory factory);

IBufferFactory:	
	IBuffer createBuffer(IOpenable owner);

IBufferManager addition:
	IBuffer getBuffer(IOpenable owner, IBufferFactory factory);

Optionally default:
	BufferManager implements IBufferFactory
	
What do you think are the substantial disadvantages of this proposal? It would 
be good for us if we could find a solution as design decisions are queueing up 
relying on a decision. If you like we could talk about this on the phone 
tomorrow morning.
Comment 4 Jerome Lanneluc CLA 2001-10-31 09:51:17 EST
IBufferManager is internal. Do you plan to use it?
Comment 5 Jerome Lanneluc CLA 2001-11-02 09:58:18 EST
Added IWorkingCopy getWorkingCopy(IProgressMonitor, IBuffer) that returns an 
IWorkingCopy opened with the given buffer on ICompilationUnit.
Comment 6 Jerome Lanneluc CLA 2001-11-02 12:15:42 EST
Actually, the buffer must know its owner upon creation as this owner is used as 
the key in the buffer manager table. So we need a factory as Kai suggested.

Added 
IBufferFactory:	
	IBuffer createBuffer(IOpenable owner);

and changed getWorkingCopy to take a factory
ICompilationUnit:
	IWorkingCopy getWorkingCopy(IBufferFactory factory);

Comment 7 Jerome Lanneluc CLA 2001-11-02 12:25:26 EST
Added WorkingCopyTests.testWorkingCopyCustomizedBuffer()