|
Eclipse Platform Release 3.0 | ||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.eclipse.jface.viewers.Viewer
org.eclipse.jface.viewers.ContentViewer
org.eclipse.compare.contentmergeviewer.ContentMergeViewer
An abstract compare and merge viewer with two side-by-side content areas and an optional content area for the ancestor. The implementation makes no assumptions about the content type.
ContentMergeViewer
A ContentMergeViewer accesses its model by means of a content provider which must implement the IMergeViewerContentProvider interface.
Clients may wish to use the standard concrete subclass TextMergeViewer, or define their own subclass.
Field Summary |
Fields inherited from class org.eclipse.jface.viewers.Viewer |
WIDGET_DATA_KEY |
Constructor Summary | |
protected | ContentMergeViewer(int style,
ResourceBundle bundle,
CompareConfiguration cc)
Creates a new content merge viewer and initializes with a resource bundle and a configuration. |
Method Summary | |
void | addPropertyChangeListener(IPropertyChangeListener listener)
Adds a listener for property changes to this notifier. |
protected Control | buildControl(Composite parent)
Builds the SWT controls for the three areas of a compare/merge viewer. |
protected abstract void | copy(boolean leftToRight)
Copies the content of one side to the other side. |
protected abstract void | createControls(Composite composite)
Creates the SWT controls for the ancestor, left, and right content areas of this compare viewer. |
protected void | createToolItems(ToolBarManager toolBarManager)
Contributes items to the given ToolBarManager. |
protected boolean | doSave(Object newInput,
Object oldInput)
This method is called from the Viewer method inputChanged to save any unsaved changes of the old input. |
protected CompareConfiguration | getCompareConfiguration()
Returns the compare configuration of this viewer, or null if this viewer does not yet have a configuration. |
protected abstract byte[] | getContents(boolean left)
Returns the byte contents of the left or right side. |
Control | getControl()
Returns the primary control associated with this viewer. |
protected ResourceBundle | getResourceBundle()
Returns the resource bundle of this viewer. |
ISelection | getSelection()
The ContentMergeViewer implementation of this Viewer method returns the empty selection. |
String | getTitle()
Returns the viewer's name. |
protected void | handleDispose(DisposeEvent event)
Called on the viewer disposal. |
protected abstract void | handleResizeAncestor(int x,
int y,
int width,
int height)
Lays out the ancestor area of the compare viewer. |
protected abstract void | handleResizeLeftRight(int x,
int y,
int leftWidth,
int centerWidth,
int rightWidth,
int height)
Lays out the left and right areas of the compare viewer. |
protected void | inputChanged(Object input,
Object oldInput)
Internal hook method called when the input to this viewer is initially set or subsequently changed. |
void | refresh()
Refreshes this viewer completely with information freshly obtained from this viewer's model. |
void | removePropertyChangeListener(IPropertyChangeListener listener)
Removes the given content change listener from this notifier. |
void | save(IProgressMonitor pm)
Save the viewers's content. |
void | setConfirmSave(boolean enable)
Controls whether doSave(Object, Object) asks for confirmation before saving the old input with saveContent(Object). |
void | setContentProvider(IContentProvider contentProvider)
The ContentMergeViewer implementation of this ContentViewer method checks to ensure that the content provider is an IMergeViewerContentProvider. |
protected void | setLeftDirty(boolean dirty)
Sets the dirty state of the left side of this viewer. |
protected void | setRightDirty(boolean dirty)
Sets the dirty state of the right side of this viewer. |
void | setSelection(ISelection s,
boolean reveal)
The ContentMergeViewer implementation of this Viewer method does nothing. |
protected abstract void | updateContent(Object ancestor,
Object left,
Object right)
Initializes the controls of the three content areas with the given input objects. |
protected void | updateHeader()
Updates the headers of the three areas by querying the content provider for a name and image for the three sides of the input object. |
protected void | updateToolItems()
Updates the enabled state of the toolbar items. |
Methods inherited from class org.eclipse.jface.viewers.ContentViewer |
getContentProvider, getInput, getLabelProvider, handleLabelProviderChanged, hookControl, labelProviderChanged, setInput, setLabelProvider |
Methods inherited from class org.eclipse.jface.viewers.Viewer |
addHelpListener, addSelectionChangedListener, fireHelpRequested, fireSelectionChanged, getData, handleHelpRequest, removeHelpListener, removeSelectionChangedListener, scrollDown, scrollUp, setData, setSelection |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
protected ContentMergeViewer(int style, ResourceBundle bundle, CompareConfiguration cc)
Method Detail |
public String getTitle()
protected abstract void createControls(Composite composite)
protected abstract void handleResizeAncestor(int x, int y, int width, int height)
protected abstract void handleResizeLeftRight(int x, int y, int leftWidth, int centerWidth, int rightWidth, int height)
protected void createToolItems(ToolBarManager toolBarManager)
protected abstract void updateContent(Object ancestor, Object left, Object right)
protected abstract void copy(boolean leftToRight)
protected abstract byte[] getContents(boolean left)
protected ResourceBundle getResourceBundle()
protected CompareConfiguration getCompareConfiguration()
public void setContentProvider(IContentProvider contentProvider)
public ISelection getSelection()
public void setSelection(ISelection s, boolean reveal)
protected final void inputChanged(Object input, Object oldInput)
The ContentMergeViewer implementation of this Viewer method tries to save the old input by calling doSave(...) and then calls internalRefresh(...).
protected boolean doSave(Object newInput, Object oldInput)
The ContentMergeViewer implementation of this method calls saveContent(...). If confirmation has been turned on with setConfirmSave(true), a confirmation alert is posted before saving.
Clients can override this method and are free to decide whether they want to call the inherited method.
public void setConfirmSave(boolean enable)
public void refresh()
protected final Control buildControl(Composite parent)
Calls the hooks createControls and createToolItems to let subclasses build the specific content areas and to add items to an enclosing toolbar.
This method must only be called in the constructor of subclasses.
public Control getControl()
protected void handleDispose(DisposeEvent event)
protected void updateToolItems()
This method is called whenever the state of the items needs updating.
Subclasses may extend this method, although this is generally not required.
protected void updateHeader()
This method is called whenever the header must be updated.
Subclasses may extend this method, although this is generally not required.
public void addPropertyChangeListener(IPropertyChangeListener listener)
public void removePropertyChangeListener(IPropertyChangeListener listener)
protected void setLeftDirty(boolean dirty)
protected void setRightDirty(boolean dirty)
public void save(IProgressMonitor pm) throws CoreException
|
Eclipse Platform Release 3.0 | ||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Guidelines for using Eclipse APIs.
Copyright (c) IBM Corp. and others 2000, 2004. All rights reserved.