Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Remote Application Platform (RAP) » EditorPart behaviour
EditorPart behaviour [message #79744] Fri, 28 March 2008 11:08 Go to next message
Mike Wrighton is currently offline Mike WrightonFriend
Messages: 19
Registered: July 2009
Junior Member
Hi,

I'm experiencing some strange behaviour in my EditorPart with regards to
the 'dirty' state. I'm using a third party javascript editor as the
actual widget, which sends a request to the server every time it becomes
dirty after a save. This results in a call to setDirty(true) (copied
from the BarEditor example) which calls firePropertyChange(PROP_DIRTY).

The strange thing is that when I call setDirty(true) manually from a
button action, everything is fine - the Save buttons become enabled and
the editor title is prefixed with an asterisk, but when the same method
is called from my listener (originates from readData()) none of these UI
updates happen. My listener method is as follows:

public void dirty() {
Display.getCurrent().syncExec(new Runnable(){
public void run(){
setDirty(true);
}
});
}

I'd be greatful if anyone could shine any light on this.

Cheers,
Mike
Re: EditorPart behaviour [message #79774 is a reply to message #79744] Fri, 28 March 2008 12:45 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: fappel.innoopract.com

Hi,

did you debug that the code gets executed? How does the third party
javascript sends the information to the server? In particular is it
ensured that the RWT lifecycle gets invoked?


Ciao
Frank

-----Ursprüngliche Nachricht-----
Von: Mike Wrighton [mailto:mike.wrighton@googlemail.com]
Bereitgestellt: Freitag, 28. März 2008 12:09
Bereitgestellt in: eclipse.technology.rap
Unterhaltung: EditorPart behaviour
Betreff: EditorPart behaviour


Hi,

I'm experiencing some strange behaviour in my EditorPart with regards to
the 'dirty' state. I'm using a third party javascript editor as the
actual widget, which sends a request to the server every time it becomes
dirty after a save. This results in a call to setDirty(true) (copied
from the BarEditor example) which calls firePropertyChange(PROP_DIRTY).

The strange thing is that when I call setDirty(true) manually from a
button action, everything is fine - the Save buttons become enabled and
the editor title is prefixed with an asterisk, but when the same method
is called from my listener (originates from readData()) none of these UI
updates happen. My listener method is as follows:

public void dirty() {
Display.getCurrent().syncExec(new Runnable(){
public void run(){
setDirty(true);
}
});
}

I'd be greatful if anyone could shine any light on this.

Cheers,
Mike
Re: EditorPart behaviour [message #79788 is a reply to message #79774] Fri, 28 March 2008 13:41 Go to previous messageGo to next message
Mike Wrighton is currently offline Mike WrightonFriend
Messages: 19
Registered: July 2009
Junior Member
I'm sending a string via org.eclipse.swt.Request.getInstance().send()
and I can see that string appear in the readData() method of my LCA
class - this is how setDirty() gets called in my editor.

Frank Appel wrote:
> Hi,
>
> did you debug that the code gets executed? How does the third party
> javascript sends the information to the server? In particular is it
> ensured that the RWT lifecycle gets invoked?
>
>
> Ciao
> Frank
>
> -----Ursprüngliche Nachricht-----
> Von: Mike Wrighton [mailto:mike.wrighton@googlemail.com]
> Bereitgestellt: Freitag, 28. März 2008 12:09
> Bereitgestellt in: eclipse.technology.rap
> Unterhaltung: EditorPart behaviour
> Betreff: EditorPart behaviour
>
>
> Hi,
>
> I'm experiencing some strange behaviour in my EditorPart with regards to
> the 'dirty' state. I'm using a third party javascript editor as the
> actual widget, which sends a request to the server every time it becomes
> dirty after a save. This results in a call to setDirty(true) (copied
> from the BarEditor example) which calls firePropertyChange(PROP_DIRTY).
>
> The strange thing is that when I call setDirty(true) manually from a
> button action, everything is fine - the Save buttons become enabled and
> the editor title is prefixed with an asterisk, but when the same method
> is called from my listener (originates from readData()) none of these UI
> updates happen. My listener method is as follows:
>
> public void dirty() {
> Display.getCurrent().syncExec(new Runnable(){
> public void run(){
> setDirty(true);
> }
> });
> }
>
> I'd be greatful if anyone could shine any light on this.
>
> Cheers,
> Mike
>
Re: EditorPart behaviour [message #79816 is a reply to message #79788] Fri, 28 March 2008 13:53 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: fappel.innoopract.com

Hi,

I think it has something to do with the different phases. Button's
selection listeners are invoked during process action, while your
invocation takes place in readdata. Events are not directly processed
during ReadData for example (see TypedEvent#processEvent() to get an
impression). So it would be interesting what exactly you are doing in
your LCA


Ciao
Frank

-----Ursprüngliche Nachricht-----
Von: Mike Wrighton [mailto:mike.wrighton@googlemail.com]
Bereitgestellt: Freitag, 28. März 2008 14:41
Bereitgestellt in: eclipse.technology.rap
Unterhaltung: EditorPart behaviour
Betreff: Re: EditorPart behaviour


I'm sending a string via org.eclipse.swt.Request.getInstance().send()
and I can see that string appear in the readData() method of my LCA
class - this is how setDirty() gets called in my editor.

Frank Appel wrote:
> Hi,
>
> did you debug that the code gets executed? How does the third party
> javascript sends the information to the server? In particular is it
> ensured that the RWT lifecycle gets invoked?
>
>
> Ciao
> Frank
>
> -----Ursprüngliche Nachricht-----
> Von: Mike Wrighton [mailto:mike.wrighton@googlemail.com]
> Bereitgestellt: Freitag, 28. März 2008 12:09 Bereitgestellt in:
> eclipse.technology.rap
> Unterhaltung: EditorPart behaviour
> Betreff: EditorPart behaviour
>
>
> Hi,
>
> I'm experiencing some strange behaviour in my EditorPart with regards
> to the 'dirty' state. I'm using a third party javascript editor as the

> actual widget, which sends a request to the server every time it
> becomes dirty after a save. This results in a call to setDirty(true)
> (copied from the BarEditor example) which calls
firePropertyChange(PROP_DIRTY).
>
> The strange thing is that when I call setDirty(true) manually from a
> button action, everything is fine - the Save buttons become enabled
> and the editor title is prefixed with an asterisk, but when the same
> method is called from my listener (originates from readData()) none of

> these UI updates happen. My listener method is as follows:
>
> public void dirty() {
> Display.getCurrent().syncExec(new Runnable(){
> public void run(){
> setDirty(true);
> }
> });
> }
>
> I'd be greatful if anyone could shine any light on this.
>
> Cheers,
> Mike
>
Re: EditorPart behaviour [message #79831 is a reply to message #79816] Fri, 28 March 2008 14:12 Go to previous messageGo to next message
Mike Wrighton is currently offline Mike WrightonFriend
Messages: 19
Registered: July 2009
Junior Member
It does very little really, bascically this:

public void readData( final Widget widget ) {
final MyWidget w = (MyWidget) widget;
final String isDirty = WidgetLCAUtil.readPropertyValue(w, "dirty");
if (isDirty != null){
w.fireDirtyEvent();
}

(my EditPart is listening to w, and calls setDirty accordingly)

I don't fully understand the various phases but do you know if there's a
way round this?

Frank Appel wrote:
> Hi,
>
> I think it has something to do with the different phases. Button's
> selection listeners are invoked during process action, while your
> invocation takes place in readdata. Events are not directly processed
> during ReadData for example (see TypedEvent#processEvent() to get an
> impression). So it would be interesting what exactly you are doing in
> your LCA
>
>
> Ciao
> Frank
>
> -----Ursprüngliche Nachricht-----
> Von: Mike Wrighton [mailto:mike.wrighton@googlemail.com]
> Bereitgestellt: Freitag, 28. März 2008 14:41
> Bereitgestellt in: eclipse.technology.rap
> Unterhaltung: EditorPart behaviour
> Betreff: Re: EditorPart behaviour
>
>
> I'm sending a string via org.eclipse.swt.Request.getInstance().send()
> and I can see that string appear in the readData() method of my LCA
> class - this is how setDirty() gets called in my editor.
>
> Frank Appel wrote:
>> Hi,
>>
>> did you debug that the code gets executed? How does the third party
>> javascript sends the information to the server? In particular is it
>> ensured that the RWT lifecycle gets invoked?
>>
>>
>> Ciao
>> Frank
>>
>> -----Ursprüngliche Nachricht-----
>> Von: Mike Wrighton [mailto:mike.wrighton@googlemail.com]
>> Bereitgestellt: Freitag, 28. März 2008 12:09 Bereitgestellt in:
>> eclipse.technology.rap
>> Unterhaltung: EditorPart behaviour
>> Betreff: EditorPart behaviour
>>
>>
>> Hi,
>>
>> I'm experiencing some strange behaviour in my EditorPart with regards
>> to the 'dirty' state. I'm using a third party javascript editor as the
>
>> actual widget, which sends a request to the server every time it
>> becomes dirty after a save. This results in a call to setDirty(true)
>> (copied from the BarEditor example) which calls
> firePropertyChange(PROP_DIRTY).
>> The strange thing is that when I call setDirty(true) manually from a
>> button action, everything is fine - the Save buttons become enabled
>> and the editor title is prefixed with an asterisk, but when the same
>> method is called from my listener (originates from readData()) none of
>
>> these UI updates happen. My listener method is as follows:
>>
>> public void dirty() {
>> Display.getCurrent().syncExec(new Runnable(){
>> public void run(){
>> setDirty(true);
>> }
>> });
>> }
>>
>> I'd be greatful if anyone could shine any light on this.
>>
>> Cheers,
>> Mike
>>
>
Re: EditorPart behaviour [message #79846 is a reply to message #79831] Fri, 28 March 2008 14:33 Go to previous messageGo to next message
Benjamin Muskalla is currently offline Benjamin MuskallaFriend
Messages: 237
Registered: July 2009
Senior Member
You can pass a runnable with your fireDirtyEvent to the
ProcessActionRunner. That may help to fire the event in the correct
phase of the lifecycle.

Greets
Benny

Mike Wrighton wrote:
> It does very little really, bascically this:
>
> public void readData( final Widget widget ) {
> final MyWidget w = (MyWidget) widget;
> final String isDirty = WidgetLCAUtil.readPropertyValue(w, "dirty");
> if (isDirty != null){
> w.fireDirtyEvent();
> }
>
> (my EditPart is listening to w, and calls setDirty accordingly)
>
> I don't fully understand the various phases but do you know if there's a
> way round this?
>
> Frank Appel wrote:
>> Hi,
>>
>> I think it has something to do with the different phases. Button's
>> selection listeners are invoked during process action, while your
>> invocation takes place in readdata. Events are not directly processed
>> during ReadData for example (see TypedEvent#processEvent() to get an
>> impression). So it would be interesting what exactly you are doing in
>> your LCA
>>
>>
>> Ciao
>> Frank
>>
>> -----Ursprüngliche Nachricht-----
>> Von: Mike Wrighton [mailto:mike.wrighton@googlemail.com]
>> Bereitgestellt: Freitag, 28. März 2008 14:41
>> Bereitgestellt in: eclipse.technology.rap
>> Unterhaltung: EditorPart behaviour
>> Betreff: Re: EditorPart behaviour
>>
>>
>> I'm sending a string via org.eclipse.swt.Request.getInstance().send()
>> and I can see that string appear in the readData() method of my LCA
>> class - this is how setDirty() gets called in my editor.
>>
>> Frank Appel wrote:
>>> Hi,
>>>
>>> did you debug that the code gets executed? How does the third party
>>> javascript sends the information to the server? In particular is it
>>> ensured that the RWT lifecycle gets invoked?
>>>
>>>
>>> Ciao
>>> Frank
>>>
>>> -----Ursprüngliche Nachricht-----
>>> Von: Mike Wrighton [mailto:mike.wrighton@googlemail.com]
>>> Bereitgestellt: Freitag, 28. März 2008 12:09 Bereitgestellt in:
>>> eclipse.technology.rap
>>> Unterhaltung: EditorPart behaviour
>>> Betreff: EditorPart behaviour
>>>
>>>
>>> Hi,
>>>
>>> I'm experiencing some strange behaviour in my EditorPart with regards
>>> to the 'dirty' state. I'm using a third party javascript editor as the
>>
>>> actual widget, which sends a request to the server every time it
>>> becomes dirty after a save. This results in a call to setDirty(true)
>>> (copied from the BarEditor example) which calls
>> firePropertyChange(PROP_DIRTY).
>>> The strange thing is that when I call setDirty(true) manually from a
>>> button action, everything is fine - the Save buttons become enabled
>>> and the editor title is prefixed with an asterisk, but when the same
>>> method is called from my listener (originates from readData()) none of
>>
>>> these UI updates happen. My listener method is as follows:
>>>
>>> public void dirty() {
>>> Display.getCurrent().syncExec(new Runnable(){
>>> public void run(){
>>> setDirty(true);
>>> }
>>> });
>>> }
>>>
>>> I'd be greatful if anyone could shine any light on this.
>>>
>>> Cheers,
>>> Mike
>>>
>>
Re: EditorPart behaviour [message #79861 is a reply to message #79846] Fri, 28 March 2008 14:57 Go to previous message
Mike Wrighton is currently offline Mike WrightonFriend
Messages: 19
Registered: July 2009
Junior Member
Yep that did it, thanks!

The only other issue with this is that it appears as though readData()
is only being called when my editor changes focus - in other words, if I
type some text, I have to click on another view for the dirty state to
become enabled. Is this normal behaviour?


Benjamin Muskalla wrote:
> You can pass a runnable with your fireDirtyEvent to the
> ProcessActionRunner. That may help to fire the event in the correct
> phase of the lifecycle.
>
> Greets
> Benny
>
> Mike Wrighton wrote:
>> It does very little really, bascically this:
>>
>> public void readData( final Widget widget ) {
>> final MyWidget w = (MyWidget) widget;
>> final String isDirty = WidgetLCAUtil.readPropertyValue(w, "dirty");
>> if (isDirty != null){
>> w.fireDirtyEvent();
>> }
>>
>> (my EditPart is listening to w, and calls setDirty accordingly)
>>
>> I don't fully understand the various phases but do you know if there's
>> a way round this?
>>
>> Frank Appel wrote:
>>> Hi,
>>>
>>> I think it has something to do with the different phases. Button's
>>> selection listeners are invoked during process action, while your
>>> invocation takes place in readdata. Events are not directly processed
>>> during ReadData for example (see TypedEvent#processEvent() to get an
>>> impression). So it would be interesting what exactly you are doing in
>>> your LCA
>>>
>>>
>>> Ciao
>>> Frank
>>>
>>> -----Ursprüngliche Nachricht-----
>>> Von: Mike Wrighton [mailto:mike.wrighton@googlemail.com]
>>> Bereitgestellt: Freitag, 28. März 2008 14:41
>>> Bereitgestellt in: eclipse.technology.rap
>>> Unterhaltung: EditorPart behaviour
>>> Betreff: Re: EditorPart behaviour
>>>
>>>
>>> I'm sending a string via org.eclipse.swt.Request.getInstance().send()
>>> and I can see that string appear in the readData() method of my LCA
>>> class - this is how setDirty() gets called in my editor.
>>>
>>> Frank Appel wrote:
>>>> Hi,
>>>>
>>>> did you debug that the code gets executed? How does the third party
>>>> javascript sends the information to the server? In particular is it
>>>> ensured that the RWT lifecycle gets invoked?
>>>>
>>>>
>>>> Ciao
>>>> Frank
>>>>
>>>> -----Ursprüngliche Nachricht-----
>>>> Von: Mike Wrighton [mailto:mike.wrighton@googlemail.com]
>>>> Bereitgestellt: Freitag, 28. März 2008 12:09 Bereitgestellt in:
>>>> eclipse.technology.rap
>>>> Unterhaltung: EditorPart behaviour
>>>> Betreff: EditorPart behaviour
>>>>
>>>>
>>>> Hi,
>>>>
>>>> I'm experiencing some strange behaviour in my EditorPart with regards
>>>> to the 'dirty' state. I'm using a third party javascript editor as the
>>>
>>>> actual widget, which sends a request to the server every time it
>>>> becomes dirty after a save. This results in a call to setDirty(true)
>>>> (copied from the BarEditor example) which calls
>>> firePropertyChange(PROP_DIRTY).
>>>> The strange thing is that when I call setDirty(true) manually from a
>>>> button action, everything is fine - the Save buttons become enabled
>>>> and the editor title is prefixed with an asterisk, but when the same
>>>> method is called from my listener (originates from readData()) none of
>>>
>>>> these UI updates happen. My listener method is as follows:
>>>>
>>>> public void dirty() {
>>>> Display.getCurrent().syncExec(new Runnable(){
>>>> public void run(){
>>>> setDirty(true);
>>>> }
>>>> });
>>>> }
>>>>
>>>> I'd be greatful if anyone could shine any light on this.
>>>>
>>>> Cheers,
>>>> Mike
>>>>
>>>
Previous Topic:Redirect url Issue
Next Topic:RAP running in JSP
Goto Forum:
  


Current Time: Fri Apr 26 09:12:48 GMT 2024

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

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

Back to the top