Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » GMF (Graphical Modeling Framework) » handleNotificationEvent in editpart not called when making a change through an action, what am I doi
handleNotificationEvent in editpart not called when making a change through an action, what am I doi [message #190767] Tue, 03 June 2008 17:10 Go to next message
Brian Jakubik is currently offline Brian JakubikFriend
Messages: 140
Registered: July 2009
Senior Member
I have setup a popup menu on an element and when the action runs, it
sets an attribute on the impl using a command and the editingdomain, and
it makes the change.

However, I have my editpart to listen for the handleNotificationEvent
and it does not get it when doing this..., but does when making the
change in the properties view, am I missing something, or am I setting
this attribute in the wrong way?

The ultimate goal is to use a decorator or change the Icon, to denote
some state based on the attribute, but I'm having the same problem for
the decorator not getting a change notification... using my popup menu...

here is a snippit of my code using to change through the action...

Command sCommand = (Command) SetCommand.create(editingDomain,
mySelectedImpl, MyPackage.eINSTANCE.getBlahType_Skip(),"true");
editingDomain.getCommandStack().execute(sCommand);

Thanks
Brian Jakubik
Re: handleNotificationEvent in editpart not called when making a change through an action, what am I [message #190807 is a reply to message #190767] Tue, 03 June 2008 18:06 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: merks.ca.ibm.com

Brian,

Comments below.

Brian Jakubik wrote:
> I have setup a popup menu on an element and when the action runs, it
> sets an attribute on the impl using a command and the editingdomain,
> and it makes the change.
>
> However, I have my editpart to listen for the handleNotificationEvent
> and it does not get it when doing this..., but does when making the
> change in the properties view, am I missing something, or am I setting
> this attribute in the wrong way?
>
> The ultimate goal is to use a decorator or change the Icon, to denote
> some state based on the attribute, but I'm having the same problem for
> the decorator not getting a change notification... using my popup menu...
>
> here is a snippit of my code using to change through the action...
>
> Command sCommand = (Command)
> SetCommand.create(editingDomain, mySelectedImpl,
> MyPackage.eINSTANCE.getBlahType_Skip(),"true");
> editingDomain.getCommandStack().execute(sCommand);
Did you check if the command is actually executable? I just have this
feeling it should be Boolean.TRUE and not "true" as the value...
MyPackage.Literals.BLAH_TYPE__SKIP will be a bit more efficient.
>
>
> Thanks
> Brian Jakubik
Re: handleNotificationEvent in editpart not called when making a change through an action, what am I [message #190815 is a reply to message #190807] Tue, 03 June 2008 18:52 Go to previous messageGo to next message
Brian Jakubik is currently offline Brian JakubikFriend
Messages: 140
Registered: July 2009
Senior Member
Thanks for the response Ed,

If the skip attribute is of type String in the ecore, is Boolean.TRUE
still the correct value?

The command is not executable, and I am having issues with "Cannot
modify resource set without a write transaction" that I did not notice
before (probably had the error log closed), so i need to figure that
out. How does a command become executable?

Thanks for the tip on the literals, I am using eInstance in quite a few
other places, ill go make the change...

Thanks
Brian

Ed Merks wrote:
> Brian,
>
> Comments below.
>
> Brian Jakubik wrote:
>> I have setup a popup menu on an element and when the action runs, it
>> sets an attribute on the impl using a command and the editingdomain,
>> and it makes the change.
>>
>> However, I have my editpart to listen for the handleNotificationEvent
>> and it does not get it when doing this..., but does when making the
>> change in the properties view, am I missing something, or am I setting
>> this attribute in the wrong way?
>>
>> The ultimate goal is to use a decorator or change the Icon, to denote
>> some state based on the attribute, but I'm having the same problem for
>> the decorator not getting a change notification... using my popup menu...
>>
>> here is a snippit of my code using to change through the action...
>>
>> Command sCommand = (Command)
>> SetCommand.create(editingDomain, mySelectedImpl,
>> MyPackage.eINSTANCE.getBlahType_Skip(),"true");
>> editingDomain.getCommandStack().execute(sCommand);
> Did you check if the command is actually executable? I just have this
> feeling it should be Boolean.TRUE and not "true" as the value...
> MyPackage.Literals.BLAH_TYPE__SKIP will be a bit more efficient.
>>
>>
>> Thanks
>> Brian Jakubik
Re: handleNotificationEvent in editpart not called when making a change through an action, what am I [message #190823 is a reply to message #190815] Tue, 03 June 2008 19:13 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: merks.ca.ibm.com

Brian,

Comments below.


Brian Jakubik wrote:
> Thanks for the response Ed,
>
> If the skip attribute is of type String in the ecore, is Boolean.TRUE
> still the correct value?
No, it should be a matching value. It just seemed odd that "true" would
be a string.
>
> The command is not executable, and I am having issues with "Cannot
> modify resource set without a write transaction" that I did not
> notice before (probably had the error log closed), so i need to figure
> that out. How does a command become executable?
There is logic in each type command that tests whether the command
should be enabled. For example, it tests that the value if of the right
type for the feature. I figured executing the command should
automatically create a transaction... Are you using it's this code that
caused such a stack trace?
>
> Thanks for the tip on the literals, I am using eInstance in quite a
> few other places, ill go make the change...
>
> Thanks
> Brian
>
> Ed Merks wrote:
>> Brian,
>>
>> Comments below.
>>
>> Brian Jakubik wrote:
>>> I have setup a popup menu on an element and when the action runs, it
>>> sets an attribute on the impl using a command and the editingdomain,
>>> and it makes the change.
>>>
>>> However, I have my editpart to listen for the
>>> handleNotificationEvent and it does not get it when doing this...,
>>> but does when making the change in the properties view, am I missing
>>> something, or am I setting this attribute in the wrong way?
>>>
>>> The ultimate goal is to use a decorator or change the Icon, to
>>> denote some state based on the attribute, but I'm having the same
>>> problem for the decorator not getting a change notification... using
>>> my popup menu...
>>>
>>> here is a snippit of my code using to change through the action...
>>>
>>> Command sCommand = (Command)
>>> SetCommand.create(editingDomain, mySelectedImpl,
>>> MyPackage.eINSTANCE.getBlahType_Skip(),"true");
>>> editingDomain.getCommandStack().execute(sCommand);
>> Did you check if the command is actually executable? I just have
>> this feeling it should be Boolean.TRUE and not "true" as the
>> value... MyPackage.Literals.BLAH_TYPE__SKIP will be a bit more
>> efficient.
>>>
>>>
>>> Thanks
>>> Brian Jakubik
Re: handleNotificationEvent in editpart not called when making a change through an action, what am I [message #191063 is a reply to message #190767] Wed, 04 June 2008 16:12 Go to previous message
Brian Jakubik is currently offline Brian JakubikFriend
Messages: 140
Registered: July 2009
Senior Member
This has been resolved, I am now using the editingdomain from the
selected editpart, and can make the change and have the notiification event.

Thanks
B



Brian Jakubik wrote:
> I have setup a popup menu on an element and when the action runs, it
> sets an attribute on the impl using a command and the editingdomain, and
> it makes the change.
>
> However, I have my editpart to listen for the handleNotificationEvent
> and it does not get it when doing this..., but does when making the
> change in the properties view, am I missing something, or am I setting
> this attribute in the wrong way?
>
> The ultimate goal is to use a decorator or change the Icon, to denote
> some state based on the attribute, but I'm having the same problem for
> the decorator not getting a change notification... using my popup menu...
>
> here is a snippit of my code using to change through the action...
>
> Command sCommand = (Command)
> SetCommand.create(editingDomain, mySelectedImpl,
> MyPackage.eINSTANCE.getBlahType_Skip(),"true");
> editingDomain.getCommandStack().execute(sCommand);
>
> Thanks
> Brian Jakubik
Previous Topic:"Element A" and "Element B" should contain both "Element C"
Next Topic:Create Note option background color
Goto Forum:
  


Current Time: Thu Apr 25 12:15:54 GMT 2024

Powered by FUDForum. Page generated in 0.03345 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top