[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Newsgroup Home]
[news.eclipse.modeling.gmf] Re: How to call own layoutProvider from "Arrange All"

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.AbstractLayoutNodeProvider


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.ILayoutNodeOperation) {
        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