Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » GMF (Graphical Modeling Framework) » ModelingAssistant Popup for ShapeCompartments
ModelingAssistant Popup for ShapeCompartments [message #988175] Wed, 28 November 2012 13:28
Daniel König is currently offline Daniel König
Messages: 24
Registered: November 2012
Junior Member
Hello!

I had to change my compartments to ShapeCompartments (ListLayout = false).
Since I changed this I do not get the ModelingAssistant Popup anymore.

The EditPolicy should be installed by default:

org.eclipse.gmf.runtime.diagram.ui.editparts.ShapeCompartmentEditPart:
	protected void createDefaultEditPolicies() {
		super.createDefaultEditPolicies();
		installEditPolicy(EditPolicyRoles.CREATION_ROLE,
			new CreationEditPolicy());
		installEditPolicy(EditPolicy.LAYOUT_ROLE, new XYLayoutEditPolicy());
		installEditPolicy(EditPolicy.CONTAINER_ROLE, new ContainerEditPolicy());
		// TODO: this edit policy get overriden by code at the end of this
		// function
		// may be this breaks some use cases; it needs to be checked
		installEditPolicy(EditPolicyRoles.DRAG_DROP_ROLE,
			new DiagramLinkDragDropEditPolicy());
		installEditPolicy(EditPolicy.GRAPHICAL_NODE_ROLE,
			new ContainerNodeEditPolicy());
		// Install an edit policy for snap
		installEditPolicy(EditPolicyRoles.SNAP_FEEDBACK_ROLE,
			new SnapFeedbackPolicy());
		installEditPolicy(EditPolicyRoles.DRAG_DROP_ROLE,
			new ShapeCompartmentDropEditPolicy());
		installEditPolicy(EditPolicyRoles.POPUPBAR_ROLE,
			new PopupBarEditPolicy());
	}




ComponentStateCompartmentEditPart extends ShapeCompartmentEditPart:
	protected void createDefaultEditPolicies() {
		super.createDefaultEditPolicies();
		installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new ComponentComponentStateCompartmentItemSemanticEditPolicy());
		installEditPolicy(EditPolicyRoles.CREATION_ROLE, new CreationEditPolicyWithCustomReparent(
				MachineVisualIDRegistry.TYPED_INSTANCE));
		installEditPolicy(EditPolicyRoles.CANONICAL_ROLE, new ComponentComponentStateCompartmentCanonicalEditPolicy());
	}


The ModelingAssistantProvider should also be fine:
	public List getTypesForPopupBar(IAdaptable host) {
		IGraphicalEditPart editPart = (IGraphicalEditPart) host.getAdapter(IGraphicalEditPart.class);
		if (editPart instanceof ModelEditPart) {
			ArrayList<IElementType> types = new ArrayList<IElementType>(1);
			types.add(MachineElementTypes.Machine_2001);
			return types;
		}
		if (editPart instanceof MachineEditPart) {
			ArrayList<IElementType> types = new ArrayList<IElementType>(1);
			types.add(MachineElementTypes.Component_3001);
			return types;
		}
		if (editPart instanceof ComponentStateCompartmentEditPart) {
			ArrayList<IElementType> types = new ArrayList<IElementType>(1);
			types.add(MachineElementTypes.State_3002);
			return types;
		}
		if (editPart instanceof StateComponentValueCompartmentEditPart) {
			ArrayList<IElementType> types = new ArrayList<IElementType>(1);
			types.add(MachineElementTypes.StateValue_3004);
			return types;
		}
		return Collections.EMPTY_LIST;
	}



Is there any way I can get the ModelingAssistant back for my ShapeCompartment?
I recognized in the ModelingAssistantProvider that the EditPart for ListCompartments is the Node itself (for example "MachineEditPart"). If it's a ShapeCompartment, the CompartmentEditPart is used ("ComponentStateCompartmentEditPart" resp. "StateComponentValueCompartmentEditPart").

Manually changing to the Node which contains the Compartment did not have any effect.


I hope someone can help me.
Thank you! Smile
Previous Topic:Custom ModelAssistant Popup Names and Icons
Next Topic:ModelingAssistant Popup for ShapeCompartments
Goto Forum:
  


Current Time: Thu May 23 16:51:20 EDT 2013

Powered by FUDForum. Page generated in 0.01391 seconds