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 8035673
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T02:22:31+00:00 2026-06-05T02:22:31+00:00

I think this is not supported in Eclipse, but I would like to find

  • 0

I think this is not supported in Eclipse, but I would like to find each closing bracket of each method I declare and replace it with one more code line before it closes.

I tried to find by regex “public.*\}” or “public[.\s]*\}” but it does not find a single method declaration.

Although some posts declare that Eclipse has multi-line search&replace capabilities, using regular expressions. I think it is not so.
The examples usually given just recognize a specific newline when the regex know where it is expected.

  • 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-05T02:22:34+00:00Added an answer on June 5, 2026 at 2:22 am

    This is possible but not with regexp. Instead, write a small Java program and add org.eclipse.jdt.core_3*.jar to the classpath. You can find this JAR in the plugins/ folder of your Eclipse installation.

    The JAR contains the Eclipse compiler which has an API to convert Java source to the AST. Iterate over the AST, locale all methods and add the new code using AST nodes. There are methods to turn an AST into a string. Use that to generate the new source code.

    If you have no idea how the new AST nodes should look like, add the code to a single method and print the result.

    Another alternative would be to use AOP which allows you to wrap methods at runtime.

    [EDIT] See the code in org.eclipse.jdt.internal.corext.refactoring.surround.SurroundWithTryCatchRefactoring
    for an example (source on grepcode)

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

Sidebar

Related Questions

I think this is a simple question, but I can not find the answer
This is not 100% programming related. But I think this is somewhat useful because
I think this should be fairly easy but I'm not familiar with how it's
This is not necessarily specific to ActionScript 3 but I could not think off
This line will not work but I think I have used correct xpath? driver.findElement(By.xpath(//a[contains(@class,'cke_button_bold')])).click();
I've been searching for a while and everybody seems to think this is not
I have not been using MVC3 for that long and think this is a
I am not familiar with Ivy. I think this is some utility to automatically
I saw this question and some similar and I think it's not duplicate :
I think regular expressions might be able to accomplish this, if not then string

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.