org.eclipse.cdt.internal.ui.editor
Class WorkingCopyManager

java.lang.Object
  extended by org.eclipse.cdt.internal.ui.editor.WorkingCopyManager
All Implemented Interfaces:
IWorkingCopyManager, IWorkingCopyManagerExtension

public class WorkingCopyManager
extends java.lang.Object
implements IWorkingCopyManager, IWorkingCopyManagerExtension

This working copy manager works together with a given compilation unit document provider and additionally offers to "overwrite" the working copy provided by this document provider.


Constructor Summary
WorkingCopyManager(CDocumentProvider provider)
          Creates a new working copy manager that co-operates with the given compilation unit document provider.
 
Method Summary
 void connect(org.eclipse.ui.IEditorInput input)
          Connects the given editor input to this manager.
 void disconnect(org.eclipse.ui.IEditorInput input)
          Disconnects the given editor input from this manager.
 org.eclipse.cdt.core.model.IWorkingCopy getWorkingCopy(org.eclipse.ui.IEditorInput input)
          Returns the working copy remembered for the translation unit encoded in the given editor input.
 void removeWorkingCopy(org.eclipse.ui.IEditorInput input)
          Removes the working copy set for the given editor input.
 void setWorkingCopy(org.eclipse.ui.IEditorInput input, org.eclipse.cdt.core.model.IWorkingCopy workingCopy)
          Sets the given working copy for the given editor input.
 void shutdown()
          Shuts down this working copy manager.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

WorkingCopyManager

public WorkingCopyManager(CDocumentProvider provider)
Creates a new working copy manager that co-operates with the given compilation unit document provider.

Parameters:
provider - the provider
Method Detail

connect

public void connect(org.eclipse.ui.IEditorInput input)
             throws org.eclipse.core.runtime.CoreException
Description copied from interface: IWorkingCopyManager
Connects the given editor input to this manager. After calling this method, a working copy will be available for the translation unit encoded in the given editor input (does nothing if there is no encoded translation unit).

Specified by:
connect in interface IWorkingCopyManager
Parameters:
input - the editor input
Throws:
org.eclipse.core.runtime.CoreException - if the working copy cannot be created for the translation unit

disconnect

public void disconnect(org.eclipse.ui.IEditorInput input)
Description copied from interface: IWorkingCopyManager
Disconnects the given editor input from this manager. After calling this method, a working copy for the translation unit encoded in the given editor input will no longer be available. Does nothing if there is no encoded translation unit, or if there is no remembered working copy for the translation unit.

Specified by:
disconnect in interface IWorkingCopyManager
Parameters:
input - the editor input

shutdown

public void shutdown()
Description copied from interface: IWorkingCopyManager
Shuts down this working copy manager. All working copies still remembered by this manager are destroyed.

Specified by:
shutdown in interface IWorkingCopyManager

getWorkingCopy

public org.eclipse.cdt.core.model.IWorkingCopy getWorkingCopy(org.eclipse.ui.IEditorInput input)
Description copied from interface: IWorkingCopyManager
Returns the working copy remembered for the translation unit encoded in the given editor input.

Specified by:
getWorkingCopy in interface IWorkingCopyManager
Parameters:
input - the editor input
Returns:
the working copy of the translation unit, or null if the input does not encode an editor input, or if there is no remembered working copy for this translation unit

setWorkingCopy

public void setWorkingCopy(org.eclipse.ui.IEditorInput input,
                           org.eclipse.cdt.core.model.IWorkingCopy workingCopy)
Description copied from interface: IWorkingCopyManagerExtension
Sets the given working copy for the given editor input. If the given editor input is not connected to this working copy manager, this call has no effect.

This working copy manager does not assume the ownership of this working copy, i.e., the given working copy is not automatically be freed when this manager is shut down.

Specified by:
setWorkingCopy in interface IWorkingCopyManagerExtension
Parameters:
input - the editor input
workingCopy - the working copy

removeWorkingCopy

public void removeWorkingCopy(org.eclipse.ui.IEditorInput input)
Description copied from interface: IWorkingCopyManagerExtension
Removes the working copy set for the given editor input. If there is no working copy set for this input or this input is not connected to this working copy manager, this call has no effect.

Specified by:
removeWorkingCopy in interface IWorkingCopyManagerExtension
Parameters:
input - the editor input