Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » GMF (Graphical Modeling Framework) » ModelingAssistantProvider (ModelingAssistantProvider don't appear for xxxcompartmentEditPart)
ModelingAssistantProvider [message #1145189] Sat, 19 October 2013 10:20 Go to next message
serhat gezgin is currently offline serhat gezginFriend
Messages: 242
Registered: January 2013
Location: Izmir
Senior Member
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 09:33 Go to previous messageGo to next message
Ralph Gerbig is currently offline Ralph GerbigFriend
Messages: 697
Registered: November 2009
Senior Member
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 07:56 Go to previous messageGo to next message
serhat gezgin is currently offline serhat gezginFriend
Messages: 242
Registered: January 2013
Location: Izmir
Senior Member
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 11:35 Go to previous messageGo to next message
Ralph Gerbig is currently offline Ralph GerbigFriend
Messages: 697
Registered: November 2009
Senior Member
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 21:57 Go to previous messageGo to next message
serhat gezgin is currently offline serhat gezginFriend
Messages: 242
Registered: January 2013
Location: Izmir
Senior Member
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 15:44 Go to previous messageGo to next message
serhat gezgin is currently offline serhat gezginFriend
Messages: 242
Registered: January 2013
Location: Izmir
Senior Member
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 15:45]

Report message to a moderator

Re: ModelingAssistantProvider [message #1182999 is a reply to message #1178352] Tue, 12 November 2013 15:20 Go to previous message
Ralph Gerbig is currently offline Ralph GerbigFriend
Messages: 697
Registered: November 2009
Senior Member
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: Sun Dec 21 16:47:23 GMT 2014

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

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