Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Platform » Correct strategy for handling page changes in FormEditor
Correct strategy for handling page changes in FormEditor [message #334992] Fri, 13 March 2009 18:40 Go to next message
Eclipse UserFriend
Originally posted by: riwright.adobe.com

I am building an editor based on FormEditor that will have a several pages,
several form pages and an XML editor - very similar to the PDEEditor. My
question is what is the best approach to tracking when the user leaves a
page? There is a notification when I go to a new page, but it is not
obvious how I get told the user is leaving the old one. I ask because it
seems like that would be the best time to update my model if the page is
dirty. I'm probably missing something, but it's not obvious how I can
detect that the page is about to change. All I seem to see is the page has
ALREADY changed. Looked though the PDEEditor source, but I am not yet seeing
how they do it.

TIA, Ric
Re: Correct strategy for handling page changes in FormEditor [message #334993 is a reply to message #334992] Fri, 13 March 2009 18:56 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: riwright.adobe.com

Doh. Easy enough it would appear, simply track what the last call to
pageChange was. I was thinking of the pages in terms of being more volatile
(i.e. I needed to retrieve their contents before they went away). And I do
see that setActive is called on the new page after the call to pageChange.
Now I just need to figure out how/when the XMLEditor gets an equivalent call
to setActive on a FormPage.

Ric


On 3/13/09 11:40 AM, in article C5DFF6A4.249BE%riwright@adobe.com, "Ric
Wright" <riwright@adobe.com> wrote:

> I am building an editor based on FormEditor that will have a several pages,
> several form pages and an XML editor - very similar to the PDEEditor. My
> question is what is the best approach to tracking when the user leaves a
> page? There is a notification when I go to a new page, but it is not
> obvious how I get told the user is leaving the old one. I ask because it
> seems like that would be the best time to update my model if the page is
> dirty. I'm probably missing something, but it's not obvious how I can
> detect that the page is about to change. All I seem to see is the page has
> ALREADY changed. Looked though the PDEEditor source, but I am not yet seeing
> how they do it.
>
> TIA, Ric
>
Re: Correct strategy for handling page changes in FormEditor [message #334994 is a reply to message #334993] Fri, 13 March 2009 19:19 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: riwright.adobe.com

(Well, I really seem to be talking to myself again - I seem to do a lot of
that ;-)

So, it appears that I can track the switch to the XMLEditor via the call
setFocus on the WorkbenchPart that is the basis of the Editor. Is that a
good strategy?

TIA, Ric


On 3/13/09 11:56 AM, in article C5DFFA7C.249CC%riwright@adobe.com, "Ric
Wright" <riwright@adobe.com> wrote:

> Doh. Easy enough it would appear, simply track what the last call to
> pageChange was. I was thinking of the pages in terms of being more volatile
> (i.e. I needed to retrieve their contents before they went away). And I do
> see that setActive is called on the new page after the call to pageChange.
> Now I just need to figure out how/when the XMLEditor gets an equivalent call
> to setActive on a FormPage.
>
> Ric
>
>
> On 3/13/09 11:40 AM, in article C5DFF6A4.249BE%riwright@adobe.com, "Ric
> Wright" <riwright@adobe.com> wrote:
>
>> I am building an editor based on FormEditor that will have a several pages,
>> several form pages and an XML editor - very similar to the PDEEditor. My
>> question is what is the best approach to tracking when the user leaves a
>> page? There is a notification when I go to a new page, but it is not
>> obvious how I get told the user is leaving the old one. I ask because it
>> seems like that would be the best time to update my model if the page is
>> dirty. I'm probably missing something, but it's not obvious how I can
>> detect that the page is about to change. All I seem to see is the page has
>> ALREADY changed. Looked though the PDEEditor source, but I am not yet seeing
>> how they do it.
>>
>> TIA, Ric
>>
>
Detecting leaving a page in the FormEditor [message #334998 is a reply to message #334994] Sat, 14 March 2009 14:21 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: riwright.adobe.com

I realized there is at least one case where I really need to know before the
user leaves a page in the FormEditor. If the user edits the XML and mangles
it such that it is no longer well-formed, I can't permit them to leave that
page until they have fixed it. This is how the PDEEditor works. If you
mangle the XML then try to leave it puts up an error dialog telling you that
you cannot edit other pages until the error is corrected.

So... Does anyone know a good way to detect when the user is leaving a
FormPage or, more importantly, an IEditorPart page? I'll try to spelunk
through the PDEEditor source, but it wasn't obvious on the first pass.

TIA, Ric



On 3/13/09 12:19 PM, in article C5DFFFEF.249E2%riwright@adobe.com, "Ric
Wright" <riwright@adobe.com> wrote:

> (Well, I really seem to be talking to myself again - I seem to do a lot of
> that ;-)
>
> So, it appears that I can track the switch to the XMLEditor via the call
> setFocus on the WorkbenchPart that is the basis of the Editor. Is that a
> good strategy?
>
> TIA, Ric
>
>
> On 3/13/09 11:56 AM, in article C5DFFA7C.249CC%riwright@adobe.com, "Ric
> Wright" <riwright@adobe.com> wrote:
>
>> Doh. Easy enough it would appear, simply track what the last call to
>> pageChange was. I was thinking of the pages in terms of being more volatile
>> (i.e. I needed to retrieve their contents before they went away). And I do
>> see that setActive is called on the new page after the call to pageChange.
>> Now I just need to figure out how/when the XMLEditor gets an equivalent call
>> to setActive on a FormPage.
>>
>> Ric
>>
>>
>> On 3/13/09 11:40 AM, in article C5DFF6A4.249BE%riwright@adobe.com, "Ric
>> Wright" <riwright@adobe.com> wrote:
>>
>>> I am building an editor based on FormEditor that will have a several pages,
>>> several form pages and an XML editor - very similar to the PDEEditor. My
>>> question is what is the best approach to tracking when the user leaves a
>>> page? There is a notification when I go to a new page, but it is not
>>> obvious how I get told the user is leaving the old one. I ask because it
>>> seems like that would be the best time to update my model if the page is
>>> dirty. I'm probably missing something, but it's not obvious how I can
>>> detect that the page is about to change. All I seem to see is the page has
>>> ALREADY changed. Looked though the PDEEditor source, but I am not yet seeing
>>> how they do it.
>>>
>>> TIA, Ric
>>>
>>
>
Re: Detecting leaving a page in the FormEditor [message #335000 is a reply to message #334998] Sat, 14 March 2009 20:32 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: riwright.adobe.com

For FormPages, there is canLeavePage(). Easy enough. But for my XMLEditor,
it looks like the answer is to implement the IFormPage interface in my
editor. At least that's what I am investigating. If there is a better way,
I would be happy to hear about it.

Ric


On 3/14/09 7:21 AM, in article C5E10B74.24AB7%riwright@adobe.com, "Ric
Wright" <riwright@adobe.com> wrote:

> I realized there is at least one case where I really need to know before the
> user leaves a page in the FormEditor. If the user edits the XML and mangles
> it such that it is no longer well-formed, I can't permit them to leave that
> page until they have fixed it. This is how the PDEEditor works. If you
> mangle the XML then try to leave it puts up an error dialog telling you that
> you cannot edit other pages until the error is corrected.
>
> So... Does anyone know a good way to detect when the user is leaving a
> FormPage or, more importantly, an IEditorPart page? I'll try to spelunk
> through the PDEEditor source, but it wasn't obvious on the first pass.
>
> TIA, Ric
>
>
>
> On 3/13/09 12:19 PM, in article C5DFFFEF.249E2%riwright@adobe.com, "Ric
> Wright" <riwright@adobe.com> wrote:
>
>> (Well, I really seem to be talking to myself again - I seem to do a lot of
>> that ;-)
>>
>> So, it appears that I can track the switch to the XMLEditor via the call
>> setFocus on the WorkbenchPart that is the basis of the Editor. Is that a
>> good strategy?
>>
>> TIA, Ric
>>
>>
>> On 3/13/09 11:56 AM, in article C5DFFA7C.249CC%riwright@adobe.com, "Ric
>> Wright" <riwright@adobe.com> wrote:
>>
>>> Doh. Easy enough it would appear, simply track what the last call to
>>> pageChange was. I was thinking of the pages in terms of being more volatile
>>> (i.e. I needed to retrieve their contents before they went away). And I do
>>> see that setActive is called on the new page after the call to pageChange.
>>> Now I just need to figure out how/when the XMLEditor gets an equivalent call
>>> to setActive on a FormPage.
>>>
>>> Ric
>>>
>>>
>>> On 3/13/09 11:40 AM, in article C5DFF6A4.249BE%riwright@adobe.com, "Ric
>>> Wright" <riwright@adobe.com> wrote:
>>>
>>>> I am building an editor based on FormEditor that will have a several pages,
>>>> several form pages and an XML editor - very similar to the PDEEditor. My
>>>> question is what is the best approach to tracking when the user leaves a
>>>> page? There is a notification when I go to a new page, but it is not
>>>> obvious how I get told the user is leaving the old one. I ask because it
>>>> seems like that would be the best time to update my model if the page is
>>>> dirty. I'm probably missing something, but it's not obvious how I can
>>>> detect that the page is about to change. All I seem to see is the page has
>>>> ALREADY changed. Looked though the PDEEditor source, but I am not yet
>>>> seeing
>>>> how they do it.
>>>>
>>>> TIA, Ric
>>>>
>>>
>>
>
Re: Correct strategy for handling page changes in FormEditor [message #335018 is a reply to message #334992] Mon, 16 March 2009 18:26 Go to previous message
Eclipse UserFriend
Originally posted by: eclipse-news.rizzoweb.com

On 3/13/2009 2:40 PM, Ric Wright wrote:
> I am building an editor based on FormEditor that will have a several pages,
> several form pages and an XML editor - very similar to the PDEEditor. My
> question is what is the best approach to tracking when the user leaves a
> page? There is a notification when I go to a new page, but it is not
> obvious how I get told the user is leaving the old one. I ask because it
> seems like that would be the best time to update my model if the page is
> dirty. I'm probably missing something, but it's not obvious how I can
> detect that the page is about to change. All I seem to see is the page has
> ALREADY changed. Looked though the PDEEditor source, but I am not yet seeing
> how they do it.

You might look into the Data Binding framework to keep your model and
views in sync at all times, rather than wait until the page is changed.
In 3.5 the API has improved a lot and there is now some beta-level
support for binding to XML directly
(https://bugs.eclipse.org/bugs/show_bug.cgi?id=243380)

Hope this helps,
Eric
Previous Topic:DataBinding allow only digit?
Next Topic:[expressions] how to use custom variable resolvers
Goto Forum:
  


Current Time: Thu Apr 25 04:51:05 GMT 2024

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

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

Back to the top