Package org.apache.cayenne.modeler.util

Examples of org.apache.cayenne.modeler.util.CayenneAction


            Application application) {
        processActionsState(MULTIPLE_OBJECTS_ACTIONS);

        updateActions("Selected Objects");

        CayenneAction cutAction = getAction(CutAction.class);
        boolean canCopy = true; // cut/copy can be performed if selected objects are on
        // the same level

        if (!cutAction.enableForPath((ConfigurationNode) objects[0])) {
            canCopy = false;
        }
        else {
            ConfigurationNodeParentGetter parentGetter = application
                    .getInjector()
                    .getInstance(ConfigurationNodeParentGetter.class);
            Object parent = parentGetter.getParent(objects[0]);

            for (int i = 1; i < objects.length; i++) {
                if (parentGetter.getParent(objects[i]) != parent
                        || !cutAction.enableForPath((ConfigurationNode) objects[i])) {
                    canCopy = false;
                    break;
                }
            }
        }

        cutAction.setEnabled(canCopy);
        getAction(CopyAction.class).setEnabled(canCopy);
    }
View Full Code Here


            Application application) {
        processActionsState(MULTIPLE_OBJECTS_ACTIONS);

        updateActions("Selected Objects");

        CayenneAction cutAction = getAction(CutAction.class);
        boolean canCopy = true; // cut/copy can be performed if selected objects are on
        // the same level

        if (!cutAction.enableForPath((ConfigurationNode) objects[0])) {
            canCopy = false;
        }
        else {
            ConfigurationNodeParentGetter parentGetter = application
                    .getInjector()
                    .getInstance(ConfigurationNodeParentGetter.class);
            Object parent = parentGetter.getParent(objects[0]);

            for (int i = 1; i < objects.length; i++) {
                if (parentGetter.getParent(objects[i]) != parent
                        || !cutAction.enableForPath((ConfigurationNode) objects[i])) {
                    canCopy = false;
                    break;
                }
            }
        }

        cutAction.setEnabled(canCopy);
        getAction(CopyAction.class).setEnabled(canCopy);
    }
View Full Code Here

    public void multipleObjectsSelected(ProjectPath[] paths) {
        processActionsState(MULTIPLE_OBJECTS_ACTIONS);
       
        updateActions("Selected Objects");
       
        CayenneAction cutAction = getAction(CutAction.getActionName());
        boolean canCopy = true; // cut/copy can be performed if selected objects are on the same level
       
        if (!cutAction.enableForPath(paths[0])) {
            canCopy = false;
        }
        else {
            Object parent = paths[0].getObjectParent();
           
            for (int i = 1; i < paths.length; i++) {
                if (paths[i].getObjectParent() != parent || !cutAction.enableForPath(paths[i])) {
                    canCopy = false;
                    break;
                }
            }
        }
       
        cutAction.setEnabled(canCopy);
        getAction(CopyAction.getActionName()).setEnabled(canCopy);
    }
View Full Code Here

        updateUI();
    }

    private void updateUI() {
        CayenneAction undoAction = application.getActionManager().getAction(
                UndoAction.getActionName());

        CayenneAction redoAction = application.getActionManager().getAction(
                RedoAction.getActionName());

        undoAction.setEnabled(canUndo());
        redoAction.setEnabled(canRedo());

        undoAction.setName(getUndoPresentationName());
        redoAction.setName(getRedoPresentationName());
    }
View Full Code Here

     * Creates and returns an menu item associated with the key.
     *
     * @param key action key
     */
    private JMenuItem buildMenu(Class<? extends Action> actionType) {
        CayenneAction action = (CayenneAction) mediator
                .getApplication()
                .getActionManager()
                .getAction(actionType);
        return action.buildMenu();
    }
View Full Code Here

        updateUI();
    }

    private void updateUI() {
        CayenneAction undoAction = application.getActionManager().getAction(
                UndoAction.class);

        CayenneAction redoAction = application.getActionManager().getAction(
                RedoAction.class);

        undoAction.setEnabled(canUndo());
        redoAction.setEnabled(canRedo());

        undoAction.setName(getUndoPresentationName());
        redoAction.setName(getRedoPresentationName());
    }
View Full Code Here

            Application application) {
        processActionsState(MULTIPLE_OBJECTS_ACTIONS);

        updateActions("Selected Objects");

        CayenneAction cutAction = getAction(CutAction.class);
        boolean canCopy = true; // cut/copy can be performed if selected objects are on
        // the same level

        if (!cutAction.enableForPath((ConfigurationNode) objects[0])) {
            canCopy = false;
        }
        else {
            ConfigurationNodeParentGetter parentGetter = application
                    .getInjector()
                    .getInstance(ConfigurationNodeParentGetter.class);
            Object parent = parentGetter.getParent(objects[0]);

            for (int i = 1; i < objects.length; i++) {
                if (parentGetter.getParent(objects[i]) != parent
                        || !cutAction.enableForPath((ConfigurationNode) objects[i])) {
                    canCopy = false;
                    break;
                }
            }
        }

        cutAction.setEnabled(canCopy);
        getAction(CopyAction.class).setEnabled(canCopy);
    }
View Full Code Here

TOP

Related Classes of org.apache.cayenne.modeler.util.CayenneAction

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.