Search in sources :

Example 1 with DirectEditRequest

use of org.eclipse.gef.requests.DirectEditRequest in project tdi-studio-se by Talend.

the class XmlMapDataEditPart method performRequest.

@Override
public void performRequest(Request req) {
    if (RequestConstants.REQ_DIRECT_EDIT.equals(req.getType())) {
        DirectEditRequest drequest = (DirectEditRequest) req;
        Point figureLocation = drequest.getLocation();
        IFigure findFigureAt = getFigure().findFigureAt(figureLocation.x, figureLocation.y);
        if (findFigureAt != null && findFigureAt instanceof Label) {
            directEditManager = new XmlMapNodeDirectEditManager(this, new XmlMapNodeCellEditorLocator((Figure) findFigureAt));
            directEditManager.show();
        }
        if (directEditManager != null) {
            if (findFigureAt != null && findFigureAt instanceof Label) {
                if (figure.containsPoint(figureLocation)) {
                    directEditManager.show();
                    ((XmlMapGraphicViewer) getViewer()).getMapperManager().setCurrentDirectEditManager(directEditManager);
                }
            }
        }
    }
}
Also used : XmlMapNodeDirectEditManager(org.talend.designer.xmlmap.parts.directedit.XmlMapNodeDirectEditManager) XmlMapNodeCellEditorLocator(org.talend.designer.gefabstractmap.part.directedit.XmlMapNodeCellEditorLocator) DirectEditRequest(org.eclipse.gef.requests.DirectEditRequest) Label(org.eclipse.draw2d.Label) Point(org.eclipse.draw2d.geometry.Point) IFigure(org.eclipse.draw2d.IFigure)

Example 2 with DirectEditRequest

use of org.eclipse.gef.requests.DirectEditRequest in project tdi-studio-se by Talend.

the class OutputXmlTreeEditPart method performRequest.

@Override
public void performRequest(Request req) {
    if (RequestConstants.REQ_DIRECT_EDIT.equals(req.getType())) {
        DirectEditRequest drequest = (DirectEditRequest) req;
        Point figureLocation = drequest.getLocation();
        IFigure findFigureAt = getFigure().findFigureAt(figureLocation.x, figureLocation.y);
        if (findFigureAt != null && findFigureAt instanceof IWidgetCell) {
            directEditManager = new XmlMapNodeDirectEditManager(this, new XmlMapNodeCellEditorLocator((Figure) findFigureAt));
            directEditManager.show();
        }
        if (directEditManager != null) {
            if (findFigureAt != null && findFigureAt instanceof FilterTextArea) {
                if (figure.containsPoint(figureLocation)) {
                    directEditManager.show();
                    ((XmlMapGraphicViewer) getViewer()).getMapperManager().setCurrentDirectEditManager(directEditManager);
                }
            }
        }
    }
}
Also used : XmlMapNodeDirectEditManager(org.talend.designer.xmlmap.parts.directedit.XmlMapNodeDirectEditManager) XmlMapNodeCellEditorLocator(org.talend.designer.gefabstractmap.part.directedit.XmlMapNodeCellEditorLocator) DirectEditRequest(org.eclipse.gef.requests.DirectEditRequest) FilterTextArea(org.talend.designer.gefabstractmap.figures.treesettings.FilterTextArea) Point(org.eclipse.draw2d.geometry.Point) IWidgetCell(org.talend.designer.gefabstractmap.figures.cells.IWidgetCell) IFigure(org.eclipse.draw2d.IFigure)

Example 3 with DirectEditRequest

use of org.eclipse.gef.requests.DirectEditRequest in project tdi-studio-se by Talend.

the class TreeNodeEditPart method performRequest.

@Override
public void performRequest(Request req) {
    if (RequestConstants.REQ_DIRECT_EDIT.equals(req.getType())) {
        Figure figure = null;
        DirectEditRequest drequest = (DirectEditRequest) req;
        Point figureLocation = drequest.getLocation();
        if (getFigure() instanceof TableTreeEntityFigure) {
            XmlmapTreeNodeFigure treeNodeFigure = (XmlmapTreeNodeFigure) getFigure();
            ArrayList collection = new ArrayList();
            collection.add(treeNodeFigure.getExpressionFigure());
            collection.add(treeNodeFigure.getBranchContent());
            figure = (Figure) treeNodeFigure.findFigureAt(figureLocation.x, figureLocation.y, new FigureSearch(collection));
        }
        if (figure instanceof IWidgetCell) {
            directEditManager = new XmlMapNodeDirectEditManager(this, new XmlMapNodeCellEditorLocator(figure, this));
        }
        if (directEditManager != null) {
            TreeNode outputTreeNode = (TreeNode) getModel();
            if (figure instanceof ExpressionFigure) {
                if (XmlMapUtil.isExpressionEditable(outputTreeNode)) {
                    Point location = drequest.getLocation();
                    if (figure.containsPoint(location)) {
                        directEditManager.show();
                        ((XmlMapGraphicViewer) getViewer()).getMapperManager().setCurrentDirectEditManager(directEditManager);
                    }
                }
            } else if (!(((TreeNode) getModel()).eContainer() instanceof AbstractInOutTree)) {
            // disable for RC2
            // directEditManager.show();
            // ((XmlMapGraphicViewer)
            // getViewer()).getMapperManager().setCurrentDirectEditManager(directEditManager);
            }
        }
    }
    super.performRequest(req);
}
Also used : XmlMapNodeDirectEditManager(org.talend.designer.xmlmap.parts.directedit.XmlMapNodeDirectEditManager) TableTreeEntityFigure(org.talend.designer.gefabstractmap.figures.table.entity.TableTreeEntityFigure) ArrayList(java.util.ArrayList) AbstractInOutTree(org.talend.designer.xmlmap.model.emf.xmlmap.AbstractInOutTree) Point(org.eclipse.draw2d.geometry.Point) XmlmapTreeNodeFigure(org.talend.designer.xmlmap.figures.treeNode.XmlmapTreeNodeFigure) IFigure(org.eclipse.draw2d.IFigure) ExpressionFigure(org.talend.designer.gefabstractmap.figures.ExpressionFigure) XmlmapTreeNodeFigure(org.talend.designer.xmlmap.figures.treeNode.XmlmapTreeNodeFigure) TableTreeEntityFigure(org.talend.designer.gefabstractmap.figures.table.entity.TableTreeEntityFigure) Figure(org.eclipse.draw2d.Figure) XmlMapNodeCellEditorLocator(org.talend.designer.gefabstractmap.part.directedit.XmlMapNodeCellEditorLocator) ExpressionFigure(org.talend.designer.gefabstractmap.figures.ExpressionFigure) DirectEditRequest(org.eclipse.gef.requests.DirectEditRequest) OutputTreeNode(org.talend.designer.xmlmap.model.emf.xmlmap.OutputTreeNode) TreeNode(org.talend.designer.xmlmap.model.emf.xmlmap.TreeNode) IWidgetCell(org.talend.designer.gefabstractmap.figures.cells.IWidgetCell)

