Plugin-defined custom scopes
The new "Changed files" scope is quite spiffy, and it reminded me of an idea I had a while ago but never had the need for. Is there any way in the current API to create a custom scope whose semantics is defined by the plugin. For instance, the Hibero people might want to create a custom scope for "All Hibernate configuration files". Users could then search/inspect/calculate metrics/show dependencies in just the Hibernate config files, a fairly common use case.
I might have a need for this sort of functionality soon, but don't seem to find it in the OpenAPI. Should I submit a request?
--Dave Griffith
Please sign in to leave a comment.
Hello Dave,
DG> The new "Changed files" scope is quite spiffy, and it reminded me of
DG> an idea I had a while ago but never had the need for. Is there any
DG> way in the current API to create a custom scope whose semantics is
DG> defined by the plugin. For instance, the Hibero people might want
DG> to create a custom scope for "All Hibernate configuration files".
DG> Users could then search/inspect/calculate metrics/show dependencies
DG> in just the Hibernate config files, a fairly common use case.
DG>
DG> I might have a need for this sort of functionality soon, but don't
DG> seem to find it in the OpenAPI. Should I submit a request?
I haven't looked at the code in much detail, but it looks like you can get
quite far by creating a class deriving from NamedScopesHolder, registering
it as ProjectComponent and providing a custom implementation of PackageSet
interface. All OpenAPI, but no JavaDoc. :)
--
Dmitry Jemerov
Software Developer
http://www.jetbrains.com/
"Develop with Pleasure!"
Hello Dave,
(note: the post I'm replying to was dated Aug 31, 2006)
I'd like to try writing a custom scope, and this post was the only result
of a quick search.
Two questions:
1) I'm wondering what the 'changed files' scope is that you're referring to.
I can't remember seeing anything like the in Demetra EAP, but is sounds
very similar to (recently discussed here) IDEA-11905
2) Did you succeed in creating your custom scope? If so, any advice, or better
yet, perhaps some example code that is available?
Regards,
-tt
I was never able to do this successfully. I still believe it would be a worthwhile functionality, but my use case for it passed.
--Dave Griffith
When selecting 'Analyze...Inspect Code', my 'homemade scope' is listed as
possible 'Custom scope' choice...3 times actually.
Unfortunately not yet in project view dropdown. Perhaps I need some magic
marker interface ;)
Scrap that last comment. It doesn't work for me at all.
Registering my own NamedScopesHolder seems to duplicate some other "pattern"
custom scope.
Here are some ideas I wanted to try:
1) Scope for all spring context files
2) Scope for all hibernate hbm mappings
3) Scope for all failing tests
4) Changelist scope (IDEA-11905)
A nice advantage of (1) and (2) would be that I can run a bulk inspection
on the whole of my spring configuration, a thing that does not seem easy
to do at the moment.
-tt
That was my use case as well. Sad to hear you didn't have any more luck than I.
--Dave Griffith