public UnitEditor getEditorForUnit(ConstructionUnit unit) { checkState(); for (UnitEditor editor : editors) { if (editor.canEdit(unit)) { editor.editUnit(unit); return editor; } } return null; }
public UnitEditor getEditorForUnitType(ConstructionUnitType type) { checkState(); for (UnitEditor editor : editors) { if (editor.canEdit(type)) { editor.clearUnit(); editor.createUnit(type); return editor; } } return null; }