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(draggableControl, 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 JSONFileDragAndDropHandler method createDropTarget.
private void createDropTarget() {
if (loopDropTarget != null) {
loopDropTarget.dispose();
}
loopDropTarget = new DropTarget(linker.getTarget(), DND.DROP_DEFAULT | DND.DROP_MOVE | DND.DROP_COPY | DND.DROP_LINK);
loopDropTarget.setTransfer(new Transfer[] { LocalDataTransfer.getInstance() });
DropTargetListener targetListener = new TableDropTargetListener();
loopDropTarget.addDropListener(targetListener);
}
use of org.eclipse.swt.dnd.DropTarget in project tdi-studio-se by Talend.
the class AbstractElementPropertySectionController method addDragAndDropTarget.
/**
* Accept Text and StyledText control.
*
* @param labelText
*/
public void addDragAndDropTarget(final Control textControl) {
DropTargetListener dropTargetListener = new DropTargetListener() {
String propertyName = null;
@Override
public void dragEnter(final DropTargetEvent event) {
}
@Override
public void dragLeave(final DropTargetEvent event) {
}
@Override
public void dragOperationChanged(final DropTargetEvent event) {
}
@Override
public void dragOver(final DropTargetEvent event) {
if (TextTransfer.getInstance().isSupportedType(event.currentDataType)) {
propertyName = getParameterName(textControl);
for (int i = 0; i < elem.getElementParameters().size(); i++) {
IElementParameter param = elem.getElementParameters().get(i);
if (param.getName().equals(propertyName)) {
if (param.isReadOnly()) {
event.detail = DND.ERROR_INVALID_DATA;
}
}
}
}
}
@Override
public void drop(final DropTargetEvent event) {
if (propertyName != null) {
String text;
if (textControl instanceof StyledText) {
text = ((StyledText) textControl).getText() + (String) event.data;
((StyledText) textControl).setText(text);
} else {
text = ((Text) textControl).getText() + (String) event.data;
((Text) textControl).setText(text);
}
Command cmd = new PropertyChangeCommand(elem, propertyName, text);
// getCommandStack().execute(cmd);
executeCommand(cmd);
}
}
@Override
public void dropAccept(final DropTargetEvent event) {
}
};
DropTarget target = new DropTarget(textControl, DND.DROP_MOVE | DND.DROP_COPY | DND.DROP_DEFAULT);
Transfer[] transfers = new Transfer[] { TextTransfer.getInstance() };
target.setTransfer(transfers);
target.addDropListener(dropTargetListener);
}
use of org.eclipse.swt.dnd.DropTarget in project tdi-studio-se by Talend.
the class DropContextAnalyzer method init.
/**
* DOC amaumont Comment method "init".
*/
private void init() {
DropTarget dropTarget = (DropTarget) event.widget;
currentTableTarget = (Table) dropTarget.getControl();
dataMapTableViewTarget = mapperManager.retrieveDataMapTableView(currentTableTarget);
zoneTarget = dataMapTableViewTarget.getZone();
draggedData = TableEntriesTransfer.getInstance().getDraggedData();
dataMapTableViewSource = (DataMapTableView) draggedData.getDataMapTableViewSource();
tableItemSource = draggedData.getTableItemSource();
zoneSource = dataMapTableViewSource.getZone();
analyzeCursorOverExpressionCell();
invalidKeyPressed = hasInvalidKeyPressed();
isDropValid = checkDropIsValid();
analyzeForFeedback();
analyzeForDetail();
// System.out.println("isCursorOverExpressionCell="+isCursorOverExpressionCell);
}
use of org.eclipse.swt.dnd.DropTarget in project tdi-studio-se by Talend.
the class HL7Message2SchemaDragAndDropHandler method createDropTarget.
private void createDropTarget() {
if (loopDropTarget != null) {
loopDropTarget.dispose();
}
loopDropTarget = new DropTarget(linker.getTarget(), DND.DROP_DEFAULT | DND.DROP_MOVE | DND.DROP_COPY | DND.DROP_LINK);
loopDropTarget.setTransfer(new Transfer[] { SegmentTransfer.getInstance() });
DropTargetListener targetListener = new TableDropTargetListener();
loopDropTarget.addDropListener(targetListener);
}
Aggregations