Search in sources :

Example 1 with BusinessItemShapeEditPart

use of org.talend.designer.business.diagram.custom.edit.parts.BusinessItemShapeEditPart in project tdi-studio-se by Talend.

the class BusinessModelingAssistantProvider method getRelTypesOnSourceAndTarget.

public List getRelTypesOnSourceAndTarget(IAdaptable source, IAdaptable target) {
    IGraphicalEditPart sourceEditPart = (IGraphicalEditPart) source.getAdapter(IGraphicalEditPart.class);
    IGraphicalEditPart targetEditPart = (IGraphicalEditPart) target.getAdapter(IGraphicalEditPart.class);
    if (sourceEditPart instanceof BusinessItemShapeEditPart && targetEditPart 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 2 with BusinessItemShapeEditPart

use of org.talend.designer.business.diagram.custom.edit.parts.BusinessItemShapeEditPart in project tdi-studio-se by Talend.

the class BusinessModelingAssistantProvider method getTypesForSource.

public List getTypesForSource(IAdaptable target, IElementType relationshipType) {
    IGraphicalEditPart editPart = (IGraphicalEditPart) target.getAdapter(IGraphicalEditPart.class);
    if (editPart instanceof BusinessItemShapeEditPart && relationshipType.getEClass() != null && relationshipType.getEClass().getEAllSuperTypes().contains(org.talend.designer.business.model.business.BusinessPackage.eINSTANCE.getBaseBusinessItemRelationship())) {
        List types = new ArrayList();
        types.add(BusinessElementTypes.ActionBusinessItem_1001);
        types.add(BusinessElementTypes.TerminalBusinessItem_1002);
        types.add(BusinessElementTypes.DocumentBusinessItem_1003);
        types.add(BusinessElementTypes.DatabaseBusinessItem_1004);
        types.add(BusinessElementTypes.ListBusinessItem_1005);
        types.add(BusinessElementTypes.DataBusinessItem_1006);
        types.add(BusinessElementTypes.InputBusinessItem_1007);
        types.add(BusinessElementTypes.DecisionBusinessItem_1008);
        types.add(BusinessElementTypes.ActorBusinessItem_1009);
        types.add(BusinessElementTypes.EllipseBusinessItem_1010);
        types.add(BusinessElementTypes.GearBusinessItem_1011);
        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 3 with BusinessItemShapeEditPart

use of org.talend.designer.business.diagram.custom.edit.parts.BusinessItemShapeEditPart in project tdi-studio-se by Talend.

the class BusinessModelingAssistantProvider method getTypesForTarget.

public List getTypesForTarget(IAdaptable source, IElementType relationshipType) {
    IGraphicalEditPart editPart = (IGraphicalEditPart) source.getAdapter(IGraphicalEditPart.class);
    if (editPart instanceof BusinessItemShapeEditPart && relationshipType.getEClass() != null && relationshipType.getEClass().getEAllSuperTypes().contains(org.talend.designer.business.model.business.BusinessPackage.eINSTANCE.getBaseBusinessItemRelationship())) {
        List types = new ArrayList();
        types.add(BusinessElementTypes.ActionBusinessItem_1001);
        types.add(BusinessElementTypes.TerminalBusinessItem_1002);
        types.add(BusinessElementTypes.DocumentBusinessItem_1003);
        types.add(BusinessElementTypes.DatabaseBusinessItem_1004);
        types.add(BusinessElementTypes.ListBusinessItem_1005);
        types.add(BusinessElementTypes.DataBusinessItem_1006);
        types.add(BusinessElementTypes.InputBusinessItem_1007);
        types.add(BusinessElementTypes.DecisionBusinessItem_1008);
        types.add(BusinessElementTypes.ActorBusinessItem_1009);
        types.add(BusinessElementTypes.EllipseBusinessItem_1010);
        types.add(BusinessElementTypes.GearBusinessItem_1011);
        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 4 with BusinessItemShapeEditPart

use of org.talend.designer.business.diagram.custom.edit.parts.BusinessItemShapeEditPart in project tdi-studio-se by Talend.

the class BusinessModelingAssistantProvider method getRelTypesOnTarget.

public List getRelTypesOnTarget(IAdaptable target) {
    IGraphicalEditPart editPart = (IGraphicalEditPart) target.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 5 with BusinessItemShapeEditPart

use of org.talend.designer.business.diagram.custom.edit.parts.BusinessItemShapeEditPart in project tdi-studio-se by Talend.

the class FindAssignmentAction method doRun.

/*
     * (non-Javadoc)
     * 
     * @see org.eclipse.jface.action.Action#run()
     */
@Override
protected void doRun() {
    RepositoryNode repositoryNode = (RepositoryNode) getFirstSelectedObject();
    IEditorPart activeEditor = getActiveEditor();
    // remove frames draw last time
    for (BusinessItemShapeFigure shapFigure : repaintedFigures) {
        shapFigure.setDrawFrame(false);
        shapFigure.revalidate();
        shapFigure.repaint();
    }
    if (activeEditor instanceof BusinessDiagramEditor) {
        BusinessDiagramEditor businessDiagramEditor = (BusinessDiagramEditor) activeEditor;
        Diagram diagram = (Diagram) businessDiagramEditor.getDiagramEditPart().getModel();
        BusinessProcess businessProcess = (BusinessProcess) diagram.getElement();
        // PTODO mhelleboid use OCL or using a visitor
        List list = new ArrayList();
        for (Iterator iter = businessProcess.getBusinessItems().iterator(); iter.hasNext(); ) {
            BusinessItem businessItem = (BusinessItem) iter.next();
            for (Iterator iterator = businessItem.getAssignments().iterator(); iterator.hasNext(); ) {
                BusinessAssignment businessAssignment = (BusinessAssignment) iterator.next();
                TalendItem talendItem = businessAssignment.getTalendItem();
                IRepositoryViewObject obj = repositoryNode.getObject();
                if (talendItem.getId().equals(repositoryNode.getId())) {
                    list.add(businessItem);
                } else if (talendItem instanceof SQLPattern || talendItem instanceof Routine || talendItem instanceof TableMetadata || talendItem instanceof Query || talendItem instanceof SapFunctionMetadata) {
                    if (talendItem.getLabel().equals(repositoryNode.getProperties(EProperties.LABEL))) {
                        list.add(businessItem);
                    }
                }
            }
        }
        IDiagramGraphicalViewer diagramGraphicalViewer = businessDiagramEditor.getDiagramGraphicalViewer();
        List editParts = new ArrayList();
        for (Iterator iter = list.iterator(); iter.hasNext(); ) {
            BusinessItem businessItem = (BusinessItem) iter.next();
            editParts.addAll(diagramGraphicalViewer.findEditPartsForElement(EMFCoreUtil.getProxyID(businessItem), BaseBusinessItemRelationShipEditPart.class));
            editParts.addAll(diagramGraphicalViewer.findEditPartsForElement(EMFCoreUtil.getProxyID(businessItem), BusinessItemShapeEditPart.class));
        }
        diagramGraphicalViewer.deselectAll();
        // add a frame when use findAassignment
        for (Iterator iter = editParts.iterator(); iter.hasNext(); ) {
            EditPart editPart = (EditPart) iter.next();
            if (editPart instanceof BusinessItemShapeEditPart) {
                BusinessItemShapeEditPart shapEditPart = (BusinessItemShapeEditPart) editPart;
                IFigure figure = shapEditPart.getFigure();
                for (Object child : figure.getChildren()) {
                    if (child instanceof BusinessItemShapeFigure) {
                        BusinessItemShapeFigure shapFigure = (BusinessItemShapeFigure) child;
                        shapFigure.setDrawFrame(true);
                        shapFigure.revalidate();
                        shapFigure.repaint();
                        repaintedFigures.add(shapFigure);
                    }
                }
            }
            diagramGraphicalViewer.getSelectionManager().appendSelection(editPart);
        }
        ZoomManager zoomManager = (ZoomManager) businessDiagramEditor.getAdapter(ZoomManager.class);
        zoomFitSelection(zoomManager, editParts, businessDiagramEditor.getDiagramEditPart(), true);
    }
}
Also used : IDiagramGraphicalViewer(org.eclipse.gmf.runtime.diagram.ui.parts.IDiagramGraphicalViewer) SapFunctionMetadata(org.talend.designer.business.model.business.SapFunctionMetadata) BusinessDiagramEditor(org.talend.designer.business.model.business.diagram.part.BusinessDiagramEditor) BusinessAssignment(org.talend.designer.business.model.business.BusinessAssignment) Query(org.talend.designer.business.model.business.Query) ArrayList(java.util.ArrayList) Iterator(java.util.Iterator) ArrayList(java.util.ArrayList) List(java.util.List) TalendItem(org.talend.designer.business.model.business.TalendItem) IFigure(org.eclipse.draw2d.IFigure) TableMetadata(org.talend.designer.business.model.business.TableMetadata) SQLPattern(org.talend.designer.business.model.business.SQLPattern) BusinessItemShapeEditPart(org.talend.designer.business.diagram.custom.edit.parts.BusinessItemShapeEditPart) DiagramEditPart(org.eclipse.gmf.runtime.diagram.ui.editparts.DiagramEditPart) GraphicalEditPart(org.eclipse.gef.GraphicalEditPart) EditPart(org.eclipse.gef.EditPart) BaseBusinessItemRelationShipEditPart(org.talend.designer.business.diagram.custom.edit.parts.BaseBusinessItemRelationShipEditPart) IEditorPart(org.eclipse.ui.IEditorPart) Routine(org.talend.designer.business.model.business.Routine) RepositoryNode(org.talend.repository.model.RepositoryNode) BaseBusinessItemRelationShipEditPart(org.talend.designer.business.diagram.custom.edit.parts.BaseBusinessItemRelationShipEditPart) Diagram(org.eclipse.gmf.runtime.notation.Diagram) BusinessItemShapeEditPart(org.talend.designer.business.diagram.custom.edit.parts.BusinessItemShapeEditPart) ZoomManager(org.eclipse.gef.editparts.ZoomManager) IRepositoryViewObject(org.talend.core.model.repository.IRepositoryViewObject) IRepositoryViewObject(org.talend.core.model.repository.IRepositoryViewObject) BusinessItemShapeFigure(org.talend.designer.business.diagram.custom.figures.BusinessItemShapeFigure) BusinessItem(org.talend.designer.business.model.business.BusinessItem) BusinessProcess(org.talend.designer.business.model.business.BusinessProcess)

Aggregations

BusinessItemShapeEditPart (org.talend.designer.business.diagram.custom.edit.parts.BusinessItemShapeEditPart)10 List (java.util.List)7 ArrayList (java.util.ArrayList)6 IGraphicalEditPart (org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart)5 DiagramEditPart (org.eclipse.gmf.runtime.diagram.ui.editparts.DiagramEditPart)3 IRepositoryViewObject (org.talend.core.model.repository.IRepositoryViewObject)3 BaseBusinessItemRelationShipEditPart (org.talend.designer.business.diagram.custom.edit.parts.BaseBusinessItemRelationShipEditPart)3 BusinessItem (org.talend.designer.business.model.business.BusinessItem)3 ExecutionException (org.eclipse.core.commands.ExecutionException)2 IFigure (org.eclipse.draw2d.IFigure)2 IStructuredSelection (org.eclipse.jface.viewers.IStructuredSelection)2 IEditorPart (org.eclipse.ui.IEditorPart)2 IWorkbenchPage (org.eclipse.ui.IWorkbenchPage)2 BusinessItemShapeFigure (org.talend.designer.business.diagram.custom.figures.BusinessItemShapeFigure)2 BusinessDiagramEditor (org.talend.designer.business.model.business.diagram.part.BusinessDiagramEditor)2 RepositoryNode (org.talend.repository.model.RepositoryNode)2 Iterator (java.util.Iterator)1 Border (org.eclipse.draw2d.Border)1 EObject (org.eclipse.emf.ecore.EObject)1 EditPart (org.eclipse.gef.EditPart)1