Petros Tsialiamanis
Petros Tsialiamanis

Reputation: 2758

Search static blocks in Eclipse

Is it possible to search for all static blocks in the code of a java project using Eclipse IDE ?

public class ExampleClass {

  static 
  {
    ...
  }

}

Upvotes: 2

Views: 560

Answers (1)

Andy Thomas
Andy Thomas

Reputation: 86459

Search for the regular expression static\s*\{

This expression works even if the curly brace is on the subsequent line, as shown in your example.

Details:

  • Use menu item Search>Search...
  • In the dialog that appears:
    • In the field Containing text, enter static\s*\{
    • Click the Regular expression checkbox.
    • Under File name patterns, put *.java.

Upvotes: 3

Related Questions