Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » GEF » Strategy to handle empty editor inputs
Strategy to handle empty editor inputs [message #157616] Thu, 11 November 2004 02:08 Go to next message
Eclipse UserFriend
Originally posted by: Lamont_Gilbert.rigidsoftware.com

I noticed that if i create a logic example, then go to the filesystem
and delete it, then double click it in the project, the logic program
does not explode.

currently my application explodes with selection errors and i have to
end eclipse with ctrl-alt-del or stop the debugger.

What technique should I used when I am passed a FileEditorInput that
happens to not actually contain a file?

The errors are from the UI thread or at least that is where I am
catching them, and that really does not tell me anything. I think the
class that is initiating the error is not logging it appropriately and
thus I can not trace back to it...


--
Respectfully,


CL Gilbert

"Verily, verily, I say unto you, He that entereth not by the door() into
the sheepfold{}, but climbeth up some other *way, the same is a thief
and a robber." John 10:1

GnuPG Key Fingerprint:
82A6 8893 C2A1 F64E A9AD 19AE 55B2 4CD7 80D2 0A2D

For a free Java interface to Freechess.org see
http://www.rigidsoftware.com/Chess/chess.html
Re: Strategy to handle empty editor inputs [message #157728 is a reply to message #157616] Thu, 11 November 2004 21:57 Go to previous messageGo to next message
Pratik Shah is currently offline Pratik ShahFriend
Messages: 1077
Registered: July 2009
Senior Member
Look at LogicEditor#setInput(). It fails to read data from the file and
prints that exception to stderr. But it doesn't "blow up" because
logicDiagram is initialized to a new instance of LogicDiagram, and that
serves as the contents for the viewer.

"CL [dnoyeb] Gilbert" <Lamont_Gilbert@rigidsoftware.com> wrote in message
news:cmuhhi$c4$1@eclipse.org...
> I noticed that if i create a logic example, then go to the filesystem
> and delete it, then double click it in the project, the logic program
> does not explode.
>
> currently my application explodes with selection errors and i have to
> end eclipse with ctrl-alt-del or stop the debugger.
>
> What technique should I used when I am passed a FileEditorInput that
> happens to not actually contain a file?
>
> The errors are from the UI thread or at least that is where I am
> catching them, and that really does not tell me anything. I think the
> class that is initiating the error is not logging it appropriately and
> thus I can not trace back to it...
>
>
> --
> Respectfully,
>
>
> CL Gilbert
>
> "Verily, verily, I say unto you, He that entereth not by the door() into
> the sheepfold{}, but climbeth up some other *way, the same is a thief
> and a robber." John 10:1
>
> GnuPG Key Fingerprint:
> 82A6 8893 C2A1 F64E A9AD 19AE 55B2 4CD7 80D2 0A2D
>
> For a free Java interface to Freechess.org see
> http://www.rigidsoftware.com/Chess/chess.html
Re: Strategy to handle empty editor inputs [message #157783 is a reply to message #157728] Fri, 12 November 2004 13:20 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: Lamont_Gilbert.rigidsoftware.com

I did look, and I did try that. But it didnt work.

That got me into some crazy looping dialog box errors and had to kill
the app. Seems like logic example sets the contents of the graphical
viewer at the same time the model is set whereas I set the graphical
viewer in initializegraphicalViewer. That seems the only difference but
i cant really debug it with the action in the UI threads being
disconnected from their source.

Some class is opening up error dialogs but not dumping stack traces
beforehand.



Pratik Shah wrote:
> Look at LogicEditor#setInput(). It fails to read data from the file and
> prints that exception to stderr. But it doesn't "blow up" because
> logicDiagram is initialized to a new instance of LogicDiagram, and that
> serves as the contents for the viewer.
>
> "CL [dnoyeb] Gilbert" <Lamont_Gilbert@rigidsoftware.com> wrote in message
> news:cmuhhi$c4$1@eclipse.org...
>
>>I noticed that if i create a logic example, then go to the filesystem
>>and delete it, then double click it in the project, the logic program
>>does not explode.
>>
>>currently my application explodes with selection errors and i have to
>>end eclipse with ctrl-alt-del or stop the debugger.
>>
>>What technique should I used when I am passed a FileEditorInput that
>>happens to not actually contain a file?
>>
>>The errors are from the UI thread or at least that is where I am
>>catching them, and that really does not tell me anything. I think the
>>class that is initiating the error is not logging it appropriately and
>>thus I can not trace back to it...
>>
>>
>>--
>>Respectfully,
>>
>>
>>CL Gilbert
>>
>>"Verily, verily, I say unto you, He that entereth not by the door() into
>>the sheepfold{}, but climbeth up some other *way, the same is a thief
>>and a robber." John 10:1
>>
>>GnuPG Key Fingerprint:
>>82A6 8893 C2A1 F64E A9AD 19AE 55B2 4CD7 80D2 0A2D
>>
>>For a free Java interface to Freechess.org see
>>http://www.rigidsoftware.com/Chess/chess.html
>
>
>


--
Respectfully,


CL Gilbert

"Verily, verily, I say unto you, He that entereth not by the door() into
the sheepfold{}, but climbeth up some other *way, the same is a thief
and a robber." John 10:1

GnuPG Key Fingerprint:
82A6 8893 C2A1 F64E A9AD 19AE 55B2 4CD7 80D2 0A2D

For a free Java interface to Freechess.org see
http://www.rigidsoftware.com/Chess/chess.html
Re: Strategy to handle empty editor inputs [message #157806 is a reply to message #157783] Fri, 12 November 2004 14:52 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: gaslade.yahoo.com

You need to do more investigating if Pratik's solution did not work. If
your editor follows along the same general flow as the logic editor (
which almost everyones will since everyone uses it as a leaping point )
then you will see when the editor starts opening the .setInput() method
is called passing in the editor input. This ought to be a file that your
code knows how to interpret and build a model from.

As Pratik has said, in the case of the logic example, if anything
horrible happens while it is trying to interpret the file and build the
model then it is caught, reported and a model is created that is empty.
The setInput method in the logic example does not need to set the
graphical viewer input..... I don't know why it does. If you take a look
at the initializeGraphicalViewer() method of the logic example you will
see that it has the same code in it to set the viewer contents.

In fact, you don't actually have to create the model in the setInput
method if you don''t want to. I have an editor that has a getter for the
model and it creates it lazily.

Anyway, there a few things to ponder but really it sounds like it is up
to you to debug.

Guy


CL [dnoyeb] Gilbert wrote:

> I did look, and I did try that. But it didnt work.
>
> That got me into some crazy looping dialog box errors and had to kill
> the app. Seems like logic example sets the contents of the graphical
> viewer at the same time the model is set whereas I set the graphical
> viewer in initializegraphicalViewer. That seems the only difference but
> i cant really debug it with the action in the UI threads being
> disconnected from their source.
>
> Some class is opening up error dialogs but not dumping stack traces
> beforehand.
>
>
>
> Pratik Shah wrote:
>
>> Look at LogicEditor#setInput(). It fails to read data from the file and
>> prints that exception to stderr. But it doesn't "blow up" because
>> logicDiagram is initialized to a new instance of LogicDiagram, and that
>> serves as the contents for the viewer.
>>
>> "CL [dnoyeb] Gilbert" <Lamont_Gilbert@rigidsoftware.com> wrote in message
>> news:cmuhhi$c4$1@eclipse.org...
>>
>>> I noticed that if i create a logic example, then go to the filesystem
>>> and delete it, then double click it in the project, the logic program
>>> does not explode.
>>>
>>> currently my application explodes with selection errors and i have to
>>> end eclipse with ctrl-alt-del or stop the debugger.
>>>
>>> What technique should I used when I am passed a FileEditorInput that
>>> happens to not actually contain a file?
>>>
>>> The errors are from the UI thread or at least that is where I am
>>> catching them, and that really does not tell me anything. I think the
>>> class that is initiating the error is not logging it appropriately and
>>> thus I can not trace back to it...
>>>
>>>
>>> --
>>> Respectfully,
>>>
>>>
>>> CL Gilbert
>>>
>>> "Verily, verily, I say unto you, He that entereth not by the door() into
>>> the sheepfold{}, but climbeth up some other *way, the same is a thief
>>> and a robber." John 10:1
>>>
>>> GnuPG Key Fingerprint:
>>> 82A6 8893 C2A1 F64E A9AD 19AE 55B2 4CD7 80D2 0A2D
>>>
>>> For a free Java interface to Freechess.org see
>>> http://www.rigidsoftware.com/Chess/chess.html
>>
>>
>>
>>
>
>
Re: Strategy to handle empty editor inputs [message #157829 is a reply to message #157806] Fri, 12 November 2004 16:06 Go to previous messageGo to next message
Pratik Shah is currently offline Pratik ShahFriend
Messages: 1077
Registered: July 2009
Senior Member
> The setInput method in the logic example does not need to set the
> graphical viewer input..... I don't know why it does. If you take a look

That is to handle the case where, once the editor is already open, the
underlying file is changed (eg., you replace the file in workspace with a
previous version from the repository).

"Guy Slade" <gaslade@yahoo.com> wrote in message
news:cn2ili$s20$1@eclipse.org...
> You need to do more investigating if Pratik's solution did not work. If
> your editor follows along the same general flow as the logic editor (
> which almost everyones will since everyone uses it as a leaping point )
> then you will see when the editor starts opening the .setInput() method
> is called passing in the editor input. This ought to be a file that your
> code knows how to interpret and build a model from.
>
> As Pratik has said, in the case of the logic example, if anything
> horrible happens while it is trying to interpret the file and build the
> model then it is caught, reported and a model is created that is empty.
> The setInput method in the logic example does not need to set the
> graphical viewer input..... I don't know why it does. If you take a look
> at the initializeGraphicalViewer() method of the logic example you will
> see that it has the same code in it to set the viewer contents.
>
> In fact, you don't actually have to create the model in the setInput
> method if you don''t want to. I have an editor that has a getter for the
> model and it creates it lazily.
>
> Anyway, there a few things to ponder but really it sounds like it is up
> to you to debug.
>
> Guy
>
>
> CL [dnoyeb] Gilbert wrote:
>
> > I did look, and I did try that. But it didnt work.
> >
> > That got me into some crazy looping dialog box errors and had to kill
> > the app. Seems like logic example sets the contents of the graphical
> > viewer at the same time the model is set whereas I set the graphical
> > viewer in initializegraphicalViewer. That seems the only difference but
> > i cant really debug it with the action in the UI threads being
> > disconnected from their source.
> >
> > Some class is opening up error dialogs but not dumping stack traces
> > beforehand.
> >
> >
> >
> > Pratik Shah wrote:
> >
> >> Look at LogicEditor#setInput(). It fails to read data from the file
and
> >> prints that exception to stderr. But it doesn't "blow up" because
> >> logicDiagram is initialized to a new instance of LogicDiagram, and that
> >> serves as the contents for the viewer.
> >>
> >> "CL [dnoyeb] Gilbert" <Lamont_Gilbert@rigidsoftware.com> wrote in
message
> >> news:cmuhhi$c4$1@eclipse.org...
> >>
> >>> I noticed that if i create a logic example, then go to the filesystem
> >>> and delete it, then double click it in the project, the logic program
> >>> does not explode.
> >>>
> >>> currently my application explodes with selection errors and i have to
> >>> end eclipse with ctrl-alt-del or stop the debugger.
> >>>
> >>> What technique should I used when I am passed a FileEditorInput that
> >>> happens to not actually contain a file?
> >>>
> >>> The errors are from the UI thread or at least that is where I am
> >>> catching them, and that really does not tell me anything. I think the
> >>> class that is initiating the error is not logging it appropriately and
> >>> thus I can not trace back to it...
> >>>
> >>>
> >>> --
> >>> Respectfully,
> >>>
> >>>
> >>> CL Gilbert
> >>>
> >>> "Verily, verily, I say unto you, He that entereth not by the door()
into
> >>> the sheepfold{}, but climbeth up some other *way, the same is a thief
> >>> and a robber." John 10:1
> >>>
> >>> GnuPG Key Fingerprint:
> >>> 82A6 8893 C2A1 F64E A9AD 19AE 55B2 4CD7 80D2 0A2D
> >>>
> >>> For a free Java interface to Freechess.org see
> >>> http://www.rigidsoftware.com/Chess/chess.html
> >>
> >>
> >>
> >>
> >
> >
>
Re: Strategy to handle empty editor inputs [message #157852 is a reply to message #157829] Fri, 12 November 2004 17:22 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: Lamont_Gilbert.rigidsoftware.com

Pratik Shah wrote:
>>The setInput method in the logic example does not need to set the
>>graphical viewer input..... I don't know why it does. If you take a look
>
>
> That is to handle the case where, once the editor is already open, the
> underlying file is changed (eg., you replace the file in workspace with a
> previous version from the repository).
>

Well that is the failure I am trying to overcome. So perhaps I can try
setting the model into the graphicalViewer inside the setInput method as
well. Hard to see why this is required, but not hard to see the
explosion that is happening in my code now.

Actually my code works well if I keep the model null. But if i make a
default model like logic example, but dont add it to the
graphicalViewer, all hell breaks loose when an empty IEditorInput is
sent to my class...



> "Guy Slade" <gaslade@yahoo.com> wrote in message
> news:cn2ili$s20$1@eclipse.org...
>
>>You need to do more investigating if Pratik's solution did not work. If
>>your editor follows along the same general flow as the logic editor (
>>which almost everyones will since everyone uses it as a leaping point )
>>then you will see when the editor starts opening the .setInput() method
>>is called passing in the editor input. This ought to be a file that your
>>code knows how to interpret and build a model from.
>>
>>As Pratik has said, in the case of the logic example, if anything
>>horrible happens while it is trying to interpret the file and build the
>>model then it is caught, reported and a model is created that is empty.
>>The setInput method in the logic example does not need to set the
>>graphical viewer input..... I don't know why it does. If you take a look
>>at the initializeGraphicalViewer() method of the logic example you will
>>see that it has the same code in it to set the viewer contents.
>>
>>In fact, you don't actually have to create the model in the setInput
>>method if you don''t want to. I have an editor that has a getter for the
>>model and it creates it lazily.
>>
>>Anyway, there a few things to ponder but really it sounds like it is up
>>to you to debug.
>>
>>Guy
>>
>>
>>CL [dnoyeb] Gilbert wrote:
>>
>>
>>>I did look, and I did try that. But it didnt work.
>>>
>>>That got me into some crazy looping dialog box errors and had to kill
>>>the app. Seems like logic example sets the contents of the graphical
>>>viewer at the same time the model is set whereas I set the graphical
>>>viewer in initializegraphicalViewer. That seems the only difference but
>>>i cant really debug it with the action in the UI threads being
>>>disconnected from their source.
>>>
>>>Some class is opening up error dialogs but not dumping stack traces
>>>beforehand.
>>>
>>>
>>>
>>>Pratik Shah wrote:
>>>
>>>
>>>>Look at LogicEditor#setInput(). It fails to read data from the file
>
> and
>
>>>>prints that exception to stderr. But it doesn't "blow up" because
>>>>logicDiagram is initialized to a new instance of LogicDiagram, and that
>>>>serves as the contents for the viewer.
>>>>
>>>>"CL [dnoyeb] Gilbert" <Lamont_Gilbert@rigidsoftware.com> wrote in
>
> message
>
>>>>news:cmuhhi$c4$1@eclipse.org...
>>>>
>>>>
>>>>>I noticed that if i create a logic example, then go to the filesystem
>>>>>and delete it, then double click it in the project, the logic program
>>>>>does not explode.
>>>>>
>>>>>currently my application explodes with selection errors and i have to
>>>>>end eclipse with ctrl-alt-del or stop the debugger.
>>>>>
>>>>>What technique should I used when I am passed a FileEditorInput that
>>>>>happens to not actually contain a file?
>>>>>
>>>>>The errors are from the UI thread or at least that is where I am
>>>>>catching them, and that really does not tell me anything. I think the
>>>>>class that is initiating the error is not logging it appropriately and
>>>>>thus I can not trace back to it...
>>>>>
>>>>>
>>>>>--
>>>>>Respectfully,
>>>>>
>>>>>
>>>>>CL Gilbert
>>>>>
>>>>>"Verily, verily, I say unto you, He that entereth not by the door()
>
> into
>
>>>>>the sheepfold{}, but climbeth up some other *way, the same is a thief
>>>>>and a robber." John 10:1
>>>>>
>>>>>GnuPG Key Fingerprint:
>>>>>82A6 8893 C2A1 F64E A9AD 19AE 55B2 4CD7 80D2 0A2D
>>>>>
>>>>>For a free Java interface to Freechess.org see
>>>>>http://www.rigidsoftware.com/Chess/chess.html
>>>>
>>>>
>>>>
>>>>
>>>
>
>


--
Respectfully,


CL Gilbert

"Verily, verily, I say unto you, He that entereth not by the door() into
the sheepfold{}, but climbeth up some other *way, the same is a thief
and a robber." John 10:1

GnuPG Key Fingerprint:
82A6 8893 C2A1 F64E A9AD 19AE 55B2 4CD7 80D2 0A2D

For a free Java interface to Freechess.org see
http://www.rigidsoftware.com/Chess/chess.html
Re: Strategy to handle empty editor inputs [message #157880 is a reply to message #157852] Fri, 12 November 2004 18:40 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: gaslade.yahoo.com

> Actually my code works well if I keep the model null. But if i make a
> default model like logic example, but dont add it to the
> graphicalViewer, all hell breaks loose when an empty IEditorInput is
> sent to my class...

When does an empty IEditorInput get sent to setInput() ?
Re: Strategy to handle empty editor inputs [message #158013 is a reply to message #157880] Fri, 12 November 2004 22:20 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: Lamont_Gilbert.rigidsoftware.com

Guy Slade wrote:
> > Actually my code works well if I keep the model null. But if i make a
> > default model like logic example, but dont add it to the
> > graphicalViewer, all hell breaks loose when an empty IEditorInput is
> > sent to my class...
>
> When does an empty IEditorInput get sent to setInput() ?
>

Like Pratik said, when there is a file resource in the project, but the
file has been deleted using some OS level technique that Eclipse is
unaware of. Its not empty per se. It contains a File, that simply does
not point to a file and will throw exceptions when you try to get one
out of it.

--
Respectfully,


CL Gilbert

"Verily, verily, I say unto you, He that entereth not by the door() into
the sheepfold{}, but climbeth up some other *way, the same is a thief
and a robber." John 10:1

GnuPG Key Fingerprint:
82A6 8893 C2A1 F64E A9AD 19AE 55B2 4CD7 80D2 0A2D

For a free Java interface to Freechess.org see
http://www.rigidsoftware.com/Chess/chess.html
Re: Strategy to handle empty editor inputs [message #158028 is a reply to message #157852] Mon, 15 November 2004 01:40 Go to previous messageGo to next message
Pratik Shah is currently offline Pratik ShahFriend
Messages: 1077
Registered: July 2009
Senior Member
This is not exactly the problem you're trying to fix. Yours is a change not
detected by Eclipse. The case I was talking about is where the file is
replaced in the workspace (with the editor already open). The platform is
aware of this change and will invoke setInput() on your editor with the new
contents.

"CL [dnoyeb] Gilbert" <Lamont_Gilbert@rigidsoftware.com> wrote in message
news:cn2rfc$dc2$2@eclipse.org...
> Pratik Shah wrote:
>>>The setInput method in the logic example does not need to set the
>>>graphical viewer input..... I don't know why it does. If you take a look
>>
>>
>> That is to handle the case where, once the editor is already open, the
>> underlying file is changed (eg., you replace the file in workspace with a
>> previous version from the repository).
>>
>
> Well that is the failure I am trying to overcome. So perhaps I can try
> setting the model into the graphicalViewer inside the setInput method as
> well. Hard to see why this is required, but not hard to see the explosion
> that is happening in my code now.
>
> Actually my code works well if I keep the model null. But if i make a
> default model like logic example, but dont add it to the graphicalViewer,
> all hell breaks loose when an empty IEditorInput is sent to my class...
>
>
>
>> "Guy Slade" <gaslade@yahoo.com> wrote in message
>> news:cn2ili$s20$1@eclipse.org...
>>
>>>You need to do more investigating if Pratik's solution did not work. If
>>>your editor follows along the same general flow as the logic editor (
>>>which almost everyones will since everyone uses it as a leaping point )
>>>then you will see when the editor starts opening the .setInput() method
>>>is called passing in the editor input. This ought to be a file that your
>>>code knows how to interpret and build a model from.
>>>
>>>As Pratik has said, in the case of the logic example, if anything
>>>horrible happens while it is trying to interpret the file and build the
>>>model then it is caught, reported and a model is created that is empty.
>>>The setInput method in the logic example does not need to set the
>>>graphical viewer input..... I don't know why it does. If you take a look
>>>at the initializeGraphicalViewer() method of the logic example you will
>>>see that it has the same code in it to set the viewer contents.
>>>
>>>In fact, you don't actually have to create the model in the setInput
>>>method if you don''t want to. I have an editor that has a getter for the
>>>model and it creates it lazily.
>>>
>>>Anyway, there a few things to ponder but really it sounds like it is up
>>>to you to debug.
>>>
>>>Guy
>>>
>>>
>>>CL [dnoyeb] Gilbert wrote:
>>>
>>>
>>>>I did look, and I did try that. But it didnt work.
>>>>
>>>>That got me into some crazy looping dialog box errors and had to kill
>>>>the app. Seems like logic example sets the contents of the graphical
>>>>viewer at the same time the model is set whereas I set the graphical
>>>>viewer in initializegraphicalViewer. That seems the only difference but
>>>>i cant really debug it with the action in the UI threads being
>>>>disconnected from their source.
>>>>
>>>>Some class is opening up error dialogs but not dumping stack traces
>>>>beforehand.
>>>>
>>>>
>>>>
>>>>Pratik Shah wrote:
>>>>
>>>>
>>>>>Look at LogicEditor#setInput(). It fails to read data from the file
>>
>> and
>>
>>>>>prints that exception to stderr. But it doesn't "blow up" because
>>>>>logicDiagram is initialized to a new instance of LogicDiagram, and that
>>>>>serves as the contents for the viewer.
>>>>>
>>>>>"CL [dnoyeb] Gilbert" <Lamont_Gilbert@rigidsoftware.com> wrote in
>>
>> message
>>
>>>>>news:cmuhhi$c4$1@eclipse.org...
>>>>>
>>>>>
>>>>>>I noticed that if i create a logic example, then go to the filesystem
>>>>>>and delete it, then double click it in the project, the logic program
>>>>>>does not explode.
>>>>>>
>>>>>>currently my application explodes with selection errors and i have to
>>>>>>end eclipse with ctrl-alt-del or stop the debugger.
>>>>>>
>>>>>>What technique should I used when I am passed a FileEditorInput that
>>>>>>happens to not actually contain a file?
>>>>>>
>>>>>>The errors are from the UI thread or at least that is where I am
>>>>>>catching them, and that really does not tell me anything. I think the
>>>>>>class that is initiating the error is not logging it appropriately and
>>>>>>thus I can not trace back to it...
>>>>>>
>>>>>>
>>>>>>--
>>>>>>Respectfully,
>>>>>>
>>>>>>
>>>>>>CL Gilbert
>>>>>>
>>>>>>"Verily, verily, I say unto you, He that entereth not by the door()
>>
>> into
>>
>>>>>>the sheepfold{}, but climbeth up some other *way, the same is a thief
>>>>>>and a robber." John 10:1
>>>>>>
>>>>>>GnuPG Key Fingerprint:
>>>>>>82A6 8893 C2A1 F64E A9AD 19AE 55B2 4CD7 80D2 0A2D
>>>>>>
>>>>>>For a free Java interface to Freechess.org see
>>>>>>http://www.rigidsoftware.com/Chess/chess.html
>>>>>
>>>>>
>>>>>
>>>>>
>>>>
>>
>>
>
>
> --
> Respectfully,
>
>
> CL Gilbert
>
> "Verily, verily, I say unto you, He that entereth not by the door() into
> the sheepfold{}, but climbeth up some other *way, the same is a thief and
> a robber." John 10:1
>
> GnuPG Key Fingerprint:
> 82A6 8893 C2A1 F64E A9AD 19AE 55B2 4CD7 80D2 0A2D
>
> For a free Java interface to Freechess.org see
> http://www.rigidsoftware.com/Chess/chess.html
Re: Strategy to handle empty editor inputs [message #158071 is a reply to message #158028] Mon, 15 November 2004 13:05 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: Lamont_Gilbert.rigidsoftware.com

How can I cause the file to be replaced in the workspace? Sounds like
an interesting test considering I am not setting the GraphicalViewer
input when I get new editor input directly.


Pratik Shah wrote:
> This is not exactly the problem you're trying to fix. Yours is a change not
> detected by Eclipse. The case I was talking about is where the file is
> replaced in the workspace (with the editor already open). The platform is
> aware of this change and will invoke setInput() on your editor with the new
> contents.
>
> "CL [dnoyeb] Gilbert" <Lamont_Gilbert@rigidsoftware.com> wrote in message
> news:cn2rfc$dc2$2@eclipse.org...
>
>>Pratik Shah wrote:
>>
>>>>The setInput method in the logic example does not need to set the
>>>>graphical viewer input..... I don't know why it does. If you take a look
>>>
>>>
>>>That is to handle the case where, once the editor is already open, the
>>>underlying file is changed (eg., you replace the file in workspace with a
>>>previous version from the repository).
>>>
>>
>>Well that is the failure I am trying to overcome. So perhaps I can try
>>setting the model into the graphicalViewer inside the setInput method as
>>well. Hard to see why this is required, but not hard to see the explosion
>>that is happening in my code now.
>>
>>Actually my code works well if I keep the model null. But if i make a
>>default model like logic example, but dont add it to the graphicalViewer,
>>all hell breaks loose when an empty IEditorInput is sent to my class...
>>
>>
>>
>>
>>>"Guy Slade" <gaslade@yahoo.com> wrote in message
>>>news:cn2ili$s20$1@eclipse.org...
>>>
>>>
>>>>You need to do more investigating if Pratik's solution did not work. If
>>>>your editor follows along the same general flow as the logic editor (
>>>>which almost everyones will since everyone uses it as a leaping point )
>>>>then you will see when the editor starts opening the .setInput() method
>>>>is called passing in the editor input. This ought to be a file that your
>>>>code knows how to interpret and build a model from.
>>>>
>>>>As Pratik has said, in the case of the logic example, if anything
>>>>horrible happens while it is trying to interpret the file and build the
>>>>model then it is caught, reported and a model is created that is empty.
>>>>The setInput method in the logic example does not need to set the
>>>>graphical viewer input..... I don't know why it does. If you take a look
>>>>at the initializeGraphicalViewer() method of the logic example you will
>>>>see that it has the same code in it to set the viewer contents.
>>>>
>>>>In fact, you don't actually have to create the model in the setInput
>>>>method if you don''t want to. I have an editor that has a getter for the
>>>>model and it creates it lazily.
>>>>
>>>>Anyway, there a few things to ponder but really it sounds like it is up
>>>>to you to debug.
>>>>
>>>>Guy
>>>>
>>>>
>>>>CL [dnoyeb] Gilbert wrote:
>>>>
>>>>
>>>>
>>>>>I did look, and I did try that. But it didnt work.
>>>>>
>>>>>That got me into some crazy looping dialog box errors and had to kill
>>>>>the app. Seems like logic example sets the contents of the graphical
>>>>>viewer at the same time the model is set whereas I set the graphical
>>>>>viewer in initializegraphicalViewer. That seems the only difference but
>>>>>i cant really debug it with the action in the UI threads being
>>>>>disconnected from their source.
>>>>>
>>>>>Some class is opening up error dialogs but not dumping stack traces
>>>>>beforehand.
>>>>>
>>>>>
>>>>>
>>>>>Pratik Shah wrote:
>>>>>
>>>>>
>>>>>
>>>>>>Look at LogicEditor#setInput(). It fails to read data from the file
>>>
>>>and
>>>
>>>
>>>>>>prints that exception to stderr. But it doesn't "blow up" because
>>>>>>logicDiagram is initialized to a new instance of LogicDiagram, and that
>>>>>>serves as the contents for the viewer.
>>>>>>
>>>>>>"CL [dnoyeb] Gilbert" <Lamont_Gilbert@rigidsoftware.com> wrote in
>>>
>>>message
>>>
>>>
>>>>>>news:cmuhhi$c4$1@eclipse.org...
>>>>>>
>>>>>>
>>>>>>
>>>>>>>I noticed that if i create a logic example, then go to the filesystem
>>>>>>>and delete it, then double click it in the project, the logic program
>>>>>>>does not explode.
>>>>>>>
>>>>>>>currently my application explodes with selection errors and i have to
>>>>>>>end eclipse with ctrl-alt-del or stop the debugger.
>>>>>>>
>>>>>>>What technique should I used when I am passed a FileEditorInput that
>>>>>>>happens to not actually contain a file?
>>>>>>>
>>>>>>>The errors are from the UI thread or at least that is where I am
>>>>>>>catching them, and that really does not tell me anything. I think the
>>>>>>>class that is initiating the error is not logging it appropriately and
>>>>>>>thus I can not trace back to it...
>>>>>>>
>>>>>>>
>>>>>>>--
>>>>>>>Respectfully,
>>>>>>>
>>>>>>>
>>>>>>>CL Gilbert
>>>>>>>
>>>>>>>"Verily, verily, I say unto you, He that entereth not by the door()
>>>
>>>into
>>>
>>>
>>>>>>>the sheepfold{}, but climbeth up some other *way, the same is a thief
>>>>>>>and a robber." John 10:1
>>>>>>>
>>>>>>>GnuPG Key Fingerprint:
>>>>>>>82A6 8893 C2A1 F64E A9AD 19AE 55B2 4CD7 80D2 0A2D
>>>>>>>
>>>>>>>For a free Java interface to Freechess.org see
>>>>>>>http://www.rigidsoftware.com/Chess/chess.html
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>
>>
>>--
>>Respectfully,
>>
>>
>>CL Gilbert
>>
>>"Verily, verily, I say unto you, He that entereth not by the door() into
>>the sheepfold{}, but climbeth up some other *way, the same is a thief and
>>a robber." John 10:1
>>
>>GnuPG Key Fingerprint:
>>82A6 8893 C2A1 F64E A9AD 19AE 55B2 4CD7 80D2 0A2D
>>
>>For a free Java interface to Freechess.org see
>>http://www.rigidsoftware.com/Chess/chess.html
>
>
>


--
Respectfully,


CL Gilbert

"Verily, verily, I say unto you, He that entereth not by the door() into
the sheepfold{}, but climbeth up some other *way, the same is a thief
and a robber." John 10:1

GnuPG Key Fingerprint:
82A6 8893 C2A1 F64E A9AD 19AE 55B2 4CD7 80D2 0A2D

For a free Java interface to Freechess.org see
http://www.rigidsoftware.com/Chess/chess.html
Re: Strategy to handle empty editor inputs [message #158252 is a reply to message #158071] Wed, 17 November 2004 03:36 Go to previous message
Pratik Shah is currently offline Pratik ShahFriend
Messages: 1077
Registered: July 2009
Senior Member
As I mentioned already, one example is by replacing the file in the
workspace with a previous version from the repository or local history.

"CL [dnoyeb] Gilbert" <Lamont_Gilbert@rigidsoftware.com> wrote in message
news:cna9jc$qlv$2@eclipse.org...
> How can I cause the file to be replaced in the workspace? Sounds like
> an interesting test considering I am not setting the GraphicalViewer
> input when I get new editor input directly.
>
>
> Pratik Shah wrote:
> > This is not exactly the problem you're trying to fix. Yours is a change
not
> > detected by Eclipse. The case I was talking about is where the file is
> > replaced in the workspace (with the editor already open). The platform
is
> > aware of this change and will invoke setInput() on your editor with the
new
> > contents.
> >
> > "CL [dnoyeb] Gilbert" <Lamont_Gilbert@rigidsoftware.com> wrote in
message
> > news:cn2rfc$dc2$2@eclipse.org...
> >
> >>Pratik Shah wrote:
> >>
> >>>>The setInput method in the logic example does not need to set the
> >>>>graphical viewer input..... I don't know why it does. If you take a
look
> >>>
> >>>
> >>>That is to handle the case where, once the editor is already open, the
> >>>underlying file is changed (eg., you replace the file in workspace with
a
> >>>previous version from the repository).
> >>>
> >>
> >>Well that is the failure I am trying to overcome. So perhaps I can try
> >>setting the model into the graphicalViewer inside the setInput method as
> >>well. Hard to see why this is required, but not hard to see the
explosion
> >>that is happening in my code now.
> >>
> >>Actually my code works well if I keep the model null. But if i make a
> >>default model like logic example, but dont add it to the
graphicalViewer,
> >>all hell breaks loose when an empty IEditorInput is sent to my class...
> >>
> >>
> >>
> >>
> >>>"Guy Slade" <gaslade@yahoo.com> wrote in message
> >>>news:cn2ili$s20$1@eclipse.org...
> >>>
> >>>
> >>>>You need to do more investigating if Pratik's solution did not work.
If
> >>>>your editor follows along the same general flow as the logic editor (
> >>>>which almost everyones will since everyone uses it as a leaping
point )
> >>>>then you will see when the editor starts opening the .setInput()
method
> >>>>is called passing in the editor input. This ought to be a file that
your
> >>>>code knows how to interpret and build a model from.
> >>>>
> >>>>As Pratik has said, in the case of the logic example, if anything
> >>>>horrible happens while it is trying to interpret the file and build
the
> >>>>model then it is caught, reported and a model is created that is
empty.
> >>>>The setInput method in the logic example does not need to set the
> >>>>graphical viewer input..... I don't know why it does. If you take a
look
> >>>>at the initializeGraphicalViewer() method of the logic example you
will
> >>>>see that it has the same code in it to set the viewer contents.
> >>>>
> >>>>In fact, you don't actually have to create the model in the setInput
> >>>>method if you don''t want to. I have an editor that has a getter for
the
> >>>>model and it creates it lazily.
> >>>>
> >>>>Anyway, there a few things to ponder but really it sounds like it is
up
> >>>>to you to debug.
> >>>>
> >>>>Guy
> >>>>
> >>>>
> >>>>CL [dnoyeb] Gilbert wrote:
> >>>>
> >>>>
> >>>>
> >>>>>I did look, and I did try that. But it didnt work.
> >>>>>
> >>>>>That got me into some crazy looping dialog box errors and had to kill
> >>>>>the app. Seems like logic example sets the contents of the graphical
> >>>>>viewer at the same time the model is set whereas I set the graphical
> >>>>>viewer in initializegraphicalViewer. That seems the only difference
but
> >>>>>i cant really debug it with the action in the UI threads being
> >>>>>disconnected from their source.
> >>>>>
> >>>>>Some class is opening up error dialogs but not dumping stack traces
> >>>>>beforehand.
> >>>>>
> >>>>>
> >>>>>
> >>>>>Pratik Shah wrote:
> >>>>>
> >>>>>
> >>>>>
> >>>>>>Look at LogicEditor#setInput(). It fails to read data from the file
> >>>
> >>>and
> >>>
> >>>
> >>>>>>prints that exception to stderr. But it doesn't "blow up" because
> >>>>>>logicDiagram is initialized to a new instance of LogicDiagram, and
that
> >>>>>>serves as the contents for the viewer.
> >>>>>>
> >>>>>>"CL [dnoyeb] Gilbert" <Lamont_Gilbert@rigidsoftware.com> wrote in
> >>>
> >>>message
> >>>
> >>>
> >>>>>>news:cmuhhi$c4$1@eclipse.org...
> >>>>>>
> >>>>>>
> >>>>>>
> >>>>>>>I noticed that if i create a logic example, then go to the
filesystem
> >>>>>>>and delete it, then double click it in the project, the logic
program
> >>>>>>>does not explode.
> >>>>>>>
> >>>>>>>currently my application explodes with selection errors and i have
to
> >>>>>>>end eclipse with ctrl-alt-del or stop the debugger.
> >>>>>>>
> >>>>>>>What technique should I used when I am passed a FileEditorInput
that
> >>>>>>>happens to not actually contain a file?
> >>>>>>>
> >>>>>>>The errors are from the UI thread or at least that is where I am
> >>>>>>>catching them, and that really does not tell me anything. I think
the
> >>>>>>>class that is initiating the error is not logging it appropriately
and
> >>>>>>>thus I can not trace back to it...
> >>>>>>>
> >>>>>>>
> >>>>>>>--
> >>>>>>>Respectfully,
> >>>>>>>
> >>>>>>>
> >>>>>>>CL Gilbert
> >>>>>>>
> >>>>>>>"Verily, verily, I say unto you, He that entereth not by the door()
> >>>
> >>>into
> >>>
> >>>
> >>>>>>>the sheepfold{}, but climbeth up some other *way, the same is a
thief
> >>>>>>>and a robber." John 10:1
> >>>>>>>
> >>>>>>>GnuPG Key Fingerprint:
> >>>>>>>82A6 8893 C2A1 F64E A9AD 19AE 55B2 4CD7 80D2 0A2D
> >>>>>>>
> >>>>>>>For a free Java interface to Freechess.org see
> >>>>>>>http://www.rigidsoftware.com/Chess/chess.html
> >>>>>>
> >>>>>>
> >>>>>>
> >>>>>>
> >>>
> >>
> >>--
> >>Respectfully,
> >>
> >>
> >>CL Gilbert
> >>
> >>"Verily, verily, I say unto you, He that entereth not by the door() into
> >>the sheepfold{}, but climbeth up some other *way, the same is a thief
and
> >>a robber." John 10:1
> >>
> >>GnuPG Key Fingerprint:
> >>82A6 8893 C2A1 F64E A9AD 19AE 55B2 4CD7 80D2 0A2D
> >>
> >>For a free Java interface to Freechess.org see
> >>http://www.rigidsoftware.com/Chess/chess.html
> >
> >
> >
>
>
> --
> Respectfully,
>
>
> CL Gilbert
>
> "Verily, verily, I say unto you, He that entereth not by the door() into
> the sheepfold{}, but climbeth up some other *way, the same is a thief
> and a robber." John 10:1
>
> GnuPG Key Fingerprint:
> 82A6 8893 C2A1 F64E A9AD 19AE 55B2 4CD7 80D2 0A2D
>
> For a free Java interface to Freechess.org see
> http://www.rigidsoftware.com/Chess/chess.html
Previous Topic:Problem with Figure and ToolbarLayout
Next Topic:Connecting to Self & Dynamic Anchors
Goto Forum:
  


Current Time: Sun Jan 19 18:39:47 GMT 2025

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

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

Back to the top