ActionScript Live templates: Where are the Expressions for package/class/method?
I wanted to create some live templates like I've used to in Flash Builder, but I have some problems doing that.
I'd like a template for mediator class (robotlegs), which inserts whole class, for example:
package $currentPackage$
{
import utils.logging.LoggerFactory;
import mx.logging.ILogger;
import org.robotlegs.mvcs.Mediator;
public class $currentClass$ extends Mediator
{
LOGGER::verbose { private static const logger:ILogger = LoggerFactory._getClassLogger($currentClass$); }
// view
[Inject] public var m_view:$viewClass$;
public override function onRegister():void
{
LOGGER::verbose { logger.debug("onRegister()"); }
}
public override function onRemove():void
{
LOGGER::verbose { logger.debug("onRemove()"); }
}
}
}
What is the Expression in Live Tempalates > Edit variables for
- current ActionScript class package name $currentPackage$
- current ActionScript class name $currentClass$
- current scope/method for live template of the logger line
Method scope live template example:
LOGGER::verbose { logger.debug("$currentMethod$ invoked"); }
There is no expression for current method
Any IDEAs? :)
请先登录再写评论。
Looks like you need File Template, not a Live Template. All custom file templates are shown in 'New' menu (I usually use Alt+Home and Alt+Ins). Use ${PACKAGE_NAME} and ${NAME} standard macros for package/class name respectively.
But if you want to use Live Templates you can use following macros:
jsClassName()
jsQualifiedClassName()
jsMethodName()
Unfortunately there's no macro for current package, you can file a YouTrack request for it.