Request for new method in ApplicationCommandManager


#1

I’m finding the ApplicationCommandManager class a bit restrictive.

Unless I’m approaching it all wrong, it doesn’t seem to lend itself well to passing commands to disparate objects. The target parsing model is pretty much hierarchical, so if a command needs to pass to a component that does not have focus, or is not a container for one that is, or a command needs to reach a target that is not a component based object at all, the only method for directing the command is:

ApplicationCommandManager::getFirstCommandTarget()

The problem there is that getFirstCommandTarget() receives no parameters, so it is not possible to know anything about the current command. That makes complex target searching impossible, and also reduces options for optimizing search paths.

What I’d like to be able to do is simply use the command group field to make a decent guess as to were the command should be going[1].

Would it be possible thereforeto add a :

getCurrentCommand()

method to the ApplicationCommandManager class. This could then be used by methods such as getFirstCommandTarget() to find out about a command that is currently being routed.

[1] Last time I bumped into this problem I just utilized a collection of specialized managers. In that case it made sense to do that, as the application is extensively scriptable. For the app I’m playing around with at the moment, that would be overkill.


#2

Good idea. I don’t think having a “current target” would be too pretty, but it certainly seems sensible to add a parameter to that method with the invocation details.


#3

Do you mean adding a parameter to getFirstCommandTarget()?

I was avoiding a request for the extra parameter as I have no idea how much existing code it’ll break…

Clearly it’s the cleaner option.


#4