use of org.eclipse.swt.dnd.DropTarget in project tdi-studio-se by Talend.
the class DragNDrop method createDropTarget.
/**
*
* create DropTarget.
*/
private void createDropTarget(DropTargetListener targetListener) {
if (dropTarget != null) {
dropTarget.dispose();
}
dropTarget = new DropTarget(draggableTable, DND.DROP_DEFAULT | DND.DROP_MOVE | DND.DROP_COPY | DND.DROP_LINK);
dropTarget.setTransfer(new Transfer[] { TableEntriesTransfer.getInstance() });
dropTarget.addDropListener(targetListener);
}
use of org.eclipse.swt.dnd.DropTarget in project tdi-studio-se by Talend.
the class ReconcilerViewer method addDropSupport.
/**
* Adds support for dropping items into this viewer via a user drag-and-drop operation.
*
* @param operations a bitwise OR of the supported drag and drop operation types ( <code>DROP_COPY</code>,
* <code>DROP_LINK</code>, and <code>DROP_MOVE</code>)
* @param transferTypes the transfer types that are supported by the drop operation
* @param listener the callback that will be invoked after the drag and drop operation finishes
* @see org.eclipse.swt.dnd.DND
*/
public void addDropSupport(int operations, Transfer[] transferTypes, final DropTargetListener listener) {
Control control = getTextWidget();
DropTarget dropTarget = new DropTarget(control, operations);
dropTarget.setTransfer(transferTypes);
dropTarget.addDropListener(listener);
}
use of org.eclipse.swt.dnd.DropTarget in project tdi-studio-se by Talend.
the class JSONToSchemaDragAndDropHandler method createDropTarget.
/**
*
* create DropTarget.
*/
private void createDropTarget() {
if (loopDropTarget != null) {
loopDropTarget.dispose();
}
loopDropTarget = new DropTarget(loopTable, DND.DROP_DEFAULT | DND.DROP_MOVE | DND.DROP_COPY | DND.DROP_LINK);
loopDropTarget.setTransfer(new Transfer[] { XPathTransfer.getInstance() });
DropTargetListener targetListener = new TableDropTargetListener();
loopDropTarget.addDropListener(targetListener);
if (fieldsDropTarget != null) {
fieldsDropTarget.dispose();
}
fieldsDropTarget = new DropTarget(fieldsTable, DND.DROP_DEFAULT | DND.DROP_MOVE | DND.DROP_COPY | DND.DROP_LINK);
fieldsDropTarget.setTransfer(new Transfer[] { XPathTransfer.getInstance() });
targetListener = new TableDropTargetListener();
fieldsDropTarget.addDropListener(targetListener);
}
use of org.eclipse.swt.dnd.DropTarget in project tdi-studio-se by Talend.
the class JSONTree2SchemaDragAndDropHandler method createDropTarget.
private void createDropTarget() {
if (loopDropTarget != null) {
loopDropTarget.dispose();
}
loopDropTarget = new DropTarget(table, DND.DROP_DEFAULT | DND.DROP_MOVE | DND.DROP_COPY | DND.DROP_LINK);
loopDropTarget.setTransfer(new Transfer[] { XPathTransfer.getInstance() });
DropTargetListener targetListener = new TableDropTargetListener();
loopDropTarget.addDropListener(targetListener);
}
use of org.eclipse.swt.dnd.DropTarget in project yamcs-studio by yamcs.
the class PVTupleTableEditor method createPVTupleListTableViewer.
/**
* Creates and configures a {@link TableViewer}.
*
* @param parent
* The parent for the table
* @return The {@link TableViewer}
*/
private TableViewer createPVTupleListTableViewer(final Composite parent) {
final TableViewer viewer = new TableViewer(parent, SWT.V_SCROLL | SWT.H_SCROLL | SWT.BORDER | SWT.FULL_SELECTION | SWT.MULTI);
viewer.getTable().setLinesVisible(true);
viewer.getTable().setHeaderVisible(true);
final TableViewerColumn numColumn = new TableViewerColumn(viewer, SWT.NONE);
numColumn.getColumn().setText("#");
numColumn.getColumn().setMoveable(false);
numColumn.getColumn().setWidth(50);
final TableViewerColumn pvColumn = new TableViewerColumn(viewer, SWT.NONE);
pvColumn.getColumn().setText("PV Name");
pvColumn.getColumn().setMoveable(false);
pvColumn.getColumn().setWidth(220);
pvColumn.setEditingSupport(new PVColumnEditingSupport(viewer, viewer.getTable()));
final TableViewerColumn TrigColumn = new TableViewerColumn(viewer, SWT.NONE);
TrigColumn.getColumn().setText("Trigger");
TrigColumn.getColumn().setMoveable(false);
TrigColumn.getColumn().pack();
TrigColumn.setEditingSupport(new TriggerColumnEditingSupport(viewer, viewer.getTable()));
viewer.setContentProvider(new ArrayContentProvider());
viewer.setLabelProvider(new PVTupleLabelProvider(pvTupleList));
viewer.addSelectionChangedListener(new ISelectionChangedListener() {
public void selectionChanged(final SelectionChangedEvent event) {
refreshToolbarOnSelection();
}
});
viewer.getTable().setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
DropTarget target = new DropTarget(viewer.getControl(), DND.DROP_MOVE | DND.DROP_COPY);
target.setTransfer(new Transfer[] { TextTransfer.getInstance() });
target.addDropListener(new DropTargetListener() {
@Override
public void dragEnter(DropTargetEvent event) {
}
@Override
public void dragLeave(DropTargetEvent event) {
}
@Override
public void dragOperationChanged(DropTargetEvent event) {
}
@Override
public void dragOver(DropTargetEvent event) {
}
@Override
public void drop(DropTargetEvent event) {
if (event == null || !(event.data instanceof String))
return;
String txt = (String) event.data;
String[] names = txt.split("[\r\n]+");
PVTuple[] tuples = new PVTuple[names.length];
int i = 0;
for (String name : names) {
tuples[i] = new PVTuple(name, true);
pvTupleList.add(tuples[i]);
i++;
}
refreshTableViewerFromAction(tuples);
}
@Override
public void dropAccept(DropTargetEvent event) {
}
});
return viewer;
}
Aggregations