diff options
author | Carolyn MacLeod <carolyn> | 2008-06-04 21:41:36 +0000 |
---|---|---|
committer | Carolyn MacLeod <carolyn> | 2008-06-04 21:41:36 +0000 |
commit | cbaebd8f0308e9c01a70019c73135ef68cbb4fa3 (patch) | |
tree | 52f050de9394f7848b45566e05d3edefca1c2f2a /bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/carbon/org/eclipse | |
parent | baa14de6b11bda5a907857000bf9a3954ac0ae55 (diff) | |
download | eclipse.platform.swt-cbaebd8f0308e9c01a70019c73135ef68cbb4fa3.tar.gz eclipse.platform.swt-cbaebd8f0308e9c01a70019c73135ef68cbb4fa3.tar.xz eclipse.platform.swt-cbaebd8f0308e9c01a70019c73135ef68cbb4fa3.zip |
After Javadoc Bash for 3.4RC4AFTER_JAVADOC_BASH_FOR_34RC4
Diffstat (limited to 'bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/carbon/org/eclipse')
7 files changed, 77 insertions, 86 deletions
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/carbon/org/eclipse/swt/dnd/ByteArrayTransfer.java b/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/carbon/org/eclipse/swt/dnd/ByteArrayTransfer.java index bb4585bc4c..d47fc52a73 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/carbon/org/eclipse/swt/dnd/ByteArrayTransfer.java +++ b/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/carbon/org/eclipse/swt/dnd/ByteArrayTransfer.java @@ -14,8 +14,7 @@ package org.eclipse.swt.dnd; /** * The class <code>ByteArrayTransfer</code> provides a platform specific * mechanism for converting a java <code>byte[]</code> to a platform - * specific representation of the byte array and vice versa. See - * <code>Transfer</code> for additional information. + * specific representation of the byte array and vice versa. * * <p><code>ByteArrayTransfer</code> is never used directly but is sub-classed * by transfer agents that convert between data in a java format such as a @@ -115,7 +114,7 @@ package org.eclipse.swt.dnd; * } * </code></pre> * - * @see <a href="http://www.eclipse.org/swt/">Sample code and further information</a> + * @see Transfer */ public abstract class ByteArrayTransfer extends Transfer { @@ -140,14 +139,13 @@ public boolean isSupportedType(TransferData transferData){ /** * This implementation of <code>javaToNative</code> converts a java - * <code>byte[]</code> to a platform specific representation. For additional - * information see <code>Transfer#javaToNative</code>. - * - * @see Transfer#javaToNative + * <code>byte[]</code> to a platform specific representation. * * @param object a java <code>byte[]</code> containing the data to be converted - * @param transferData an empty <code>TransferData</code> object; this - * object will be filled in on return with the platform specific format of the data + * @param transferData an empty <code>TransferData</code> object that will + * be filled in on return with the platform specific format of the data + * + * @see Transfer#nativeToJava */ protected void javaToNative (Object object, TransferData transferData) { if (!checkByteArray(object) && !isSupportedType(transferData)) { @@ -164,14 +162,12 @@ protected void javaToNative (Object object, TransferData transferData) { /** * This implementation of <code>nativeToJava</code> converts a platform specific * representation of a byte array to a java <code>byte[]</code>. - * For additional information see <code>Transfer#nativeToJava</code>. * - * @see Transfer#nativeToJava + * @param transferData the platform specific representation of the data to be converted + * @return a java <code>byte[]</code> containing the converted data if the conversion was + * successful; otherwise null * - * @param transferData the platform specific representation of the data to be - * been converted - * @return a java <code>byte[]</code> containing the converted data if the - * conversion was successful; otherwise null + * @see Transfer#javaToNative */ protected Object nativeToJava(TransferData transferData) { if (!isSupportedType(transferData) || transferData.data == null) return null; diff --git a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/carbon/org/eclipse/swt/dnd/FileTransfer.java b/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/carbon/org/eclipse/swt/dnd/FileTransfer.java index ba7123a7b8..79aa5c6146 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/carbon/org/eclipse/swt/dnd/FileTransfer.java +++ b/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/carbon/org/eclipse/swt/dnd/FileTransfer.java @@ -20,7 +20,6 @@ import org.eclipse.swt.internal.carbon.*; * platform specific representation of the data and vice versa. * Each <code>String</code> in the array contains the absolute path for a single * file or directory. - * See <code>Transfer</code> for additional information. * * <p>An example of a java <code>String[]</code> containing a list of files is shown * below:</p> @@ -33,7 +32,7 @@ import org.eclipse.swt.internal.carbon.*; * fileData[1] = file2.getAbsolutePath(); * </code></pre> * - * @see <a href="http://www.eclipse.org/swt/">Sample code and further information</a> + * @see Transfer */ public class FileTransfer extends ByteArrayTransfer { @@ -58,13 +57,13 @@ public static FileTransfer getInstance () { * This implementation of <code>javaToNative</code> converts a list of file names * represented by a java <code>String[]</code> to a platform specific representation. * Each <code>String</code> in the array contains the absolute path for a single - * file or directory. For additional information see - * <code>Transfer#javaToNative</code>. + * file or directory. + * + * @param object a java <code>String[]</code> containing the file names to be converted + * @param transferData an empty <code>TransferData</code> object that will + * be filled in on return with the platform specific format of the data * - * @param object a java <code>String[]</code> containing the file names to be - * converted - * @param transferData an empty <code>TransferData</code> object; this - * object will be filled in on return with the platform specific format of the data + * @see Transfer#nativeToJava */ public void javaToNative(Object object, TransferData transferData) { if (!checkFile(object) || !isSupportedType(transferData)) { @@ -126,12 +125,12 @@ public void javaToNative(Object object, TransferData transferData) { * This implementation of <code>nativeToJava</code> converts a platform specific * representation of a list of file names to a java <code>String[]</code>. * Each String in the array contains the absolute path for a single file or directory. - * For additional information see <code>Transfer#nativeToJava</code>. * - * @param transferData the platform specific representation of the data to be - * been converted - * @return a java <code>String[]</code> containing a list of file names if the - * conversion was successful; otherwise null + * @param transferData the platform specific representation of the data to be converted + * @return a java <code>String[]</code> containing a list of file names if the conversion + * was successful; otherwise null + * + * @see Transfer#javaToNative */ public Object nativeToJava(TransferData transferData) { if (!isSupportedType(transferData) || transferData.data == null) return null; diff --git a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/carbon/org/eclipse/swt/dnd/HTMLTransfer.java b/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/carbon/org/eclipse/swt/dnd/HTMLTransfer.java index 142ea24c08..638a39e287 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/carbon/org/eclipse/swt/dnd/HTMLTransfer.java +++ b/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/carbon/org/eclipse/swt/dnd/HTMLTransfer.java @@ -15,8 +15,7 @@ import org.eclipse.swt.internal.carbon.OS; /** * The class <code>HTMLTransfer</code> provides a platform specific mechanism * for converting text in HTML format represented as a java <code>String</code> - * to a platform specific representation of the data and vice versa. See - * <code>Transfer</code> for additional information. + * to a platform specific representation of the data and vice versa. * * <p>An example of a java <code>String</code> containing HTML text is shown * below:</p> @@ -25,7 +24,7 @@ import org.eclipse.swt.internal.carbon.OS; * String htmlData = "<p>This is a paragraph of text.</p>"; * </code></pre> * - * @see <a href="http://www.eclipse.org/swt/">Sample code and further information</a> + * @see Transfer */ public class HTMLTransfer extends ByteArrayTransfer { @@ -47,11 +46,12 @@ public static HTMLTransfer getInstance () { /** * This implementation of <code>javaToNative</code> converts HTML-formatted text * represented by a java <code>String</code> to a platform specific representation. - * For additional information see <code>Transfer#javaToNative</code>. * * @param object a java <code>String</code> containing HTML text - * @param transferData an empty <code>TransferData</code> object; this - * object will be filled in on return with the platform specific format of the data + * @param transferData an empty <code>TransferData</code> object that will + * be filled in on return with the platform specific format of the data + * + * @see Transfer#nativeToJava */ public void javaToNative (Object object, TransferData transferData){ if (!checkHTML(object) || !isSupportedType(transferData)) { @@ -71,12 +71,12 @@ public void javaToNative (Object object, TransferData transferData){ /** * This implementation of <code>nativeToJava</code> converts a platform specific * representation of HTML text to a java <code>String</code>. - * For additional information see <code>Transfer#nativeToJava</code>. * - * @param transferData the platform specific representation of the data to be - * been converted - * @return a java <code>String</code> containing HTML text if the - * conversion was successful; otherwise null + * @param transferData the platform specific representation of the data to be converted + * @return a java <code>String</code> containing HTML text if the conversion was successful; + * otherwise null + * + * @see Transfer#javaToNative */ public Object nativeToJava(TransferData transferData){ if (!isSupportedType(transferData) || transferData.data == null) return null; diff --git a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/carbon/org/eclipse/swt/dnd/ImageTransfer.java b/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/carbon/org/eclipse/swt/dnd/ImageTransfer.java index 51155adce7..467bfc1b9c 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/carbon/org/eclipse/swt/dnd/ImageTransfer.java +++ b/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/carbon/org/eclipse/swt/dnd/ImageTransfer.java @@ -18,19 +18,17 @@ import org.eclipse.swt.widgets.*; /** * The class <code>ImageTransfer</code> provides a platform specific mechanism - * for converting a Image represented as a java <code>ImageData</code> to a + * for converting an Image represented as a java <code>ImageData</code> to a * platform specific representation of the data and vice versa. - * See <code>Transfer</code> for additional information. * - * <p>An example of a java <code>ImageData</code> is shown - * below:</p> + * <p>An example of a java <code>ImageData</code> is shown below:</p> * * <code><pre> - * Image image = new Image("C:\temp\img1.gif"); + * Image image = new Image(display, "C:\temp\img1.gif"); * ImageData imgData = image.getImageData(); * </code></pre> * - * @see <a href="http://www.eclipse.org/swt/">Sample code and further information</a> + * @see Transfer * * @since 3.4 */ @@ -57,12 +55,12 @@ public static ImageTransfer getInstance() { /** * This implementation of <code>javaToNative</code> converts an ImageData object represented * by java <code>ImageData</code> to a platform specific representation. - * For additional information see <code>Transfer#javaToNative</code>. * - * @param object a java <code>ImageData</code> containing the ImageData to be - * converted - * @param transferData an empty <code>TransferData</code> object; this - * object will be filled in on return with the platform specific format of the data + * @param object a java <code>ImageData</code> containing the ImageData to be converted + * @param transferData an empty <code>TransferData</code> object that will + * be filled in on return with the platform specific format of the data + * + * @see Transfer#nativeToJava */ public void javaToNative(Object object, TransferData transferData) { if (!checkImage(object) || !isSupportedType(transferData)) { @@ -117,12 +115,12 @@ public void javaToNative(Object object, TransferData transferData) { /** * This implementation of <code>nativeToJava</code> converts a platform specific * representation of an image to java <code>ImageData</code>. - * For additional information see <code>Transfer#nativeToJava</code>. * - * @param transferData the platform specific representation of the data to be - * been converted - * @return a java <code>ImageData</code> of the image if - * conversion was successful; otherwise null + * @param transferData the platform specific representation of the data to be converted + * @return a java <code>ImageData</code> of the image if the conversion was successful; + * otherwise null + * + * @see Transfer#javaToNative */ public Object nativeToJava(TransferData transferData) { if (!isSupportedType(transferData) || transferData.data == null) diff --git a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/carbon/org/eclipse/swt/dnd/RTFTransfer.java b/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/carbon/org/eclipse/swt/dnd/RTFTransfer.java index a60bf238db..7558bc66ef 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/carbon/org/eclipse/swt/dnd/RTFTransfer.java +++ b/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/carbon/org/eclipse/swt/dnd/RTFTransfer.java @@ -16,8 +16,7 @@ import org.eclipse.swt.internal.carbon.CFRange; /** * The class <code>RTFTransfer</code> provides a platform specific mechanism * for converting text in RTF format represented as a java <code>String</code> - * to a platform specific representation of the data and vice versa. See - * <code>Transfer</code> for additional information. + * to a platform specific representation of the data and vice versa. * * <p>An example of a java <code>String</code> containing RTF text is shown * below:</p> @@ -26,7 +25,7 @@ import org.eclipse.swt.internal.carbon.CFRange; * String rtfData = "{\\rtf1{\\colortbl;\\red255\\green0\\blue0;}\\uc1\\b\\i Hello World}"; * </code></pre> * - * @see <a href="http://www.eclipse.org/swt/">Sample code and further information</a> + * @see Transfer */ public class RTFTransfer extends ByteArrayTransfer { @@ -48,11 +47,12 @@ public static RTFTransfer getInstance () { /** * This implementation of <code>javaToNative</code> converts RTF-formatted text * represented by a java <code>String</code> to a platform specific representation. - * For additional information see <code>Transfer#javaToNative</code>. * * @param object a java <code>String</code> containing RTF text - * @param transferData an empty <code>TransferData</code> object; this - * object will be filled in on return with the platform specific format of the data + * @param transferData an empty <code>TransferData</code> object that will + * be filled in on return with the platform specific format of the data + * + * @see Transfer#nativeToJava */ public void javaToNative (Object object, TransferData transferData){ if (!checkRTF(object) || !isSupportedType(transferData)) { @@ -86,12 +86,12 @@ public void javaToNative (Object object, TransferData transferData){ /** * This implementation of <code>nativeToJava</code> converts a platform specific * representation of RTF text to a java <code>String</code>. - * For additional information see <code>Transfer#nativeToJava</code>. * - * @param transferData the platform specific representation of the data to be - * been converted - * @return a java <code>String</code> containing RTF text if the - * conversion was successful; otherwise null + * @param transferData the platform specific representation of the data to be converted + * @return a java <code>String</code> containing RTF text if the conversion was successful; + * otherwise null + * + * @see Transfer#javaToNative */ public Object nativeToJava(TransferData transferData){ if (!isSupportedType(transferData) || transferData.data == null) return null; diff --git a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/carbon/org/eclipse/swt/dnd/TextTransfer.java b/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/carbon/org/eclipse/swt/dnd/TextTransfer.java index 4ff2324d09..1b323e44e9 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/carbon/org/eclipse/swt/dnd/TextTransfer.java +++ b/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/carbon/org/eclipse/swt/dnd/TextTransfer.java @@ -26,7 +26,6 @@ import org.eclipse.swt.internal.carbon.OS; * </code></pre> * * @see Transfer - * @see <a href="http://www.eclipse.org/swt/">Sample code and further information</a> */ public class TextTransfer extends ByteArrayTransfer { @@ -54,10 +53,10 @@ public static TextTransfer getInstance () { * represented by a java <code>String</code> to a platform specific representation. * * @param object a java <code>String</code> containing text - * @param transferData an empty <code>TransferData</code> object; this object - * will be filled in on return with the platform specific format of the data + * @param transferData an empty <code>TransferData</code> object that will + * be filled in on return with the platform specific format of the data * - * @see Transfer#javaToNative + * @see Transfer#nativeToJava */ public void javaToNative (Object object, TransferData transferData) { if (!checkText(object) || !isSupportedType(transferData)) { @@ -109,7 +108,7 @@ public void javaToNative (Object object, TransferData transferData) { * @param transferData the platform specific representation of the data to be converted * @return a java <code>String</code> containing text if the conversion was successful; otherwise null * - * @see Transfer#nativeToJava + * @see Transfer#javaToNative */ public Object nativeToJava(TransferData transferData){ if (!isSupportedType(transferData) || transferData.data == null) return null; diff --git a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/carbon/org/eclipse/swt/dnd/URLTransfer.java b/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/carbon/org/eclipse/swt/dnd/URLTransfer.java index a1e97aac13..af8fcc62d3 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/carbon/org/eclipse/swt/dnd/URLTransfer.java +++ b/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/carbon/org/eclipse/swt/dnd/URLTransfer.java @@ -1,18 +1,16 @@ /*******************************************************************************
* Copyright (c) 20007 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* IBM Corporation - initial API and implementation
*******************************************************************************/
package org.eclipse.swt.dnd;
import org.eclipse.swt.internal.carbon.*;
/** * The class <code>URLTransfer</code> provides a platform specific mechanism * for converting text in URL format represented as a java <code>String</code> - * to a platform specific representation of the data and vice versa. See - * <code>Transfer</code> for additional information. The string + * to a platform specific representation of the data and vice versa. The string * must contain a fully specified url. * - * <p>An example of a java <code>String</code> containing a URL is shown - * below:</p> + * <p>An example of a java <code>String</code> containing a URL is shown below:</p> * * <code><pre> * String url = "http://www.eclipse.org"; * </code></pre> * - * @see <a href="http://www.eclipse.org/swt/">Sample code and further information</a> + * @see Transfer */
public class URLTransfer extends ByteArrayTransfer {
static URLTransfer _instance = new URLTransfer();
static final String URL = "url "; //$NON-NLS-1$
static final int URL_ID = registerType(URL);
static final String URLN = "urln"; //$NON-NLS-1$
static final int URLN_ID = registerType(URLN);
private URLTransfer() {}
/** * Returns the singleton instance of the URLTransfer class. * @@ -20,18 +18,19 @@ */
public static URLTransfer getInstance () {
return _instance;
}
/** * This implementation of <code>javaToNative</code> converts a URL * represented by a java <code>String</code> to a platform specific representation. - * For additional information see <code>Transfer#javaToNative</code>. * * @param object a java <code>String</code> containing a URL - * @param transferData an empty <code>TransferData</code> object; this - * object will be filled in on return with the platform specific format of the data + * @param transferData an empty <code>TransferData</code> object that will + * be filled in on return with the platform specific format of the data + * + * @see Transfer#nativeToJava */
public void javaToNative (Object object, TransferData transferData){
if (!checkURL(object) || !isSupportedType(transferData)) {
DND.error(DND.ERROR_INVALID_DATA);
}
transferData.result = -1;
String url = (String)object;
int count = url.length();
char[] chars = new char[count];
url.getChars(0, count, chars, 0);
int cfstring = OS.CFStringCreateWithCharacters(OS.kCFAllocatorDefault, chars, count);
if (cfstring == 0) return;
try {
CFRange range = new CFRange();
range.length = chars.length;
int encoding = OS.kCFStringEncodingUTF8;
int[] size = new int[1];
int numChars = OS.CFStringGetBytes(cfstring, range, encoding, (byte)'?', true, null, 0, size);
if (numChars == 0 || size[0] == 0) return;
byte[] buffer = new byte[size[0]];
numChars = OS.CFStringGetBytes(cfstring, range, encoding, (byte)'?', true, buffer, size [0], size);
if (numChars == 0) return;
transferData.data = new byte[][] {buffer};
transferData.result = 0;
} finally {
OS.CFRelease(cfstring);
}
}
/** - * This implementation of <code>nativeToJava</code> converts a platform specific - * representation of a URL to a java <code>String</code>. - * For additional information see <code>Transfer#nativeToJava</code>. + * This implementation of <code>nativeToJava</code> converts a platform + * specific representation of a URL to a java <code>String</code>. + * + * @param transferData the platform specific representation of the data to be converted + * @return a java <code>String</code> containing a URL if the conversion was successful; + * otherwise null * - * @param transferData the platform specific representation of the data to be - * converted - * @return a java <code>String</code> containing a URL if the - * conversion was successful; otherwise null + * @see Transfer#javaToNative */
public Object nativeToJava(TransferData transferData){
if (!isSupportedType(transferData) || transferData.data == null) return null;
if (transferData.data.length == 0) return null;
byte[] buffer = transferData.data[0];
int encoding = OS.kCFStringEncodingUTF8;
int cfstring = OS.CFStringCreateWithBytes(OS.kCFAllocatorDefault, buffer, buffer.length, encoding, true);
if (cfstring == 0) return null;
char[] unescapedChars = new char[] {'%'};
int unescapedStr = OS.CFStringCreateWithCharacters(0, unescapedChars, unescapedChars.length);
int str = OS.CFURLCreateStringByReplacingPercentEscapes(OS.kCFAllocatorDefault, cfstring, unescapedStr);
OS.CFRelease(unescapedStr);
OS.CFRelease(cfstring);
if (str == 0) return null;
try {
int length = OS.CFStringGetLength(str);
if (length == 0) return null;
char[] chars = new char[length];
CFRange range = new CFRange();
range.length = length;
OS.CFStringGetCharacters(str, range, chars);
return new String(chars);
} finally {
OS.CFRelease(str);
}
}
protected int[] getTypeIds(){
return new int[] {URL_ID, URLN_ID};
}
protected String[] getTypeNames(){
return new String[] {URL, URLN};
}
boolean checkURL(Object object) {
return object != null && (object instanceof String) && ((String)object).length() > 0;
}
protected boolean validate(Object object) {
return checkURL(object);
}
}
\ No newline at end of file |