class MyView extends ViewPart {
public void createPartControl(Composite composite) {
}
public void setFocus(){
}
}
def view = new MyView();
view
The first disappointment was that I couldn't write the method declarations in a groovy way, using def, because it was yelling that the abstract methods should be implemented. Thus I conclude that I cannot implement the abstract methods using def.
So far, so good... OK, when I executed the above script I got a nice stack trace, saying that "A part must be equal to itself", and/or "A part must have a meaningful equals method". This was a message from org.eclipse.ui.internal.PartTester#testWorkbenchPart(), that checks the brand new part for some strange things, like part.equals(new Integer(32)). Why 32, can anyone tell!?
So I implemented a goofy equals() for my script object, just to make it work. Here's the example code: view.groovy.
No comments:
Post a Comment