Search in sources :

Example 1 with NoteAttachmentEditPart

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

the class BusinessDiagramEditor method selectionChanged.

@Override
public void selectionChanged(IWorkbenchPart part, ISelection selection) {
    super.selectionChanged(part, selection);
    IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
    JobSettingsView view = (JobSettingsView) page.findView(JobSettingsView.ID);
    getDiagramEditorInput().getItem().getProperty().eAdapters().remove(dirtyListener);
    if (view == null) {
        return;
    }
    if (!(selection instanceof IStructuredSelection)) {
        return;
    }
    Object firstElement = ((IStructuredSelection) selection).getFirstElement();
    if (!(selection instanceof IStructuredSelection)) {
        return;
    } else if (firstElement instanceof RepositoryNode) {
        return;
    }
    // for Find Assignment
    if (((IStructuredSelection) selection).size() > 0) {
        DiagramEditPart diagramEditPart = getDiagramEditPart();
        if (diagramEditPart instanceof BusinessProcessEditPart) {
            BusinessProcessEditPart processPart = (BusinessProcessEditPart) diagramEditPart;
            for (Object object : processPart.getChildren()) {
                if (object instanceof BusinessItemShapeEditPart) {
                    BusinessItemShapeEditPart shapEditPart = (BusinessItemShapeEditPart) object;
                    IFigure figure = shapEditPart.getFigure();
                    for (Object child : figure.getChildren()) {
                        if (child instanceof BusinessItemShapeFigure) {
                            BusinessItemShapeFigure shapFigure = (BusinessItemShapeFigure) child;
                            Border border = shapFigure.getBorder();
                            if (border != null) {
                                shapFigure.setDrawFrame(false);
                                shapFigure.revalidate();
                                shapFigure.repaint();
                            }
                        }
                    }
                }
            }
        }
    }
    // to refresh the jobsettings view
    if (((IStructuredSelection) selection).size() > 1) {
        view.cleanDisplay();
    } else {
        if (firstElement instanceof BusinessItemShapeEditPart || firstElement instanceof BaseBusinessItemRelationShipEditPart || firstElement instanceof NoteEditPart || firstElement instanceof NoteAttachmentEditPart) {
            view.refresh(false, firstElement);
        } else if (firstElement instanceof BusinessProcessEditPart || firstElement instanceof CompartmentEditPart) {
            view.refresh(true, this);
        }
    }
    getDiagramEditorInput().getItem().getProperty().eAdapters().add(dirtyListener);
}
Also used : JobSettingsView(org.talend.designer.core.ui.views.jobsettings.JobSettingsView) CompartmentEditPart(org.eclipse.gmf.runtime.diagram.ui.editparts.CompartmentEditPart) NoteEditPart(org.eclipse.gmf.runtime.diagram.ui.editparts.NoteEditPart) IStructuredSelection(org.eclipse.jface.viewers.IStructuredSelection) RepositoryNode(org.talend.repository.model.RepositoryNode) BaseBusinessItemRelationShipEditPart(org.talend.designer.business.diagram.custom.edit.parts.BaseBusinessItemRelationShipEditPart) BusinessProcessEditPart(org.talend.designer.business.model.business.diagram.edit.parts.BusinessProcessEditPart) DiagramEditPart(org.eclipse.gmf.runtime.diagram.ui.editparts.DiagramEditPart) NoteAttachmentEditPart(org.eclipse.gmf.runtime.diagram.ui.internal.editparts.NoteAttachmentEditPart) BusinessItemShapeEditPart(org.talend.designer.business.diagram.custom.edit.parts.BusinessItemShapeEditPart) IWorkbenchPage(org.eclipse.ui.IWorkbenchPage) IRepositoryViewObject(org.talend.core.model.repository.IRepositoryViewObject) Border(org.eclipse.draw2d.Border) BusinessItemShapeFigure(org.talend.designer.business.diagram.custom.figures.BusinessItemShapeFigure) IFigure(org.eclipse.draw2d.IFigure)

Aggregations

Border (org.eclipse.draw2d.Border)1 IFigure (org.eclipse.draw2d.IFigure)1 CompartmentEditPart (org.eclipse.gmf.runtime.diagram.ui.editparts.CompartmentEditPart)1 DiagramEditPart (org.eclipse.gmf.runtime.diagram.ui.editparts.DiagramEditPart)1 NoteEditPart (org.eclipse.gmf.runtime.diagram.ui.editparts.NoteEditPart)1 NoteAttachmentEditPart (org.eclipse.gmf.runtime.diagram.ui.internal.editparts.NoteAttachmentEditPart)1 IStructuredSelection (org.eclipse.jface.viewers.IStructuredSelection)1 IWorkbenchPage (org.eclipse.ui.IWorkbenchPage)1 IRepositoryViewObject (org.talend.core.model.repository.IRepositoryViewObject)1 BaseBusinessItemRelationShipEditPart (org.talend.designer.business.diagram.custom.edit.parts.BaseBusinessItemRelationShipEditPart)1 BusinessItemShapeEditPart (org.talend.designer.business.diagram.custom.edit.parts.BusinessItemShapeEditPart)1 BusinessItemShapeFigure (org.talend.designer.business.diagram.custom.figures.BusinessItemShapeFigure)1 BusinessProcessEditPart (org.talend.designer.business.model.business.diagram.edit.parts.BusinessProcessEditPart)1 JobSettingsView (org.talend.designer.core.ui.views.jobsettings.JobSettingsView)1 RepositoryNode (org.talend.repository.model.RepositoryNode)1