Home » Modeling » GMF (Graphical Modeling Framework) » How to call own layoutProvider from "Arrange All"
| |
Re: How to call own layoutProvider from "Arrange All" [message #216644 is a reply to message #216637] |
Thu, 29 January 2009 09:15 |
Martin Jacob Messages: 191 Registered: July 2009 |
Senior Member |
|
|
Hi Mariot,
the package and class name in plugin.xml is correct. (I just delete some parts for posting it here)
And yes u are right system.out is evil, its just a old habit from C programming....
Now I used the debugger but got the same result. My layout provider will not be called :(
Any other suggestions?
Cheers, Martin
Mariot Chauvin wrote, On 29.01.2009 09:49:
> Hi Martin,
>
> It seems to me that your class value in plugin.xml is not the right one :
>
> <layoutProvider class="ui.diagram.providers.LayoutProvider">
>
> should be :
>
> <layoutProvider class="yourcompany.yourpackage.PscViewerLayoutProvider">
>
> BTW debugging with system.out is evil :P, why you do not simply add breakpoints ?
>
> Regards,
>
> Mariot
>
> Martin Jacob a écrit :
>> Hi everyone,
>>
>> I was searching on the mailing list but did not find a sufficient
>> answer fop my problem.
>>
>> I want to use my own layoutProvider while using the already existing
>> menu item "Arrange All".
>>
>>
>> I did the following things so far:
>>
>> 1. Add the extension point, see below:
>>
>> <extension name="PSC Viewer Layout Provider"
>> point="org.eclipse.gmf.runtime.diagram.ui.layoutProviders">
>> <layoutProvider class="ui.diagram.providers.LayoutProvider">
>> <Priority name="Highest">
>> </Priority>
>> </layoutProvider>
>> </extension>
>>
>>
>> 2. Create a class derived from
>> org.eclipse.gmf.runtime.diagram.ui.services.layout.AbstractL ayoutNodeProvider
>>
>>
>> public class PscViewerLayoutProvider extends AbstractLayoutNodeProvider {
>>
>> public Runnable layoutLayoutNodes(List layoutNodes,
>> boolean offsetFromBoundingBox, IAdaptable layoutHint) {
>> System.out.println("layoutNodes: "+layoutNodes.toString());
>> System.out.println("offsetFromBoundingBox: "+offsetFromBoundingBox);
>> System.out.println("layoutHint: "+layoutHint.toString());
>> return null;
>> }
>>
>> public boolean provides(IOperation operation) {
>> System.out.println(""+operation.toString());
>> if (operation instanceof
>> org.eclipse.gmf.runtime.diagram.ui.services.layout.ILayoutNo deOperation) {
>> System.out.println("true");
>> return true;
>> }
>> System.out.println("false");
>> return false;
>> }
>> }
>>
>> I would expect to see at least the println while calling "Arrange All".
>> But I don't see any thing at System.out!
>>
>> Does any one could please give me a hint how to solve the problem?
>>
>> Thanks, Martin
|
|
|
Re: How to call own layoutProvider from "Arrange All" [message #216652 is a reply to message #216644] |
Thu, 29 January 2009 09:46 |
Mariot Chauvin Messages: 174 Registered: July 2009 |
Senior Member |
|
|
Martin,
Is there another layout defined with the highest priority ?
If you externalize your layout in a plug-in check that you plug-in started without errors ("Show View" -> "Other" -> "Plug-in Registry").
If you install GMF sdk there is also an example of layout provider ("New" -> "Example/ GMF PLugins/Square layout provider") to compare.
Regards,
Mariot
Martin Jacob a écrit :
> Hi Mariot,
>
> the package and class name in plugin.xml is correct. (I just delete some
> parts for posting it here)
> And yes u are right system.out is evil, its just a old habit from C
> programming....
>
> Now I used the debugger but got the same result. My layout provider will
> not be called :(
>
> Any other suggestions?
>
> Cheers, Martin
>
> Mariot Chauvin wrote, On 29.01.2009 09:49:
>> Hi Martin,
>>
>> It seems to me that your class value in plugin.xml is not the right one :
>>
>> <layoutProvider class="ui.diagram.providers.LayoutProvider">
>>
>> should be :
>>
>> <layoutProvider class="yourcompany.yourpackage.PscViewerLayoutProvider">
>>
>> BTW debugging with system.out is evil :P, why you do not simply add
>> breakpoints ?
>>
>> Regards,
>>
>> Mariot
>>
>> Martin Jacob a écrit :
>>> Hi everyone,
>>>
>>> I was searching on the mailing list but did not find a sufficient
>>> answer fop my problem.
>>>
>>> I want to use my own layoutProvider while using the already existing
>>> menu item "Arrange All".
>>>
>>>
>>> I did the following things so far:
>>>
>>> 1. Add the extension point, see below:
>>>
>>> <extension name="PSC Viewer Layout Provider"
>>> point="org.eclipse.gmf.runtime.diagram.ui.layoutProviders">
>>> <layoutProvider class="ui.diagram.providers.LayoutProvider">
>>> <Priority name="Highest">
>>> </Priority>
>>> </layoutProvider>
>>> </extension>
>>>
>>>
>>> 2. Create a class derived from
>>> org.eclipse.gmf.runtime.diagram.ui.services.layout.AbstractL ayoutNodeProvider
>>>
>>>
>>>
>>> public class PscViewerLayoutProvider extends
>>> AbstractLayoutNodeProvider {
>>>
>>> public Runnable layoutLayoutNodes(List layoutNodes,
>>> boolean offsetFromBoundingBox, IAdaptable layoutHint) {
>>> System.out.println("layoutNodes: "+layoutNodes.toString());
>>> System.out.println("offsetFromBoundingBox: "+offsetFromBoundingBox);
>>> System.out.println("layoutHint: "+layoutHint.toString());
>>> return null;
>>> }
>>>
>>> public boolean provides(IOperation operation) {
>>> System.out.println(""+operation.toString());
>>> if (operation instanceof
>>> org.eclipse.gmf.runtime.diagram.ui.services.layout.ILayoutNo deOperation)
>>> {
>>> System.out.println("true");
>>> return true;
>>> }
>>> System.out.println("false");
>>> return false;
>>> }
>>> }
>>>
>>> I would expect to see at least the println while calling "Arrange All".
>>> But I don't see any thing at System.out!
>>>
>>> Does any one could please give me a hint how to solve the problem?
>>>
>>> Thanks, Martin
|
|
|
Re: How to call own layoutProvider from "Arrange All" [message #216658 is a reply to message #216652] |
Thu, 29 January 2009 10:08 |
Martin Jacob Messages: 191 Registered: July 2009 |
Senior Member |
|
|
Hi Mariot,
thanks for the hint!
In fact the plugin could not be loaded because a ClassNotFoundException was thrown...
Now I copied the package name and class name to the extension point in plugin.xml. And it works! There must be a typo some where...
Regards, Martin
Mariot Chauvin wrote, On 29.01.2009 10:46:
> Martin,
>
> Is there another layout defined with the highest priority ?
> If you externalize your layout in a plug-in check that you plug-in started without errors ("Show View" -> "Other" -> "Plug-in Registry").
>
> If you install GMF sdk there is also an example of layout provider ("New" -> "Example/ GMF PLugins/Square layout provider") to compare.
>
> Regards,
>
> Mariot
>
> Martin Jacob a écrit :
>> Hi Mariot,
>>
>> the package and class name in plugin.xml is correct. (I just delete some
>> parts for posting it here)
>> And yes u are right system.out is evil, its just a old habit from C
>> programming....
>>
>> Now I used the debugger but got the same result. My layout provider will
>> not be called :(
>>
>> Any other suggestions?
>>
>> Cheers, Martin
>>
>> Mariot Chauvin wrote, On 29.01.2009 09:49:
>>> Hi Martin,
>>>
>>> It seems to me that your class value in plugin.xml is not the right one :
>>>
>>> <layoutProvider class="ui.diagram.providers.LayoutProvider">
>>>
>>> should be :
>>>
>>> <layoutProvider class="yourcompany.yourpackage.PscViewerLayoutProvider">
>>>
>>> BTW debugging with system.out is evil :P, why you do not simply add
>>> breakpoints ?
>>>
>>> Regards,
>>>
>>> Mariot
>>>
>>> Martin Jacob a écrit :
>>>> Hi everyone,
>>>>
>>>> I was searching on the mailing list but did not find a sufficient
>>>> answer fop my problem.
>>>>
>>>> I want to use my own layoutProvider while using the already existing
>>>> menu item "Arrange All".
>>>>
>>>>
>>>> I did the following things so far:
>>>>
>>>> 1. Add the extension point, see below:
>>>>
>>>> <extension name="PSC Viewer Layout Provider"
>>>> point="org.eclipse.gmf.runtime.diagram.ui.layoutProviders">
>>>> <layoutProvider class="ui.diagram.providers.LayoutProvider">
>>>> <Priority name="Highest">
>>>> </Priority>
>>>> </layoutProvider>
>>>> </extension>
>>>>
>>>>
>>>> 2. Create a class derived from
>>>> org.eclipse.gmf.runtime.diagram.ui.services.layout.AbstractL ayoutNodeProvider
>>>>
>>>>
>>>>
>>>> public class PscViewerLayoutProvider extends
>>>> AbstractLayoutNodeProvider {
>>>>
>>>> public Runnable layoutLayoutNodes(List layoutNodes,
>>>> boolean offsetFromBoundingBox, IAdaptable layoutHint) {
>>>> System.out.println("layoutNodes: "+layoutNodes.toString());
>>>> System.out.println("offsetFromBoundingBox: "+offsetFromBoundingBox);
>>>> System.out.println("layoutHint: "+layoutHint.toString());
>>>> return null;
>>>> }
>>>>
>>>> public boolean provides(IOperation operation) {
>>>> System.out.println(""+operation.toString());
>>>> if (operation instanceof
>>>> org.eclipse.gmf.runtime.diagram.ui.services.layout.ILayoutNo deOperation)
>>>> {
>>>> System.out.println("true");
>>>> return true;
>>>> }
>>>> System.out.println("false");
>>>> return false;
>>>> }
>>>> }
>>>>
>>>> I would expect to see at least the println while calling "Arrange All".
>>>> But I don't see any thing at System.out!
>>>>
>>>> Does any one could please give me a hint how to solve the problem?
>>>>
>>>> Thanks, Martin
|
|
|
Goto Forum:
Current Time: Sat Apr 20 06:28:04 GMT 2024
Powered by FUDForum. Page generated in 0.03573 seconds
|