Search in sources :

Example 21 with Request

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

the class DecisionBusinessItemNameEditPart 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 22 with Request

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

the class EllipseBusinessItemNameEditPart 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 23 with Request

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

the class EllipseBusinessItemNameEditPart method createDefaultEditPolicies.

/**
     * @generated
     */
protected void createDefaultEditPolicies() {
    super.createDefaultEditPolicies();
    installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, new LabelDirectEditPolicy());
    installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, new NonResizableEditPolicy() {

        protected List createSelectionHandles() {
            List handles = new ArrayList();
            NonResizableHandleKit.addMoveHandle((GraphicalEditPart) getHost(), handles);
            return handles;
        }

        public Command getCommand(Request request) {
            return null;
        }

        public boolean understandsRequest(Request request) {
            return false;
        }
    });
}
Also used : LabelDirectEditPolicy(org.eclipse.gmf.runtime.diagram.ui.editpolicies.LabelDirectEditPolicy) Command(org.eclipse.gef.commands.Command) ArrayList(java.util.ArrayList) Request(org.eclipse.gef.Request) DirectEditRequest(org.eclipse.gef.requests.DirectEditRequest) List(java.util.List) ArrayList(java.util.ArrayList) NonResizableEditPolicy(org.eclipse.gef.editpolicies.NonResizableEditPolicy) GraphicalEditPart(org.eclipse.gef.GraphicalEditPart) IGraphicalEditPart(org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart)

Example 24 with Request

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

the class DataBusinessItemNameEditPart method createDefaultEditPolicies.

/**
     * @generated
     */
protected void createDefaultEditPolicies() {
    super.createDefaultEditPolicies();
    installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, new LabelDirectEditPolicy());
    installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, new NonResizableEditPolicy() {

        protected List createSelectionHandles() {
            List handles = new ArrayList();
            NonResizableHandleKit.addMoveHandle((GraphicalEditPart) getHost(), handles);
            return handles;
        }

        public Command getCommand(Request request) {
            return null;
        }

        public boolean understandsRequest(Request request) {
            return false;
        }
    });
}
Also used : LabelDirectEditPolicy(org.eclipse.gmf.runtime.diagram.ui.editpolicies.LabelDirectEditPolicy) Command(org.eclipse.gef.commands.Command) ArrayList(java.util.ArrayList) Request(org.eclipse.gef.Request) DirectEditRequest(org.eclipse.gef.requests.DirectEditRequest) List(java.util.List) ArrayList(java.util.ArrayList) NonResizableEditPolicy(org.eclipse.gef.editpolicies.NonResizableEditPolicy) GraphicalEditPart(org.eclipse.gef.GraphicalEditPart) IGraphicalEditPart(org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart)

Example 25 with Request

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

the class DataBusinessItemNameEditPart 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

Request (org.eclipse.gef.Request)27 DirectEditRequest (org.eclipse.gef.requests.DirectEditRequest)25 ArrayList (java.util.ArrayList)12 List (java.util.List)12 GraphicalEditPart (org.eclipse.gef.GraphicalEditPart)12 Command (org.eclipse.gef.commands.Command)11 NonResizableEditPolicy (org.eclipse.gef.editpolicies.NonResizableEditPolicy)11 IGraphicalEditPart (org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart)11 LabelDirectEditPolicy (org.eclipse.gmf.runtime.diagram.ui.editpolicies.LabelDirectEditPolicy)11 EditPart (org.eclipse.gef.EditPart)2 Iterator (java.util.Iterator)1 IAdaptable (org.eclipse.core.runtime.IAdaptable)1 AbstractEditPart (org.eclipse.gef.editparts.AbstractEditPart)1 View (org.eclipse.gmf.runtime.notation.View)1 StructuredSelection (org.eclipse.jface.viewers.StructuredSelection)1