use of org.eclipse.gmf.runtime.emf.type.core.IElementType in project tdi-studio-se by Talend.
the class BusinessViewProvider method getEdgeViewClass.
/**
* @generated
*/
protected Class getEdgeViewClass(IAdaptable semanticAdapter, View containerView, String semanticHint) {
IElementType elementType = getSemanticElementType(semanticAdapter);
if (elementType != null && !BusinessElementTypes.isKnownElementType(elementType)) {
return null;
}
EClass semanticType = getSemanticEClass(semanticAdapter);
if (semanticType == null) {
return null;
}
EObject semanticElement = getSemanticElement(semanticAdapter);
int linkVID = BusinessVisualIDRegistry.getLinkWithClassVisualID(semanticElement, semanticType);
switch(linkVID) {
case BusinessItemRelationshipEditPart.VISUAL_ID:
return BusinessItemRelationshipViewFactory.class;
case DirectionalBusinessItemRelationshipEditPart.VISUAL_ID:
return DirectionalBusinessItemRelationshipViewFactory.class;
case BidirectionalBusinessItemRelationshipEditPart.VISUAL_ID:
return BidirectionalBusinessItemRelationshipViewFactory.class;
}
return getUnrecognizedConnectorViewClass(semanticAdapter, containerView, semanticHint);
}
use of org.eclipse.gmf.runtime.emf.type.core.IElementType in project tdi-studio-se by Talend.
the class BusinessBaseItemSemanticEditPolicy method getSemanticCommand.
/**
* @generated
*/
protected Command getSemanticCommand(IEditCommandRequest request) {
IEditCommandRequest completedRequest = completeRequest(request);
Object editHelperContext = completedRequest.getEditHelperContext();
if (editHelperContext instanceof View || (editHelperContext instanceof IEditHelperContext && ((IEditHelperContext) editHelperContext).getEObject() instanceof View)) {
// no semantic commands are provided for pure design elements
return null;
}
if (editHelperContext == null) {
editHelperContext = ViewUtil.resolveSemanticElement((View) getHost().getModel());
}
IElementType elementType = ElementTypeRegistry.getInstance().getElementType(editHelperContext);
if (elementType == ElementTypeRegistry.getInstance().getType("org.eclipse.gmf.runtime.emf.type.core.default")) {
//$NON-NLS-1$
elementType = null;
}
Command epCommand = getSemanticCommandSwitch(completedRequest);
if (epCommand != null) {
ICommand command = epCommand instanceof ICommandProxy ? ((ICommandProxy) epCommand).getICommand() : new CommandProxy(epCommand);
completedRequest.setParameter(BusinessBaseEditHelper.EDIT_POLICY_COMMAND, command);
}
Command ehCommand = null;
if (elementType != null) {
ICommand command = elementType.getEditCommand(completedRequest);
if (command != null) {
if (!(command instanceof CompositeTransactionalCommand)) {
TransactionalEditingDomain editingDomain = ((IGraphicalEditPart) getHost()).getEditingDomain();
command = new CompositeTransactionalCommand(editingDomain, null).compose(command);
}
ehCommand = new ICommandProxy(command);
}
}
boolean shouldProceed = true;
if (completedRequest instanceof DestroyRequest) {
shouldProceed = shouldProceed((DestroyRequest) completedRequest);
}
if (shouldProceed) {
if (completedRequest instanceof DestroyRequest) {
TransactionalEditingDomain editingDomain = ((IGraphicalEditPart) getHost()).getEditingDomain();
Command deleteViewCommand = new ICommandProxy(new DeleteCommand(editingDomain, (View) getHost().getModel()));
ehCommand = ehCommand == null ? deleteViewCommand : ehCommand.chain(deleteViewCommand);
}
return ehCommand;
}
return null;
}
use of org.eclipse.gmf.runtime.emf.type.core.IElementType in project statecharts by Yakindu.
the class SheetLabelProvider method getImage.
public Image getImage(Object element) {
element = unwrap(element);
if (element instanceof IGraphicalEditPart) {
EObject semanticElement = ((IGraphicalEditPart) element).resolveSemanticElement();
if (semanticElement == null) {
// Default images
View view = ((IGraphicalEditPart) element).getNotationView();
String viewType = view.getType();
if (ViewType.NOTE.equals(viewType)) {
return SharedImages.get(SharedImages.IMG_NOTE);
} else if (ViewType.TEXT.equals(viewType)) {
return SharedImages.get(SharedImages.IMG_TEXT);
}
} else {
// custom images
IElementType elementType = ElementTypeRegistry.getInstance().getElementType(semanticElement);
Image image = DiagramActivator.getDefault().getImageRegistry().get(elementType.getIconURL().toString());
if (image == null) {
ImageDescriptor desc = ImageDescriptor.createFromURL(elementType.getIconURL());
DiagramActivator.getDefault().getImageRegistry().put(elementType.getIconURL().toString(), desc.createImage());
return DiagramActivator.getDefault().getImageRegistry().get(elementType.getIconURL().toString());
}
return image;
}
}
return null;
}
use of org.eclipse.gmf.runtime.emf.type.core.IElementType in project statecharts by Yakindu.
the class SheetLabelProvider method getText.
public String getText(Object element) {
element = unwrap(element);
if (element instanceof IGraphicalEditPart) {
EObject semanticElement = ((IGraphicalEditPart) element).resolveSemanticElement();
if (semanticElement == null) {
View view = ((IGraphicalEditPart) element).getNotationView();
return view.getType();
} else {
IElementType elementType = ElementTypeRegistry.getInstance().getElementType(semanticElement);
StringBuilder builder = new StringBuilder();
builder.append(elementType.getDisplayName());
if (semanticElement instanceof NamedElement && ((NamedElement) semanticElement).getName() != null) {
builder.append(' ');
builder.append(((NamedElement) semanticElement).getName());
}
return builder.toString();
}
}
return null;
}
use of org.eclipse.gmf.runtime.emf.type.core.IElementType in project tdi-studio-se by Talend.
the class BusinessViewProvider method getNodeViewClass.
/**
* @generated
*/
protected Class getNodeViewClass(IAdaptable semanticAdapter, View containerView, String semanticHint) {
if (containerView == null) {
return null;
}
IElementType elementType = getSemanticElementType(semanticAdapter);
if (elementType != null && !BusinessElementTypes.isKnownElementType(elementType)) {
return null;
}
EClass semanticType = getSemanticEClass(semanticAdapter);
EObject semanticElement = getSemanticElement(semanticAdapter);
int nodeVID = BusinessVisualIDRegistry.getNodeVisualID(containerView, semanticElement, semanticType, semanticHint);
switch(nodeVID) {
case ActionBusinessItemEditPart.VISUAL_ID:
return ActionBusinessItemViewFactory.class;
case ActionBusinessItemNameEditPart.VISUAL_ID:
return ActionBusinessItemNameViewFactory.class;
case TerminalBusinessItemEditPart.VISUAL_ID:
return TerminalBusinessItemViewFactory.class;
case TerminalBusinessItemNameEditPart.VISUAL_ID:
return TerminalBusinessItemNameViewFactory.class;
case DocumentBusinessItemEditPart.VISUAL_ID:
return DocumentBusinessItemViewFactory.class;
case DocumentBusinessItemNameEditPart.VISUAL_ID:
return DocumentBusinessItemNameViewFactory.class;
case DatabaseBusinessItemEditPart.VISUAL_ID:
return DatabaseBusinessItemViewFactory.class;
case DatabaseBusinessItemNameEditPart.VISUAL_ID:
return DatabaseBusinessItemNameViewFactory.class;
case ListBusinessItemEditPart.VISUAL_ID:
return ListBusinessItemViewFactory.class;
case ListBusinessItemNameEditPart.VISUAL_ID:
return ListBusinessItemNameViewFactory.class;
case DataBusinessItemEditPart.VISUAL_ID:
return DataBusinessItemViewFactory.class;
case DataBusinessItemNameEditPart.VISUAL_ID:
return DataBusinessItemNameViewFactory.class;
case InputBusinessItemEditPart.VISUAL_ID:
return InputBusinessItemViewFactory.class;
case InputBusinessItemNameEditPart.VISUAL_ID:
return InputBusinessItemNameViewFactory.class;
case DecisionBusinessItemEditPart.VISUAL_ID:
return DecisionBusinessItemViewFactory.class;
case DecisionBusinessItemNameEditPart.VISUAL_ID:
return DecisionBusinessItemNameViewFactory.class;
case ActorBusinessItemEditPart.VISUAL_ID:
return ActorBusinessItemViewFactory.class;
case ActorBusinessItemNameEditPart.VISUAL_ID:
return ActorBusinessItemNameViewFactory.class;
case EllipseBusinessItemEditPart.VISUAL_ID:
return EllipseBusinessItemViewFactory.class;
case EllipseBusinessItemNameEditPart.VISUAL_ID:
return EllipseBusinessItemNameViewFactory.class;
case GearBusinessItemEditPart.VISUAL_ID:
return GearBusinessItemViewFactory.class;
case GearBusinessItemNameEditPart.VISUAL_ID:
return GearBusinessItemNameViewFactory.class;
case BusinessItemRelationshipNameEditPart.VISUAL_ID:
return BusinessItemRelationshipNameViewFactory.class;
case DirectionalBusinessItemRelationshipNameEditPart.VISUAL_ID:
return DirectionalBusinessItemRelationshipNameViewFactory.class;
case BidirectionalBusinessItemRelationshipNameEditPart.VISUAL_ID:
return BidirectionalBusinessItemRelationshipNameViewFactory.class;
}
return null;
}
Aggregations