本文整理汇总了Java中org.eclipse.swt.dnd.ImageTransfer.getInstance方法的典型用法代码示例。如果您正苦于以下问题:Java ImageTransfer.getInstance方法的具体用法?Java ImageTransfer.getInstance怎么用?Java ImageTransfer.getInstance使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.swt.dnd.ImageTransfer
的用法示例。
在下文中一共展示了ImageTransfer.getInstance方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getTransferType
import org.eclipse.swt.dnd.ImageTransfer; //导入方法依赖的package包/类
Transfer getTransferType(String mime) {
if (mime.equals("text/plain")) {
return TextTransfer.getInstance();
}
if (mime.equals("text/rtf")) {
return RTFTransfer.getInstance();
}
if (mime.equals("text/html")) {
return HTMLTransfer.getInstance();
}
if (mime.equals("text/uri-list")) {
return URLTransfer.getInstance();
}
if (mime.equals("application/x-java-rawimage")) {
return ImageTransfer.getInstance();
}
if (mime.equals("application/x-java-file-list") || mime.equals("java.file-list")) {
return FileTransfer.getInstance();
}
return getCustomTransfer(mime);
}
示例2: run
import org.eclipse.swt.dnd.ImageTransfer; //导入方法依赖的package包/类
public void run(IAction action) {
Image image = view.getViewer().getImage();
ImageData imageData = image.getImageData();
ImageTransfer imageTransfer = ImageTransfer.getInstance();
Clipboard clipboard = new Clipboard(Display.getCurrent());
clipboard.setContents(new Object[] { imageData }, new Transfer[] { imageTransfer });
}
示例3: getTransferType
import org.eclipse.swt.dnd.ImageTransfer; //导入方法依赖的package包/类
Transfer getTransferType(String mime) {
if (mime.equals("text/plain")) return TextTransfer.getInstance();
if (mime.equals("text/rtf")) return RTFTransfer.getInstance();
if (mime.equals("text/html")) return HTMLTransfer.getInstance();
if (mime.equals("text/uri-list")) return URLTransfer.getInstance();
if (mime.equals("application/x-java-rawimage")) return ImageTransfer.getInstance();
if (mime.equals("application/x-java-file-list") || mime.equals("java.file-list")) {
return FileTransfer.getInstance();
}
return getCustomTransfer(mime);
}
示例4: addDropSupport
import org.eclipse.swt.dnd.ImageTransfer; //导入方法依赖的package包/类
/** This method adds drop (drag & drop) support to a given SWT widget
* @param widget an SWT widget such as a label or a composite */
private void addDropSupport(final Widget widget) {
int ops = DND.DROP_COPY | DND.DROP_LINK | DND.DROP_DEFAULT;
final FileTransfer fTransfer = FileTransfer.getInstance();
final ImageTransfer iTransfer = ImageTransfer.getInstance();
Transfer[] transfers = new Transfer[] { fTransfer, iTransfer };
DropTarget target = new DropTarget((Control) widget, ops);
target.setTransfer(transfers);
target.addDropListener(this);
}