org.eclipse.emf.compare.ui.viewer.content.part
Class ModelContentMergeTabFolder

java.lang.Object
  extended by org.eclipse.emf.compare.ui.viewer.content.part.ModelContentMergeTabFolder

public class ModelContentMergeTabFolder
extends java.lang.Object

Describes a part of a ModelContentMergeViewer.


Field Summary
protected  ModelContentMergeViewer parentViewer
          This keeps track of the parent viewer of this tab folder.
protected  int partSide
          This int represents the side of this viewer part.
protected  IModelContentMergeViewerTab properties
          This is the content of the properties tab for this viewer part.
protected  org.eclipse.swt.custom.CTabFolder tabFolder
          This is the view displayed by this viewer part.
protected  java.util.List<IModelContentMergeViewerTab> tabs
          Keeps references to the tabs contained within this folder.
protected  IModelContentMergeViewerTab tree
          This is the content of the tree tab for this viewer part.
 
Constructor Summary
ModelContentMergeTabFolder(ModelContentMergeViewer viewer, org.eclipse.swt.widgets.Composite composite, int side)
          Instantiates a ModelContentMergeTabFolder given its parent Composite and its side.
 
Method Summary
 void addCompareEditorPartListener(ICompareEditorPartListener listener)
          Registers the given listener for notification.
protected  void createContents(org.eclipse.swt.widgets.Composite composite)
          Creates the contents of this viewer part given its parent composite.
protected  IModelContentMergeViewerTab createModelContentMergeDiffTab(org.eclipse.swt.widgets.Composite parent)
          Actual creation of the tree tab.
protected  IModelContentMergeViewerTab createModelContentMergeViewerTab(org.eclipse.swt.widgets.Composite parent)
          Actual creation of the properties tab.
 void dispose()
          Disposes of all resources used by this folder.
protected  org.eclipse.emf.ecore.EObject findMatchFromElement(org.eclipse.emf.ecore.EObject element)
          Returns the Match2Elements containing the given EObject as its left or right element.
protected  void fireSelectedtabChanged()
          Notifies All listeners registered for this viewer part that the tab selection has been changed.
protected  void fireSelectionChanged(org.eclipse.jface.viewers.SelectionChangedEvent event)
          Notifies All listeners registered for this viewer part that the user selection has changed on the properties or tree tab.
protected  void fireUpdateCenter()
          Notifies All listeners registered for this viewer part that the center part needs to be refreshed.
 java.util.List<DiffElement> getDiffAsList()
          Returns a list of all diffs contained by the input DiffModel except for DiffGroups.
 IModelContentMergeViewerTab getPropertyPart()
          Returns the properties tab of this tab folder.
 IModelContentMergeViewerTab getTreePart()
          Returns the tree tab of this tab folder.
 ModelContentMergeTabItem getUIItem(DiffElement element)
          This will be used when drawing the center part's marquees.
 java.util.List<ModelContentMergeTabItem> getVisibleElements()
          Returns the visible elements of the active tab.
 void layout()
          Redraws this viewer part.
 void navigateToDiff(DiffElement diff)
          Shows the given item on the tree tab or its properties on the property tab.
 void navigateToDiff(java.util.List<DiffElement> diffs)
          Ensures the first item of the given list of DiffElements is visible, and sets the selection of the tree to all those items.
 void removeCompareEditorPartListener(ICompareEditorPartListener listener)
          Removes the given listener from this folder's listeners list.
protected  void resizeBounds()
          This will resize the tabs displayed by this content merge viewer.
 void setBounds(int x, int y, int width, int height)
          Sets the receiver's size and location to the rectangular area specified by the arguments.
 void setBounds(org.eclipse.swt.graphics.Rectangle bounds)
          Sets the receiver's size and location to given rectangular area.
 void setInput(java.lang.Object input)
          Sets the input of this viewer part.
 void setSelectedTab(int index)
          Changes the current tab.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

parentViewer

protected final ModelContentMergeViewer parentViewer
This keeps track of the parent viewer of this tab folder.


partSide

protected final int partSide
This int represents the side of this viewer part. Must be one of


properties

protected IModelContentMergeViewerTab properties
This is the content of the properties tab for this viewer part.


tabFolder

protected org.eclipse.swt.custom.CTabFolder tabFolder
This is the view displayed by this viewer part.


tabs

protected final java.util.List<IModelContentMergeViewerTab> tabs
Keeps references to the tabs contained within this folder.


tree

protected IModelContentMergeViewerTab tree
This is the content of the tree tab for this viewer part.

Constructor Detail

ModelContentMergeTabFolder

public ModelContentMergeTabFolder(ModelContentMergeViewer viewer,
                                  org.eclipse.swt.widgets.Composite composite,
                                  int side)
Instantiates a ModelContentMergeTabFolder given its parent Composite and its side.

Parameters:
viewer - Parent viewer of this viewer part.
composite - Parent Composite for this part.
side - Comparison side of this part. Must be one of EMFCompareConstants.RIGHT, EMFCompareConstants.LEFT or EMFCompareConstants.ANCESTOR.
Method Detail

