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


Java LocalSelectionTransfer類代碼示例

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


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

示例1: createContextMenuFor

import org.eclipse.jface.util.LocalSelectionTransfer; //導入依賴的package包/類
/**
 * This creates a context menu for the viewer and adds a listener as well registering the menu for extension.
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
protected void createContextMenuFor ( StructuredViewer viewer )
{
    MenuManager contextMenu = new MenuManager ( "#PopUp" ); //$NON-NLS-1$
    contextMenu.add ( new Separator ( "additions" ) ); //$NON-NLS-1$
    contextMenu.setRemoveAllWhenShown ( true );
    contextMenu.addMenuListener ( this );
    Menu menu = contextMenu.createContextMenu ( viewer.getControl () );
    viewer.getControl ().setMenu ( menu );
    getSite ().registerContextMenu ( contextMenu, new UnwrappingSelectionProvider ( viewer ) );

    int dndOperations = DND.DROP_COPY | DND.DROP_MOVE | DND.DROP_LINK;
    Transfer[] transfers = new Transfer[] { LocalTransfer.getInstance (), LocalSelectionTransfer.getTransfer (), FileTransfer.getInstance () };
    viewer.addDragSupport ( dndOperations, transfers, new ViewerDragAdapter ( viewer ) );
    viewer.addDropSupport ( dndOperations, transfers, new EditingDomainViewerDropAdapter ( editingDomain, viewer ) );
}
 
開發者ID:eclipse,項目名稱:neoscada,代碼行數:22,代碼來源:ProtocolEditor.java

示例2: createContextMenuFor

import org.eclipse.jface.util.LocalSelectionTransfer; //導入依賴的package包/類
/**
 * This creates a context menu for the viewer and adds a listener as well
 * registering the menu for extension.
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * 
 * @generated NOT
 */
protected void createContextMenuFor ( final StructuredViewer viewer )
{
    final MenuManager contextMenu = new MenuManager ( "#PopUp" ); //$NON-NLS-1$
    contextMenu.add ( new Separator ( "additions" ) ); //$NON-NLS-1$
    contextMenu.setRemoveAllWhenShown ( true );
    contextMenu.addMenuListener ( this );
    final Menu menu = contextMenu.createContextMenu ( viewer.getControl () );
    viewer.getControl ().setMenu ( menu );
    getSite ().registerContextMenu ( contextMenu, new UnwrappingSelectionProvider ( viewer ) );

    final int dndOperations = DND.DROP_COPY | DND.DROP_MOVE | DND.DROP_LINK;
    final Transfer[] transfers = new Transfer[] {
            LocalTransfer.getInstance (),
            LocalSelectionTransfer.getTransfer (),
            FileTransfer.getInstance (),
            ItemTransfer.getInstance ()
    };
    viewer.addDragSupport ( dndOperations, transfers, new ViewerDragAdapter ( viewer ) );
    viewer.addDropSupport ( dndOperations, transfers, new DropAdapterExtension ( this.editingDomain, viewer ) );
}
 
開發者ID:eclipse,項目名稱:neoscada,代碼行數:29,代碼來源:ChartEditor.java

示例3: dragSetData

import org.eclipse.jface.util.LocalSelectionTransfer; //導入依賴的package包/類
@Override
public void dragSetData ( final DragSourceEvent event )
{
    try
    {
        if ( ItemTransfer.getInstance ().isSupportedType ( event.dataType ) )
        {
            final IStructuredSelection selection = (IStructuredSelection)LocalSelectionTransfer.getTransfer ().getSelection ();
            final Collection<Item> items = ItemSelectionHelper.getSelection ( selection );
            event.data = items.toArray ( new Item[items.size ()] );
            event.doit = true;
        }
    }
    catch ( final Exception e )
    {
        logger.warn ( "Failed to set drag data", e );
        event.doit = false;
    }

}
 
開發者ID:eclipse,項目名稱:neoscada,代碼行數:21,代碼來源:ItemDragSourceListener.java

示例4: dragStart

