I have heard that the Tooling API in 1.6 will have a preliminary support for custom models defined by 3rd party plugins. This is good news, however for good and efficient IDE integration, we will need a little more. I will describe our needs through an example (real need).
I have been working with Radim Kubacki (the developer of NetBeans Android plugin) to provide support for Android project using the new build system. This is how things go (or rather, will go) in NetBeans: Determine what models can be queried from the project (IdeaProject, AndroidProject) and load them. The problem is that I cannot determine this. Currently, the only way I can think of is to attempt requesting each model separately and see if they are available. This is however has an unacceptable performance overhead (last time I checked it had) in a common case where not every model is available (possibly because it is a plain j2se project).
My idea is that I can specify all my possible needs to Gradle in a single call. This way, I expect that Gradle can efficiently decide what is available and what is not and return only the available models.
One extra useful feature would help with possible future evolution of models: For each queried model, allow to specify a fall-back model. That is, assume that the ProjectConnection.getModel takes an argument ‘List<List<Class<?>> requested’, then each element of ‘requested’ defines a single model request. An element of ‘requested’ (a ‘List<Class<?>’) requires that a single model is to be returned, the first model that is available as defined by the order of the list. As an example assume the following request: ‘[[IdeaProject.class], [AndroidProject2.class, AndroidProject.class]]’. If all these classes are available then an instance of ‘IdeaProject’ and ‘AndroidProject2’ is returned. If ‘AndroidProject2’ is not available then ‘AndroidProject’ is returned instead. If not even ‘AndroidProject’ is available then only ‘IdeaProject’ is returned (etc.).