}
});
// try to get the layout correct...
toolBarData = new CellData();
toolBarData.align(SWT.FILL, SWT.FILL);
menuTB.setLayoutData(toolBarData);
}
// Construct the ToolBar containing the 'Fast' views
fastViewBar = new ToolBarManager(SWT.FLAT | SWT.WRAP | orientation);
fastViewBar.add(new ShowFastViewContribution(window));
fastViewBar.createControl(fvbComposite);
getToolBar().addListener(SWT.MenuDetect, menuListener);
IDragOverListener fastViewDragTarget = new IDragOverListener() {
public IDropTarget drag(Control currentControl,
Object draggedObject, Point position,
Rectangle dragRectangle) {
ToolItem targetItem = getToolItem(position);
if (draggedObject instanceof ViewPane) {
ViewPane pane = (ViewPane) draggedObject;
// Can't drag views between windows
if (pane.getWorkbenchWindow() != window) {
return null;
}
List newList = new ArrayList(1);
newList.add(draggedObject);
return createDropTarget(newList, targetItem);
}
if (draggedObject instanceof ViewStack) {
ViewStack folder = (ViewStack) draggedObject;
if (folder.getWorkbenchWindow() != window) {
return null;
}
List viewList = new ArrayList(folder.getItemCount());
LayoutPart[] children = folder.getChildren();
for (int idx = 0; idx < children.length; idx++) {
if (!(children[idx] instanceof PartPlaceholder)) {
viewList.add(children[idx]);
}
}
return createDropTarget(viewList, targetItem);
}
return null;
}
};
toolBarData = new CellData();
toolBarData.align(SWT.FILL, SWT.FILL);
getToolBar().setLayoutData(toolBarData);
PresentationUtil.addDragListener(getToolBar(), dragListener);
DragUtil.addDragTarget(getControl(), fastViewDragTarget);