import org.eclipse.jface.util.LocalSelectionTransfer; //導入依賴的package包/類
@Override
public void dragStart ( final DragSourceEvent event )
{
    event.doit = false;

    if ( ! ( this.viewer.getSelection () instanceof IStructuredSelection ) )
    {
        return;
    }

    final Collection<Item> items = ItemSelectionHelper.getSelection ( this.viewer.getSelection () );
    if ( !items.isEmpty () )
    {
        LocalSelectionTransfer.getTransfer ().setSelection ( this.viewer.getSelection () );
        event.doit = true;
    }

}
 
開發者ID:eclipse,項目名稱:neoscada,代碼行數:19,代碼來源:ItemDragSourceListener.java

示例5: createContextMenuFor

import org.eclipse.jface.util.LocalSelectionTransfer; //導入依賴的package包/類
/**
 * This creates a context menu for the viewer and adds a listener as well registering the menu for extension.
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
protected void createContextMenuFor ( StructuredViewer viewer )
{
    MenuManager contextMenu = new MenuManager ( "#PopUp" );
    contextMenu.add ( new Separator ( "additions" ) );
    contextMenu.setRemoveAllWhenShown ( true );
    contextMenu.addMenuListener ( this );
    Menu menu = contextMenu.createContextMenu ( viewer.getControl () );
    viewer.getControl ().setMenu ( menu );
    getSite ().registerContextMenu ( contextMenu, new UnwrappingSelectionProvider ( viewer ) );

    int dndOperations = DND.DROP_COPY | DND.DROP_MOVE | DND.DROP_LINK;
    Transfer[] transfers = new Transfer[] { LocalTransfer.getInstance (), LocalSelectionTransfer.getTransfer (), FileTransfer.getInstance () };
    viewer.addDragSupport ( dndOperations, transfers, new ViewerDragAdapter ( viewer ) );
    viewer.addDropSupport ( dndOperations, transfers, new EditingDomainViewerDropAdapter ( editingDomain, viewer ) );
}
 
開發者ID:eclipse,項目名稱:neoscada,代碼行數:22,代碼來源:MemoryEditor.java

示例6: createContextMenuFor

import org.eclipse.jface.util.LocalSelectionTransfer; //導入依賴的package包/類
/**
 * This creates a context menu for the viewer and adds a listener as well
 * registering the menu for extension.
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 *
 * @generated NOT
 */
protected void createContextMenuFor ( final StructuredViewer viewer )
{
    final MenuManager contextMenu = new MenuManager ( "#PopUp" ); //$NON-NLS-1$
    contextMenu.add ( new Separator ( "additions" ) ); //$NON-NLS-1$
    contextMenu.setRemoveAllWhenShown ( true );
    contextMenu.addMenuListener ( this );
    final Menu menu = contextMenu.createContextMenu ( viewer.getControl () );
    viewer.getControl ().setMenu ( menu );
    getSite ().registerContextMenu ( contextMenu, new UnwrappingSelectionProvider ( viewer ) );

    final int dndOperations = DND.DROP_COPY | DND.DROP_MOVE | DND.DROP_LINK;
    final Transfer[] transfers = new Transfer[] { LocalTransfer.getInstance (), LocalSelectionTransfer.getTransfer (), FileTransfer.getInstance (), ItemTransfer.getInstance () };
    viewer.addDragSupport ( dndOperations, transfers, new ViewerDragAdapter ( viewer ) );
    viewer.addDropSupport ( dndOperations, transfers, new DropAdapterExtension ( this.editingDomain, viewer ) );
}
 
開發者ID:eclipse,項目名稱:neoscada,代碼行數:24,代碼來源:ComponentEditor.java

示例7: drop

import org.eclipse.jface.util.LocalSelectionTransfer; //導入依賴的package包/類
@Override
public void drop(DropTargetEvent event) {
	
	IStructuredSelection structuredSelection = (IStructuredSelection) LocalSelectionTransfer
               .getTransfer().getSelection();
	
	if (structuredSelection.size() == 1) {

		AvroNode sourceNode = (AvroNode) structuredSelection.getFirstElement();
		TreeItem item = (TreeItem) event.item;
		if (item != null) {
			AvroNode targetNode = nodeConverter.convertToAvroNode(item.getData());
			dropPolicy.drop(sourceNode, targetNode, position);
		}
		
	}
	
}
 
