Home » Modeling » GMF (Graphical Modeling Framework) » Custom LayoutProviders
Custom LayoutProviders [message #160998] |
Fri, 16 November 2007 12:13  |
Eclipse User |
|
|
|
Originally posted by: jdente.21technologies.com
Hi,
I had a hard time getting the
org.eclipse.gmf.runtime.diagram.ui.layoutProviders extension to work. I
looked at the example SquareLayout in the plugin
org.eclipse.gmf.examples.runtime.diagram.layout. I could not get this
custom layout to work. After stepping through the code with the debugger, I
realized that the provides(IOperation operation) method on SquareLayout is
always returning false because it can only find the DEFAULT layout:
IAdaptable layoutHint = ((ILayoutNodeOperation)operation).getLayoutHint();
String layoutType = (String)layoutHint.getAdapter(String.class);
The only layoutType that seems to be registered is the default layout, and
so layoutType always equals DEFAULT. If I understand this correctly, it
seems that the layoutProviders extension is the extension point for
registering new layouts. Yet, this extension does not seem to do anything,
since even with the example plugin, only the default layout ever gets
registered.
Does anybody have any insight?
Thanks,
Joe
|
|
|
Re: Custom LayoutProviders [message #161108 is a reply to message #160998] |
Sun, 18 November 2007 13:09   |
Eclipse User |
|
|
|
Originally posted by: martin.tauber.t-online.de
Joe,
could you provide some more information on what you are trying to
achieve here. I'm curious, because I have some figures in my diagram,
which need there own layout Manager, but I would have just written an
layout manager and changed the gmfgraph model to use the custom layout
for the figure ....
Joe Dente wrote:
> Hi,
> I had a hard time getting the
> org.eclipse.gmf.runtime.diagram.ui.layoutProviders extension to work. I
> looked at the example SquareLayout in the plugin
> org.eclipse.gmf.examples.runtime.diagram.layout. I could not get this
> custom layout to work. After stepping through the code with the debugger, I
> realized that the provides(IOperation operation) method on SquareLayout is
> always returning false because it can only find the DEFAULT layout:
>
> IAdaptable layoutHint = ((ILayoutNodeOperation)operation).getLayoutHint();
> String layoutType = (String)layoutHint.getAdapter(String.class);
>
> The only layoutType that seems to be registered is the default layout, and
> so layoutType always equals DEFAULT. If I understand this correctly, it
> seems that the layoutProviders extension is the extension point for
> registering new layouts. Yet, this extension does not seem to do anything,
> since even with the example plugin, only the default layout ever gets
> registered.
>
> Does anybody have any insight?
> Thanks,
> Joe
>
>
|
|
| |
Re: Custom LayoutProviders [message #161321 is a reply to message #160998] |
Mon, 19 November 2007 09:31   |
Eclipse User |
|
|
|
Joe,
It is explained here:
http://help.eclipse.org/help33/topic/org.eclipse.gmf.doc/exa mples-guide/diagram/layoutServiceExample.html
The Square Layout is used when the layout type is SQUARE_LAYOUT which
happens when you invoke the "Layout Diagram as Square" menu item under
the Sample menu. If you wanted to invoke your layout during an arrange
all or arrange selected then you would contribute your layout provider
when the layout type is DEFAULT.
Regards,
Cherie
Joe Dente wrote:
> Hi,
> I had a hard time getting the
> org.eclipse.gmf.runtime.diagram.ui.layoutProviders extension to work. I
> looked at the example SquareLayout in the plugin
> org.eclipse.gmf.examples.runtime.diagram.layout. I could not get this
> custom layout to work. After stepping through the code with the debugger, I
> realized that the provides(IOperation operation) method on SquareLayout is
> always returning false because it can only find the DEFAULT layout:
>
> IAdaptable layoutHint = ((ILayoutNodeOperation)operation).getLayoutHint();
> String layoutType = (String)layoutHint.getAdapter(String.class);
>
> The only layoutType that seems to be registered is the default layout, and
> so layoutType always equals DEFAULT. If I understand this correctly, it
> seems that the layoutProviders extension is the extension point for
> registering new layouts. Yet, this extension does not seem to do anything,
> since even with the example plugin, only the default layout ever gets
> registered.
>
> Does anybody have any insight?
> Thanks,
> Joe
>
>
|
|
|
Re: Custom LayoutProviders [message #161528 is a reply to message #161321] |
Mon, 19 November 2007 16:18  |
Eclipse User |
|
|
|
Originally posted by: jdente.21technologies.com
Ok, that makes sense.
I misunderstood the process/extension point. DEFAULT layout type is what
gets called by "Arrange All", so if you want your layout to override the
default behavior you return true when the layoutType equals DEFAULT.
Otherwise, your custom action can set the LayoutType and the provides()
method can figure out what to do.
Thanks,
Joe
"Cherie Revells" <crevells@ca.ibm.com> wrote in message
news:fhs6uu$8is$1@build.eclipse.org...
> Joe,
>
> It is explained here:
> http://help.eclipse.org/help33/topic/org.eclipse.gmf.doc/exa mples-guide/diagram/layoutServiceExample.html
>
> The Square Layout is used when the layout type is SQUARE_LAYOUT which
> happens when you invoke the "Layout Diagram as Square" menu item under the
> Sample menu. If you wanted to invoke your layout during an arrange all or
> arrange selected then you would contribute your layout provider when the
> layout type is DEFAULT.
>
> Regards,
> Cherie
>
> Joe Dente wrote:
>> Hi,
>> I had a hard time getting the
>> org.eclipse.gmf.runtime.diagram.ui.layoutProviders extension to work. I
>> looked at the example SquareLayout in the plugin
>> org.eclipse.gmf.examples.runtime.diagram.layout. I could not get this
>> custom layout to work. After stepping through the code with the
>> debugger, I realized that the provides(IOperation operation) method on
>> SquareLayout is always returning false because it can only find the
>> DEFAULT layout:
>>
>> IAdaptable layoutHint =
>> ((ILayoutNodeOperation)operation).getLayoutHint();
>> String layoutType = (String)layoutHint.getAdapter(String.class);
>>
>> The only layoutType that seems to be registered is the default layout,
>> and so layoutType always equals DEFAULT. If I understand this correctly,
>> it seems that the layoutProviders extension is the extension point for
>> registering new layouts. Yet, this extension does not seem to do
>> anything, since even with the example plugin, only the default layout
>> ever gets registered.
>>
>> Does anybody have any insight?
>> Thanks,
>> Joe
|
|
|
Goto Forum:
Current Time: Sat Aug 30 16:15:43 EDT 2025
Powered by FUDForum. Page generated in 0.03525 seconds
|