org.eclipse.jface.util.LocalSelectionTransfer Java Examples
The following examples show how to use
org.eclipse.jface.util.LocalSelectionTransfer.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: FilterEditUtils.java From tracecompass with Eclipse Public License 2.0 | 6 votes |
/** * Gets the ITmfFilterTreeNode in LocalSelectionTransfer, if any * @return a ITmfFilterTreeNode or <code>null</code> */ public static ITmfFilterTreeNode getTransferredTreeNode() { ITmfFilterTreeNode treeNodeToDrop = null; ISelection sel = LocalSelectionTransfer.getTransfer().getSelection(); if (sel instanceof IStructuredSelection) { IStructuredSelection selection = (IStructuredSelection) sel; for (Object data : selection.toList()) { if (!(data instanceof ITmfFilterTreeNode)) { return null; } else if (treeNodeToDrop != null) { // should never occur, since tree has SWT.SINGLE style return null; } else { treeNodeToDrop = (ITmfFilterTreeNode) data; } } } return treeNodeToDrop; }
Example #2
Source File: ItemDragSourceListener.java From neoscada with Eclipse Public License 1.0 | 6 votes |
@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; } }
Example #3
Source File: ItemDragSourceListener.java From neoscada with Eclipse Public License 1.0 | 6 votes |
@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; } }
Example #4
Source File: DeploymentEditor.java From neoscada with Eclipse Public License 1.0 | 6 votes |
/** * 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 ) ); }
Example #5
Source File: ItemDragSourceListener.java From neoscada with Eclipse Public License 1.0 | 6 votes |
@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; } }
Example #6
Source File: VisualInterfaceEditor.java From neoscada with Eclipse Public License 1.0 | 6 votes |
/** * 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 ) ); }
Example #7
Source File: DetailViewEditor.java From neoscada with Eclipse Public License 1.0 | 6 votes |
/** * 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 ) ); }
Example #8
Source File: ChartEditor.java From neoscada with Eclipse Public License 1.0 | 6 votes |
/** * 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 ) ); }
Example #9
Source File: ProtocolEditor.java From neoscada with Eclipse Public License 1.0 | 6 votes |
/** * 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 ) ); }
Example #10
Source File: ItemDragSourceListener.java From neoscada with Eclipse Public License 1.0 | 6 votes |
@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; } }
Example #11
Source File: SetupEditor.java From neoscada with Eclipse Public License 1.0 | 6 votes |
/** * 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 ) ); }
Example #12
Source File: ProfileEditor.java From neoscada with Eclipse Public License 1.0 | 6 votes |
/** * 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 ) ); }
Example #13
Source File: OsgiEditor.java From neoscada with Eclipse Public License 1.0 | 6 votes |
/** * 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 ) ); }
Example #14
Source File: MemoryEditor.java From neoscada with Eclipse Public License 1.0 | 6 votes |
/** * 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 ) ); }
Example #15
Source File: AbapGitStagingView.java From ADT_Frontend with MIT License | 6 votes |
private void addDragAndDropSupport(TreeViewer viewer, final boolean unstaged) { viewer.addDragSupport(DND.DROP_MOVE | DND.DROP_COPY | DND.DROP_LINK, new Transfer[] { LocalSelectionTransfer.getTransfer(), LocalSelectionTransfer.getTransfer() }, new StagingDragListener(viewer, ArrayContentProvider.getInstance(), unstaged)); viewer.addDropSupport(DND.DROP_MOVE | DND.DROP_COPY | DND.DROP_LINK, new Transfer[] { LocalSelectionTransfer.getTransfer() }, new DropTargetAdapter() { public void drop(DropTargetEvent event) { event.detail = DND.DROP_COPY; if (event.data instanceof IStructuredSelection) { IStructuredSelection selection = (IStructuredSelection) event.data; if (selection instanceof StagingDragSelection && ((StagingDragSelection) selection).isFromUnstaged() == unstaged) { return; } if (((StagingDragSelection) selection).isFromUnstaged()) { stageSelectedObjects(selection); } else { unstageSelectedObjects(selection); } } } }); }
Example #16
Source File: PydevPackageExplorer.java From Pydev with Eclipse Public License 1.0 | 6 votes |
@Override public CommonDropAdapterAssistant[] findCommonDropAdapterAssistants( Object aDropTarget, TransferData aTransferType) { CommonDropAdapterDescriptor[] descriptors = CommonDropDescriptorManager .getInstance().findCommonDropAdapterAssistants(aDropTarget, pyContentService); if (descriptors.length == 0) { return NO_ASSISTANTS; } if (LocalSelectionTransfer.getTransfer().isSupportedType(aTransferType) && LocalSelectionTransfer.getTransfer().getSelection() instanceof IStructuredSelection) { return pyGetAssistantsBySelection(descriptors, (IStructuredSelection) LocalSelectionTransfer .getTransfer().getSelection()); } return pyGetAssistantsByTransferData(descriptors, aTransferType); }
Example #17
Source File: GenconfEditor.java From M2Doc with Eclipse Public License 1.0 | 6 votes |
/** * 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)); }
Example #18
Source File: ConfigurationEditor.java From neoscada with Eclipse Public License 1.0 | 6 votes |
/** * 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 ) ); }
Example #19
Source File: ItemEditor.java From neoscada with Eclipse Public License 1.0 | 6 votes |
/** * 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 ) ); }
Example #20
Source File: ComponentEditor.java From neoscada with Eclipse Public License 1.0 | 6 votes |
/** * 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 ) ); }
Example #21
Source File: GlobalizeEditor.java From neoscada with Eclipse Public License 1.0 | 6 votes |
/** * 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 ) ); }
Example #22
Source File: SecurityEditor.java From neoscada with Eclipse Public License 1.0 | 6 votes |
/** * 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 ) ); }
Example #23
Source File: InfrastructureEditor.java From neoscada with Eclipse Public License 1.0 | 6 votes |
/** * 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 ) ); }
Example #24
Source File: RecipeEditor.java From neoscada with Eclipse Public License 1.0 | 6 votes |
/** * 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 ) ); }
Example #25
Source File: WorldEditor.java From neoscada with Eclipse Public License 1.0 | 6 votes |
/** * 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 ) ); }
Example #26
Source File: CopyHandler.java From tracecompass with Eclipse Public License 2.0 | 5 votes |
@Override public Object execute(ExecutionEvent event) throws ExecutionException { // Check if we are closing down IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow(); if (window == null) { return null; } IWorkbenchPage page = window.getActivePage(); FilterView part = (FilterView) page.getActivePart(); ISelection selection = getSelection(part); LocalSelectionTransfer.getTransfer().setSelection(selection); LocalSelectionTransfer.getTransfer().setSelectionSetTime(System.currentTimeMillis()); return null; }
Example #27
Source File: ResourceDropAdapterAssistant.java From translationstudio8 with GNU General Public License v2.0 | 5 votes |
/** * Returns the resource selection from the LocalSelectionTransfer. * * @return the resource selection from the LocalSelectionTransfer */ private IResource[] getSelectedResources() { ISelection selection = LocalSelectionTransfer.getTransfer() .getSelection(); if (selection instanceof IStructuredSelection) { return getSelectedResources((IStructuredSelection)selection); } return NO_RESOURCES; }
Example #28
Source File: FilterDropTargetAdapter.java From tracecompass with Eclipse Public License 2.0 | 5 votes |
@Override public void dropAccept(DropTargetEvent event) { ITmfFilterTreeNode treeNodeToDrop = null; if (LocalSelectionTransfer.getTransfer().isSupportedType(event.currentDataType)) { treeNodeToDrop = FilterEditUtils.getTransferredTreeNode(); } if (treeNodeToDrop == null) { // should never occur event.detail = DND.DROP_NONE; return; } if (event.item instanceof TreeItem) { Object data = event.item.getData(); if (data instanceof ITmfFilterTreeNode) { ITmfFilterTreeNode node = (ITmfFilterTreeNode) data; if (node.getValidChildren().contains(treeNodeToDrop.getNodeName())) { if (isAncestor(treeNodeToDrop, node) && event.detail != DND.DROP_COPY) { // do nothing in this case event.detail = DND.DROP_NONE; } return; } } } else { // accept only TmfFilterNode if (!TmfFilterNode.NODE_NAME.equals(treeNodeToDrop.getNodeName())) { event.detail = DND.DROP_NONE; } return; } event.detail = DND.DROP_NONE; return; }
Example #29
Source File: FilterDragSourceAdapter.java From tracecompass with Eclipse Public License 2.0 | 5 votes |
@Override public void dragFinished(DragSourceEvent event) { if (event.detail == DND.DROP_MOVE) { IStructuredSelection selection = (IStructuredSelection) LocalSelectionTransfer.getTransfer().getSelection(); for (Object data : selection.toList()) { if (data instanceof ITmfFilterTreeNode) { ITmfFilterTreeNode e = (ITmfFilterTreeNode) data; e.remove(); fViewer.refresh(); } } } LocalSelectionTransfer.getTransfer().setSelection(null); LocalSelectionTransfer.getTransfer().setSelectionSetTime(0); }
Example #30
Source File: ResourceDropAdapterAssistant.java From tmxeditor8 with GNU General Public License v2.0 | 5 votes |
/** * Returns the resource selection from the LocalSelectionTransfer. * * @return the resource selection from the LocalSelectionTransfer */ private IResource[] getSelectedResources() { ISelection selection = LocalSelectionTransfer.getTransfer() .getSelection(); if (selection instanceof IStructuredSelection) { return getSelectedResources((IStructuredSelection)selection); } return NO_RESOURCES; }