ModelingAssistantProvider [message #1145189] |
Sat, 19 October 2013 06:20  |
Eclipse User |
|
|
|
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 #1178352 is a reply to message #1173985] |
Sat, 09 November 2013 10:44   |
Eclipse User |
|
|
|
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  |
Eclipse User |
|
|
|
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
|
|
|
Powered by
FUDForum. Page generated in 0.04129 seconds