-
Notifications
You must be signed in to change notification settings - Fork 783
Code Templates
Robert Biter edited this page Jun 3, 2014
·
7 revisions
It's handy to use code templates for code constructs you need often. The code templates can be defined here: Tools -> Options -> Editor -> Code Templates (Language=Java). You define an "Abbreviation" the "Expand Text" and optional a description. (This looks cool - what IDE is this for?) As you enter the abbreviation followed by a tab in the code, the netbeans editor changes the abbreviation to the expand text.
${no-format}public static final
class ${effectName newVarName default="New"}Effect extends ${osef type="mage.abilities.effects.OneShotEffect" default="OneShotEffect" editable="false"} {
public ${effectName}Effect() {
super(Outcome.Benefit);
this.staticText = "${selection}${cursor}";
}
public ${effectName}Effect(final ${effectName}Effect effect) {
super(effect);
}
@Override
public ${effectName}Effect copy() {
return new ${effectName}Effect(this);
}
@Override
public boolean apply(${game type="mage.game.Game" default="Game" editable="false"} game, ${ability type="mage.abilities.Ability" default="Ability" editable="false"} source) {
return false;
}
}
class ${abilityName default="New"}TriggeredAbility extends ${trab type="mage.abilities.TriggeredAbilityImpl" default="TriggeredAbilityImpl" editable="false"} {
public ${abilityName}TriggeredAbility() {
super(Zone.BATTLEFIELD, null, false);
}
public ${abilityName}TriggeredAbility(final ${abilityName}TriggeredAbility ability) {
super(ability);
}
@Override
public ${abilityName}TriggeredAbility copy() {
return new ${abilityName}TriggeredAbility(this);
}
@Override
public boolean checkTrigger(${gameEvent type="mage.game.events.GameEvent" default="GameEvent" editable="false"} event, ${game type="mage.game.Game" default="Game" editable="false"} game) {
return false;
}
@Override
public String getRule() {
return "${cursor}" + super.getRule();
}
}