Finding a line of code in Eclipse

I am developing code in Eclipse (java). When debugging the code, I used a lot of System.out.println(...) . Now I need to delete all these lines. For this, I wrote System.out.println in Search-> Java, but it did not provide any search result. So, how can I find all the places where this System.out.println line System.out.println ?

+6
source share
7 answers

Search → File. Type "System.out.println" and select the type of files you want to find in "* .java" (without quotes)

Java Search is something else. This does not allow you to find things in java files, but methods / declarations / etc. in java files. For example, declare somewhere in your project "String canYou =" FindMe? "; and then search → Java, enter“ String ”and select“ Type ”and click“ Search. "It should find all uses of String in your project, including the aforementioned.

+10
source

Try writing System.out.println anywhere in your project, select this text, and then press ctrl + alt + g (sorry, I don’t know exactly what this search is), and it will give you all the occurrences of this line in all your projects (workplaces). I am 100% sure that this means something in the search> java - you can look more closely at what exactly. Other than that you can have conditional execution for logs - i.e.

 if(Consts.DEBUG){ Log("something"); } 
+1
source

just find println . I am sure that the eclipse interprets what you put in the regular expression.

0
source

I would do a search in the println method (ctrl + shift + g)

0
source

press Control + H

this will open a search box, go to the “File Search” tab and find the system.out.println file (

0
source

Use the menu "Search-> File" and in the field "Contains text" in the field "System.out.println *" in the field "Samples of file names" enter "* .java". Now click the Replace button in the lower right corner. Leave the "C" field blank and click the "Preview" button. Uncheck any cases that you want to save, and then click OK.

You can make sure your code is in version control before trying to do it if you do it wrong and want to come back.

0
source

We created an eclipse plugin to do the same. It will find System.out.println in your Java code and comment on it. Soon there will be a version that will also remove it. Hope this is helpful.

http://eclipseo.blogspot.in/2013/05/commenting-systemoutprintln-from.html

0
source

Source: https://habr.com/ru/post/905869/


All Articles