Indeed, as Bart explained, the point is that you won't have enough information when it came to isAvailable/isEnabled.
Information for the item, could be collected from List Item Properties(when list gets loaded, it contains simple item representation), or from Item properties (when you load an item, it has full set of properties associated with item).
In your case the PublicationType not contained a part of list properties. So even if you have list loaded, you still need to load an Item to collect this property.
I would suggest following actions to achieve functionality you need:
Create data extender to add a property, based on which you'll be able to properly update a context menu command state.
Add ItemType extension, which will extend Tridion.ContentManager.Publication
to be able to collect a property from either publication or list node.
Use this property to determine a command state.
Update:
I have just checked, Publication List node already contains PublicationType in Publication node.
This makes it a little bit simpler.
You can do the following trick:
if (selection.getItemType(0) == $const.ItemType.PUBLICATION)
{
var itemId = selection.getItem(0);
var item = $models.getItem(itemId);
var publicationType = item.getPublicationType();
// If publication Type is not defined, then try to find it from lists loaded
if (!publicationType)
{
// Loop over already loaded lists, and try to find a list node there.
for (var i = 0, lists = $models.getListsRegistry(), list; list = $models.getItem(lists[i]); i++)
{
// you only need navigation lists
if (Tridion.OO.implementsInterface(list, "Tridion.ContentManager.ListNavigation")/* && list.hasItem(itemId)*/)
{
publicationType = $xml.getInnerText(list.getXmlDocument(), "/tcm:*/tcm:Item[@ID=\"{0}\"]/@PublicationType".format(itemId));
if (publicationType)
{
break;
}
}
}
}
if (publicationType == "0")
{
return true;
}
}