Include File Name in Flex Template

By default, when creating a new MXML Component a dialog appears that asks for two inputs: File name and Parent Component. I'm trying to update the file template for MXML Components to look like:

<?xml version="1.0"?>
<mx:${Parent_component} xmlns:mx="http://www.adobe.com/2006/mxml">

    <mx:Script>
        <![CDATA[
            import mx.logging.ILogger;
            import mx.logging.Log;

            private static const logger:ILogger = Log.getLogger("${PACKAGE_NAME}.${File_name}");
        ]]>
    </mx:Script>

</mx:${Parent_component}>



Essentially, I'm adding a logger object and you see I'm trying to set the logger to use package_name.file_name. The problem is when that now that I have put in ${File_name} when I try and create an MXML Component the dialog that appears has three input fields: File name, File name and Parent component. I just want to get the value entered into the original "File name" input (just like ${Parent_component}) without having two "File name" fields.
2 comments
Comment actions Permalink

I am not sure file name is referenced as $, it seems it should be $ (please look for source of new ActionScript class template for reference), btw, PACKAGE_NAME can be empty On 29.12.2009 15:40, craig wrote: > By default, when creating a new MXML Component a dialog appears that asks for two inputs: File name and Parent Component. I'm trying to update the file template for MXML Components to look like: > > <?xml version="1.0"?> > <mx:$ xmlns:mx="http://www.adobe.com/2006/mxml"> > >      <mx:Script> >          <![CDATA[ >              import mx.logging.ILogger; >              import mx.logging.Log; > >              private static const logger:ILogger = Log.getLogger("$.$");

         ]]>
     </mx:Script>

>

</mx:$> > > Essentially, I'm adding a logger object and you see I'm trying to set the logger to use package_name.file_name. The problem is when that now that I have put in $ when I try and create an MXML Component the dialog that appears has three input fields: File name, File name and Parent component. I just want to get the value entered into the original "File name" input (just like $) without having two "File name" fields.

>

---
Original message URL: http://www.jetbrains.net/devnet/message/5253367#5253367



--
Best regards,
   Maxim Mossienko
IntelliJ Labs / JetBrains Inc.
http://www.intellij.com
"Develop with pleasure!"

0
Comment actions Permalink

I got it, there is a variable provided by IntelliJ called "NAME"...so the working template is:

<?xml version="1.0"?>
<mx:${Parent_component} xmlns:mx="http://www.adobe.com/2006/mxml">

    <mx:Script>
        <![CDATA[
            import mx.logging.ILogger;
            import mx.logging.Log;

            private static const logger:ILogger = Log.getLogger("${PACKAGE_NAME}.${NAME}");
        ]]>
    </mx:Script>

</mx:${Parent_component}>

0

Please sign in to leave a comment.