setGenericContextButtons(data, pe, CONTEXT_BUTTON_DELETE);
Object bo = getFeatureProvider().getBusinessObjectForPictogramElement(pe);
CreateConnectionContext connectionContext = new CreateConnectionContext();
connectionContext.setSourcePictogramElement(pe);
Anchor connectionAnchor = null;
if (pe instanceof Anchor) {
connectionAnchor = (Anchor) pe;
} else if (pe instanceof AnchorContainer) {
connectionAnchor = Graphiti.getPeService().getChopboxAnchor((AnchorContainer) pe);
}
connectionContext.setSourceAnchor(connectionAnchor);
if (pe.eContainer() instanceof ContainerShape == false) {
return data;
}
CreateContext taskContext = new CreateContext();
taskContext.setTargetContainer((ContainerShape) pe.eContainer());
taskContext.putProperty("org.activiti.designer.connectionContext", connectionContext);
if (bo instanceof StartEvent || bo instanceof Task || bo instanceof CallActivity || bo instanceof Gateway) {
CreateUserTaskFeature userTaskfeature = new CreateUserTaskFeature(getFeatureProvider());
ContextButtonEntry newUserTaskButton = new ContextButtonEntry(userTaskfeature, taskContext);
newUserTaskButton.setText("new user task"); //$NON-NLS-1$
newUserTaskButton.setDescription("Create a new task"); //$NON-NLS-1$
newUserTaskButton.setIconId(PluginImage.IMG_USERTASK.getImageKey());
data.getDomainSpecificContextButtons().add(newUserTaskButton);
CreateExclusiveGatewayFeature exclusiveGatewayFeature = new CreateExclusiveGatewayFeature(getFeatureProvider());
ContextButtonEntry newExclusiveGatewayButton = new ContextButtonEntry(exclusiveGatewayFeature, taskContext);
newExclusiveGatewayButton.setText("new exclusive gateway"); //$NON-NLS-1$
newExclusiveGatewayButton.setDescription("Create a new exclusive gateway"); //$NON-NLS-1$
newExclusiveGatewayButton.setIconId(PluginImage.IMG_GATEWAY_EXCLUSIVE.getImageKey());
data.getDomainSpecificContextButtons().add(newExclusiveGatewayButton);
CreateEndEventFeature endFeature = new CreateEndEventFeature(getFeatureProvider());
ContextButtonEntry newEndButton = new ContextButtonEntry(endFeature, taskContext);
newEndButton.setText("new end event"); //$NON-NLS-1$
newEndButton.setDescription("Create a new end event"); //$NON-NLS-1$
newEndButton.setIconId(PluginImage.IMG_ENDEVENT_NONE.getImageKey());
data.getDomainSpecificContextButtons().add(newEndButton);
}
CreateConnectionContext ccc = new CreateConnectionContext();
ccc.setSourcePictogramElement(pe);
Anchor anchor = null;
if (pe instanceof Anchor) {
anchor = (Anchor) pe;
} else if (pe instanceof AnchorContainer) {
anchor = Graphiti.getPeService().getChopboxAnchor((AnchorContainer) pe);
}
ccc.setSourceAnchor(anchor);
ContextButtonEntry button = new ContextButtonEntry(null, context);
button.setText("Create connection"); //$NON-NLS-1$
button.setIconId(PluginImage.IMG_EREFERENCE.getImageKey());
ICreateConnectionFeature[] features = getFeatureProvider().getCreateConnectionFeatures();