Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test implemention of #858 suggested method #890

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -35,16 +35,19 @@
* </p>
*
* @see Transfer
* @since 3.124
*/
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 TEXT_PLAIN_UTF8 = "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 TEXT_PLAIN_UTF8_ID = GTK.GTK4 ? 0 : registerType(TEXT_PLAIN_UTF8);

private TextTransfer() {}

Expand Down Expand Up @@ -88,11 +91,10 @@ public void javaToNative (Object object, TransferData transferData) {
transferData.pValue = ctext[0];
transferData.result = 1;
}
if (transferData.type == UTF8_STRING_ID) {
if (transferData.type == UTF8_STRING_ID || transferData.type == TEXT_PLAIN_UTF8_ID) {
long pValue = OS.g_malloc(utf8.length);
if (pValue == 0) return;
C.memmove(pValue, utf8, utf8.length);
transferData.type = UTF8_STRING_ID;
transferData.format = 8;
transferData.length = utf8.length - 1;
transferData.pValue = pValue;
Expand All @@ -109,6 +111,7 @@ public void javaToNative (Object object, TransferData transferData) {
}
}


/**
* This implementation of <code>nativeToJava</code> converts a platform specific
* representation of plain text to a java <code>String</code>.
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, TEXT_PLAIN_UTF8_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, TEXT_PLAIN_UTF8};
}

boolean checkText(Object object) {
Expand Down
2 changes: 1 addition & 1 deletion bundles/org.eclipse.swt/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-Name: %pluginName
Bundle-Vendor: %providerName
Bundle-SymbolicName: org.eclipse.swt; singleton:=true
Bundle-Version: 3.124.100.qualifier
Bundle-Version: 3.124.101.qualifier
Bundle-ManifestVersion: 2
Bundle-Localization: plugin
DynamicImport-Package: org.eclipse.swt.accessibility2
Expand Down
4 changes: 2 additions & 2 deletions bundles/org.eclipse.swt/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,15 @@
</parent>
<groupId>org.eclipse.swt</groupId>
<artifactId>org.eclipse.swt</artifactId>
<version>3.124.100-SNAPSHOT</version>
<version>3.124.101-SNAPSHOT</version>
<packaging>eclipse-plugin</packaging>

<properties>
<!--
forceContextQualifier gets updated during build input process using
ant script <SWT source repo>/bundles/org.eclipse.swt/buildInternal.xml
-->
<forceContextQualifier>v20230825-1346</forceContextQualifier>
<forceContextQualifier>v20231112-1315</forceContextQualifier>
<sonar.sources>Eclipse SWT Accessibility/cocoa,Eclipse SWT Accessibility/common,Eclipse SWT Accessibility/gtk,Eclipse SWT Accessibility/win32,Eclipse SWT AWT/cocoa,Eclipse SWT AWT/common,Eclipse SWT AWT/gtk,Eclipse SWT AWT/win32,Eclipse SWT Browser/cocoa,Eclipse SWT Browser/common,Eclipse SWT Browser/gtk,Eclipse SWT Browser/win32,Eclipse SWT Custom Widgets/common,Eclipse SWT Drag and Drop/cocoa,Eclipse SWT Drag and Drop/common,Eclipse SWT Drag and Drop/gtk,Eclipse SWT Drag and Drop/win32,Eclipse SWT OLE Win32/win32,Eclipse SWT OpenGL/cocoa,Eclipse SWT OpenGL/common,Eclipse SWT OpenGL/glx,Eclipse SWT OpenGL/gtk,Eclipse SWT OpenGL/win32,Eclipse SWT PI/cairo,Eclipse SWT PI/cocoa,Eclipse SWT PI/common,Eclipse SWT PI/gtk,Eclipse SWT PI/win32,Eclipse SWT Printing/cocoa,Eclipse SWT Printing/common,Eclipse SWT Printing/gtk,Eclipse SWT Printing/win32,Eclipse SWT Program/cocoa,Eclipse SWT Program/common,Eclipse SWT Program/gtk,Eclipse SWT Program/win32,Eclipse SWT WebKit/cocoa,Eclipse SWT WebKit/gtk,Eclipse SWT/cairo,Eclipse SWT/cocoa,Eclipse SWT/common,Eclipse SWT/emulated/bidi,Eclipse SWT/emulated/coolbar,Eclipse SWT/emulated/expand,Eclipse SWT/emulated/taskbar,Eclipse SWT/emulated/tooltip,Eclipse SWT/gtk,Eclipse SWT/win32</sonar.sources>
</properties>

Expand Down
Loading