Examples of OleAutomation


Examples of org.eclipse.swt.ole.win32.OleAutomation

   *          supplied to the function, which must be null if it is static.
   * @return the return value of the JavaScript function
   */
  protected static Variant doInvokeOnWindow(OleAutomation window, String name,
      Variant[] vArgs) {
    OleAutomation funcObj = null;
    Variant funcObjVar = null;
    try {

      // Get the function object and its 'call' method.
      //
      int[] ids = window.getIDsOfNames(new String[] {name});
      if (ids == null) {
        throw new RuntimeException(
            "Could not find a native method with the signature '" + name + "'");
      }
      int functionId = ids[0];
      funcObjVar = window.getProperty(functionId);
      funcObj = funcObjVar.getAutomation();
      int callDispId = funcObj.getIDsOfNames(new String[] {"call"})[0];

      // Invoke it and return the result.
      //
      return funcObj.invoke(callDispId, vArgs);

    } finally {
      if (funcObjVar != null) {
        funcObjVar.dispose();
      }

      if (funcObj != null) {
        funcObj.dispose();
      }
    }
  }
View Full Code Here

Examples of org.eclipse.swt.ole.win32.OleAutomation

   */
  public ModuleSpaceIE6(TreeLogger logger, ModuleSpaceHost host,
      IDispatch scriptFrameWindow, String moduleName, Object key) {
    super(logger, host, moduleName, key);

    window = new OleAutomation(scriptFrameWindow);
  }
View Full Code Here

Examples of org.eclipse.swt.ole.win32.OleAutomation

      sb.append("(did you forget to prefix the call with 'this.'?)");
      throw new HResultException(sb.toString());
    } finally {
      for (int i = 0; i < javaParams.length; i++) {
        if (javaParams[i] instanceof OleAutomation) {
          OleAutomation tmp = (OleAutomation) javaParams[i];
          tmp.dispose();
        }
      }
    }

    return SwtOleGlue.convertObjectToVariant(cl, method.getReturnType(), result);
View Full Code Here

Examples of org.eclipse.swt.ole.win32.OleAutomation

   * @param propName name of the property to get
   * @return the property value as an integer
   * @throws RuntimeException if the property does not exist
   */
  private static int getIntProperty(IDispatch frameWnd, String propName) {
    OleAutomation window = null;
    try {
      window = new OleAutomation(frameWnd);
      int[] dispID = window.getIDsOfNames(new String[] {propName});
      if (dispID == null) {
        throw new RuntimeException("No such property " + propName);
      }
      Variant value = null;
      try {
        value = window.getProperty(dispID[0]);
        return value.getInt();
      } finally {
        if (value != null) {
          value.dispose();
        }
      }
    } finally {
      if (window != null) {
        window.dispose();
      }
    }
  }
View Full Code Here

Examples of org.eclipse.swt.ole.win32.OleAutomation

   * @param intValue the value to set
   * @throws RuntimeException if the property does not exist
   */
  private static void setIntProperty(IDispatch frameWnd, String propName,
      int intValue) {
    OleAutomation window = null;
    try {
      window = new OleAutomation(frameWnd);
      int[] dispID = window.getIDsOfNames(new String[] {propName});
      if (dispID == null) {
        throw new RuntimeException("No such property " + propName);
      }
      Variant value = null;
      try {
        value = new Variant(intValue);
        window.setProperty(dispID[0], value);
      } finally {
        if (value != null) {
          value.dispose();
        }
      }
    } finally {
      if (window != null) {
        window.dispose();
      }
    }
  }
View Full Code Here

Examples of org.eclipse.swt.ole.win32.OleAutomation

        throw new RuntimeException("Could not find a native method with the signature '" + name + "'");
      }
      int functionId = ids[0];
      // prepare function and "call" property
      Variant functionVariant = window.getProperty(functionId);
      OleAutomation function = functionVariant.getAutomation();
      int callId = function.getIDsOfNames(new String[]{"call"})[0];
      // dispose function variant (we have automation) and fill information object
      functionVariant.dispose();
      functionInfo = new NativeFunctionInfo(function, callId);
      m_nativeFunctions.put(name, functionInfo);
    }
View Full Code Here

