Hi,
I'm an everyday C#/ASP.NET MVC/Visual Studio user and i've just started a project in JAVA/GRails/Eclipse but i'm finding it quite difficult to use Eclipse's debugging features and find them somewhat limited compared to Visual Studio's. In particular, i'm finding the following rather disappointing but i don't know if they're limitations of Eclipse as a vanilla IDE or the fact that i'm trying to use it for development using Grails.
Seemingly poor equivalent of Visual Studio's "Immediate Window" - In VS i use the Immediate window all the time during debugging and I've found that in eclipse the equivalent is the "Display" View. However, whereas in VS i can type the name of an object (e.g. "?user") and upon hitting enter i'm given all the properties/methods of the object, in eclipse i have to highlight the expression and then explicitly tell it to either Inspect, execute etc. Having done so, it then adds the results of the Inspection to another window forcing me to go between the two.
The Display View seems to be unable to actually evaluate properties or methods. If, for example, i have an instance of a User class and in the Display window i type userInstance.FirstName or call a method such as userInstance.FullName(), i get evaluation failed errors: "The method FullName() is undefined for the type Object". Furthermore, if i add a watch for the instance i can see the properties but again the method is nowhere to be seen. However, the method evaluates fine as an expression within a block of code (proving that it does exist and is recognised)
Also, although various documentations state that it's possible to add a watch by simply highlighting an object, right clicking and adding a Watch this option seems not to be there so i'm having to type the object into the Display view, highlight it and add a watch from the display view context menu.
Evaluating expressions such as User.get(params.id) (again in the Display view) returns errors such as the following:
User.get(params.id)
Evaluation failed. Reason(s): params cannot be resolved
However, it evaluates fine while stepping over the code. Is this due to the dynamic nature of Grails/Groovy?
Code snippets:
User.groovy:
class User {
String firstName
String lastName
String middleName
private String fullname
static constraints = {
firstName(blank:false)
lastName(blank:false)
middleName(blank:false)
}
public String FullName()
{
fullname = firstName + " " + lastName;
}
}
UserController.groovy:
class UserController {
...
def show = {
User userInstance = User.get(params.id)
userInstance.FullName()
if (!userInstance) {
flash.message = "${message(code: 'default.not.found.message', args: [message(code: 'user.label', default: 'User'), params.id])}"
redirect(action: "list")
}
else {
[userInstance: userInstance]
}
}
...
}
Can anyone say whether these are limitations of Eclipse, the Grails Plugins for Eclipse or possibly something else. Whatever the case, they're making development of an MVC web application using JAVA much less appealing that the equivalent ASP.NET MVC that i've used.
Thanks