public Object getParent(Object element)
{
if (element instanceof IModelElement)
{
IModelElement model = (IModelElement) element;
return model.getParent();
}
return null;
}
public boolean hasChildren(Object element)
{
if (element instanceof ICompoundModelElement)
{
ICompoundModelElement model = (ICompoundModelElement) element;
return model.children().length > 0;
}
return false;
}
public Object[] getElements(Object inputElement)
{
IBundleRepository rep = (IBundleRepository) inputElement;
IRepositoryModel model = SigilCore.getRepositoryModel(rep);
if ( model.getProblem() == null ) {
return getBundles(rep);
}
else {
return new Object[] { model.getProblem() };
}
}
});
treeViewer.setComparator(new ModelElementComparator());
treeViewer.setLabelProvider(new ModelLabelProvider());
treeViewer.addDragSupport(DND.DROP_LINK,
new Transfer[] { LocalSelectionTransfer.getTransfer() },
new DragSourceAdapter()
{
@Override
public void dragFinished(DragSourceEvent event)
{
// TODO Auto-generated method stub
super.dragFinished(event);
}
@Override
public void dragSetData(DragSourceEvent event)
{
// TODO Auto-generated method stub
super.dragSetData(event);
}
@SuppressWarnings("unchecked")
@Override
public void dragStart(DragSourceEvent event)
{
if (treeViewer.getSelection().isEmpty())
{
IStructuredSelection sel = (IStructuredSelection) treeViewer.getSelection();
for (Iterator<IModelElement> i = sel.iterator(); i.hasNext();)
{
IModelElement e = i.next();
if (e instanceof ISigilBundle)
{
event.data = e;
}
else