Intellij Ultimate does the first two already. You can create new inspections using structured search and then mark any matches as errors. I've done this to make usage of one or two awkward APIs safer. Or you can quickly write a bit of new inspection logic if your inspection can't be expressed using a structured search. Those can be stored in tree.
It also has a pretty powerful diagramming tool.