Java Code Examples for org.eclipse.ui.part.ResourceTransfer#getInstance()

The following examples show how to use org.eclipse.ui.part.ResourceTransfer#getInstance() . 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: CallHierarchyViewPart.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 6 votes vote down vote up
private void addDragAdapters(StructuredViewer viewer) {
	int ops= DND.DROP_COPY | DND.DROP_LINK;

	Transfer[] transfers= new Transfer[] { LocalSelectionTransfer.getInstance(), ResourceTransfer.getInstance(), FileTransfer.getInstance()};

	DelegatingDragAdapter dragAdapter= new DelegatingDragAdapter() {
		@Override
		public void dragStart(DragSourceEvent event) {
			IStructuredSelection selection= (IStructuredSelection) fSelectionProviderMediator.getSelection();
			if (selection.isEmpty()) {
				event.doit= false;
				return;
			}
			super.dragStart(event);
		}
	};
	dragAdapter.addDragSourceListener(new SelectionTransferDragAdapter(fSelectionProviderMediator));
	dragAdapter.addDragSourceListener(new EditorInputTransferDragAdapter(fSelectionProviderMediator));
	dragAdapter.addDragSourceListener(new ResourceTransferDragAdapter(fSelectionProviderMediator));
	dragAdapter.addDragSourceListener(new FileTransferDragAdapter(fSelectionProviderMediator));

	viewer.addDragSupport(ops, transfers, dragAdapter);
}
 
Example 2
Source File: PasteAction.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
protected final IResource[] getClipboardResources(TransferData[] availableDataTypes) {
	Transfer transfer= ResourceTransfer.getInstance();
	if (isAvailable(transfer, availableDataTypes)) {
		return (IResource[])getContents(fClipboard2, transfer, getShell());
	}
	return null;
}
 
Example 3
Source File: JdtViewerDragSupport.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
public void start() {
	Assert.isLegal(!fStarted);

	int ops= DND.DROP_COPY | DND.DROP_MOVE | DND.DROP_LINK;

	Transfer[] transfers= new Transfer[] {
		LocalSelectionTransfer.getInstance(),
		ResourceTransfer.getInstance(),
		FileTransfer.getInstance()};

	fViewer.addDragSupport(ops, transfers, fDragAdapter);

	fStarted= true;
}
 
Example 4
Source File: JavaSearchResultPage.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
private void addDragAdapters(StructuredViewer viewer) {
	Transfer[] transfers= new Transfer[] { LocalSelectionTransfer.getInstance(), ResourceTransfer.getInstance() };
	int ops= DND.DROP_COPY | DND.DROP_LINK;

	JdtViewerDragAdapter dragAdapter= new JdtViewerDragAdapter(viewer);
	dragAdapter.addDragSourceListener(new SelectionTransferDragAdapter(viewer));
	dragAdapter.addDragSourceListener(new EditorInputTransferDragAdapter(viewer));
	dragAdapter.addDragSourceListener(new ResourceTransferDragAdapter(viewer));
	viewer.addDragSupport(ops, transfers, dragAdapter);
}
 
Example 5
Source File: TypeHierarchyViewPart.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
private void addDragAdapters(StructuredViewer viewer) {
	int ops= DND.DROP_COPY | DND.DROP_LINK;
	Transfer[] transfers= new Transfer[] { LocalSelectionTransfer.getInstance(), ResourceTransfer.getInstance(), FileTransfer.getInstance()};

	JdtViewerDragAdapter dragAdapter= new JdtViewerDragAdapter(viewer);
	dragAdapter.addDragSourceListener(new SelectionTransferDragAdapter(viewer));
	dragAdapter.addDragSourceListener(new EditorInputTransferDragAdapter(viewer));
	dragAdapter.addDragSourceListener(new ResourceTransferDragAdapter(viewer));
	dragAdapter.addDragSourceListener(new FileTransferDragAdapter(viewer));

	viewer.addDragSupport(ops, transfers, dragAdapter);
}
 
Example 6
Source File: TypeScriptSearchResultPage.java    From typescript.java with MIT License 4 votes vote down vote up
private void addDragAdapters(StructuredViewer viewer) {
	Transfer[] transfers= new Transfer[] { ResourceTransfer.getInstance() };
	int ops= DND.DROP_COPY | DND.DROP_LINK;
	viewer.addDragSupport(ops, transfers, new NavigatorDragAdapter(viewer));
}
 
Example 7
Source File: ResourceTransferDragAdapter.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 4 votes vote down vote up
public Transfer getTransfer() {
	return ResourceTransfer.getInstance();
}
 
Example 8
Source File: AbstractSearchIndexResultPage.java    From Pydev with Eclipse Public License 1.0 4 votes vote down vote up
private void addDragAdapters(StructuredViewer viewer) {
    Transfer[] transfers = new Transfer[] { ResourceTransfer.getInstance() };
    int ops = DND.DROP_COPY | DND.DROP_LINK;
    viewer.addDragSupport(ops, transfers, new NavigatorDragAdapter(viewer));
}
 
Example 9
Source File: FileSearchPage.java    From Pydev with Eclipse Public License 1.0 4 votes vote down vote up
private void addDragAdapters(StructuredViewer viewer) {
    Transfer[] transfers = new Transfer[] { ResourceTransfer.getInstance() };
    int ops = DND.DROP_COPY | DND.DROP_LINK;
    viewer.addDragSupport(ops, transfers, new NavigatorDragAdapter(viewer));
}