EmulatorSkin.java: Fixed for old/new SWT version support
authorStanislav Vorobiov <s.vorobiov@samsung.com>
Thu, 14 Jun 2012 11:17:46 +0000 (15:17 +0400)
committerEvgeny Voevodin <e.voevodin@samsung.com>
Fri, 15 Jun 2012 07:25:02 +0000 (11:25 +0400)
tizen/src/skin/client/src/org/tizen/emulator/skin/EmulatorSkin.java

index cd2306a..2d161fc 100644 (file)
@@ -305,8 +305,16 @@ public class EmulatorSkin {
                if ( SkinUtil.isLinuxPlatform() ) {
 
                        try {
+                               /*
+                                * Accessing private fields of other classes via reflection
+                                * is VERY BAD, must be fixed !
+                                */
                                Field field = lcdCanvas.getClass().getField( "embeddedHandle" );
-                               windowHandleId = field.getLong( lcdCanvas );
+                               try {
+                               windowHandleId = field.getInt( lcdCanvas );
+                               } catch ( Exception e ) {
+                                       windowHandleId = (int)field.getLong( lcdCanvas );
+                               }
                                logger.info( "lcdCanvas.embeddedHandle:" + windowHandleId );
                        } catch ( IllegalArgumentException e ) {
                                logger.log( Level.SEVERE, e.getMessage(), e );