Package org.apache.cayenne.modeler.undo

Examples of org.apache.cayenne.modeler.undo.RemoveUndoableEdit


        if (mediator.getCurrentObjEntity() != null) {
            if (dialog
                    .shouldDelete("ObjEntity", mediator.getCurrentObjEntity().getName())) {
                application.getUndoManager().addEdit(
                        new RemoveUndoableEdit(mediator.getCurrentDataMap(), mediator
                                .getCurrentObjEntity()));
                removeObjEntity(mediator.getCurrentDataMap(), mediator
                        .getCurrentObjEntity());
            }
        }
        else if (mediator.getCurrentDbEntity() != null) {
            if (dialog.shouldDelete("DbEntity", mediator.getCurrentDbEntity().getName())) {
                application.getUndoManager().addEdit(
                        new RemoveUndoableEdit(mediator.getCurrentDataMap(), mediator
                                .getCurrentDbEntity()));
                removeDbEntity(mediator.getCurrentDataMap(), mediator
                        .getCurrentDbEntity());
            }
        }
        else if (mediator.getCurrentQuery() != null) {
            if (dialog.shouldDelete("query", mediator.getCurrentQuery().getName())) {
                application.getUndoManager().addEdit(
                        new RemoveUndoableEdit(mediator.getCurrentDataMap(), mediator
                                .getCurrentQuery()));
                removeQuery(mediator.getCurrentDataMap(), mediator.getCurrentQuery());
            }
        }
        else if (mediator.getCurrentProcedure() != null) {
            if (dialog
                    .shouldDelete("procedure", mediator.getCurrentProcedure().getName())) {

                application.getUndoManager().addEdit(
                        new RemoveUndoableEdit(mediator.getCurrentDataMap(), mediator
                                .getCurrentProcedure()));

                removeProcedure(mediator.getCurrentDataMap(), mediator
                        .getCurrentProcedure());

            }
        }
        else if (mediator.getCurrentEmbeddable() != null) {
            if (dialog.shouldDelete("embeddable", mediator
                    .getCurrentEmbeddable()
                    .getClassName())) {

                application.getUndoManager().addEdit(
                        new RemoveUndoableEdit(mediator.getCurrentDataMap(), mediator
                                .getCurrentEmbeddable()));

                removeEmbeddable(mediator.getCurrentDataMap(), mediator
                        .getCurrentEmbeddable());
            }
        }
        else if (mediator.getCurrentDataMap() != null) {
            if (dialog.shouldDelete("data map", mediator.getCurrentDataMap().getName())) {

                // In context of Data node just remove from Data Node
                if (mediator.getCurrentDataNode() != null) {
                    application.getUndoManager().addEdit(
                            new RemoveUndoableEdit(application, mediator
                                    .getCurrentDataNode(), mediator.getCurrentDataMap()));

                    removeDataMapFromDataNode(mediator.getCurrentDataNode(), mediator
                            .getCurrentDataMap());

                }
                else {
                    // Not under Data Node, remove completely
                    application.getUndoManager().addEdit(
                            new RemoveUndoableEdit(application, mediator
                                    .getCurrentDataMap()));

                    removeDataMap(mediator.getCurrentDataMap());

                }
            }
        }
        else if (mediator.getCurrentDataNode() != null) {
            if (dialog.shouldDelete("data node", mediator.getCurrentDataNode().getName())) {
                application
                        .getUndoManager()
                        .addEdit(
                                new RemoveUndoableEdit(application, mediator
                                        .getCurrentDataNode()));

                removeDataNode(mediator.getCurrentDataNode());
            }
        }
