M
- The type of the business Mapping objectL
- The type of the left bound of the mapping (as provided by Left ITreeContentProvider
)R
- The type of the left bound of the mapping (as provided by R>ight ITreeContentProvider
)public class TreeMapper<M,L,R>
extends java.lang.Object
implements org.eclipse.jface.viewers.ISelectionProvider
TreeViewer
(left and right)
and an area to display mappings between tree nodes.
It relies on a ISemanticTreeMapperSupport
to create your business mapping objects,
and to resolve the bounds of a mapping object to object that are provided in the trees.Constructor and Description |
---|
TreeMapper(org.eclipse.swt.widgets.Composite parent,
ISemanticTreeMapperSupport<M,L,R> semanticSupport,
TreeMapperUIConfigProvider uiConfig) |
Modifier and Type | Method and Description |
---|---|
void |
addNewMappingListener(INewMappingListener<M> listener) |
void |
addSelectionChangedListener(org.eclipse.jface.viewers.ISelectionChangedListener listener) |
protected void |
fireMappingSelection(M mapping,
LinkFigure arrowFigure) |
protected void |
fireMouseEntered(M mapping,
LinkFigure arrowFigure) |
protected void |
fireMouseExited(M mapping,
LinkFigure arrowFigure) |
org.eclipse.swt.custom.SashForm |
getControl() |
org.eclipse.jface.viewers.TreeViewer |
getLeftTreeViewer() |
org.eclipse.jface.viewers.TreeViewer |
getRightTreeViewer() |
org.eclipse.jface.viewers.IStructuredSelection |
getSelection() |
protected void |
performMappingByDrop(org.eclipse.jface.viewers.TreeViewer sourceTreeViewer,
org.eclipse.jface.viewers.ISelection sourceData,
org.eclipse.jface.viewers.TreeViewer targetTreeViewer,
org.eclipse.swt.widgets.TreeItem targetTreeItem,
int direction) |
void |
refresh()
Refresh the widget by resetting the setInput value
|
void |
removeSelectionChangedListener(org.eclipse.jface.viewers.ISelectionChangedListener listener) |
void |
setContentProviders(org.eclipse.jface.viewers.ITreeContentProvider leftContentProvider,
org.eclipse.jface.viewers.ITreeContentProvider rightTreeContentProvider)
Set the content providers for both trees.
|
void |
setInput(java.lang.Object leftTreeInput,
java.lang.Object rightTreeInput,
java.util.List<M> mappings)
Sets the input of the widget.
|
void |
setLabelProviders(org.eclipse.jface.viewers.IBaseLabelProvider leftLabelProvider,
org.eclipse.jface.viewers.IBaseLabelProvider rightLabelProvider) |
void |
setSelection(org.eclipse.jface.viewers.ISelection selection) |
public TreeMapper(org.eclipse.swt.widgets.Composite parent, ISemanticTreeMapperSupport<M,L,R> semanticSupport, TreeMapperUIConfigProvider uiConfig)
public void setContentProviders(org.eclipse.jface.viewers.ITreeContentProvider leftContentProvider, org.eclipse.jface.viewers.ITreeContentProvider rightTreeContentProvider)
ITreeContentProvider.getParent(Object)
method implemeneted.leftContentProvider
- An ITreeContentProvider
that node are instances of the L type parameter.rightTreeContentProvider
- An ITreeContentProvider
that node are instances of the R type parameter.public void setLabelProviders(org.eclipse.jface.viewers.IBaseLabelProvider leftLabelProvider, org.eclipse.jface.viewers.IBaseLabelProvider rightLabelProvider)
public void setInput(java.lang.Object leftTreeInput, java.lang.Object rightTreeInput, java.util.List<M> mappings)
leftTreeInput
- The input for left TreeViewer
rightTreeInput
- The input for right TreeViewer
mappings
- The list containing the mapping. It will be used as a working copy and
then MODIFIED by the tree mapper. If you don't want to pass a modifiable list, then pass
a copy of the default mapping list, and prefer using TreeMapper
addNewMappingListener(INewMappingListener)
and INewMappingListener
to track the creation of mapping.protected void performMappingByDrop(org.eclipse.jface.viewers.TreeViewer sourceTreeViewer, org.eclipse.jface.viewers.ISelection sourceData, org.eclipse.jface.viewers.TreeViewer targetTreeViewer, org.eclipse.swt.widgets.TreeItem targetTreeItem, int direction)
targetTreeViewer
- data
- widget
- public org.eclipse.swt.custom.SashForm getControl()
public void addSelectionChangedListener(org.eclipse.jface.viewers.ISelectionChangedListener listener)
addSelectionChangedListener
in interface org.eclipse.jface.viewers.ISelectionProvider
public org.eclipse.jface.viewers.IStructuredSelection getSelection()
getSelection
in interface org.eclipse.jface.viewers.ISelectionProvider
ISelectionProvider.getSelection()
public void removeSelectionChangedListener(org.eclipse.jface.viewers.ISelectionChangedListener listener)
removeSelectionChangedListener
in interface org.eclipse.jface.viewers.ISelectionProvider
ISelectionProvider.removeSelectionChangedListener(org.eclipse.jface.viewers.ISelectionChangedListener)
public void setSelection(org.eclipse.jface.viewers.ISelection selection)
setSelection
in interface org.eclipse.jface.viewers.ISelectionProvider
ISelectionProvider.setSelection(org.eclipse.jface.viewers.ISelection)
protected void fireMappingSelection(M mapping, LinkFigure arrowFigure)
mapping
- arrowFigure
- public void addNewMappingListener(INewMappingListener<M> listener)
iNewMappingListener
- protected void fireMouseExited(M mapping, LinkFigure arrowFigure)
mapping
- arrowFigure
- protected void fireMouseEntered(M mapping, LinkFigure arrowFigure)
mapping
- arrowFigure
- public org.eclipse.jface.viewers.TreeViewer getLeftTreeViewer()
public org.eclipse.jface.viewers.TreeViewer getRightTreeViewer()
public void refresh()