Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » GMF (Graphical Modeling Framework) » PopUp Bar on nested child elements
PopUp Bar on nested child elements [message #548860] Fri, 23 July 2010 10:23 Go to next message
Kellogs is currently offline KellogsFriend
Messages: 7
Registered: July 2010
Junior Member
Hi,

I'm trying to implement the popup bar on compartments.
I have a figure like this one:

-------------------------------
| + Rectangle A
| --------------------------
| | + Rectangle B
| | -------------------
| | | + Rectangle C
| | -------------------
| --------------------------
-------------------------------

It's supposed to be a figure A with nested child elements Wink
(C is child of B, and B is child of A)


If I click the Rectangle A (or hover over it) the litte popup bar is showing up and I can select child B (in the little popup bar) and it will be created.
But if I click Rectangle B (or again, hover over it) nothing happens.
Where's the little popup bar? I want to create a child C using this bar...

I found a solution (here: http://www.eclipse.org/forums/index.php?t=rview&goto=103 725&th=31971) using "DelegatingMouseEventsEditPolicy" but this doesn't work for me.

So my questions is:
- Am I doing something wrong? (I installed a new EditPolicy in RectangleACompartmentEditPart #createDefaultEditPolicies() using POPUPBAR_ROLE as EditPolicy Role)
- Is there another way to to this? Smile


Thanks for any hint,
kellogs
Re: PopUp Bar on nested child elements [message #549080 is a reply to message #548860] Sat, 24 July 2010 07:08 Go to previous messageGo to next message
Robert Wloch is currently offline Robert WlochFriend
Messages: 109
Registered: July 2009
Senior Member
Hi Kellogs,

I can only give you hints, but I'm not 100% sure if they're the right direction:

1) Compare the implementations of createDefaultEditPolicies() of your generated EditParts for Figure A, B and C

2) Your generated EditParts should extend ShapeEditPart. ShapeEditPart#createDefaultEditPolicies() installs an EditPolicy for a popup bar role, which sounds as what you're looking for:
installEditPolicy(EditPolicyRoles.POPUPBAR_ROLE, new PopupBarEditPolicy());


That EditPolicy has a calculateEnabled() method:
PopupBarEditPolicy.PopupBarLabelHandle.calculateEnabled()

Maybe setting a break point there brings you further.

Unfortunately, even the GMF Book only mentions the popup bars, without giving examples (pg. 365f).

Rob
Re: PopUp Bar on nested child elements [message #549172 is a reply to message #549080] Sun, 25 July 2010 19:52 Go to previous message
Kellogs is currently offline KellogsFriend
Messages: 7
Registered: July 2010
Junior Member
Hi Rob,

thanks for your tip.
I tried debugging the method you mentioned:
PopupBarEditPolicy.PopupBarLabelHandle.calculateEnabled()

but it seems like this method is never be called.

Following your hint I took a closer look at
PopupBarEditPolicy.populatePopupBars()

and debugged very deep until I reached
ExecutionStrategy.getUncachedProviders

	public List getUncachedProviders(
		Service service,
		ProviderPriority priority,
		IOperation operation) {

		List descriptors = service.getProviders(priority);
		int size = descriptors.size();
		List providers = new ArrayList(size);

		for (int i = 0; i < size; ++i) {
			ProviderDescriptor descriptor = (ProviderDescriptor)descriptors.get(i);

			if (Service.safeProvides(descriptor, operation)) {
				providers.add(descriptor.getProvider());
			}
		}


Comparing the List of providers of Figure A and B I couldn't figure out any difference.
They both have 2 Providers:
1. org.eclipse.gmf.runtime.diagram.ui.providers.internal.Diagra mModelingAssistantProvider
2. com.XXX.diagram.providers.XXX.ModelingAssistantProvider

The "Tragedy" happens in the if()-clause:
if (Service.safeProvides(descriptor, operation))

Though they both have the same providers AND the same operation:
org.eclipse.gmf.runtime.emf.ui.services.modelingassistant.GetTypesForPopupBarOperation

the if()-clause fails at the 2. provider while debugging Figure B.
(This doesn't happend with Figure A).

Currently I'm debugging the if()-clause,
but maybe somebody did already figure out the problem and can give me a tip Wink

Kellogs
Previous Topic:Property Sheet title
Next Topic:Link source and target points coordinate
Goto Forum:
  


Current Time: Tue Apr 16 04:30:06 GMT 2024

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

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

Back to the top