本文整理匯總了Java中org.eclipse.swt.dnd.DragSource.setTransfer方法的典型用法代碼示例。如果您正苦於以下問題:Java DragSource.setTransfer方法的具體用法?Java DragSource.setTransfer怎麽用?Java DragSource.setTransfer使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.eclipse.swt.dnd.DragSource
的用法示例。
在下文中一共展示了DragSource.setTransfer方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: createXhtmlTree
import org.eclipse.swt.dnd.DragSource; //導入方法依賴的package包/類
private void createXhtmlTree() {
sourcePicker.createXhtmlTree(treesSashForm);
// DND support
int ops = DND.DROP_COPY | DND.DROP_MOVE;
Transfer[] transfers = new Transfer[] {StepSourceTransfer.getInstance()};
DragSource source = new DragSource(sourcePicker.getTwsDomTree().getTree(), ops);
source.setTransfer(transfers);
source.addDragListener(new DragSourceAdapter() {
@Override
public void dragStart(DragSourceEvent event) {
event.doit = true;
StepSourceTransfer.getInstance().setStepSource(sourcePicker.getDragData());
}
});
}
示例2: applyDragFromTableViewer
import org.eclipse.swt.dnd.DragSource; //導入方法依賴的package包/類
public void applyDragFromTableViewer(Control sourceControl, int index) {
Transfer[] types = new Transfer[] { TextTransfer.getInstance() };
final String portLabel = "in" + index + ".";
int operations = DND.DROP_MOVE | DND.DROP_COPY | DND.DROP_LINK;
final Table table = (Table) sourceControl;
DragSource source = new DragSource(table, operations);
source.setTransfer(types);
final String[] columnData = new String[1];
source.addDragListener(new DragSourceAdapter() {
public void dragSetData(DragSourceEvent event) {
// Set the data to be the first selected item's text
event.data = addDelimeter(portLabel, table.getSelection());
}
});
}
示例3: attachDragListener
import org.eclipse.swt.dnd.DragSource; //導入方法依賴的package包/類
private void attachDragListener() {
dragSource = new DragSource(table_1, DND.DROP_MOVE);
dragSource.setTransfer(new Transfer[] { TextTransfer.getInstance() });
dragSource.addDragListener(new DragSourceAdapter() {
public void dragSetData(DragSourceEvent event) {
// Set the data to be the first selected item's text
event.data = formatDataToTransfer(table_1.getSelection());
}
});
}
示例4: createSourceTable
import org.eclipse.swt.dnd.DragSource; //導入方法依賴的package包/類
private void createSourceTable(Composite composite_2) {
sourceTable = new Table(composite_2, SWT.BORDER | SWT.MULTI | SWT.FULL_SELECTION);
sourceTable.addMouseListener(new MouseAdapter() {
@Override
public void mouseDoubleClick(MouseEvent e) {
if(sourceTable.getSelection().length==1){
addNewProperty(targetTableViewer, sourceTable.getSelection()[0].getText());
enableControlButtons();
}
}
});
GridData gd_table = new GridData(SWT.FILL, SWT.FILL, true, true, 1, 2);
gd_table.widthHint = 221;
gd_table.heightHint = 407;
sourceTable.setLayoutData(gd_table);
sourceTable.setHeaderVisible(true);
sourceTable.setLinesVisible(true);
TableColumn sourceTableColumnFieldName = new TableColumn(sourceTable, SWT.LEFT);
if(OSValidator.isMac()){
sourceTableColumnFieldName.setWidth(212);
}else{
sourceTableColumnFieldName.setWidth(202);
}
sourceTableColumnFieldName.setText(Messages.AVAILABLE_FIELDS_HEADER);
getSourceFieldsFromPropagatedSchema(sourceTable);
dragSource = new DragSource(sourceTable, DND.DROP_MOVE);
dragSource.setTransfer(new Transfer[] { TextTransfer.getInstance() });
dragSource.addDragListener(new DragSourceAdapter() {
public void dragSetData(DragSourceEvent event) {
// Set the data to be the first selected item's text
event.data = formatDataToTransfer(sourceTable.getSelection());
}
});
}
示例5: addDoubleClickListener
import org.eclipse.swt.dnd.DragSource; //導入方法依賴的package包/類
private void addDoubleClickListener(TableViewer availableFieldtableViewer) {
DragSource dragSource = new DragSource(availableFieldsTable, DND.DROP_COPY);
dragSource.setTransfer(new Transfer[] { ObjectTransfer.getInstance() });
dragSource.addDragListener(new DragSourceAdapter() {
public void dragSetData(DragSourceEvent event) { // Set the data to be the first selected item's text
List<Object> list=new ArrayList<Object>();
for(TableItem tableItem:availableFieldsTable.getSelection()){
list.add(tableItem.getData());
}
event.data=list.toArray(new Object[list.size()]);
}
});
}
示例6: configure
import org.eclipse.swt.dnd.DragSource; //導入方法依賴的package包/類
public void configure(CommandManager commandManager, Control control, ISelectionProvider provider) {
dragAdapter = new DelegatingDragAdapter();
dragSource = new DragSource(control, DND.DROP_COPY | DND.DROP_MOVE);
dragAdapter.addDragSourceListener(new OutlineDragSourceListener(provider));
dragSource.addDragListener(dragAdapter);
dragSource.setTransfer(dragAdapter.getTransfers());
dropAdapter = new DelegatingDropAdapter();
dropTarget = new DropTarget(control, DND.DROP_COPY | DND.DROP_MOVE);
dropAdapter.addDropTargetListener(new OutlineDropTargetListener(commandManager));
dropTarget.addDropListener(dropAdapter);
dropTarget.setTransfer(dropAdapter.getTransfers());
}
示例7: addDragSupport
import org.eclipse.swt.dnd.DragSource; //導入方法依賴的package包/類
/**
* Add the drag support to the element of the gallery
*/
private void addDragSupport() {
int operations = DND.DROP_MOVE;
final Transfer[] types = new Transfer[] { CrosstrabRestrictedTransferType.getInstance() };
DragSource source = new DragSource(checkedGallery, operations);
source.setTransfer(types);
source.addDragListener(new StyleDragListener());
}
示例8: addDragSupport
import org.eclipse.swt.dnd.DragSource; //導入方法依賴的package包/類
/**
* Add the drag support
*/
private void addDragSupport() {
int operations = DND.DROP_MOVE;
final Transfer[] types = new Transfer[] { TableRestrictedTransferType.getInstance() };
DragSource source = new DragSource(checkedGallery, operations);
source.setTransfer(types);
source.addDragListener(new StyleDragListener());
}
示例9: addDragSupport
import org.eclipse.swt.dnd.DragSource; //導入方法依賴的package包/類
/**
* Add the drag support to move a text template on a textual element
*
* @param control control where the drag operation where added
*/
private void addDragSupport(Control control) {
int operations = DND.DROP_MOVE;
final Transfer[] types = new Transfer[] { TextRestrictedTransferType.getInstance() };
DragSource source = new DragSource(control, operations);
source.setTransfer(types);
source.addDragListener(new StyleDragListener(control));
}
示例10: isDragPossible
import org.eclipse.swt.dnd.DragSource; //導入方法依賴的package包/類
@Override
protected boolean isDragPossible(DragSource source, long time) {
transferable = getTransferable(source, time);
if (transferable == null) {
return false;
}
Transfer transfers[] = TransferRegistry.getInstance().getTransfersFor(transferable);
source.setTransfer(transfers);
viewer.cancelEditing();
return true;
}
示例11: registerDragDrop
import org.eclipse.swt.dnd.DragSource; //導入方法依賴的package包/類
/**
* Register DragDropAdapter
*/
private void registerDragDrop() {
// Drag-Part //////////////////////////////////////////////////////////
DragSource source = new DragSource(tree, DND.DROP_COPY | DND.DROP_MOVE);
source.setTransfer(new Transfer[] { TextTransfer.getInstance() });
source.addDragListener(new TreeDragSourceListener(tree));
// Drop-Part //////////////////////////////////////////////////////////
DropTarget dropTarget = new DropTarget(tree, DND.DROP_COPY
| DND.DROP_DEFAULT);
dropTarget.setTransfer(new Transfer[] { TextTransfer.getInstance(),
FileTransfer.getInstance() });
dropTarget.addDropListener(new TreeDropTargetAdapter(viewer, root));
}
示例12: addDragListener
import org.eclipse.swt.dnd.DragSource; //導入方法依賴的package包/類
private void addDragListener(Control control) {
LocalSelectionTransfer transfer = LocalSelectionTransfer.getTransfer();
DragSourceAdapter dragAdapter = new DragSourceAdapter() {
@Override
public void dragSetData(DragSourceEvent event) {
transfer.setSelection(new StructuredSelection(control));
}
};
DragSource dragSource = new DragSource(control, DND.DROP_MOVE | DND.DROP_COPY);
dragSource.setTransfer(new Transfer[] { transfer });
dragSource.addDragListener(dragAdapter);
}
示例13: addDragListenerToHeaderButton
import org.eclipse.swt.dnd.DragSource; //導入方法依賴的package包/類
protected void addDragListenerToHeaderButton( Button button )
{
DragSource ds = new DragSource( button, DND.DROP_COPY );
ds.setTransfer( new Transfer[]{
SimpleTextTransfer.getInstance( )
} );
CustomPreviewTableDragListener dragSourceAdapter = new CustomPreviewTableDragListener( this,
button.getText( ) );
ds.addDragListener( dragSourceAdapter );
}
示例14: createDataField
import org.eclipse.swt.dnd.DragSource; //導入方法依賴的package包/類
private void createDataField( )
{
Composite dataField = new Composite( this, SWT.NONE );
dataField.setLayoutData( new GridData( GridData.FILL_BOTH ) );
dataField.setLayout( new GridLayout( ) );
Label dataLabel = new Label( dataField, SWT.NONE );
dataLabel.setText( Messages.getString( "GroupsPage.Label.DataField" ) ); //$NON-NLS-1$
dataFieldsViewer = new TreeViewer( dataField, SWT.SINGLE
| SWT.H_SCROLL
| SWT.V_SCROLL
| SWT.BORDER );
cubeLabelProvider = getCubeLabelProvider( );
cubeLabelProvider.setProivderViewer( true );
dataFieldsViewer.setLabelProvider( cubeLabelProvider );
dataFieldsViewer.setContentProvider( dataContentProvider );
dataFieldsViewer.setAutoExpandLevel( 3 );
GridData gd = new GridData( GridData.FILL_BOTH );
dataFieldsViewer.getTree( ).setLayoutData( gd );
( (GridData) dataFieldsViewer.getTree( ).getLayoutData( ) ).heightHint = 250;
( (GridData) dataFieldsViewer.getTree( ).getLayoutData( ) ).widthHint = 200;
dataFieldsViewer.addSelectionChangedListener( new ISelectionChangedListener( ) {
public void selectionChanged( SelectionChangedEvent event )
{
updateButtons( );
}
} );
final DragSource fieldsSource = new DragSource( dataFieldsViewer.getTree( ),
operations );
fieldsSource.setTransfer( types );
fieldsSource.addDragListener( new CustomDragListener( dataFieldsViewer ) );
}
示例15: setupAsDragSource
import org.eclipse.swt.dnd.DragSource; //導入方法依賴的package包/類
private void setupAsDragSource()
{
DragSource source = new DragSource(_table, DND.DROP_MOVE);
source.setTransfer(new Transfer[] {TextTransfer.getInstance()});
source.addDragListener(new DragSourceAdapter() {
@Override
public void dragSetData(DragSourceEvent evt)
{
if (TextTransfer.getInstance().isSupportedType(evt.dataType))
evt.data = "drag";
}
});
}