use of pcgen.cdom.content.TabInfo in project pcgen by PCGen.
the class ModifyfeatchoiceToken method parseTokenWithSeparator.
@Override
protected ParseResult parseTokenWithSeparator(LoadContext context, Ability ability, String value) {
StringTokenizer tok = new StringTokenizer(value, Constants.PIPE);
List<CDOMReference<Ability>> refs = new ArrayList<>();
ReferenceManufacturer<Ability> rm = context.getReferenceContext().getManufacturer(ABILITY_CLASS, AbilityCategory.FEAT);
while (tok.hasMoreTokens()) {
String token = tok.nextToken();
CDOMReference<Ability> ref = TokenUtilities.getTypeOrPrimitive(rm, token);
if (ref == null) {
return ParseResult.INTERNAL_ERROR;
}
refs.add(ref);
}
ReferenceChoiceSet<Ability> rcs = new ReferenceChoiceSet<>(refs);
ModifyChoiceDecorator gfd = new ModifyChoiceDecorator(rcs);
ChoiceSet<CNAbility> cs = new ChoiceSet<>(getTokenName(), gfd);
TabInfo ti = context.getReferenceContext().silentlyGetConstructedCDOMObject(TabInfo.class, Tab.ABILITIES.toString());
String singularName = ti.getResolvedName();
if (singularName.endsWith("s")) {
singularName = singularName.substring(0, singularName.length() - 1);
}
cs.setTitle("Select a " + singularName + " to modify");
TransitionChoice<CNAbility> tc = new ConcreteTransitionChoice<>(cs, FormulaFactory.ONE);
tc.setRequired(false);
context.getObjectContext().put(ability, ObjectKey.MODIFY_CHOICE, tc);
tc.setChoiceActor(this);
return ParseResult.SUCCESS;
}
use of pcgen.cdom.content.TabInfo in project pcgen by PCGen.
the class GameModeFileLoader method addDefaultTabInfo.
public static void addDefaultTabInfo(GameMode gameMode) {
LoadContext context = gameMode.getModeContext();
for (final Tab aTab : Tab.values()) {
TabInfo ti = context.getReferenceContext().silentlyGetConstructedCDOMObject(TabInfo.class, aTab.toString());
if (ti == null) {
ti = context.getReferenceContext().constructCDOMObject(TabInfo.class, aTab.toString());
ti.setTabName(aTab.label());
}
}
}
Aggregations