Search in sources :

Example 11 with IGraphicalEditPart

use of org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart in project tdi-studio-se by Talend.

the class BusinessModelingAssistantProvider method selectExistingElement.

/**
     * @generated
     */
protected EObject selectExistingElement(IAdaptable host, Collection types) {
    if (types.isEmpty()) {
        return null;
    }
    IGraphicalEditPart editPart = (IGraphicalEditPart) host.getAdapter(IGraphicalEditPart.class);
    if (editPart == null) {
        return null;
    }
    Diagram diagram = (Diagram) editPart.getRoot().getContents().getModel();
    Collection elements = new HashSet();
    for (Iterator it = diagram.getElement().eAllContents(); it.hasNext(); ) {
        EObject element = (EObject) it.next();
        if (isApplicableElement(element, types)) {
            elements.add(element);
        }
    }
    if (elements.isEmpty()) {
        return null;
    }
    return selectElement((EObject[]) elements.toArray(new EObject[elements.size()]));
}
Also used : IGraphicalEditPart(org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart) EObject(org.eclipse.emf.ecore.EObject) Iterator(java.util.Iterator) Collection(java.util.Collection) Diagram(org.eclipse.gmf.runtime.notation.Diagram) HashSet(java.util.HashSet)

Example 12 with IGraphicalEditPart

use of org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart in project tdi-studio-se by Talend.

the class BusinessModelingAssistantProvider method getRelTypesOnSource.

public List getRelTypesOnSource(IAdaptable source) {
    IGraphicalEditPart editPart = (IGraphicalEditPart) source.getAdapter(IGraphicalEditPart.class);
    if (editPart instanceof BusinessItemShapeEditPart) {
        List types = new ArrayList();
        types.add(BusinessElementTypes.BusinessItemRelationship_3001);
        types.add(BusinessElementTypes.DirectionalBusinessItemRelationship_3002);
        types.add(BusinessElementTypes.BidirectionalBusinessItemRelationship_3003);
        return types;
    }
    return Collections.EMPTY_LIST;
}
Also used : IGraphicalEditPart(org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart) BusinessItemShapeEditPart(org.talend.designer.business.diagram.custom.edit.parts.BusinessItemShapeEditPart) ArrayList(java.util.ArrayList) ArrayList(java.util.ArrayList) List(java.util.List)

Example 13 with IGraphicalEditPart

use of org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart in project tdi-studio-se by Talend.

the class BusinessGraphicalNodeEditPolicy method getConnectionWithReorientedViewCompleteCommand.

/**
     * @generated
     */
protected Command getConnectionWithReorientedViewCompleteCommand(CreateConnectionRequest request) {
    ICommandProxy c = (ICommandProxy) super.getConnectionCompleteCommand(request);
    CompositeCommand cc = (CompositeCommand) c.getICommand();
    TransactionalEditingDomain editingDomain = ((IGraphicalEditPart) getHost()).getEditingDomain();
    BusinessReorientConnectionViewCommand rcvCommand = new BusinessReorientConnectionViewCommand(editingDomain, null);
    rcvCommand.setEdgeAdaptor(getViewAdapter());
    cc.compose(rcvCommand);
    return c;
}
Also used : IGraphicalEditPart(org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart) ICommandProxy(org.eclipse.gmf.runtime.diagram.ui.commands.ICommandProxy) TransactionalEditingDomain(org.eclipse.emf.transaction.TransactionalEditingDomain) BusinessReorientConnectionViewCommand(org.talend.designer.business.model.business.diagram.edit.commands.BusinessReorientConnectionViewCommand) CompositeCommand(org.eclipse.gmf.runtime.common.core.command.CompositeCommand)

Aggregations

IGraphicalEditPart (org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart)13 List (java.util.List)7 ArrayList (java.util.ArrayList)6 BusinessItemShapeEditPart (org.talend.designer.business.diagram.custom.edit.parts.BusinessItemShapeEditPart)5 TransactionalEditingDomain (org.eclipse.emf.transaction.TransactionalEditingDomain)3 Command (org.eclipse.gef.commands.Command)3 Iterator (java.util.Iterator)2 EObject (org.eclipse.emf.ecore.EObject)2 UnexecutableCommand (org.eclipse.gef.commands.UnexecutableCommand)2 DeleteCommand (org.eclipse.gmf.runtime.diagram.core.commands.DeleteCommand)2 ICommandProxy (org.eclipse.gmf.runtime.diagram.ui.commands.ICommandProxy)2 View (org.eclipse.gmf.runtime.notation.View)2 BusinessProcessEditPart (org.talend.designer.business.model.business.diagram.edit.parts.BusinessProcessEditPart)2 WeakReference (java.lang.ref.WeakReference)1 Collection (java.util.Collection)1 HashSet (java.util.HashSet)1 LinkedList (java.util.LinkedList)1 IAdaptable (org.eclipse.core.runtime.IAdaptable)1 EditPart (org.eclipse.gef.EditPart)1 CompoundCommand (org.eclipse.gef.commands.CompoundCommand)1