@Override public void dragSetData(DragSourceEvent event) { // For consistency set the data to the selection even though // the selection is provided by the LocalSelectionTransfer // to the drop target adapter. event.data = LocalSelectionTransfer.getTransfer().getSelection(); }
public void dragFinished(DragSourceEvent event) { if (DEBUG) { System.out.println("CommonDragAdapter.dragFinished()."); //$NON-NLS-1$ } LocalSelectionTransfer.getTransfer().setSelection(null); // TODO Handle clean up if drop target was outside of workbench // if (event.doit != false) { // // } }
public CommonDropAdapterAssistant[] findCommonDropAdapterAssistants( Object aDropTarget, TransferData aTransferType) { // TODO Make sure descriptors are sorted by priority CommonDropAdapterDescriptor[] descriptors = CommonDropDescriptorManager .getInstance().findCommonDropAdapterAssistants(aDropTarget, contentService); if (descriptors.length == 0) { return NO_ASSISTANTS; } if (LocalSelectionTransfer.getTransfer().isSupportedType(aTransferType) && LocalSelectionTransfer.getTransfer().getSelection() instanceof IStructuredSelection) { return getAssistantsBySelection(descriptors, (IStructuredSelection) LocalSelectionTransfer.getTransfer().getSelection()); } return getAssistantsByTransferData(descriptors, aTransferType); }
public void dragFinished(DragSourceEvent event) { if (LocalSelectionTransfer.getTransfer().isSupportedType( event.dataType)) LocalSelectionTransfer.getTransfer().setSelection(null); }
@Override public void dragFinished(DragSourceEvent event) { LocalSelectionTransfer.getTransfer().setSelection(null); LocalSelectionTransfer.getTransfer().setSelectionSetTime(0); } }
/** * Clients may extend the supported transfer types beyond the default * {@link LocalSelectionTransfer#getTransfer()} and * {@link org.eclipse.ui.part.PluginTransfer#getInstance()} transfer types. When a transfer type * other than one of these is encountered, the DND Service will query the * <b>visible</b> and <b>active</b> descriptors that are <b>enabled</b> * for the drop target of the current operation. * * @param aTransferType * The transfer data from the drop operation * @return True if the given TransferData can be understood by this * assistant. */ public boolean isSupportedType(TransferData aTransferType) { return LocalSelectionTransfer.getTransfer().isSupportedType( aTransferType); }
@Override public void breakpointsRemoved(IBreakpoint[] breakpoints, IMarkerDelta[] deltas) { // remove deleted breakpoints from drag/drop clipboard if (fStamp == LocalSelectionTransfer.getTransfer().getSelectionSetTime()) { ISelection selection = LocalSelectionTransfer.getTransfer().getSelection(); if (selection instanceof IStructuredSelection) { Set<IBreakpoint> removed = new HashSet<>(); for (int i = 0; i < breakpoints.length; i++) { removed.add(breakpoints[i]); } boolean modified = false; List<Object> remain = new ArrayList<>(); IStructuredSelection ss = (IStructuredSelection) selection; Iterator<?> iterator = ss.iterator(); while (iterator.hasNext()) { Object bp = iterator.next(); if (removed.contains(bp)) { modified = true; } else { remain.add(bp); } } if (modified) { LocalSelectionTransfer.getTransfer().setSelection(new StructuredSelection(remain)); fStamp = System.currentTimeMillis(); LocalSelectionTransfer.getTransfer().setSelectionSetTime(fStamp); } } } }
public Transfer getTransfer() { return LocalSelectionTransfer.getTransfer(); }
@Override public ISelection getSelection() { return jfaceTransfer.getSelection(); }
@Override public void setSelection(ISelection s) { jfaceTransfer.setSelection(s); }
/** * Overrides org.eclipse.swt.dnd.ByteArrayTransfer#nativeToJava(TransferData). * Test if the native drop data matches this transfer type. * * @see org.eclipse.swt.dnd.ByteArrayTransfer#nativeToJava(TransferData) */ @Override public Object nativeToJava(TransferData transferData) { Object result = super.nativeToJava(transferData); if (result != null && isInvalidNativeType(result)) { Policy.getLog().log(new Status( IStatus.ERROR, Policy.JFACE, IStatus.ERROR, JFaceResources.getString("LocalSelectionTransfer.errorMessage"), null)); //$NON-NLS-1$ } return selection; }
@Override public long getSelectionSetTime() { return jfaceTransfer.getSelectionSetTime(); }
public void dragFinished(final DragSourceEvent event, final IStructuredSelection selection) { if (LocalSelectionTransfer.getTransfer() .isSupportedType(event.dataType)) LocalSelectionTransfer.getTransfer().setSelection(selection); } }
@Override public void dragStart(DragSourceEvent event) { ISelection selection = fViewer.getSelection(); LocalSelectionTransfer.getTransfer().setSelection(selection); LocalSelectionTransfer.getTransfer().setSelectionSetTime(event.time & 0xFFFFFFFFL); event.doit = !selection.isEmpty(); }
public void dragLeave(DropTargetEvent event) { super.dragLeave(event); if (LocalSelectionTransfer.getTransfer().isSupportedType( event.currentDataType)) { event.data = NavigatorPluginDropAction .createTransferData(contentService); } }
public Transfer getTransfer() { return LocalSelectionTransfer.getTransfer(); }
/** * Overrides org.eclipse.swt.dnd.ByteArrayTransfer#nativeToJava(TransferData). * Test if the native drop data matches this transfer type. * * @see org.eclipse.swt.dnd.ByteArrayTransfer#nativeToJava(TransferData) */ public Object nativeToJava(TransferData transferData) { Object result = super.nativeToJava(transferData); if (isInvalidNativeType(result)) { Policy.getLog().log(new Status( IStatus.ERROR, Policy.JFACE, IStatus.ERROR, JFaceResources.getString("LocalSelectionTransfer.errorMessage"), null)); //$NON-NLS-1$ } return selection; }
@Override public void dragSetData(DragSourceEvent event) { // For consistency set the data to the selection even though // the selection is provided by the LocalSelectionTransfer // to the drop target adapter. event.data = LocalSelectionTransfer.getTransfer().getSelection(); }
public void dragFinished(DragSourceEvent event) { LocalSelectionTransfer.getTransfer().setSelection(null); }
/** * Set the drag data to represent the local selection of IU's if possible. * Fallback to using a text description of each IU. */ public void dragSetData(DragSourceEvent event) { IInstallableUnit[] ius = getSelectedIUs(); if (ius == null || ius.length == 0) { return; } // use local selection transfer if possible if (LocalSelectionTransfer.getTransfer().isSupportedType(event.dataType)) { event.data = LocalSelectionTransfer.getTransfer().getSelection(); return; } // resort to a text transfer if (!TextTransfer.getInstance().isSupportedType(event.dataType)) { return; } // Get a text description of each IU and set as the drag data final StringBuffer buffer = new StringBuffer(); for (int i = 0; i < ius.length; i++) { buffer.append(ius[i].toString()); buffer.append('\n'); } event.data = buffer.toString(); }