X-Git-Url: http://git.phpeclipse.com diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/dnd/LocalSelectionTransfer.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/dnd/LocalSelectionTransfer.java index 408c2f5..6a870fd 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/dnd/LocalSelectionTransfer.java +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/dnd/LocalSelectionTransfer.java @@ -18,82 +18,87 @@ import org.eclipse.jface.viewers.ISelection; import org.eclipse.swt.dnd.ByteArrayTransfer; import org.eclipse.swt.dnd.TransferData; - public class LocalSelectionTransfer extends ByteArrayTransfer { // First attempt to create a UUID for the type name to make sure that // different Eclipse applications use different "types" of // LocalSelectionTransfer - private static final String TYPE_NAME= "local-selection-transfer-format" + (new Long(System.currentTimeMillis())).toString(); //$NON-NLS-1$; - private static final int TYPEID= registerType(TYPE_NAME); - - private static final LocalSelectionTransfer INSTANCE= new LocalSelectionTransfer(); - + private static final String TYPE_NAME = "local-selection-transfer-format" + (new Long(System.currentTimeMillis())).toString(); //$NON-NLS-1$; + + private static final int TYPEID = registerType(TYPE_NAME); + + private static final LocalSelectionTransfer INSTANCE = new LocalSelectionTransfer(); + private ISelection fSelection; + private int fSelectionSetTime; - + private LocalSelectionTransfer() { } - + /** * Returns the singleton. */ public static LocalSelectionTransfer getInstance() { return INSTANCE; } - + /** * Sets the transfer data for local use. - */ + */ public void setSelection(ISelection s) { - fSelection= s; + fSelection = s; } - + /** * Returns the local transfer data. */ public ISelection getSelection() { return fSelection; } - + public void javaToNative(Object object, TransferData transferData) { - // No encoding needed since this is a hardcoded string read and written in the same process. + // No encoding needed since this is a hardcoded string read and written + // in the same process. // See nativeToJava below - byte[] check= TYPE_NAME.getBytes(); + byte[] check = TYPE_NAME.getBytes(); super.javaToNative(check, transferData); } public Object nativeToJava(TransferData transferData) { - Object result= super.nativeToJava(transferData); + Object result = super.nativeToJava(transferData); if (isInvalidNativeType(result)) { - PHPeclipsePlugin.log(IStatus.ERROR, PHPUIMessages.getString("LocalSelectionTransfer.errorMessage")); //$NON-NLS-1$ + PHPeclipsePlugin.log(IStatus.ERROR, PHPUIMessages + .getString("LocalSelectionTransfer.errorMessage")); //$NON-NLS-1$ } return fSelection; } private boolean isInvalidNativeType(Object result) { - // No encoding needed since this is a hardcoded string read and written in the same process. + // No encoding needed since this is a hardcoded string read and written + // in the same process. // See javaToNative above - return !(result instanceof byte[]) || !TYPE_NAME.equals(new String((byte[])result)); + return !(result instanceof byte[]) + || !TYPE_NAME.equals(new String((byte[]) result)); } - + /** * The type id used to identify this transfer. */ protected int[] getTypeIds() { - return new int[] {TYPEID}; + return new int[] { TYPEID }; } - - protected String[] getTypeNames(){ - return new String[] {TYPE_NAME}; - } - + + protected String[] getTypeNames() { + return new String[] { TYPE_NAME }; + } + public int getSelectionSetTime() { return fSelectionSetTime; } public void setSelectionSetTime(int time) { - fSelectionSetTime= time; + fSelectionSetTime = time; } }