How can I use a custom GridLayer in the Editor? [message #502505] |
Tue, 08 December 2009 10:17  |
Eclipse User |
|
|
|
Hello,
I'm using Compartments in my model which have a GridLayout. To visualize
the grid of my layout manager, I would like to draw some horizontal and
vertical lines.
Probably the best practice would be to override the GridLayer of the
Editor whith a custom implementation.
So how can I replace the default GridLayerEx whith a custom
GridLayer-Implementation? On which location can I integrate my own
GridLayer into the generated Editor-Code?
Thank you very much for your answer.
Regards,
Marco
|
|
|
|
Re: How can I use a custom GridLayer in the Editor? [message #502947 is a reply to message #502753] |
Thu, 10 December 2009 07:06   |
Eclipse User |
|
|
|
Hello Daniel,
thank you for your reply!
I have created my own edit part provider and contributed it over the
extension point "org.eclipse.gmf.runtime.diagram.ui.editpartProviders"
But my "createRootEditPart"-method (where I return my custom
RootEditPart) is never invoked.
Which methods did you override in your edit part provider to get access
to the root edit part of the diagram?
Could you provide me some example-code, please? Thank you very much!
Regards,
Marco
Daniel Beland schrieb:
>
>
> Hi,
>
>
> Don't know if there is a better way, but this is how I did:
>
> Add an edit part provider to provide the root edit part of the diagram.
> See the extension point
> org.eclipse.gmf.runtime.diagram.ui.editpartProviders
>
>
> My RootEditPart extends the standard gmf
> org.eclipse.gmf.runtime.diagram.ui.render.editparts.Rendered DiagramRootEditPart
>
>
> Override the two createGridLayer() methods to provide your own GridLayer.
>
> I think a few times in the code the GridLayer is cast to
> org.eclipse.gmf.runtime.diagram.ui.internal.editparts.GridLa yerEx
> without a check, so I suggest your GridLayer class extends it.
>
>
> Cheers,
> Daniel
>
>
> Marco wrote:
>> Hello,
>>
>> I'm using Compartments in my model which have a GridLayout. To
>> visualize the grid of my layout manager, I would like to draw some
>> horizontal and vertical lines.
>>
>> Probably the best practice would be to override the GridLayer of the
>> Editor whith a custom implementation.
>>
>> So how can I replace the default GridLayerEx whith a custom
>> GridLayer-Implementation? On which location can I integrate my own
>> GridLayer into the generated Editor-Code?
>>
>> Thank you very much for your answer.
>>
>> Regards,
>> Marco
|
|
|
Re: How can I use a custom GridLayer in the Editor? [message #503036 is a reply to message #502947] |
Thu, 10 December 2009 10:38   |
Eclipse User |
|
|
|
Hi Marco,
You need to configure the edit part provider correctly.
Set a higher priority than the current one (I've put highest).
In the context you must specify it provides the root edit part.
<extension point="org.eclipse.gmf.runtime.diagram.ui.editpartProviders "
id="my-ep-provider">
<editpartProvider class="a.b.RootPartProvider">
<Priority name="Highest">
</Priority>
<context providesRootEditPart="true">
</context>
</editpartProvider>
</extension>
Then the createRootEditPart method will be called.
public RootEditPart createRootEditPart(Diagram diagram) {
return new MyDiagramRootEditPart(diagram.getMeasurementUnit());
}
Cheers,
Daniel
Marco wrote:
> Hello Daniel,
>
> thank you for your reply!
>
> I have created my own edit part provider and contributed it over the
> extension point "org.eclipse.gmf.runtime.diagram.ui.editpartProviders"
>
> But my "createRootEditPart"-method (where I return my custom
> RootEditPart) is never invoked.
>
> Which methods did you override in your edit part provider to get access
> to the root edit part of the diagram?
>
> Could you provide me some example-code, please? Thank you very much!
>
> Regards,
> Marco
>
>
>
> Daniel Beland schrieb:
>>
>>
>> Hi,
>>
>>
>> Don't know if there is a better way, but this is how I did:
>>
>> Add an edit part provider to provide the root edit part of the diagram.
>> See the extension point
>> org.eclipse.gmf.runtime.diagram.ui.editpartProviders
>>
>>
>> My RootEditPart extends the standard gmf
>> org.eclipse.gmf.runtime.diagram.ui.render.editparts.Rendered DiagramRootEditPart
>>
>>
>> Override the two createGridLayer() methods to provide your own GridLayer.
>>
>> I think a few times in the code the GridLayer is cast to
>> org.eclipse.gmf.runtime.diagram.ui.internal.editparts.GridLa yerEx
>> without a check, so I suggest your GridLayer class extends it.
>>
>>
>> Cheers,
>> Daniel
>>
>>
>> Marco wrote:
>>> Hello,
>>>
>>> I'm using Compartments in my model which have a GridLayout. To
>>> visualize the grid of my layout manager, I would like to draw some
>>> horizontal and vertical lines.
>>>
>>> Probably the best practice would be to override the GridLayer of the
>>> Editor whith a custom implementation.
>>>
>>> So how can I replace the default GridLayerEx whith a custom
>>> GridLayer-Implementation? On which location can I integrate my own
>>> GridLayer into the generated Editor-Code?
>>>
>>> Thank you very much for your answer.
>>>
>>> Regards,
>>> Marco
|
|
|
Re: How can I use a custom GridLayer in the Editor? [message #503252 is a reply to message #503036] |
Fri, 11 December 2009 10:37  |
Eclipse User |
|
|
|
Thank you, Daniel. I got it working this way.
Daniel Beland schrieb:
>
>
> Hi Marco,
>
>
> You need to configure the edit part provider correctly.
> Set a higher priority than the current one (I've put highest).
> In the context you must specify it provides the root edit part.
>
> <extension point="org.eclipse.gmf.runtime.diagram.ui.editpartProviders "
> id="my-ep-provider">
> <editpartProvider class="a.b.RootPartProvider">
> <Priority name="Highest">
> </Priority>
> <context providesRootEditPart="true">
> </context>
> </editpartProvider>
> </extension>
>
> Then the createRootEditPart method will be called.
>
>
> public RootEditPart createRootEditPart(Diagram diagram) {
> return new MyDiagramRootEditPart(diagram.getMeasurementUnit());
> }
>
>
> Cheers,
> Daniel
>
>
> Marco wrote:
>> Hello Daniel,
>>
>> thank you for your reply!
>>
>> I have created my own edit part provider and contributed it over the
>> extension point "org.eclipse.gmf.runtime.diagram.ui.editpartProviders"
>>
>> But my "createRootEditPart"-method (where I return my custom
>> RootEditPart) is never invoked.
>>
>> Which methods did you override in your edit part provider to get
>> access to the root edit part of the diagram?
>>
>> Could you provide me some example-code, please? Thank you very much!
>>
>> Regards,
>> Marco
>>
>>
>>
>> Daniel Beland schrieb:
>>>
>>>
>>> Hi,
>>>
>>>
>>> Don't know if there is a better way, but this is how I did:
>>>
>>> Add an edit part provider to provide the root edit part of the diagram.
>>> See the extension point
>>> org.eclipse.gmf.runtime.diagram.ui.editpartProviders
>>>
>>>
>>> My RootEditPart extends the standard gmf
>>> org.eclipse.gmf.runtime.diagram.ui.render.editparts.Rendered DiagramRootEditPart
>>>
>>>
>>> Override the two createGridLayer() methods to provide your own
>>> GridLayer.
>>>
>>> I think a few times in the code the GridLayer is cast to
>>> org.eclipse.gmf.runtime.diagram.ui.internal.editparts.GridLa yerEx
>>> without a check, so I suggest your GridLayer class extends it.
>>>
>>>
>>> Cheers,
>>> Daniel
>>>
>>>
>>> Marco wrote:
>>>> Hello,
>>>>
>>>> I'm using Compartments in my model which have a GridLayout. To
>>>> visualize the grid of my layout manager, I would like to draw some
>>>> horizontal and vertical lines.
>>>>
>>>> Probably the best practice would be to override the GridLayer of the
>>>> Editor whith a custom implementation.
>>>>
>>>> So how can I replace the default GridLayerEx whith a custom
>>>> GridLayer-Implementation? On which location can I integrate my own
>>>> GridLayer into the generated Editor-Code?
>>>>
>>>> Thank you very much for your answer.
>>>>
>>>> Regards,
>>>> Marco
|
|
|
Powered by
FUDForum. Page generated in 0.21808 seconds