How to get the SLOC count for the Flex code in Eclipse?
Is there a plug-in similar to "Metrics" for finding information about the Flex porject?
This is the easiest way to count lines of code of any particular language and does not require a plugin.
Steps:
Click on the root folder of your project
Right-click and select Search (or Cntl+H)
In the box "Containing Text" type \n and make sure to select the "Regular Expression" checkbox
In the "File name patterns" input, type the file extensions of the files you want to include in your count, or click on "Choose" if you are feeling lazy.
Click "Search"
BAM! Instant line count for your entire project!
These instructions may differ slightly depending on your version of Eclipse, but you should be able to figure it out.
Good luck!
From this question:
http://metrics.sourceforge.net can do lines. I'm not sure about words
however.
Related
Consider a Java while-loop without a body, for example this:
while (map.values().remove(value));
When formatting it (Shift + Alt + F), Eclipse breaks the line before the semicolon and indents it:
while (map.values().remove(value))
;
How can I configure the formatter to not add these line breaks?
Be aware that by setting this semicolon to a new line, you may avoid unintended endless loops and a long search to find them.
However, in Eclipse all code formatting properties are 1) in the project properties and 2) in the Eclipse properties. The project properties inherit from the Eclipse properties.
So if you open the project properties, type "format" in the search field. It will show you a "Formatter" menu item, that may depend on the current language (at least in Java it is called "Formatter"). Then, in this example, allow the project-specific settings, and then click edit. You will see a flood of possible details you can decide.
See here:
Then, in the tab "New Lines", uncheck the checkbox "Put empty statement on new line", in the section "Empty statements".
Often you have to try and search a bit because there are really many options. The part at right shows you a preview of the code formatting.
I am having a block of code in Eclipse IDE and I want to replace that with new block of code in the whole project, can any one help me out regarding this issue.
First consider to refactor the repeated code into a function and then you can easily find/replace the function name. It will save you a lot of work.
If its just one line of code, just click ctrl+H select the so it should search in your project, when eclipse finds all results right click on the search window and select "replace all".
If its more than one line of code, enable first regular expression search, so when you select the code and hit ctrl+H eclipse will convert your text to regex, then do the search and select replace all...
(in the search window, make sure to be in the "File Search" tab.)
I've been having this problem for some time and have never bothered to fix it since Eclipse has a horrible help system and I can't seem to find the right Google keywords to find what I need.
My problem is that when I refactor a class name, eclipse looks for all potential locations of that name and replaces them.
For instance, if I have a string inside a test case for the "list command" that says something like, "List - list all the users on a team", when I refactor the List.java class to something like UserListCommand.java, the expression inside the string also changes to "UserListCommand - list all the users on a team"
This is SOOO annoying! And like I said, Google is useless when you cannot even think of the right keywords to use.
Has anyone else had this problem and solved it?
Thanks in advance.
Eclipse calls this updating textual occurrences in comments and strings. I sometimes turn this on so javadoc gets updated correctly if I didn't properly link it. But it can be a pain because it sometimes replaces substrings that match.
I've only seen this when renaming classes or interfaces (methods don't seem to do this, at least not for me),
You need to open the Rename Dialog to stop eclipse from updating textual occurrences in comments and strings:
Highlight the type you want to rename, then either:
press Shift+Alt+R
Right click, then go to refactor->rename.. then instead of typing the new name, there should now be a yellow context popup menu under the class name to be changed which says "Enter new name, press Enter to refactor", notice that there is a down arrow to expand the menu. If you press that instead of enter a new name a new drop down menu appears, select Open Rename Dialog...
Once the Rename Dialog is open:
uncheck "update textual occurences in comments and strings (forces preview)" and "Update fully qualified names in non-Java text files (forces preview)"
Hope that helps
We have one installation of Eclipse which does not show the individual lines on which search results occur as do all other installations, as shown here:
How can we turn on this feature so that individual results in each line are shown?
I think it's a question of what tool you are using. If you do a text search, you get one line per hit. But if, say, you look for references to a Java method, you get one line per file.
Although it seems like a perfectly desirable thing, I can't find any way to get Java search to return one line per hit.
In the preferences of the Search window (usually button with triangle icon) choose "Show as List" item
Is there any tool or plugin can do this? CodeBlock has this neat tool which is really nice. Wonder if it's available on Eclipse. Thanks.
http://metrics.sourceforge.net can do lines. I'm not sure about words however.
For newlines, use file search, and search for \n (with regular expressions enabled) in all of the files you want.
For words, you can just make your search term for \w+
The count is the number of matches! If you want anything fancier, make a fancier regex.
Source: http://www.binaryfrost.com/index.php?/archives/207-Easy-way-to-count-Lines-of-Code-in-Eclipse.html
Linenumber is always displayed on the lower right corner, and left if you use the context menu an left side of your edit window and check "Show Line Numbers".
Google>: "eclipse word count" shows that many people had the same problem and developed plugins.