當前位置: 首頁>>代碼示例>>Java>>正文


Java DragSource.setTransfer方法代碼示例

本文整理匯總了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());
		}
	});
	
}
 
開發者ID:convertigo,項目名稱:convertigo-eclipse,代碼行數:19,代碼來源:SourcePickerView.java

示例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());
		}
	});

}
 
開發者ID:capitalone,項目名稱:Hydrograph,代碼行數:17,代碼來源:ELTSWTWidgets.java

示例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());
		}

	});
}
 
開發者ID:capitalone,項目名稱:Hydrograph,代碼行數:12,代碼來源:ExcelFormattingDialog.java

示例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());
		}

	});
}
 
開發者ID:capitalone,項目名稱:Hydrograph,代碼行數:38,代碼來源:SecondaryColumnKeysDialog.java

示例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()]);
		}
	});
}
 
開發者ID:capitalone,項目名稱:Hydrograph,代碼行數:15,代碼來源:AvailableFieldComposite.java

示例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());
	}
 
開發者ID:grosenberg,項目名稱:fluentmark,代碼行數:15,代碼來源:DndConfigurationStrategy.java

示例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());
}
 
開發者ID:OpenSoftwareSolutions,項目名稱:PDFReporter-Studio,代碼行數:11,代碼來源:CrosstabStyleView.java

示例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());
}
 
開發者ID:OpenSoftwareSolutions,項目名稱:PDFReporter-Studio,代碼行數:11,代碼來源:TableStyleView.java

示例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));
}
 
開發者ID:OpenSoftwareSolutions,項目名稱:PDFReporter-Studio,代碼行數:13,代碼來源:TextStyleView.java

示例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;
}
 
開發者ID:nasa,項目名稱:OpenSPIFe,代碼行數:12,代碼來源:AbstractTreeViewerDragSourceListener.java

示例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));
}
 
開發者ID:dev131,項目名稱:DropTillLate_Application,代碼行數:17,代碼來源:ViewController.java

示例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);
}
 
開發者ID:vogellacompany,項目名稱:codeexamples-eclipse,代碼行數:15,代碼來源:View.java

示例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 );
}
 
開發者ID:eclipse,項目名稱:birt,代碼行數:11,代碼來源:CustomPreviewTable.java

示例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 ) );

}
 
開發者ID:eclipse,項目名稱:birt,代碼行數:37,代碼來源:CubeGroupContent.java

示例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";
	}
});
  }
 
開發者ID:edeoliveira,項目名稱:Mailster,代碼行數:14,代碼來源:MailBoxTableView.java


注:本文中的org.eclipse.swt.dnd.DragSource.setTransfer方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。