Access to SWT Widgets in Parts at runtime [message #1016830] |
Thu, 07 March 2013 15:26  |
Eclipse User |
|
|
|
Hi at all,
is it possible to get access to the SWT Widgets of a Part at runtime in a Handler class?
I have a Customer View that shall act as both, view and editor. I have text fields in there and I want the text fields to be disabled / not editable by default (act as View = read-only to prevent unintentional editing) and if I invoke the "Edit Customer" command (from the main menu or context menu from view) I want the text fields in that view to be editable and in addition show a 'Save' and 'Cancel' button in that part.
I use the following code to make sure the command can be executed and the right part is active:
@CanExecute
public boolean canEditCustomer(@Optional @Named(IServiceConstants.ACTIVE_PART) MApplicationElement part) {
// true if Active part is of type "customerDetails"
if (part.getElementId().equals("com.im.ticd.app.part.customerDetails"))
return true;
else
return false;
}
But how - if at all - can I get access to my text fields in that part. I cannot cast to that implementation class as it doesn't inherit from MPart, so I think accessor methods like getNameTextField() won't work.
Any ideas on how to accomplish this?
Thx, Marina
|
|
|
|
|
Re: Access to SWT Widgets in Parts at runtime [message #1016961 is a reply to message #1016913] |
Fri, 08 March 2013 06:11  |
Eclipse User |
|
|
|
This sounds exactly like what I was looking for. I've been looking through all those MPart methods, but the JavaDoc isn't really helpful for them, because it's only the default EMF docs.
I will try that and post later whether it worked for me.
Thx for now.
[UPDATE]
Works perfectly, thanks.
[Updated on: Fri, 08 March 2013 07:29] by Moderator
|
|
|
Powered by
FUDForum. Page generated in 0.08789 seconds