use of org.apache.cayenne.modeler.util.CayenneAction in project cayenne by apache.
the class DefaultActionManager method multipleObjectsSelected.
/**
* Invoked when several objects were selected in ProjectTree at time
*/
public void multipleObjectsSelected(ConfigurationNode[] objects, Application application) {
processActionsState(MULTIPLE_OBJECTS_ACTIONS);
updateActions("Selected Objects");
CayenneAction cutAction = getAction(CutAction.class);
// cut/copy can be performed if selected objects are on
boolean canCopy = true;
if (!cutAction.enableForPath(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(objects[i])) {
canCopy = false;
break;
}
}
}
cutAction.setEnabled(canCopy);
getAction(CopyAction.class).setEnabled(canCopy);
}
use of org.apache.cayenne.modeler.util.CayenneAction in project cayenne by apache.
the class CayenneUndoManager method 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());
}
Aggregations