viewerComp.setLayout(participantsColLayout);
{
TableViewerColumn viewerColumn;
TableColumn tableColumn;
EditingSupport editSupport;
participantsViewer = new TableViewer(viewerComp, SWT.MULTI | SWT.FULL_SELECTION | SWT.BORDER);
selectionProvider.addSelectionProvider(participantsViewer);
final Table table = participantsViewer.getTable();
viewerColumn = new TableViewerColumn(participantsViewer, SWT.LEFT);
tableColumn = viewerColumn.getColumn();
tableColumn.setText("");
tableColumn
.setToolTipText(Messages
.getString("encounter.builder.ui.editor.encounter.participants.table.column.selection.tooltip"));
tableColumn.setResizable(false);
tableColumn.setMoveable(false);
viewerColumn.setLabelProvider(new ColumnLabelProvider() {
@Override
public Image getImage(Object element) {
return null;
}
@Override
public String getText(Object element) {
if(element instanceof EncounterParticipant) {
return ((EncounterParticipant)element).getLabel();
}
return null;
}
});
participantsColLayout.setColumnData(tableColumn, new ColumnWeightData(100));
table.setHeaderVisible(false);
table.setLinesVisible(true);
participantsViewer.setContentProvider(new EncounterBuilderParticipantsViewerContentProvider(this));
participantsViewer.setInput(this);
// setup drop target
Transfer[] types = new Transfer[] { LocalSelectionTransfer.getTransfer() };
DropTarget target = new DropTarget(table, DND.DROP_COPY);
target.setTransfer(types);
target.addDropListener(new DropTargetAdapter() {
@Override
public void dragEnter(DropTargetEvent event) {
logger.debug("drag enter: " + event);
event.operations = DND.DROP_COPY;
event.feedback = DND.FEEDBACK_INSERT_BEFORE;
};
@Override
public void drop(DropTargetEvent event) {
logger.debug("drop: " + event);
// A drop has occurred, copy over the data
// if(event.data == null) { // no data to copy, indicate failure in event.detail
// event.detail = DND.DROP_NONE;
// return;
// }
// label.setText ((String) event.data); // data copied to label text
}
});
}
}
// selection list
Group selectionGroup = new Group(comp, SWT.NONE);
selectionGroup.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 2, 1));
selectionGroup.setLayout(new GridLayout(2, true));
selectionGroup.setText(Messages.getString("encounter.builder.ui.editor.encounter.selection.group.label"));
{
// toolbar
selectionTools = new ToolBar(selectionGroup, SWT.FLAT);
selectionTools.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
selectionToolsManager = new ToolBarManager(selectionTools);
// selection search box
selectionSearchText = new Text(selectionGroup, SWT.SINGLE | SWT.BORDER | SWT.SEARCH | SWT.CANCEL);
selectionSearchText.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
selectionSearchText.addModifyListener(new ModifyListener() {
public void modifyText(ModifyEvent event) {
selectableSearchValue = ((Text)event.widget).getText();
selectionViewer.refresh();
}
});
// viewer
Composite viewerComp = new Composite(selectionGroup, SWT.NONE);
viewerComp.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 2, 1));
TableColumnLayout selectionColLayout = new TableColumnLayout();
viewerComp.setLayout(selectionColLayout);
TableViewerColumn viewerColumn;
TableColumn tableColumn;
EditingSupport editSupport;
selectionViewer = new TableViewer(viewerComp, SWT.MULTI | SWT.FULL_SELECTION | SWT.BORDER);
selectionProvider.addSelectionProvider(selectionViewer);
final Table table = selectionViewer.getTable();