Examples of org.eclipse.swt.ole.win32.OleAutomation

   *            the array of arguments. vArgs[0] is the this parameter supplied to the function, which must
   *            be null if it is static.
   * @return the return value of the JavaScript function
   */
  protected Variant doInvokeOnWindow2(OleAutomation window, String name, Variant[] vArgs) {
    OleAutomation funcObj = null;
    Variant funcObjVar = null;
    try {
      // Get the function object and its 'call' method.
      //
      int[] ids = window.getIDsOfNames(new String[]{name});
      if (ids == null) {
        throw new RuntimeException("Could not find a native method with the signature '" + name + "'");
      }
      int functionId = ids[0];
      funcObjVar = window.getProperty(functionId);
      funcObj = funcObjVar.getAutomation();
      int callDispId = funcObj.getIDsOfNames(new String[]{"call"})[0];
      // Invoke it and return the result.
      //
      return funcObj.invoke(callDispId, vArgs);
    } finally {
      if (funcObjVar != null) {
        funcObjVar.dispose();
      }
      if (funcObj != null) {
        funcObj.dispose();
      }
    }
  }
View Full Code Here

Examples of org.eclipse.swt.ole.win32.OleAutomation

      sb.append("(did you forget to prefix the call with 'this.'?)");
      throw new HResultException(sb.toString());
    } finally {
      for (int i = 0; i < javaParams.length; i++) {
        if (javaParams[i] instanceof OleAutomation) {
          OleAutomation tmp = (OleAutomation) javaParams[i];
          tmp.dispose();
        }
      }
    }

    return SwtOleGlue.convertObjectToVariant(cl, method.getReturnType(), result);
View Full Code Here

Examples of org.eclipse.swt.ole.win32.OleAutomation

  private static class CMN_invokeOleFunction extends ControlCommandMessage {
    @Override
    public Object run(Object[] args) {
      String[] propertyPath = (String[])args[1];
      OleAutomation automation = new OleAutomation(getSite((OleFrame)getControl()));
      int[] ids;
      for(int i=0; i<propertyPath.length; i++) {
        ids = automation.getIDsOfNames(new String[] {propertyPath[i]});
        if(ids == null) {
          automation.dispose();
          return null;
        }
        if(i == propertyPath.length - 1) {
          Object[] vargs = (Object[])args[2];
          Variant[] params = new Variant[vargs.length];
          for(int j=0; j<vargs.length; j++) {
            params[j] = createVariant(vargs[j]);
          }
          Object result;
          if((Boolean)args[0]) {
            Variant resultVariant = automation.invoke(ids[0], params);
            result = getVariantValue(resultVariant);
            dispose(resultVariant);
          } else {
            result = null;
            automation.invokeNoReply(ids[0], params);
          }
          for(Variant param: params) {
            dispose(param);
          }
          automation.dispose();
          return result;
        }
        Variant variantProperty = automation.getProperty(ids[0]);
        OleAutomation newAutomation = variantProperty.getAutomation();
        variantProperty.dispose();
        automation.dispose();
        automation = newAutomation;
      }
      automation.dispose();
View Full Code Here

Examples of org.eclipse.swt.ole.win32.OleAutomation

  private static class CMN_setOleProperty extends ControlCommandMessage {
    @Override
    public Object run(Object[] args) {
      String[] propertyPath = (String[])args[0];
      OleAutomation automation = new OleAutomation(getSite((OleFrame)getControl()));
      int[] ids;
      for(int i=0; i<propertyPath.length; i++) {
        ids = automation.getIDsOfNames(new String[] {propertyPath[i]});
        if(ids == null) {
          automation.dispose();
          return false;
        }
        if(i == propertyPath.length - 1) {
          Object[] vargs = (Object[])args[1];
          Variant[] params = new Variant[vargs.length];
          for(int j=0; j<vargs.length; j++) {
            params[j] = createVariant(vargs[j]);
          }
          boolean result = automation.setProperty(ids[0], params);
          for(Variant param: params) {
            dispose(param);
          }
          automation.dispose();
          return result;
        }
        Variant variantProperty = automation.getProperty(ids[0]);
        OleAutomation newAutomation = variantProperty.getAutomation();
        variantProperty.dispose();
        automation.dispose();
        automation = newAutomation;
      }
      automation.dispose();
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.