arrangeAll by code [message #85401] |
Thu, 14 December 2006 12:12 |
Eclipse User |
|
|
|
Originally posted by: pqueralt.yahoo.es
Hi all,
Well I would like to call the arrangeAll action by code.
|
|
|
Re: arrangeAll by code [message #85416 is a reply to message #85401] |
Thu, 14 December 2006 12:36 |
Eclipse User |
|
|
|
Originally posted by: pqueralt.yahoo.es
Well, I am trying this code
but it always falls in the getCommand(arrangeRequest) instruction because of
it don't understand the request.
try
{
ArrangeRequest arrangeRequest = new
ArrangeRequest(ActionIds.ACTION_ARRANGE_ALL);
List l = getDiagram().getChildren();
arrangeRequest.setPartsToArrange(l);
Command arrangeCmd = getCommand(arrangeRequest);
arrangeCmd.execute();
System.out.println("He hecho el ARRANGEAll");
}catch(Exception e){
e.printStackTrace();
}
Any idea?
Many thanks.
Pascual
but It alwa
"P" <pqueralt@yahoo.es> escribi
|
|
|
|
Re: arrangeAll by code [message #85527 is a reply to message #85431] |
Thu, 14 December 2006 15:23 |
Eclipse User |
|
|
|
Originally posted by: pqueralt.yahoo.es
Hi Cherie,
Many thanks for your answer, it has been very helpful. However I appreciate
that the effect is totally different if I do arrangeAll automatically all
the boxes and edges appear together in the center of the diagram, while if i
do it manually it places everything o.k. It is always like that or am I
doing something wrong??
I have put the code at the end of the method "where " in the module
DiagramCanonicalEditPolicy where it seems to finish the process, with the
instruction "getHost().getCommand(arrangeRequest)" just like you said
Cheers.
Pascual
"Cherie Revells" <crevells@ca.ibm.com> escribi
|
|
|
Re: arrangeAll by code [message #85572 is a reply to message #85527] |
Thu, 14 December 2006 16:32 |
Mohammed Mostafa Messages: 143 Registered: July 2009 |
Senior Member |
|
|
Hi ;
The arrange result will vary depending on the context, if the context
is the same the result should be the same regardless how did you invoke
it. Make sure that you invoke the arrange request on the correct Parent
(the one you want to arrange its children, like the diagram edit part)
at the correct time, for example if you execute the arrange command
before the children edit parts are created then nothing will be arranged.
One way to debug it is to put a break point in the
DefaultProvider#build_graph and check the editparts passed in both
cases, if it is not the same then this will explain the different
results you get.
One more point, if your the edit part had a ContainerEditPolicy
installed on it it should be able to understand the ACTION_ARRANGE_ALL
P wrote:
> Hi Cherie,
>
> Many thanks for your answer, it has been very helpful. However I appreciate
> that the effect is totally different if I do arrangeAll automatically all
> the boxes and edges appear together in the center of the diagram, while if i
> do it manually it places everything o.k. It is always like that or am I
> doing something wrong??
>
> I have put the code at the end of the method "where " in the module
> DiagramCanonicalEditPolicy where it seems to finish the process, with the
> instruction "getHost().getCommand(arrangeRequest)" just like you said
> Cheers.
>
> Pascual
>
>
>
>
> "Cherie Revells" <crevells@ca.ibm.com> escribió en el mensaje
> news:elri7n$500$1@utils.eclipse.org...
>> Hi Pascual,
>>
>> Where are you sending the request? The request should go to the
>> DiagramEditPart or the ShapeCompartmentEditpart for which you want to
>> arrange all the shapes.
>>
>> By the way, if you are doing an arrange all then you do not need to set
>> the parts to arrange. An arrange all will layout all the children of the
>> container to which the request is being sent.
>>
>> Regards,
>> Cherie
>>
>> P wrote:
>>> Well, I am trying this code
>>>
>>>
>>> but it always falls in the getCommand(arrangeRequest) instruction because
>>> of it don't understand the request.
>>> try
>>>
>>> {
>>>
>>> ArrangeRequest arrangeRequest = new
>>> ArrangeRequest(ActionIds.ACTION_ARRANGE_ALL);
>>>
>>> List l = getDiagram().getChildren();
>>>
>>> arrangeRequest.setPartsToArrange(l);
>>>
>>> Command arrangeCmd = getCommand(arrangeRequest);
>>>
>>> arrangeCmd.execute();
>>>
>>> System.out.println("He hecho el ARRANGEAll");
>>>
>>> }catch(Exception e){
>>>
>>> e.printStackTrace();
>>>
>>> }
>>>
>>>
>>>
>>> Any idea?
>>> Many thanks.
>>> Pascual
>>>
>>> but It alwa
>>>
>>>
>>>
>>>
>>> "P" <pqueralt@yahoo.es> escribió en el mensaje
>>> news:elrf2r$fik$1@utils.eclipse.org...
>>>> Hi all,
>>>>
>>>> Well I would like to call the arrangeAll action by code.ç
>>>> I have imported the library
>>>>
>>>> import
>>>> org.eclipse.gmf.runtime.diagram.ui.actions.internal.ArrangeA ction;
>>>>
>>>>
>>>> but it is not visible as a restriction of these plugin. The same is
>>>> happening with DiagramAction class.
>>>>
>>>> Does anybody know how I can succed?
>>>>
>>>> Many thanks in advance.
>>>>
>>>> Pascual
>>>>
>
|
|
|
Powered by
FUDForum. Page generated in 0.03609 seconds