addCompareEditorPartListener

public void addCompareEditorPartListener(ICompareEditorPartListener listener)
Registers the given listener for notification. If the identical listener is already registered the method has no effect.

Parameters:
listener - The listener to register for changes of this input.

dispose

public void dispose()
Disposes of all resources used by this folder.


getDiffAsList

public java.util.List<DiffElement> getDiffAsList()
Returns a list of all diffs contained by the input DiffModel except for DiffGroups.

Returns:
List of the DiffModel's differences.

getPropertyPart

public IModelContentMergeViewerTab getPropertyPart()
Returns the properties tab of this tab folder.

Returns:
The properties tab of this tab folder.

getTreePart

public IModelContentMergeViewerTab getTreePart()
Returns the tree tab of this tab folder.

Returns:
The tree tab of this tab folder.

getUIItem

public ModelContentMergeTabItem getUIItem(DiffElement element)
This will be used when drawing the center part's marquees.

Parameters:
element - The DiffElement which we need UI variables for.
Returns:
The item corresponding to the given DiffElement, wrapped along with UI information.

getVisibleElements

public java.util.List<ModelContentMergeTabItem> getVisibleElements()
Returns the visible elements of the active tab.

Returns:
The visible elements of the active tab.

layout

public void layout()
Redraws this viewer part.


navigateToDiff

public void navigateToDiff(DiffElement diff)
Shows the given item on the tree tab or its properties on the property tab.

Parameters:
diff - Item to scroll to.

navigateToDiff

public void navigateToDiff(java.util.List<DiffElement> diffs)
Ensures the first item of the given list of DiffElements is visible, and sets the selection of the tree to all those items.

Parameters:
diffs - Items to select.

removeCompareEditorPartListener

public void removeCompareEditorPartListener(ICompareEditorPartListener listener)
Removes the given listener from this folder's listeners list. This will have no effect if the listener is not registered against this folder.

Parameters:
listener - The listener to remove from this folder.

setBounds

public void setBounds(int x,
                      int y,
                      int width,
                      int height)
Sets the receiver's size and location to the rectangular area specified by the arguments.

Parameters:
x - Desired x coordinate of the part.
y - Desired y coordinate of the part.
width - Desired width of the part.
height - Desired height of the part.

setBounds

public void setBounds(org.eclipse.swt.graphics.Rectangle bounds)
Sets the receiver's size and location to given rectangular area.

Parameters:
bounds - Desired bounds for this receiver.

setInput

public void setInput(java.lang.Object input)
Sets the input of this viewer part.

Parameters:
input - New input of this viewer part.

setSelectedTab

public void setSelectedTab(int index)
Changes the current tab.

Parameters:
index - New tab to set selected.

createContents

protected void createContents(org.eclipse.swt.widgets.Composite composite)
Creates the contents of this viewer part given its parent composite.

Parameters:
composite - Parent composite of this viewer parts's widgets.

findMatchFromElement

protected org.eclipse.emf.ecore.EObject findMatchFromElement(org.eclipse.emf.ecore.EObject element)
Returns the Match2Elements containing the given EObject as its left or right element.

Parameters:
element - Element we seek the Match2Elements for.
Returns:
The Match2Elements containing the given EObject as its left or right element.

fireSelectedtabChanged

protected void fireSelectedtabChanged()
Notifies All listeners registered for this viewer part that the tab selection has been changed.


fireSelectionChanged

protected void fireSelectionChanged(org.eclipse.jface.viewers.SelectionChangedEvent event)
Notifies All listeners registered for this viewer part that the user selection has changed on the properties or tree tab.

Parameters:
event - Source Selection changed event of the notification.

fireUpdateCenter

protected void fireUpdateCenter()
Notifies All listeners registered for this viewer part that the center part needs to be refreshed.


resizeBounds

protected void resizeBounds()
This will resize the tabs displayed by this content merge viewer.


createModelContentMergeViewerTab

protected IModelContentMergeViewerTab createModelContentMergeViewerTab(org.eclipse.swt.widgets.Composite parent)
Actual creation of the properties tab. Synchronization of the scroll bars and selections will be handled through createPropertiesPart(Composite).

Parameters:
parent - Parent Composite of the viewer tab that is to be created.
Returns:
The newly created IModelContentMergeViewerTab that'll be added to the current tab folder.
Since:
1.1

createModelContentMergeDiffTab

protected IModelContentMergeViewerTab createModelContentMergeDiffTab(org.eclipse.swt.widgets.Composite parent)
Actual creation of the tree tab. Synchronization of the scroll bars and selections will be handled through createTreePart(Composite).

Parameters:
parent - Parent Composite of the viewer tab that is to be created.
Returns:
The newly created IModelContentMergeViewerTab that'll be added to the current tab folder.
Since:
1.1

Copyright 2006 IBM Corporation and others.
All Rights Reserved.