class for the misc/singletons template

Hi,

In hope to see how to write a template which searches for a featured  (test/static, etc) and regexped (contains specifically named variable/other method) method (as here http://devnet.jetbrains.net/thread/437773?tstart=0) I browsed list of predefined templates and found singletons template which contains $SomeStatement$; variable. It seemed to be what I want - if there is a variable which corresponds to an arbitrary content then a regexp can be applied to that content and that should give me what I need. But then I realized that singletons template doesn't find any of the singletons in my project. So I wrote one which matches it 100%. Here is it:

class Testttt {
    private Testttt(String xxx) {
        System.out.println(xxx);
    }
    private static Testttt inst;
    static Testttt getInst() {
        inst = new Testttt("xxx");
        return inst;
    }
}

Even blank spaces as in template, although the shouldn't matter, if I understand documentation correctly.

But Testttt is still not found. So the question, why my singleton is not found by predefined misc/singletons template?

Best regards, Eugene.

2 comments
Comment actions Permalink

  inst = new Testttt("xxx");
        return inst;



that is not really a singleton...
0
Comment actions Permalink

Well, yes. Do you think Intellij search engine is so clever that it omits awry singletons?

0

Please sign in to leave a comment.