1 11 package org.eclipse.swt.dnd; 12 13 14 import org.eclipse.swt.*; 15 16 22 public class DND { 23 24 32 public final static int CLIPBOARD = 1 << 0; 33 34 42 public final static int SELECTION_CLIPBOARD = 1 << 1; 43 44 48 public final static int DROP_NONE = 0; 49 50 54 public final static int DROP_COPY = 1 << 0; 55 56 60 public final static int DROP_MOVE = 1 << 1; 61 62 66 public final static int DROP_LINK = 1 << 2; 67 68 77 public final static int DROP_TARGET_MOVE = 1 << 3; 78 79 89 public final static int DROP_DEFAULT = 1 << 4; 90 91 95 public static final int DragEnd = 2000; 96 97 100 public static final int DragSetData = 2001; 101 102 105 public static final int DragEnter = 2002; 106 107 112 public static final int DragLeave = 2003; 113 114 117 public static final int DragOver = 2004; 118 119 123 public static final int DragOperationChanged = 2005; 124 125 128 public static final int Drop = 2006; 129 130 133 public static final int DropAccept = 2007; 134 135 138 public static final int DragStart = 2008; 139 140 143 public static final int FEEDBACK_NONE = 0; 144 145 149 public static final int FEEDBACK_SELECT = 1; 150 151 155 public static final int FEEDBACK_INSERT_BEFORE = 2; 156 157 161 public static final int FEEDBACK_INSERT_AFTER = 4; 162 163 167 public static final int FEEDBACK_SCROLL = 8; 168 169 173 public static final int FEEDBACK_EXPAND = 16; 174 175 178 public static final int ERROR_CANNOT_INIT_DRAG = 2000; 179 180 183 public static final int ERROR_CANNOT_INIT_DROP = 2001; 184 185 188 public static final int ERROR_CANNOT_SET_CLIPBOARD = 2002; 189 190 194 public static final int ERROR_INVALID_DATA = 2003; 195 196 197 static final String INIT_DRAG_MESSAGE = "Cannot initialize Drag"; static final String INIT_DROP_MESSAGE = "Cannot initialize Drop"; static final String CANNOT_SET_CLIPBOARD_MESSAGE = "Cannot set data in clipboard"; static final String INVALID_DATA_MESSAGE = "Data does not have correct format for type"; 202 207 public static void error (int code) { 208 error (code, 0); 209 } 210 211 236 public static void error (int code, int hresult) { 237 switch (code) { 238 239 case DND.ERROR_CANNOT_INIT_DRAG:{ 240 String msg = DND.INIT_DRAG_MESSAGE; 241 if (hresult != 0) msg += " result = "+hresult; throw new SWTError (code, msg); 243 } 244 case DND.ERROR_CANNOT_INIT_DROP:{ 245 String msg = DND.INIT_DROP_MESSAGE; 246 if (hresult != 0) msg += " result = "+hresult; throw new SWTError (code, msg); 248 } 249 case DND.ERROR_CANNOT_SET_CLIPBOARD:{ 250 String msg = DND.CANNOT_SET_CLIPBOARD_MESSAGE; 251 if (hresult != 0) msg += " result = "+hresult; throw new SWTError (code, msg); 253 } 254 case DND.ERROR_INVALID_DATA:{ 255 String msg = DND.INVALID_DATA_MESSAGE; 256 if (hresult != 0) msg += " result = "+hresult; throw new SWTException (code, msg); 258 } 259 } 260 261 262 SWT.error(code); 263 } 264 265 } 266 | Popular Tags |