marker link to EditPart [message #119514] |
Thu, 26 February 2004 01:36 |
Eclipse User |
|
|
|
Originally posted by: david_michonneau.hotmail.com
I would like to create a new type of marker that will allow me to point to
an EditPart from the Tasks view, like the java errors that select the
current line and word that correspond to the marker.
For example, I will have a builder that will check my file for errors. It
will find a problem in one place, that corresponds to a model object, and
create the marker, that reference this model object by name or id. This
marker will appear in the tasks view, when the user clicks on it, I want the
GEF editor to open the file, and select automatically the EditPart that
correspond to the model object referenced by my marker.
I have two questions:
1- how can I find an EditPart from a model object? I know how to get the
model from the EditPart, but it seems difficult the other way round, I can't
really afford to query all my editparts for that.
2-Let's say I found the EditPart, how can I select it or change its color
when I click on the marker in the tasks view given that I need to
a- open the file in the editor (this seems to be the default behaviour
in the tasks view)
b-wait until it's loaded and EditParts are created, then select the
EditPart (where should I hook this code, and how to select an EditPart
programmatically?)
Thanks,
David
|
|
|
Re: marker link to EditPart [message #119528 is a reply to message #119514] |
Thu, 26 February 2004 03:30 |
Eclipse User |
|
|
|
Originally posted by: none.us.ibm.com
Wow, this one's easy :-0...
> I would like to create a new type of marker that will allow me to point to
> an EditPart from the Tasks view, like the java errors that select the
> current line and word that correspond to the marker.
>
> For example, I will have a builder that will check my file for errors. It
> will find a problem in one place, that corresponds to a model object, and
> create the marker, that reference this model object by name or id. This
> marker will appear in the tasks view, when the user clicks on it, I want
the
> GEF editor to open the file, and select automatically the EditPart that
> correspond to the model object referenced by my marker.
>
> I have two questions:
>
> 1- how can I find an EditPart from a model object? I know how to get the
> model from the EditPart, but it seems difficult the other way round, I
can't
> really afford to query all my editparts for that.
EditPart part = (cast)editpartViewer.getEditPartRegistry().get(theModel);
> 2-Let's say I found the EditPart, how can I select it or change its color
> when I click on the marker in the tasks view given that I need to
> a- open the file in the editor (this seems to be the default behaviour
> in the tasks view)
> b-wait until it's loaded and EditParts are created, then select the
> EditPart (where should I hook this code, and how to select an EditPart
> programmatically?)
editpartViewer.select(editpart);
//make sure it's visible on the screen (scrolling)
editpartViewer.reveal(editpart);
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.03820 seconds