Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGrant Gayed2003-07-14 15:44:32 +0000
committerGrant Gayed2003-07-14 15:44:32 +0000
commitfdfa369631eadcf406c767a46019e7eb67783245 (patch)
tree0c0872bb41713545875d4eca99224f7d42baca1d
parentcbd104d32a119f73e8f59679e54fa5a74d8c9341 (diff)
downloadeclipse.platform.swt-fdfa369631eadcf406c767a46019e7eb67783245.tar.gz
eclipse.platform.swt-fdfa369631eadcf406c767a46019e7eb67783245.tar.xz
eclipse.platform.swt-fdfa369631eadcf406c767a46019e7eb67783245.zip
*** empty log message ***
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT Accessibility/gtk/org/eclipse/swt/accessibility/AccessibleFactory.java25
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT Accessibility/gtk/org/eclipse/swt/accessibility/AccessibleObject.java3
2 files changed, 14 insertions, 14 deletions
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Accessibility/gtk/org/eclipse/swt/accessibility/AccessibleFactory.java b/bundles/org.eclipse.swt/Eclipse SWT Accessibility/gtk/org/eclipse/swt/accessibility/AccessibleFactory.java
index b38f5134eb..74eea03f5c 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT Accessibility/gtk/org/eclipse/swt/accessibility/AccessibleFactory.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT Accessibility/gtk/org/eclipse/swt/accessibility/AccessibleFactory.java
@@ -27,14 +27,19 @@ class AccessibleFactory {
static AccessibleType childType;
static final String CHILD_TYPE = "SWTChild";
static final String DEFAULT_PARENTTYPE = "GtkAccessible";
- static final String FACTORY_TYPE = "SWTFactory";
static final String FACTORY_PARENTTYPE = "AtkObjectFactory";
- static final String SWT_TYPE_PREFIX = "SWT";
+ static final byte[] SWT_TYPE_PREFIX = "SWT".getBytes ();
+ static final byte[] FACTORY_TYPE = "SWTFactory".getBytes ();
private AccessibleFactory (int widgetType) {
super ();
int widgetTypeName = ATK.g_type_name (widgetType);
- byte[] factoryName = concat (FACTORY_TYPE, widgetTypeName);
+ int widgetTypeNameLength = OS.strlen (widgetTypeName) + 1;
+ byte[] buffer = new byte [widgetTypeNameLength];
+ OS.memmove (buffer, widgetTypeName, widgetTypeNameLength);
+ byte[] factoryName = new byte [FACTORY_TYPE.length + widgetTypeNameLength];
+ System.arraycopy (FACTORY_TYPE, 0, factoryName, 0, FACTORY_TYPE.length);
+ System.arraycopy (buffer, 0, factoryName, FACTORY_TYPE.length, widgetTypeNameLength);
if (ATK.g_type_from_name (factoryName) == 0) {
// register the factory
int registry = ATK.atk_get_default_registry ();
@@ -45,7 +50,9 @@ class AccessibleFactory {
parentType = ATK.g_type_from_name (Converter.wcsToMbcs (null, DEFAULT_PARENTTYPE, true));
}
ATK.atk_registry_set_factory_type (registry, widgetType, swtFactory);
- byte[] newTypeName = concat (SWT_TYPE_PREFIX, widgetTypeName);
+ byte[] newTypeName = new byte [SWT_TYPE_PREFIX.length + widgetTypeNameLength];
+ System.arraycopy (SWT_TYPE_PREFIX, 0, newTypeName, 0, SWT_TYPE_PREFIX.length);
+ System.arraycopy (buffer, 0, newTypeName, SWT_TYPE_PREFIX.length, widgetTypeNameLength);
accessibleType = new AccessibleType (newTypeName, parentType);
}
}
@@ -59,16 +66,6 @@ class AccessibleFactory {
return accessibleType.createObject (accessible, widget);
}
- byte[] concat (String str1, int str2ptr) {
- int str2length = OS.strlen (str2ptr) + 1;
- byte[] buffer = new byte [str2length];
- OS.memmove (buffer, str2ptr, str2length);
- byte[] newName = new byte [str1.length () + str2length];
- System.arraycopy (str1.getBytes (), 0, newName, 0, str1.length ());
- System.arraycopy (buffer, 0, newName, str1.length (), str2length);
- return newName;
- }
-
int createFactory (byte[] name) {
int parent = ATK.g_type_from_name (Converter.wcsToMbcs (null, FACTORY_PARENTTYPE, true));
gTypeInfoCB_base_init = new Callback (this, "gTypeInfo_base_init", 1);
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Accessibility/gtk/org/eclipse/swt/accessibility/AccessibleObject.java b/bundles/org.eclipse.swt/Eclipse SWT Accessibility/gtk/org/eclipse/swt/accessibility/AccessibleObject.java
index 4a45806974..0c691acd43 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT Accessibility/gtk/org/eclipse/swt/accessibility/AccessibleObject.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT Accessibility/gtk/org/eclipse/swt/accessibility/AccessibleObject.java
@@ -549,6 +549,9 @@ public class AccessibleObject {
}
int atkText_get_character_count () {
+ // TODO next line is workaround for disposed widget exception;
+ // should not be needed
+ if (accessible.control.isDisposed()) return 0;
String text = getText ();
if (text != null) return text.length ();
if (ATK.g_type_is_a (parentType, AccessibleType.ATK_TEXT_TYPE)) {

Back to the top