Example 4 with DirectEditRequest

use of org.eclipse.gef.requests.DirectEditRequest in project tdi-studio-se by Talend.

the class ListBusinessItemNameEditPart method performDirectEditRequest.

/**
     * @generated
     */
protected void performDirectEditRequest(Request request) {
    final Request theRequest = request;
    try {
        getEditingDomain().runExclusive(new Runnable() {

            public void run() {
                if (isActive() && isEditable()) {
                    if (theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) {
                        Character initialChar = (Character) theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR);
                        performDirectEdit(initialChar.charValue());
                    } else if ((theRequest instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) {
                        DirectEditRequest editRequest = (DirectEditRequest) theRequest;
                        performDirectEdit(editRequest.getLocation());
                    } else {
                        performDirectEdit();
                    }
                }
            }
        });
    } catch (InterruptedException e) {
        // e.printStackTrace();
        ExceptionHandler.process(e);
    }
}
Also used : DirectEditRequest(org.eclipse.gef.requests.DirectEditRequest) Request(org.eclipse.gef.Request) DirectEditRequest(org.eclipse.gef.requests.DirectEditRequest)

Example 5 with DirectEditRequest

use of org.eclipse.gef.requests.DirectEditRequest in project tdi-studio-se by Talend.

the class InputBusinessItemNameEditPart method performDirectEditRequest.

/**
     * @generated
     */
protected void performDirectEditRequest(Request request) {
    final Request theRequest = request;
    try {
        getEditingDomain().runExclusive(new Runnable() {

            public void run() {
                if (isActive() && isEditable()) {
                    if (theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) {
                        Character initialChar = (Character) theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR);
                        performDirectEdit(initialChar.charValue());
                    } else if ((theRequest instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) {
                        DirectEditRequest editRequest = (DirectEditRequest) theRequest;
                        performDirectEdit(editRequest.getLocation());
                    } else {
                        performDirectEdit();
                    }
                }
            }
        });
    } catch (InterruptedException e) {
        // e.printStackTrace();
        ExceptionHandler.process(e);
    }
}
Also used : DirectEditRequest(org.eclipse.gef.requests.DirectEditRequest) Request(org.eclipse.gef.Request) DirectEditRequest(org.eclipse.gef.requests.DirectEditRequest)

Aggregations

DirectEditRequest (org.eclipse.gef.requests.DirectEditRequest)25 Request (org.eclipse.gef.Request)14 IFigure (org.eclipse.draw2d.IFigure)6 Point (org.eclipse.draw2d.geometry.Point)6 XmlMapNodeCellEditorLocator (org.talend.designer.gefabstractmap.part.directedit.XmlMapNodeCellEditorLocator)6 XmlMapNodeDirectEditManager (org.talend.designer.xmlmap.parts.directedit.XmlMapNodeDirectEditManager)6 Figure (org.eclipse.draw2d.Figure)3 IWidgetCell (org.talend.designer.gefabstractmap.figures.cells.IWidgetCell)3 EObject (org.eclipse.emf.ecore.EObject)2 IGraphicalEditPart (org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart)2 View (org.eclipse.gmf.runtime.notation.View)2 TableTreeEntityFigure (org.talend.designer.gefabstractmap.figures.table.entity.TableTreeEntityFigure)2 FilterTextArea (org.talend.designer.gefabstractmap.figures.treesettings.FilterTextArea)2 ArrayList (java.util.ArrayList)1 Map (java.util.Map)1 IFile (org.eclipse.core.resources.IFile)1 IResource (org.eclipse.core.resources.IResource)1 CoreException (org.eclipse.core.runtime.CoreException)1 Path (org.eclipse.core.runtime.Path)1 ImageFigure (org.eclipse.draw2d.ImageFigure)1