Solved! Go to Solution.
My thought is that you cannot control with which FeatureLayer a custom Construction Tool can be offered in the Construction Tools pane of the Create Features dockable window. It seems that the only reason why a custom Construction Tool displays is because:
a) that Construction Tool has been registered with a given ESRI Editor Construction Tools component category--e.g. ESRI Editor Point Feature Construction Tools or ESRI Editor Annotation Feature Construction Tools component category--which is determined by the developer in the source code of the construction tool.
b) the enduser has selected a feature template associated with a feature layer whose geometry type corresponds to the geometry type of the editor construction tool.
So if an enduser selects a feature template that is associated with a point feature layer, ArcMap will load all the classes/tools that are registered in the component category called ESRI Editor Point Feature Construction Tools in the Construction Tools pane of the Create Features dockable window. This is similar to ArcMap loading all the classes/tools that are registered in the component category called ESRI Mx Commands in the Commands tab of the Customize dialog, which one can then drag onto any toolbar.
I think you found a good workaround which is to disable that tool with the Enable property of the BaseCommand class. That even falls within the expected behavior of all ArcMap tools/commands (built-in or custom) which is for the tool/command to be disabled if the criteria for using it has not been met, e.g. when the Select tool becomes disabled because no feature layers have yet been added to the map. Such tool would not disappear just because its use does not apply--rather, it becomes disabled.
If for example your construction tool is for using with a point feature layer, is there a specific reason you do not want to offer your custom construction tool with all point feature layers? Will your "point" construction tool run into some trouble if it is used with a point feature layer that does not have a certain attribute field? I can only think of the fields being a problem because your "point" construction tool should apply to all point feature layers.
The reason why I want to show a point construction tool for only a specific feature layer is that I want to make the construction tool do attribute population and location validation when a point of this layer is created. The logic of calculating attribute values (such as finding the parent feature ID) and verifying locations (such as cannot be too far away from another feature) are specific for the business case, rather than reusable generic logic.
[...]Since the construction tools cannot be hidden, I will need to use other alternative method to automate attribute population and data verfication on feature creation.
But in addition to wanting to automate attribute writing and data verification, is your construction tool offering a custom way of constructing point features that is different from the built-in ones which are Point and Point at End of Line (for example, our developer sample called "Points along line construction tool" will add a construction tool to that list called Points Along Line)? If your construction tool is not offering a different, custom way of constructing point features then I would definitely consider a different custom component, such as an Editor Extension or a geodatabase customization, such as a Class Extension or a Workspace Extension.
If your construction tool does offer a different way of constructing point features in addition to automating attribute value writing, perhaps you can combine the custom construction tool with an editor extension with which you can listen for events from IEditEvents, e.g. OnCreateFeature. But this would still leave you with a construction tool that does not apply to all point feature layers. However, a construction tool (a class that implements BaseTool, IShapeConstructorTool, ISketchTool) does not need to be added as a Construction Tool, but rather to a toolbar like a regular tool, and a toolbar can be hidden or shown based on whether your editor extension is turned on or off. But then again, this would still leave you with a tool UI that would still be shown in the toolbar (disabled or enabled).