简体   繁体   中英

How to add shortcuts (“templates”) to eclipse properties through my plugin?

I'm developing a plugin for visualization of objects by calling Doo.dle(Object o) . Now I'd like to automatically define a shortcut like sysout for System.out.println() , eg doodle .

I already know how to do it by hand:

Window > Preferences > Java > Editor > Templates

Is there an extension point or something similar to do this automatically with my plugin?

I managed to do it on my own:

I had to define a javaCompletionProposalComputer extension and implement an ICompletionProposal .

It's not exactly what I intended, but it's working too.

Update:

I finally found it out:

The key is to define an extension for org.eclipse.ui.editors.templates . Patterns etc. can be cheated off predifined templates in eclipse properties (see question).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM