Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8774947
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T18:41:32+00:00 2026-06-13T18:41:32+00:00

I like when Eclipse lets me jump between parameters in a method call using

  • 0

I like when Eclipse lets me jump between parameters in a method call using a Tab key. I would like my plugin to provide a similar functionality. To be precise, I am injecting some piece of text into the editor and I would like to highlight specific syntax and let the programmer jump to the next match using the Tab key.

Here is an example. Lets suppose I dynamically created the following snippet:

String a = "bogus string";
int i = a.[?]

I will inject that into the editor and I would like that [?] is highlighted and ready for modification (user might type length()). Moreover, if there is more [?] fragments, I would like user to use Tab to move to the next one.

After researching a bit, I found that it might be done using templates. However, I can’t find any relevant examples on the Web. Does anybody have experience with this?

UPDATE:

I found two links that might be useful, although I am still not able to come up with a solution.

link one

link two

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T18:41:33+00:00Added an answer on June 13, 2026 at 6:41 pm

    Sample Handler Codes:

    AbstractTextEditor activeEditor = 
            (AbstractTextEditor) HandlerUtil.getActiveEditor(event);
    
    ISourceViewer sourceViewer = 
            (ISourceViewer) activeEditor.getAdapter(ITextOperationTarget.class);
    
    Point range = sourceViewer.getSelectedRange();
    
    // You can generate template dynamically here!
    Template template = new Template("sample", 
            "sample description", 
            "no-context", 
            "private void ${name}(){\r\n" + 
            "\tSystem.out.println(\"${name}\")\r\n"
            + "}\r\n", true);
    
    IRegion region = new Region(range.x, range.y);
    TemplateContextType contextType = new TemplateContextType("test");
    TemplateContext ctx =
        new DocumentTemplateContext(contextType, 
            sourceViewer.getDocument(), 
            range.x, 
            range.y);
    
    TemplateProposal proposal 
        = new TemplateProposal(template, ctx, region, null);
    
    proposal.apply(sourceViewer, (char) 0, 0, 0);
    

    Result:

    enter image description here

    I suggest you use org.eclipse.jdt.ui.javaCompletionProposalComputer extension. It allows you can contribute Template more legal way.

    In my codes, there are hacks since there is no way to get ISourceViewer legally. I know ISourceViewer is ITextTargetOperation itself, but it is not API(Illegal Casting). And Template is intended to designed to be used by TemplateCompletionProcessor or TemplateCompletionProposalComputer.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I would like to invoke a method, using Java Reflection. The problem is that
I would like to know what are best practises of using Eclipse Scala interpreter
Im writing a server based application and i would like eclipse to be able
I need to add Plugin support to a Java Swing App (like in Eclipse).
Is there a Visual Studio like plugin for Eclipse that will allow me create
Like the subject reads: How much good-looking UIs can be built using Eclipse RCP?
I am using team svn plugin in my eclipse helios pydev project.I deleted a
How do I call a class instance method while debugging in eclipse? For example
I have some collections that I would like to analyze in the Eclipse debugger.
I like Eclipse for a number of reasons. One of them is, when I'm

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.