Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » GMF (Graphical Modeling Framework) » Rearranging a Compartment?
Rearranging a Compartment? [message #56656] Wed, 27 September 2006 22:21 Go to next message
Eclipse UserFriend
Originally posted by: amoiln.sktcorp.com

How do I manage to rearrange items in a Compartment? For instance, in
the Mindmap tutorial example, it is easy to create a Thread with a bunch
of Thread Items, but suppose after I create the Thread Items I want to
rearrange them. Is there any way to make a (user interface) control to
do that? I can't seem to figure it out.

Thanks!

Arthur Molin
Re: Rearranging a Compartment? [message #58404 is a reply to message #56656] Mon, 02 October 2006 14:55 Go to previous messageGo to next message
Mohammed Mostafa is currently offline Mohammed MostafaFriend
Messages: 143
Registered: July 2009
Senior Member
Hi Arthur:
Check the ArrangeAction

Arthur Molin wrote:
> How do I manage to rearrange items in a Compartment? For instance, in
> the Mindmap tutorial example, it is easy to create a Thread with a bunch
> of Thread Items, but suppose after I create the Thread Items I want to
> rearrange them. Is there any way to make a (user interface) control to
> do that? I can't seem to figure it out.
>
> Thanks!
>
> Arthur Molin
Re: Rearranging a Compartment? [message #58458 is a reply to message #58404] Tue, 03 October 2006 01:06 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: amolin.sktcorp.com

I cannot find ArrangeAction anywhere. Can you provide a little more
information? What package is it in?

Thanks!

Arthur

Mohammed Mostafa wrote:

> Hi Arthur:
> Check the ArrangeAction

> Arthur Molin wrote:
>> How do I manage to rearrange items in a Compartment? For instance, in
>> the Mindmap tutorial example, it is easy to create a Thread with a bunch
>> of Thread Items, but suppose after I create the Thread Items I want to
>> rearrange them. Is there any way to make a (user interface) control to
>> do that? I can't seem to figure it out.
>>
>> Thanks!
>>
>> Arthur MolinI cannot find ArrangeAction anywhere. Can you provide a little
more information? What package it is in?

Thanks!

Arthur
Re: Rearranging a Compartment? [message #58469 is a reply to message #58458] Tue, 03 October 2006 01:56 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: vcciubot.uwaterloo.ca

package org.eclipse.gmf.runtime.diagram.ui.actions.internal;

import java.util.ArrayList;
import java.util.Collections;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.ListIterator;
import java.util.Set;

import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.draw2d.Animation;
import org.eclipse.draw2d.XYLayout;
import org.eclipse.gef.ConnectionEditPart;
import org.eclipse.gef.EditPart;
import org.eclipse.gef.GraphicalEditPart;
import org.eclipse.gef.Request;
import org.eclipse.gef.commands.Command;
import org.eclipse.gef.commands.CompoundCommand;
import org.eclipse.gef.commands.UnexecutableCommand;
import org.eclipse.gef.tools.ToolUtilities;
import org.eclipse.gmf.runtime.diagram.ui.actions.ActionIds;
import org.eclipse.gmf.runtime.diagram.ui.actions.DiagramAction;
import org.eclipse.gmf.runtime.diagram.ui.actions.internal.l10n.Dia gramUIActionsMessages;
import org.eclipse.gmf.runtime.diagram.ui.actions.internal.l10n.Dia gramUIActionsPluginImages;
import org.eclipse.gmf.runtime.diagram.ui.editparts.DiagramEditPart ;
import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditP art;
import org.eclipse.gmf.runtime.diagram.ui.editparts.ShapeCompartmen tEditPart;
import org.eclipse.gmf.runtime.diagram.ui.preferences.IPreferenceCo nstants;
import org.eclipse.gmf.runtime.diagram.ui.requests.ArrangeRequest;
import org.eclipse.jface.preference.IPreferenceStore;
import org.eclipse.ui.IWorkbenchPage;

/**
* The Arrange Action: arranges a container editpart or a set of selected editparts
*
* @author melaasar
* @canBeSeenBy %level1
*/
public class ArrangeAction extends DiagramAction {


On Tue, 03 Oct 2006 01:06:08 +0000, Arthur Molin wrote:

> I cannot find ArrangeAction anywhere. Can you provide a little more
> information? What package is it in?
>
> Thanks!
>
> Arthur
>
> Mohammed Mostafa wrote:
>
>> Hi Arthur:
>> Check the ArrangeAction
>
>> Arthur Molin wrote:
>>> How do I manage to rearrange items in a Compartment? For instance, in
>>> the Mindmap tutorial example, it is easy to create a Thread with a bunch
>>> of Thread Items, but suppose after I create the Thread Items I want to
>>> rearrange them. Is there any way to make a (user interface) control to
>>> do that? I can't seem to figure it out.
>>>
>>> Thanks!
>>>
>>> Arthur MolinI cannot find ArrangeAction anywhere. Can you provide a little
> more information? What package it is in?
>
> Thanks!
>
> Arthur
Re: Rearranging a Compartment? [message #58987 is a reply to message #58469] Tue, 03 October 2006 17:44 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: amolin.sktcorp.com

If I understand this correctly, ArrangeAction is the action which is used
to arrange nodes programmatically. I need to give the user of the editor
the capability to rearrange items manually--select an item and drag it to
another place in the Compartment.

You can drag an item to another Compartment in the editor, but not to
another place in the same Compartment.

Also, as far as I can tell, with a GMF editor you cannot insert an item
into the middle of a Compartment. With an EMF editor, you can select an
item and a menu item says "Add Sibling", but there is nothing for GMF.

Thanks for your help!

Arthur Molin

Vlad Ciubotariu wrote:

> package org.eclipse.gmf.runtime.diagram.ui.actions.internal;
> ...
> public class ArrangeAction extends DiagramAction {


>>
>>> Arthur Molin wrote:
>>>> How do I manage to rearrange items in a Compartment? For instance, in
>>>> the Mindmap tutorial example, it is easy to create a Thread with a bunch
>>>> of Thread Items, but suppose after I create the Thread Items I want to
>>>> rearrange them. Is there any way to make a (user interface) control to
>>>> do that? I can't seem to figure it out.
>>>>
>>>> Thanks!
>>>>
>>>> Arthur MolinI cannot find ArrangeAction anywhere. Can you provide a
little
>> more information? What package it is in?
>>
>> Thanks!
>>
>> Arthur
Re: Rearranging a Compartment? [message #59613 is a reply to message #58987] Thu, 05 October 2006 15:11 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: vcciubot.uwaterloo.ca

This has to do with the layout edit policy installed on your compartment
edit part. Here's a configuration that works for me. The
ShapeCompartmentEditPart installs an XYLayoutEditPolicy that allows you
to rearrange things in your compartment.

You can ignore the last two other edit policy installed on this
edit part:

public class BlockChildrenCompartmentEditPart extends ShapeCompartmentEditPart {

public BlockChildrenCompartmentEditPart(View view) {
super(view);
}

public String getCompartmentName() {
return "BlockChildrenCompartment";
}

public IFigure createFigure() {
ResizableCompartmentFigure result = (ResizableCompartmentFigure) super
.createFigure();
result.setTitleVisibility(false);
return result;
}

protected void createDefaultEditPolicies() {
super.createDefaultEditPolicies();
installEditPolicy(EditPolicyRoles.CREATION_ROLE,
new CreationEditPolicy());
installEditPolicy(EditPolicyRoles.DRAG_DROP_ROLE,
new DragDropEditPolicy());
installEditPolicy(EditPolicyRoles.CANONICAL_ROLE,
new BlockCanonicalEditPolicy());
installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE,
new BlockChildrenCompartmentCreationEditPolicy());
}
....
}

The edit parts contained in this compartment extend ShapeNodeEditPart.

Hope this helps.

vlad




On Tue, 03 Oct 2006 17:44:58 +0000, Arthur Molin wrote:

> If I understand this correctly, ArrangeAction is the action which is used
> to arrange nodes programmatically. I need to give the user of the editor
> the capability to rearrange items manually--select an item and drag it to
> another place in the Compartment.
>
> You can drag an item to another Compartment in the editor, but not to
> another place in the same Compartment.
>
> Also, as far as I can tell, with a GMF editor you cannot insert an item
> into the middle of a Compartment. With an EMF editor, you can select an
> item and a menu item says "Add Sibling", but there is nothing for GMF.
>
> Thanks for your help!
>
> Arthur Molin
>
> Vlad Ciubotariu wrote:
>
>> package org.eclipse.gmf.runtime.diagram.ui.actions.internal;
>> ...
>> public class ArrangeAction extends DiagramAction {
>
>
>>>
>>>> Arthur Molin wrote:
>>>>> How do I manage to rearrange items in a Compartment? For instance, in
>>>>> the Mindmap tutorial example, it is easy to create a Thread with a bunch
>>>>> of Thread Items, but suppose after I create the Thread Items I want to
>>>>> rearrange them. Is there any way to make a (user interface) control to
>>>>> do that? I can't seem to figure it out.
>>>>>
>>>>> Thanks!
>>>>>
>>>>> Arthur MolinI cannot find ArrangeAction anywhere. Can you provide a
> little
>>> more information? What package it is in?
>>>
>>> Thanks!
>>>
>>> Arthur
Re: Rearranging a Compartment? [message #80498 is a reply to message #58987] Thu, 23 November 2006 15:59 Go to previous message
Eclipse UserFriend
Originally posted by: benjamin_fu.126.com

I have the same problem.
I found that FlowLayoutEditPolicy can do the work, but need to override the
method :
protected Command createMoveChildCommand(EditPart child, EditPart after)
In Logic example the LogicFlowLayoutEditPolicy do not implement the method
above, any one who can give some example code to do the rearrange work?

Br,
Ben


"Arthur Molin" <amolin@sktcorp.com>
??????:51f6d75ad8d2226c9bb37eed7f06c4d1$1@www.eclipse.org...
> If I understand this correctly, ArrangeAction is the action which is used
> to arrange nodes programmatically. I need to give the user of the editor
> the capability to rearrange items manually--select an item and drag it to
> another place in the Compartment.
>
> You can drag an item to another Compartment in the editor, but not to
> another place in the same Compartment.
>
> Also, as far as I can tell, with a GMF editor you cannot insert an item
> into the middle of a Compartment. With an EMF editor, you can select an
> item and a menu item says "Add Sibling", but there is nothing for GMF.
>
> Thanks for your help!
>
> Arthur Molin
>
> Vlad Ciubotariu wrote:
>
>> package org.eclipse.gmf.runtime.diagram.ui.actions.internal;
>> ...
>> public class ArrangeAction extends DiagramAction {
>
>
>>>
>>>> Arthur Molin wrote:
>>>>> How do I manage to rearrange items in a Compartment? For instance, in
>>>>> the Mindmap tutorial example, it is easy to create a Thread with a
>>>>> bunch of Thread Items, but suppose after I create the Thread Items I
>>>>> want to rearrange them. Is there any way to make a (user interface)
>>>>> control to do that? I can't seem to figure it out.
>>>>>
>>>>> Thanks!
>>>>>
>>>>> Arthur MolinI cannot find ArrangeAction anywhere. Can you provide a
> little
>>> more information? What package it is in?
>>>
>>> Thanks!
>>>
>>> Arthur
>
Previous Topic:Getting the XMI from a graphical edit part
Next Topic:Error in Single file for diagram and domain model
Goto Forum:
  


Current Time: Wed Jul 17 06:27:45 GMT 2024

Powered by FUDForum. Page generated in 0.03874 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top