View Full Code Here


    private UndoableEdit removeLastPathComponent(Object object) {

        UndoableEdit undo = null;

        if (object instanceof DataMap) {
            undo = new RemoveUndoableEdit(application, (DataMap) object);
            removeDataMap((DataMap) object);
        }
        else if (object instanceof DataNodeDescriptor) {
            undo = new RemoveUndoableEdit(application, (DataNodeDescriptor) object);

            removeDataNode((DataNodeDescriptor) object);
        }
        else if (object instanceof DbEntity) {
            undo = new RemoveUndoableEdit(
                    ((DbEntity) object).getDataMap(),
                    (DbEntity) object);

            removeDbEntity(((DbEntity) object).getDataMap(), (DbEntity) object);
        }
        else if (object instanceof ObjEntity) {
            undo = new RemoveUndoableEdit(
                    ((ObjEntity) object).getDataMap(),
                    (ObjEntity) object);

            removeObjEntity(((ObjEntity) object).getDataMap(), (ObjEntity) object);
        }
        else if (object instanceof Query) {
            undo = new RemoveUndoableEdit(((Query) object).getDataMap(), (Query) object);

            removeQuery(((Query) object).getDataMap(), (Query) object);
        }
        else if (object instanceof Procedure) {
            undo = new RemoveUndoableEdit(
                    ((Procedure) object).getDataMap(),
                    (Procedure) object);

            removeProcedure(((Procedure) object).getDataMap(), (Procedure) object);
        }
        else if (object instanceof Embeddable) {
            undo = new RemoveUndoableEdit(
                    ((Embeddable) object).getDataMap(),
                    (Embeddable) object);
            removeEmbeddable(((Embeddable) object).getDataMap(), (Embeddable) object);
        }
View Full Code Here

        if (mediator.getCurrentObjEntity() != null) {
            if (dialog
                    .shouldDelete("ObjEntity", mediator.getCurrentObjEntity().getName())) {
                application.getUndoManager().addEdit(
                        new RemoveUndoableEdit(mediator.getCurrentDataMap(), mediator
                                .getCurrentObjEntity()));
                removeObjEntity(mediator.getCurrentDataMap(), mediator
                        .getCurrentObjEntity());
            }
        }
        else if (mediator.getCurrentDbEntity() != null) {
            if (dialog.shouldDelete("DbEntity", mediator.getCurrentDbEntity().getName())) {
                application.getUndoManager().addEdit(
                        new RemoveUndoableEdit(mediator.getCurrentDataMap(), mediator
                                .getCurrentDbEntity()));
                removeDbEntity(mediator.getCurrentDataMap(), mediator
                        .getCurrentDbEntity());
            }
        }
        else if (mediator.getCurrentQuery() != null) {
            if (dialog.shouldDelete("query", mediator.getCurrentQuery().getName())) {
                application.getUndoManager().addEdit(
                        new RemoveUndoableEdit(mediator.getCurrentDataMap(), mediator
                                .getCurrentQuery()));
                removeQuery(mediator.getCurrentDataMap(), mediator.getCurrentQuery());
            }
        }
        else if (mediator.getCurrentProcedure() != null) {
            if (dialog
                    .shouldDelete("procedure", mediator.getCurrentProcedure().getName())) {

                application.getUndoManager().addEdit(
                        new RemoveUndoableEdit(mediator.getCurrentDataMap(), mediator
                                .getCurrentProcedure()));

                removeProcedure(mediator.getCurrentDataMap(), mediator
                        .getCurrentProcedure());

            }
        }
        else if (mediator.getCurrentEmbeddable() != null) {
            if (dialog.shouldDelete("embeddable", mediator
                    .getCurrentEmbeddable()
                    .getClassName())) {

                application.getUndoManager().addEdit(
                        new RemoveUndoableEdit(mediator.getCurrentDataMap(), mediator
                                .getCurrentEmbeddable()));

                removeEmbeddable(mediator.getCurrentDataMap(), mediator
                        .getCurrentEmbeddable());
            }
        }
        else if (mediator.getCurrentDataMap() != null) {
            if (dialog.shouldDelete("data map", mediator.getCurrentDataMap().getName())) {

                // In context of Data node just remove from Data Node
                if (mediator.getCurrentDataNode() != null) {
                    application.getUndoManager().addEdit(
                            new RemoveUndoableEdit(application, mediator
                                    .getCurrentDataNode(), mediator.getCurrentDataMap()));

                    removeDataMapFromDataNode(mediator.getCurrentDataNode(), mediator
                            .getCurrentDataMap());

                }
                else {
                    // Not under Data Node, remove completely
                    application.getUndoManager().addEdit(
                            new RemoveUndoableEdit(application, mediator
                                    .getCurrentDataMap()));

                    removeDataMap(mediator.getCurrentDataMap());

                }
            }
        }
        else if (mediator.getCurrentDataNode() != null) {
            if (dialog.shouldDelete("data node", mediator.getCurrentDataNode().getName())) {
                application
                        .getUndoManager()
                        .addEdit(
                                new RemoveUndoableEdit(application, mediator
                                        .getCurrentDataNode()));

                removeDataNode(mediator.getCurrentDataNode());
            }
        }
View Full Code Here

    private UndoableEdit removeLastPathComponent(Object object) {

        UndoableEdit undo = null;

        if (object instanceof DataMap) {
            undo = new RemoveUndoableEdit(application, (DataMap) object);
            removeDataMap((DataMap) object);
        }
        else if (object instanceof DataNodeDescriptor) {
            undo = new RemoveUndoableEdit(application, (DataNodeDescriptor) object);

            removeDataNode((DataNodeDescriptor) object);
        }
        else if (object instanceof DbEntity) {
            undo = new RemoveUndoableEdit(
                    ((DbEntity) object).getDataMap(),
                    (DbEntity) object);

            removeDbEntity(((DbEntity) object).getDataMap(), (DbEntity) object);
        }
        else if (object instanceof ObjEntity) {
            undo = new RemoveUndoableEdit(
                    ((ObjEntity) object).getDataMap(),
                    (ObjEntity) object);

            removeObjEntity(((ObjEntity) object).getDataMap(), (ObjEntity) object);
        }
        else if (object instanceof Query) {
            undo = new RemoveUndoableEdit(((Query) object).getDataMap(), (Query) object);

            removeQuery(((Query) object).getDataMap(), (Query) object);
        }
        else if (object instanceof Procedure) {
            undo = new RemoveUndoableEdit(
                    ((Procedure) object).getDataMap(),
                    (Procedure) object);

            removeProcedure(((Procedure) object).getDataMap(), (Procedure) object);
        }
        else if (object instanceof Embeddable) {
            undo = new RemoveUndoableEdit(
                    ((Embeddable) object).getDataMap(),
                    (Embeddable) object);
            removeEmbeddable(((Embeddable) object).getDataMap(), (Embeddable) object);
        }
View Full Code Here

        if (mediator.getCurrentObjEntity() != null) {
            if (dialog
                    .shouldDelete("ObjEntity", mediator.getCurrentObjEntity().getName())) {
                application.getUndoManager().addEdit(
                        new RemoveUndoableEdit(mediator.getCurrentDataMap(), mediator
                                .getCurrentObjEntity()));
                removeObjEntity(mediator.getCurrentDataMap(), mediator
                        .getCurrentObjEntity());
            }
        }
        else if (mediator.getCurrentDbEntity() != null) {
            if (dialog.shouldDelete("DbEntity", mediator.getCurrentDbEntity().getName())) {
                application.getUndoManager().addEdit(
                        new RemoveUndoableEdit(mediator.getCurrentDataMap(), mediator
                                .getCurrentDbEntity()));
                removeDbEntity(mediator.getCurrentDataMap(), mediator
                        .getCurrentDbEntity());
            }
        }
        else if (mediator.getCurrentQuery() != null) {
            if (dialog.shouldDelete("query", mediator.getCurrentQuery().getName())) {
                application.getUndoManager().addEdit(
                        new RemoveUndoableEdit(mediator.getCurrentDataMap(), mediator
                                .getCurrentQuery()));
                removeQuery(mediator.getCurrentDataMap(), mediator.getCurrentQuery());
            }
        }
        else if (mediator.getCurrentProcedure() != null) {
            if (dialog
                    .shouldDelete("procedure", mediator.getCurrentProcedure().getName())) {

                application.getUndoManager().addEdit(
                        new RemoveUndoableEdit(mediator.getCurrentDataMap(), mediator
                                .getCurrentProcedure()));

                removeProcedure(mediator.getCurrentDataMap(), mediator
                        .getCurrentProcedure());

            }
        }
        else if (mediator.getCurrentEmbeddable() != null) {
            if (dialog.shouldDelete("embeddable", mediator
                    .getCurrentEmbeddable()
                    .getClassName())) {

                application.getUndoManager().addEdit(
                        new RemoveUndoableEdit(mediator.getCurrentDataMap(), mediator
                                .getCurrentEmbeddable()));

                removeEmbeddable(mediator.getCurrentDataMap(), mediator
                        .getCurrentEmbeddable());
            }
        }
        else if (mediator.getCurrentDataMap() != null) {
            if (dialog.shouldDelete("data map", mediator.getCurrentDataMap().getName())) {

                // In context of Data node just remove from Data Node
                if (mediator.getCurrentDataNode() != null) {
                    application.getUndoManager().addEdit(
                            new RemoveUndoableEdit(application, mediator
                                    .getCurrentDataNode(), mediator.getCurrentDataMap()));

                    removeDataMapFromDataNode(mediator.getCurrentDataNode(), mediator
                            .getCurrentDataMap());

                }
                else {
                    // Not under Data Node, remove completely
                    application
                            .getUndoManager()
                            .addEdit(
                                    new RemoveUndoableEdit(application, mediator
                                            .getCurrentDataDomain(), mediator
                                            .getCurrentDataMap()));

                    removeDataMap(mediator.getCurrentDataDomain(), mediator
                            .getCurrentDataMap());

                }
            }
        }
        else if (mediator.getCurrentDataNode() != null) {
            if (dialog.shouldDelete("data node", mediator.getCurrentDataNode().getName())) {
                application.getUndoManager().addEdit(
                        new RemoveUndoableEdit(application, mediator
                                .getCurrentDataDomain(), mediator.getCurrentDataNode()));

                removeDataNode(mediator.getCurrentDataDomain(), mediator
                        .getCurrentDataNode());
            }
        }
        else if (mediator.getCurrentDataDomain() != null) {
            if (dialog.shouldDelete("data domain", mediator
                    .getCurrentDataDomain()
                    .getName())) {

                application.getUndoManager().addEdit(
                        new RemoveUndoableEdit(application, mediator
                                .getCurrentDataDomain()));

                removeDomain(mediator.getCurrentDataDomain());
            }
        }
View Full Code Here

        Object lastObject = path.getObject();

        UndoableEdit undo = null;

        if (lastObject instanceof DataDomain) {
            undo = new RemoveUndoableEdit(application, (DataDomain) lastObject);
            removeDomain((DataDomain) lastObject);
        }
        else if (lastObject instanceof DataMap) {
            Object parent = path.getObjectParent();

            if (parent instanceof DataDomain) {
                undo = new RemoveUndoableEdit(
                        application,
                        (DataDomain) parent,
                        (DataMap) lastObject);

                removeDataMap((DataDomain) parent, (DataMap) lastObject);
            }
            else { // if(parent instanceof DataNode)
                undo = new RemoveUndoableEdit(
                        application,
                        (DataNode) parent,
                        (DataMap) lastObject);

                removeDataMapFromDataNode((DataNode) parent, (DataMap) lastObject);
            }
        }
        else if (lastObject instanceof DataNode) {
            undo = new RemoveUndoableEdit(application, (DataDomain) path
                    .getObjectParent(), (DataNode) lastObject);

            removeDataNode((DataDomain) path.getObjectParent(), (DataNode) lastObject);
        }
        else if (lastObject instanceof DbEntity) {
            undo = new RemoveUndoableEdit(
                    (DataMap) path.getObjectParent(),
                    (DbEntity) lastObject);

            removeDbEntity((DataMap) path.getObjectParent(), (DbEntity) lastObject);
        }
        else if (lastObject instanceof ObjEntity) {
            undo = new RemoveUndoableEdit(
                    (DataMap) path.getObjectParent(),
                    (ObjEntity) lastObject);

            removeObjEntity((DataMap) path.getObjectParent(), (ObjEntity) lastObject);
        }
        else if (lastObject instanceof Query) {
            undo = new RemoveUndoableEdit(
                    (DataMap) path.getObjectParent(),
                    (Query) lastObject);

            removeQuery((DataMap) path.getObjectParent(), (Query) lastObject);
        }
        else if (lastObject instanceof Procedure) {
            undo = new RemoveUndoableEdit(
                    (DataMap) path.getObjectParent(),
                    (Procedure) lastObject);

            removeProcedure((DataMap) path.getObjectParent(), (Procedure) lastObject);
        }
        else if (lastObject instanceof Embeddable) {
            undo = new RemoveUndoableEdit(
                    (DataMap) path.getObjectParent(),
                    (Embeddable) lastObject);
            removeEmbeddable((DataMap) path.getObjectParent(), (Embeddable) lastObject);
        }
View Full Code Here

        if (mediator.getCurrentObjEntity() != null) {
            if (dialog
                    .shouldDelete("ObjEntity", mediator.getCurrentObjEntity().getName())) {
                application.getUndoManager().addEdit(
                        new RemoveUndoableEdit(mediator.getCurrentDataMap(), mediator
                                .getCurrentObjEntity()));
                removeObjEntity(mediator.getCurrentDataMap(), mediator
                        .getCurrentObjEntity());
            }
        }
        else if (mediator.getCurrentDbEntity() != null) {
            if (dialog.shouldDelete("DbEntity", mediator.getCurrentDbEntity().getName())) {
                application.getUndoManager().addEdit(
                        new RemoveUndoableEdit(mediator.getCurrentDataMap(), mediator
                                .getCurrentDbEntity()));
                removeDbEntity(mediator.getCurrentDataMap(), mediator
                        .getCurrentDbEntity());
            }
        }
        else if (mediator.getCurrentQuery() != null) {
            if (dialog.shouldDelete("query", mediator.getCurrentQuery().getName())) {
                application.getUndoManager().addEdit(
                        new RemoveUndoableEdit(mediator.getCurrentDataMap(), mediator
                                .getCurrentQuery()));
                removeQuery(mediator.getCurrentDataMap(), mediator.getCurrentQuery());
            }
        }
        else if (mediator.getCurrentProcedure() != null) {
            if (dialog
                    .shouldDelete("procedure", mediator.getCurrentProcedure().getName())) {

                application.getUndoManager().addEdit(
                        new RemoveUndoableEdit(mediator.getCurrentDataMap(), mediator
                                .getCurrentProcedure()));

                removeProcedure(mediator.getCurrentDataMap(), mediator
                        .getCurrentProcedure());

            }
        }
        else if (mediator.getCurrentEmbeddable() != null) {
            if (dialog.shouldDelete("embeddable", mediator
                    .getCurrentEmbeddable()
                    .getClassName())) {

                application.getUndoManager().addEdit(
                        new RemoveUndoableEdit(mediator.getCurrentDataMap(), mediator
                                .getCurrentEmbeddable()));

                removeEmbeddable(mediator.getCurrentDataMap(), mediator
                        .getCurrentEmbeddable());
            }
        }
        else if (mediator.getCurrentDataMap() != null) {
            if (dialog.shouldDelete("data map", mediator.getCurrentDataMap().getName())) {

                // In context of Data node just remove from Data Node
                if (mediator.getCurrentDataNode() != null) {
                    application.getUndoManager().addEdit(
                            new RemoveUndoableEdit(application, mediator
                                    .getCurrentDataNode(), mediator.getCurrentDataMap()));

                    removeDataMapFromDataNode(mediator.getCurrentDataNode(), mediator
                            .getCurrentDataMap());

                }
                else {
                    // Not under Data Node, remove completely
                    application.getUndoManager().addEdit(
                            new RemoveUndoableEdit(application, mediator
                                    .getCurrentDataMap()));

                    removeDataMap(mediator.getCurrentDataMap());

                }
            }
        }
        else if (mediator.getCurrentDataNode() != null) {
            if (dialog.shouldDelete("data node", mediator.getCurrentDataNode().getName())) {
                application
                        .getUndoManager()
                        .addEdit(
                                new RemoveUndoableEdit(application, mediator
                                        .getCurrentDataNode()));

                removeDataNode(mediator.getCurrentDataNode());
            }
        }
View Full Code Here

    private UndoableEdit removeLastPathComponent(Object object) {

        UndoableEdit undo = null;

        if (object instanceof DataMap) {
            undo = new RemoveUndoableEdit(application, (DataMap) object);
            removeDataMap((DataMap) object);
        }
        else if (object instanceof DataNodeDescriptor) {
            undo = new RemoveUndoableEdit(application, (DataNodeDescriptor) object);

            removeDataNode((DataNodeDescriptor) object);
        }
        else if (object instanceof DbEntity) {
            undo = new RemoveUndoableEdit(
                    ((DbEntity) object).getDataMap(),
                    (DbEntity) object);

            removeDbEntity(((DbEntity) object).getDataMap(), (DbEntity) object);
        }
        else if (object instanceof ObjEntity) {
            undo = new RemoveUndoableEdit(
                    ((ObjEntity) object).getDataMap(),
                    (ObjEntity) object);

            removeObjEntity(((ObjEntity) object).getDataMap(), (ObjEntity) object);
        }
        else if (object instanceof Query) {
            undo = new RemoveUndoableEdit(((Query) object).getDataMap(), (Query) object);

            removeQuery(((Query) object).getDataMap(), (Query) object);
        }
        else if (object instanceof Procedure) {
            undo = new RemoveUndoableEdit(
                    ((Procedure) object).getDataMap(),
                    (Procedure) object);

            removeProcedure(((Procedure) object).getDataMap(), (Procedure) object);
        }
        else if (object instanceof Embeddable) {
            undo = new RemoveUndoableEdit(
                    ((Embeddable) object).getDataMap(),
                    (Embeddable) object);
            removeEmbeddable(((Embeddable) object).getDataMap(), (Embeddable) object);
        }
View Full Code Here

        }
       
        if (entity instanceof ObjEntity) {
            if (dialog.shouldDelete("ObjEntity", entity.getName())) {
                application.getUndoManager().addEdit(
                        new RemoveUndoableEdit(entity.getDataMap(), (ObjEntity) entity));
                removeObjEntity(entity.getDataMap(), (ObjEntity) entity);
            }
        }
        else {
            if (dialog.shouldDelete("DbEntity", entity.getName())) {
                application.getUndoManager().addEdit(
                        new RemoveUndoableEdit(entity.getDataMap(), (DbEntity) entity));
                removeDbEntity(entity.getDataMap(), (DbEntity) entity);
            }
        }
    }
View Full Code Here

TOP

Related Classes of org.apache.cayenne.modeler.undo.RemoveUndoableEdit

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.