Java 类org.eclipse.swt.dnd.HTMLTransfer 实例源码

项目:JavaFX-FrameRateMeter    文件:OldFXCanvas.java   
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);
}
项目:JavaFX-FrameRateMeter    文件:OldFXCanvas.java   
String getMime(Transfer transfer) {
    if (transfer.equals(TextTransfer.getInstance())) {
      return "text/plain";
    }
    if (transfer.equals(RTFTransfer.getInstance())) {
      return "text/rtf";
    } ;
    if (transfer.equals( HTMLTransfer.getInstance())) {
      return "text/html";
    }
    if (transfer.equals(URLTransfer.getInstance())) {
      return "text/uri-list";
    }
    if (transfer.equals( ImageTransfer.getInstance())) {
      return "application/x-java-rawimage";
    }
    if (transfer.equals(FileTransfer.getInstance())) {
      return "application/x-java-file-list";
    }
    if (transfer instanceof CustomTransfer) {
      return ((CustomTransfer)transfer).getMime();
    }
    return null;
}
项目:eclipse-timekeeper    文件:CopyTaskDetailsToHTML.java   
public void copyTaskAsHTML(ITask task) {
    StringBuilder sb = new StringBuilder();
    String taskKey = task.getTaskId();
    if (taskKey != null) {
        sb.append("<a href=\"" + task.getUrl() + "\">");
        sb.append(taskKey);
        sb.append("</a>");
        sb.append(": ");
    }
    sb.append(task.getSummary());
    HTMLTransfer textTransfer = HTMLTransfer.getInstance();
    TextTransfer tt = TextTransfer.getInstance();
    Clipboard clipboard = new Clipboard(Display.getCurrent());
    clipboard.setContents(new String[] { sb.toString(), sb.toString() }, new Transfer[] { textTransfer, tt });
    clipboard.dispose();
}
项目:team-explorer-everywhere    文件:ShelvesetDetailsDialog.java   
/**
 * Get transferTypes, if null, create them
 *
 * @return
 */
private Transfer[] getTransferTypes() {
    if (transferTypes == null) {
        transferTypes = new Transfer[] {
            TextTransfer.getInstance(),
            HTMLTransfer.getInstance()
        };
    }

    return transferTypes;
}
项目:Rel    文件:BrowserManager.java   
public static void copyToClipboard(String html) {
    if (html == null || html.length() == 0)
        return;
    html = html.replace("<table", "<table border=\"1\"");
    Clipboard clipboard = new Clipboard(Display.getCurrent());
    TextTransfer textTransfer = TextTransfer.getInstance();
    HTMLTransfer htmlTransfer = HTMLTransfer.getInstance();
    Transfer[] transfers = new Transfer[] {textTransfer, htmlTransfer};
    Object[] data = new Object[] {html, html};
    clipboard.setContents(data, transfers);
    clipboard.dispose();    
}
项目:Rel    文件:Paste.java   
private boolean isThereSomethingToPaste() {
    Clipboard clipboard = new Clipboard(Display.getCurrent());
    try {
        TextTransfer textTransfer = TextTransfer.getInstance();
        HTMLTransfer htmlTransfer = HTMLTransfer.getInstance();
        String textData = (String)clipboard.getContents(textTransfer);
        String htmlData = (String)clipboard.getContents(htmlTransfer);
        return (textData != null && textData.length() > 0) || (htmlData != null && htmlData.length() > 0);
    } finally {
        clipboard.dispose();    
    }
}
项目:eclipse-timekeeper    文件:HTMLToClipboardHandler.java   
@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
    IWorkbenchPart activePart = HandlerUtil.getActivePart(event);
    if (activePart instanceof WorkWeekView) {
        LocalDate firstDayOfWeek = ((WorkWeekView) activePart).getFirstDayOfWeek();
        HTMLExporter export = new HTMLExporter();
        String result = export.getData(firstDayOfWeek);
        HTMLTransfer textTransfer = HTMLTransfer.getInstance();
        TextTransfer tt = TextTransfer.getInstance();
        Clipboard clipboard = new Clipboard(Display.getCurrent());
        clipboard.setContents(new String[] { result, result }, new Transfer[] { textTransfer, tt });
        clipboard.dispose();
    }
    return null;
}
项目:JXTN    文件:FXCanvas.java   
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);
}
项目:JXTN    文件:FXCanvas.java   
String getMime(Transfer transfer) {
    if (transfer.equals(TextTransfer.getInstance())) return "text/plain";
    if (transfer.equals(RTFTransfer.getInstance())) return "text/rtf"; ;
    if (transfer.equals( HTMLTransfer.getInstance())) return "text/html";
    if (transfer.equals(URLTransfer.getInstance())) return "text/uri-list";
    if (transfer.equals( ImageTransfer.getInstance())) return "application/x-java-rawimage";
    if (transfer.equals(FileTransfer.getInstance())) return "application/x-java-file-list";
    if (transfer instanceof CustomTransfer) return ((CustomTransfer)transfer).getMime();
    return null;
}
项目:birt    文件:TextEditor.java   
private void pasteClipboard( )
{
    Clipboard cb = new Clipboard( Display.getCurrent( ) );
    // TransferData[] types = cb.getAvailableTypes( );
    RTFTransfer rtfTransfer = RTFTransfer.getInstance( );
    Object contents = cb.getContents( rtfTransfer );
    // textEditor.paste( );
    if ( contents != null )
    {
        RTFHTMLHandler handler = new RTFHTMLHandler( );
        try
        {
            RTFParser.parse( contents.toString( ), handler );
            textEditor.insert( handler.toHTML( ) );
            return;
        }
        catch ( Exception e1 )
        {
        }
    }
    else
    {
        HTMLTransfer htmlTransfer = HTMLTransfer.getInstance( );
        contents = cb.getContents( htmlTransfer );
        if ( contents != null )
        {
            textEditor.insert( contents.toString( ) );
            return;
        }
    }

    TextTransfer plainTextTransfer = TextTransfer.getInstance( );
    String text = (String) cb.getContents( plainTextTransfer, DND.CLIPBOARD );
    textEditor.insert( text );
}
项目:OpenSPIFe    文件:HTMLTransferProvider.java   
@Override
public Transfer getTransfer() {
    return HTMLTransfer.getInstance(); 
}