use of org.apache.cayenne.modeler.action.MultipleObjectsAction in project cayenne by apache.
the class ModelerUtil method updateActions.
/**
* Updates MultipleObjectActions' state, depending on number of selected objects
* (attributes, rel etc.)
*/
public static void updateActions(int numSelected, Class<? extends Action>... actions) {
ActionManager actionManager = Application.getInstance().getActionManager();
for (Class<? extends Action> actionType : actions) {
Action action = actionManager.getAction(actionType);
if (action instanceof MultipleObjectsAction) {
MultipleObjectsAction multiObjectAction = (MultipleObjectsAction) action;
multiObjectAction.setEnabled(numSelected > 0);
((CayenneAction) multiObjectAction).setName(multiObjectAction.getActionName(numSelected > 1));
}
}
}
Aggregations