Skip to main content



      Home
Home » Modeling » GMF (Graphical Modeling Framework) » ModelingAssistantProvider (ModelingAssistantProvider don't appear for xxxcompartmentEditPart)
ModelingAssistantProvider [message #1145189] Sat, 19 October 2013 06:20 Go to next message
Eclipse UserFriend
hi all,

my modeling assistand for my compartments;

if (editPart instanceof WebWebOwnedListCompartmentEditPart) {
			ArrayList<IElementType> types = new ArrayList<IElementType>(1);
			types.add(ContentElementTypes.CustomList_3001);
			return types;
		}
		if (editPart instanceof WebWebOwnedWebCompartmentEditPart) {
			ArrayList<IElementType> types = new ArrayList<IElementType>(1);
			types.add(ContentElementTypes.Web_3014);
			return types;
		}


but they dont appear on compartmentEditPart why don't understand anyone can help me to solve this ?

or there is any shortcut for popupbar ?

Regards
Re: ModelingAssistantProvider [message #1160686 is a reply to message #1145189] Tue, 29 October 2013 05:33 Go to previous messageGo to next message
Eclipse UserFriend
Hi,

do you have PopupBarEditPolicy installed into your editpart? Did you debug the code executed there?

Ralph
Re: ModelingAssistantProvider [message #1162185 is a reply to message #1160686] Wed, 30 October 2013 03:56 Go to previous messageGo to next message
Eclipse UserFriend
Hi,

I don't know PopupBarEditPolicy

How can i find this policy ? or there is any sample ?

Regards
Re: ModelingAssistantProvider [message #1162449 is a reply to message #1162185] Wed, 30 October 2013 07:35 Go to previous messageGo to next message
Eclipse UserFriend
Hi,

it should be installed in the createDefaultEditPolicies() method of your edit part or one of ist super classes.

Ralph
Re: ModelingAssistantProvider [message #1173985 is a reply to message #1162449] Wed, 06 November 2013 16:57 Go to previous messageGo to next message
Eclipse UserFriend
Hi,

I tried as;

installEditPolicy(EditPolicyRoles.POPUPBAR_ROLE, new PopupBarEditPolicy());

But still don't work Sad

Regards
Re: ModelingAssistantProvider [message #1178352 is a reply to message #1173985] Sat, 09 November 2013 10:44 Go to previous messageGo to next message
Eclipse UserFriend
Hi,

I tried EditPolicyRoles.POPUPBAR_ROLE as;

WebPopupBarEditPolicy;
package com.mdd4cca.msf.content.diagram.edit.policies;

import org.eclipse.emf.ecore.EObject;
import org.eclipse.gmf.runtime.diagram.ui.editpolicies.PopupBarEditPolicy;
import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;

import com.mdd4cca.msf.content.Web;
import com.mdd4cca.msf.content.diagram.part.Messages;
import com.mdd4cca.msf.content.diagram.providers.ContentElementTypes;
import com.mdd4cca.msf.content.diagram.toolBar.WebPopupBarTool;

public class WebPopupBarEditPolicy extends PopupBarEditPolicy{
	@Override
	protected void fillPopupBarDescriptors() {
		super.fillPopupBarDescriptors();
		EObject webElement = ((IGraphicalEditPart) getHost()).resolveSemanticElement();
		
		// Component -> State
		if (webElement instanceof Web) {
			addPopupBarDescriptor(new WebPopupBarTool(this, ContentElementTypes.Web_3014, Messages.Web5CreationTool_title));			
		}
	}
	
	public void addPopupBarDescriptor(WebPopupBarTool tool) {
		super.addPopupBarDescriptor(null, tool.getImage(), tool, tool.getDescription());
	}
	
	@Override
	protected boolean shouldShowDiagramAssistant() {
		return true;
	}
}



WebPopupBarTool,
package com.mdd4cca.msf.content.diagram.toolBar;

import org.eclipse.gmf.runtime.diagram.ui.tools.PopupBarTool;
import org.eclipse.gmf.runtime.emf.type.core.IElementType;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.swt.graphics.Image;

import com.mdd4cca.msf.content.diagram.edit.policies.WebPopupBarEditPolicy;
import com.mdd4cca.msf.content.diagram.providers.ContentElementTypes;

public class WebPopupBarTool extends PopupBarTool{
	private Image image;
	private String description;
	
	public WebPopupBarTool(WebPopupBarEditPolicy policy, IElementType elementType, String description) {
		super(policy.getHost(), elementType);
		
		ImageDescriptor imageDescriptor = ContentElementTypes.getImageDescriptor(elementType);
		this.image = imageDescriptor.createImage();
		this.description = description;
	}
	
	public Image getImage() {
		return image;
	}
	
	public String getDescription() {
		return description;
	}
}


EditPart
	/**
	 * @generated
	 */
	protected void createDefaultEditPolicies() {
		super.createDefaultEditPolicies();
		installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE,
				new WebItemSemanticEditPolicy());
		installEditPolicy(EditPolicy.LAYOUT_ROLE, createLayoutEditPolicy());
		installEditPolicy(EditPolicyRoles.OPEN_ROLE,
				new OpenDiagramEditPolicy());
		installEditPolicy(EditPolicyRoles.POPUPBAR_ROLE,
				new WebPopupBarEditPolicy());
		// XXX need an SCR to runtime to have another abstract superclass that would let children add reasonable editpolicies
		// removeEditPolicy(org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.CONNECTION_HANDLES_ROLE);
	}


But i always get disabled popubbar anyone can help me ?

Regards

Error Image Added.

[Updated on: Sat, 09 November 2013 10:45] by Moderator

Re: ModelingAssistantProvider [message #1182999 is a reply to message #1178352] Tue, 12 November 2013 10:20 Go to previous message
Eclipse UserFriend
Hi,

can the model element added at the place where you put the popup bar? Did you compare your code to the default implementation you extend and check that you setup the tools right? Is the view to which you want to add the created model element visible?

Ralph
Previous Topic:How Can I Enable Delete From Diagram Button
Next Topic:get the connection end point..
Goto Forum:
  


Current Time: Tue Jul 22 12:43:15 EDT 2025

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

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

Back to the top