当前位置: 首页>>代码示例>>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;未经允许,请勿转载。