Re: generating stubs: problem with naming

Josh Passenger <[email protected]> Fri, 2 Dec 2005 11:16:18 +1000
Newsgroups gmane.comp.windows.devel.jawin
Message-ID <[email protected]>
Hi Sascha,

You could check out the stylesheets and config file that come with the
TypeBrowser and perhaps add a type related prefix to the generated class
names?

Check out the codegenconfig.xml:

<codegen>
        <task name="Jawin coclass"
                xpath="//coclass"
                fileNameXPath="concat(@name, '.java')"
                saveDirectoryXPath="@saveDirectory"
                javaEncodingXPath="@javaEncoding"
                packageNameXPath="@packageName"
                stylesheet="stylesheets/codegen/jawin/coclass.xsl"
                icon="images/coclass.png"/>

        <task name="Jawin Enum"
                xpath="//enum"
                fileNameXPath="concat(@name, '.java')"
                saveDirectoryXPath="@saveDirectory"
                javaEncodingXPath="@javaEncoding"
                packageNameXPath="@packageName"
                stylesheet="stylesheets/codegen/jawin/enum.xsl"
                icon="images/enum.png"/>

        <task name="Jawin Alias"
                xpath="//alias"
                fileNameXPath="concat(@name, '.java')"
                saveDirectoryXPath="@saveDirectory"
                javaEncodingXPath="@javaEncoding"
                packageNameXPath="@packageName"
                stylesheet="stylesheets/codegen/jawin/alias.xsl"
                icon="images/alias.png"/>

        <task name="Jawin Dispatch"
                xpath="//dispatch"
                fileNameXPath="concat(@name, '.java')"
                saveDirectoryXPath="@saveDirectory"
                javaEncodingXPath="@javaEncoding"
                packageNameXPath="@packageName"
                stylesheet="stylesheets/codegen/jawin/dispatch.xsl"
                icon="images/dispatch.png"/>

        <task name="Jawin Interface"
                xpath="//interface"
                fileNameXPath="concat(@name, '.java')"
                saveDirectoryXPath="@saveDirectory"
                javaEncodingXPath="@javaEncoding"
                packageNameXPath="@packageName"
                stylesheet="stylesheets/codegen/jawin/interface.xsl"
                icon="images/interface.png"/>

        <task name="Jawin Module"
                xpath="//module"
                fileNameXPath="concat(@name, '.java')"
                saveDirectoryXPath="@saveDirectory"
                javaEncodingXPath="@javaEncoding"
                packageNameXPath="@packageName"
                stylesheet="stylesheets/codegen/jawin/module.xsl"
                icon="images/module.png"/>

        <task name="Jawin Record"
                xpath="//record"
                fileNameXPath="concat(@name, '.java')"
                saveDirectoryXPath="@saveDirectory"
                javaEncodingXPath="@javaEncoding"
                packageNameXPath="@packageName"
                stylesheet="stylesheets/codegen/jawin/record.xsl"
                icon="images/record.png"/>

        <task name="Jawin Union"
                xpath="//union"
                fileNameXPath="concat(@name, '.java')"
                saveDirectoryXPath="@saveDirectory"
                javaEncodingXPath="@javaEncoding"
                packageNameXPath="@packageName"
                stylesheet="stylesheets/codegen/jawin/union.xsl"
                icon="images/union.png"/>
</codegen>

You would need to edit the fileNameXPath attribute to add your prefix and
possibly change the stlesheet referenced in the stylesheet attribute to
change the class name.

I designed the type browser to have pretty much nothing hard coded so it
should just work,

Tell me how it goes,

Josh

>From: Sascha Uhlmann <[email protected]>
>Reply-To: Discussion of Java/Win32/COM integration with Jawin
><[email protected]>
>To: [email protected]
>Subject: [JAWIN] generating stubs: problem with naming
>Date: Thu, 1 Dec 2005 06:37:40 -0500
>MIME-Version: 1.0
>Received: from discuss.develop.com ([66.129.110.38]) by MC6-F29.hotmail.com
>with Microsoft SMTPSVC(6.0.3790.211); Thu, 1 Dec 2005 04:17:27 -0800
>Received: from develop-lserv (66.129.110.38) by discuss.develop.com (LSMTP
>for Windows NT v1.1b) with SMTP id <[email protected]>; Thu, 1
>Dec 2005 6:52:41 -0500
>Received: from DISCUSS.DEVELOP.COM by DISCUSS.DEVELOP.COM (LISTSERV-TCP/IP
>         release 1.8e) with spool id 2961598 for [email protected];
>          Thu, 1 Dec 2005 06:52:40 -0500
>Received: from develop-lserv (66.129.110.38) by discuss.develop.com (LSMTP
>for          Windows NT v1.1b) with SMTP id
><[email protected]>; Thu,          1 Dec 2005 6:37:40 -0500
>X-Message-Info: KtxBqYfPyq3Rfro4vN+fLt/N4br4gTV2Kz0acFWH1gY=
>Precedence: list
>Return-Path: [email protected]
>X-OriginalArrivalTime: 01 Dec 2005 12:17:29.0041 (UTC)
>FILETIME=[3296D410:01C5F671]
>
>Hello everyone,
>
>I have a problem using JAWIN for generating stubs for Microsoft Powerpoint.
>The typelibrary contains both CoClasses and Dispatch-Interfaces with the
>same naming. (i.e. „application“)
>JTB seems to solve the problem and renames the Dispatch-
>Interface “application“ to “_application“ but confuses the names afterwards
>when referencing the classes’ methods from other classes.
>If I then import the stubs into my eclipse project I get lots of error
>messages and would actually have to fix lots of the generated classes
>manually ...
>
>So my questions are:
>• Is this a common problem?
>• Is there is a possibility to configure Jawin to correctly
>   translate the COM-interfaces?
>• Or is there else an automated way to correct the generated classes?
>
>Could anyone help me?
>Thanks!
>Sascha