1 11 package org.eclipse.ui.navigator; 12 13 import org.eclipse.core.runtime.IStatus; 14 import org.eclipse.core.runtime.Status; 15 import org.eclipse.jface.util.LocalSelectionTransfer; 16 import org.eclipse.jface.viewers.IStructuredSelection; 17 import org.eclipse.swt.dnd.DropTargetEvent; 18 import org.eclipse.swt.dnd.TransferData; 19 import org.eclipse.swt.widgets.Shell; 20 import org.eclipse.ui.internal.navigator.NavigatorContentService; 21 22 85 public abstract class CommonDropAdapterAssistant { 86 87 private INavigatorContentService contentService; 88 89 98 public final void init(INavigatorContentService aContentService) { 99 contentService = aContentService; 100 doInit(); 101 } 102 103 106 protected void doInit() { 107 108 } 109 110 128 public abstract IStatus validateDrop(Object target, int operation, 129 TransferData transferType); 130 131 143 public abstract IStatus handleDrop(CommonDropAdapter aDropAdapter, 144 DropTargetEvent aDropTargetEvent, Object aTarget); 145 146 159 public boolean isSupportedType(TransferData aTransferType) { 160 return LocalSelectionTransfer.getTransfer().isSupportedType( 161 aTransferType); 162 } 163 164 179 public IStatus validatePluginTransferDrop( 180 IStructuredSelection aDragSelection, Object aDropTarget) { 181 return Status.CANCEL_STATUS; 182 } 183 184 197 public IStatus handlePluginTransferDrop( 198 IStructuredSelection aDragSelection, Object aDropTarget) { 199 return Status.CANCEL_STATUS; 200 } 201 202 206 protected INavigatorContentService getContentService() { 207 return contentService; 208 } 209 210 215 protected final Shell getShell() { 216 return ((NavigatorContentService) contentService).getShell(); 217 } 218 219 } 220 | Popular Tags |