開發者ID:Talend,項目名稱:avro-schema-editor,代碼行數:19,代碼來源:DnDTargetListener.java

示例8: configureDragAndDrop

import org.eclipse.jface.util.LocalSelectionTransfer; //導入依賴的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

示例9: createContextMenuFor

import org.eclipse.jface.util.LocalSelectionTransfer; //導入依賴的package包/類
/**
 * This creates a context menu for the viewer and adds a listener as well registering the menu for extension.
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * 
 * @generated
 */
protected void createContextMenuFor(StructuredViewer viewer) {
    MenuManager contextMenu = new MenuManager("#PopUp");
    contextMenu.add(new Separator("additions"));
    contextMenu.setRemoveAllWhenShown(true);
    contextMenu.addMenuListener(this);
    Menu menu = contextMenu.createContextMenu(viewer.getControl());
    viewer.getControl().setMenu(menu);
    getSite().registerContextMenu(contextMenu, new UnwrappingSelectionProvider(viewer));

    int dndOperations = DND.DROP_COPY | DND.DROP_MOVE | DND.DROP_LINK;
    Transfer[] transfers = new Transfer[] {LocalTransfer.getInstance(), LocalSelectionTransfer.getTransfer(),
        FileTransfer.getInstance()};
    viewer.addDragSupport(dndOperations, transfers, new ViewerDragAdapter(viewer));
    viewer.addDropSupport(dndOperations, transfers, new EditingDomainViewerDropAdapter(editingDomain, viewer));
}
 
開發者ID:ObeoNetwork,項目名稱:M2Doc,代碼行數:23,代碼來源:GenconfEditor.java

示例10: initDragAndDrop

import org.eclipse.jface.util.LocalSelectionTransfer; //導入依賴的package包/類
void initDragAndDrop() {
		int operations = DND.DROP_MOVE;
		Transfer[] transferTypes = new Transfer[]{ LocalSelectionTransfer.getTransfer() };
		
		treeViewer.addDragSupport(operations, transferTypes, new DragSourceAdapter() {			
			@Override public void dragStart(DragSourceEvent event) {
				LocalSelectionTransfer.getTransfer().setSelection(treeViewer.getSelection()); // not really needed since we can get selection from member variable
			}
//			@Override public void dragSetData(DragSourceEvent event) {
//			}
//			@Override public void dragFinished(DragSourceEvent event) {
//			}
		});
		
		treeViewer.addDropSupport(operations, transferTypes, new StructureTreeDropAdapter(treeViewer));
	}
 
開發者ID:Transkribus,項目名稱:TranskribusSwtGui,代碼行數:17,代碼來源:StructureTreeWidget.java

示例11: getStructuredSelection

import org.eclipse.jface.util.LocalSelectionTransfer; //導入依賴的package包/類
private IStructuredSelection getStructuredSelection(Object data, TransferData currentDataType) {
	if (LocalSelectionTransfer.getTransfer().isSupportedType(currentDataType)) {
		return (IStructuredSelection) data;
	}
	if (URLTransfer.getInstance().isSupportedType(currentDataType)) {
		try {
			return new StructuredSelection(new URL((String) data));
		} catch (MalformedURLException e) {
			// ignore
		}
	}
	if (FileTransfer.getInstance().isSupportedType(currentDataType)) {
		return new StructuredSelection(Arrays.stream((String[]) data).map(Path::new).collect(Collectors.toList()));
	}
	return new StructuredSelection();
}
 
開發者ID:cchabanois,項目名稱:mesfavoris,代碼行數:17,代碼來源:BookmarksViewerDropListener.java

示例12: getDropItems

import org.eclipse.jface.util.LocalSelectionTransfer; //導入依賴的package包/類
/**
 * get the outline items being dropped, or null if there are none or if the event does not
 * qualify for a drop.
 */
