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


Java DragSourceListener類代碼示例

本文整理匯總了Java中org.eclipse.swt.dnd.DragSourceListener的典型用法代碼示例。如果您正苦於以下問題:Java DragSourceListener類的具體用法?Java DragSourceListener怎麽用?Java DragSourceListener使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


DragSourceListener類屬於org.eclipse.swt.dnd包,在下文中一共展示了DragSourceListener類的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: configureDragAndDrop

import org.eclipse.swt.dnd.DragSourceListener; //導入依賴的package包/類
protected void configureDragAndDrop(DragAndDropConfiguration dragAndDropConfiguration, TreeViewer treeViewer) {

      // drop
      Transfer[] transferTypes = new Transfer[] { LocalSelectionTransfer.getTransfer() };
      int operations = dragAndDropConfiguration.getSupportedDropOperations(this);
      
      DropTarget target = new DropTarget(treeViewer.getControl(), operations);
      target.setTransfer(transferTypes);

      // Drop listeners pour le drop des elements sur l'arbre
      SchemaViewerDropPolicy dropPolicy = dragAndDropConfiguration.getDropPolicy(this);
      DnDTargetListener targetListener = new DnDTargetListener(this, nodeConverter, dropPolicy);
      target.addDropListener(targetListener);

      // Drag listener pour le drag des elements de l'arbre
      DragSourceListener sourceListener = new DnDSourceListener(this);
      operations = DND.DROP_MOVE | DND.DROP_COPY | DND.DROP_DEFAULT;
      transferTypes = new Transfer[] { LocalSelectionTransfer.getTransfer() };
      treeViewer.addDragSupport(operations, transferTypes, sourceListener);
      
  }
 
開發者ID:Talend,項目名稱:avro-schema-editor,代碼行數:22,代碼來源:SchemaViewer.java

示例2: getDragSourceAdapter

import org.eclipse.swt.dnd.DragSourceListener; //導入依賴的package包/類
protected DragSourceListener getDragSourceAdapter(
        final TableViewer inViewer) {
	return new DragSourceAdapter() {
		@Override
		public void dragSetData(final DragSourceEvent inEvent) {
			final IStructuredSelection lSelected = (IStructuredSelection) inViewer
	                .getSelection();
			if (!lSelected.isEmpty()) {
				final Object[] lItems = lSelected.toArray();
				final UniqueID[] lIDs = new UniqueID[lItems.length];
				for (int i = 0; i < lItems.length; i++) {
					final ILightWeightItem lItem = (ILightWeightItem) lItems[i];
					lIDs[i] = new UniqueID(lItem.getItemType(),
	                        lItem.getID());
				}
				inEvent.data = lIDs;
			}
		}
	};
}
 
開發者ID:aktion-hip,項目名稱:relations,代碼行數:21,代碼來源:AbstractToolPart.java

示例3: addDragSupport

import org.eclipse.swt.dnd.DragSourceListener; //導入依賴的package包/類
@Override
public void addDragSupport(int operations, Transfer[] transferTypes, DragSourceListener listener) {
	fViewer.addDragSupport(operations, transferTypes, listener);
}
 
開發者ID:trylimits,項目名稱:Eclipse-Postfix-Code-Completion,代碼行數:5,代碼來源:PackageViewerWrapper.java

示例4: addDragSupport

import org.eclipse.swt.dnd.DragSourceListener; //導入依賴的package包/類
/**
 * Adds support for dragging items out of 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 drag operation
 * @param listener
 *            the callback that will be invoked to set the drag data and to
 *            cleanup after the drag and drop operation finishes
 * @see org.eclipse.swt.dnd.DND
 */
public void addDragSupport(int operations, Transfer[] transferTypes,
		DragSourceListener listener) {

	Control myControl = getControl();
	final DragSource dragSource = new DragSource(myControl, operations);
	dragSource.setTransfer(transferTypes);
	dragSource.addDragListener(listener);
}
 
開發者ID:ghillairet,項目名稱:gef-gwt,代碼行數:24,代碼來源:StructuredViewer.java


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