Skip to content

Commit

Permalink
Fix eclipse-platform#851 Add text/plain;charset=utf-8 to TextTransfer().
Browse files Browse the repository at this point in the history
This makes it possible to paste into eclipse from a KDE/QT app
  • Loading branch information
the-snowwhite committed Nov 7, 2023
1 parent 4daf005 commit dc80c9e
Showing 1 changed file with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -35,16 +35,19 @@
* </p>
*
* @see Transfer
* @since 3.125
*/
public class TextTransfer extends ByteArrayTransfer {

private static TextTransfer _instance = new TextTransfer();
private static final String COMPOUND_TEXT = "COMPOUND_TEXT"; //$NON-NLS-1$
private static final String UTF8_STRING = "UTF8_STRING"; //$NON-NLS-1$
private static final String STRING = "STRING"; //$NON-NLS-1$
private static final String TEXTPLAINUTF8 = "text/plain;charset=utf-8";
private static final int COMPOUND_TEXT_ID = GTK.GTK4 ? 0 : registerType(COMPOUND_TEXT);
private static final int UTF8_STRING_ID = GTK.GTK4 ? 0 : registerType(UTF8_STRING);
private static final int STRING_ID = GTK.GTK4 ? 0 : registerType(STRING);
private static final int TEXTPLAINUTF8_ID = GTK.GTK4 ? 0 : registerType(TEXTPLAINUTF8);

private TextTransfer() {}

Expand Down Expand Up @@ -145,7 +148,7 @@ protected int[] getTypeIds() {
if(GTK.GTK4) {
return new int[] {(int) OS.G_TYPE_STRING()};
}
return new int[] {UTF8_STRING_ID, STRING_ID};
return new int[] {UTF8_STRING_ID, STRING_ID, TEXTPLAINUTF8_ID};
}

@Override
Expand All @@ -157,7 +160,7 @@ protected String[] getTypeNames() {
return new String[] {"text/plain", STRING};
}

return new String[] {UTF8_STRING, STRING};
return new String[] {UTF8_STRING, STRING, TEXTPLAINUTF8};
}

boolean checkText(Object object) {
Expand Down

0 comments on commit dc80c9e

Please sign in to comment.