@SuppressWarnings("unchecked")
private List<PagePart> getDropItems(DropTargetEvent event) {
	if (event.operations == DND.DROP_NONE || event.item == null) {
		return null;
	}
	Object targetData = event.item.getData();
	if (!(targetData instanceof PagePart)) {
		return null;
	}

	ISelection selection = LocalSelectionTransfer.getTransfer().getSelection();
	if (selection instanceof IStructuredSelection && !selection.isEmpty()) {
		IStructuredSelection structuredSelection = (IStructuredSelection) selection;
		List<?> list = structuredSelection.toList();
		if (!list.isEmpty()) {
			for (Object i : list) {
				if (!(i instanceof PagePart)) return null;
			}
			return (List<PagePart>) list;
		}
	}
	return null;
}
 
開發者ID:grosenberg,項目名稱:fluentmark,代碼行數:28,代碼來源:OutlineDropTargetListener.java

示例13: validateDrop

import org.eclipse.jface.util.LocalSelectionTransfer; //導入依賴的package包/類
@Override
	public boolean validateDrop(Object target, int operation, TransferData type) {
		overrideOperation(DND.DROP_COPY);
//		if (application == null)
//			return false;

		if (operation == DND.DROP_COPY || operation == DND.DROP_DEFAULT) {
			if (LocalSelectionTransfer.getTransfer().isSupportedType(type)) {
				IStructuredSelection selection = (IStructuredSelection) LocalSelectionTransfer.getTransfer()
						.getSelection();
				Object[] objects = selection.toArray();
				for (Object obj : objects) {
					if (obj instanceof CFServiceInstance) {
						return true;
					}
				}
			}
		}
		return false;
	}
 
開發者ID:eclipse,項目名稱:cft,代碼行數:21,代碼來源:ServicesViewerDropListener.java

示例14: createContextMenuFor

import org.eclipse.jface.util.LocalSelectionTransfer; //導入依賴的package包/類
/**
 * This creates a context menu for the viewer and adds a listener as well registering the menu for extension.
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
protected void createContextMenuFor(StructuredViewer viewer)
{
	MenuManager contextMenu = new MenuManager("#PopUp");
	contextMenu.add(new Separator("additions"));
	contextMenu.setRemoveAllWhenShown(true);
	contextMenu.addMenuListener(this);
	Menu menu= contextMenu.createContextMenu(viewer.getControl());
	viewer.getControl().setMenu(menu);
	getSite().registerContextMenu(contextMenu, new UnwrappingSelectionProvider(viewer));

	int dndOperations = DND.DROP_COPY | DND.DROP_MOVE | DND.DROP_LINK;
	Transfer[] transfers = new Transfer[] { LocalTransfer.getInstance(), LocalSelectionTransfer.getTransfer(), FileTransfer.getInstance() };
	viewer.addDragSupport(dndOperations, transfers, new ViewerDragAdapter(viewer));
	viewer.addDropSupport(dndOperations, transfers, new EditingDomainViewerDropAdapter(editingDomain, viewer));
}
 
開發者ID:cplutte,項目名稱:bts,代碼行數:22,代碼來源:BtsmodelEditor.java

示例15: validateDrop

import org.eclipse.jface.util.LocalSelectionTransfer; //導入依賴的package包/類
@Override
	public boolean validateDrop(Object target, int operation, TransferData type) {
		overrideOperation(DND.DROP_COPY);
//		if (application == null)
//			return false;

		if (operation == DND.DROP_COPY || operation == DND.DROP_DEFAULT) {
			if (LocalSelectionTransfer.getTransfer().isSupportedType(type)) {
				IStructuredSelection selection = (IStructuredSelection) LocalSelectionTransfer.getTransfer()
						.getSelection();
				Object[] objects = selection.toArray();
				for (Object obj : objects) {
					if (obj instanceof CloudService) {
						return true;
					}
				}
			}
		}
		return false;
	}
 
開發者ID:osswangxining,項目名稱:dockerfoundry,代碼行數:21,代碼來源:ServicesViewerDropListener.java


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