title: How to get the handle of SWT control in Mac 64 bit cocoa enviornment?
body: <p>I have one Eclipse based RCP application in which I need to pass the SWT Control handles to native code to paint something on it.
  I have the following code to get the handle of any SWT control:</p>
  
  <pre><code>public static int getControlHandle(Control c){
              int handle = 0;
              try {
                  if(_isMACOS){
                      if(_viewField== null)
                          _viewField = Control.class.getDeclaredField("view");
                      Object view = _viewField.get(c);
                      if(_idField== null) {
                          Class&lt;?&gt;idClass = Class.forName("org.eclipse.swt.internal.cocoa.id");
                          _idField = idClass.getDeclaredField("id");
                      }
                      handle = _idField.getInt(view);
  
                  }
                  else {
                      if(_idField== null)
                          _idField = Control.class.getDeclaredField("handle");
                      handle = _idField.getInt(c);
                  }
              }
              catch(Exception e){
  
              }
              return handle;
      }
  </code></pre>
  
  <p><code>_viewField</code> and <code>_idField</code> are <code>java.lang.reflect.Field</code>.</p>
  
  <p>While this works well for Windows and Mac 32 bit but its not working with Mac 64 bit cocoa libs and env.
  Is there any change in the way to get the handle for 64 bit Mac?</p>