Reputation: 237
I have a large number of classes and an interface. All I want to do it select all of the classes and add "implements " to each of them without having to do it manually. Is this possible?
that is ALL I want to do, simply add the implementation
Upvotes: 2
Views: 1877
Reputation: 95
Select the class in Eclipse, right click on it and go to Properties.
Upvotes: 0
Reputation: 1235
Use search and Replace all feature for this project in eclipse.
EDIT
A very basic replace is like this
search (ctrl+H and select File Search make sure regex is checked. Also you can search only this project with .java files) for all occurrence of the following regex
(public class+ \w+\s+)
Click replace button (shown in File Search or in search results) and enter the following string to replace
$1 implements myinterface
Basically The regex (public class+ \w+\s+)
value is captured in $1
. this might not work in cases where there are inner classes etc
You might need to import this interface to prevent any compiler errors.(may be one more regex :)
Note: make sure you use the 'preview' option before you replace all occurrence in 'Replace text matches window'
Upvotes: 2