use of org.apache.cayenne.modeler.ProjectController in project cayenne by apache.
the class InferRelationshipsController method generateAction.
public void generateAction() {
ProjectController mediator = application.getFrameController().getProjectController();
InferRelationshipsUndoableEdit undoableEdit = new InferRelationshipsUndoableEdit();
for (InferredRelationship temp : selectedEntities) {
DbRelationship rel = new DbRelationship(uniqueRelName(temp.getSource(), temp.getName()));
RelationshipEvent e = new RelationshipEvent(Application.getFrame(), rel, temp.getSource(), MapEvent.ADD);
mediator.fireDbRelationshipEvent(e);
rel.setSourceEntity(temp.getSource());
rel.setTargetEntityName(temp.getTarget());
DbJoin join = new DbJoin(rel, temp.getJoinSource().getName(), temp.getJoinTarget().getName());
rel.addJoin(join);
rel.setToMany(temp.isToMany());
temp.getSource().addRelationship(rel);
undoableEdit.addEdit(new CreateRelationshipUndoableEdit(temp.getSource(), new DbRelationship[] { rel }));
}
JOptionPane.showMessageDialog(this.getView(), getSelectedEntitiesSize() + " relationships generated");
view.dispose();
}
use of org.apache.cayenne.modeler.ProjectController in project cayenne by apache.
the class CopyAction method performAction.
/**
* Performs copying of items into system buffer
*/
@Override
public void performAction(ActionEvent e) {
ProjectController mediator = getProjectController();
Object content = copy(mediator);
if (content != null) {
Clipboard sysClip = Toolkit.getDefaultToolkit().getSystemClipboard();
sysClip.setContents(new CayenneTransferable(content), null);
}
// update paste button
getApplication().getActionManager().getAction(PasteAction.class).updateState();
}
use of org.apache.cayenne.modeler.ProjectController in project cayenne by apache.
the class CreateAttributeAction method createObjAttribute.
public void createObjAttribute(DataMap map, ObjEntity objEntity, ObjAttribute attr) {
ProjectController mediator = getProjectController();
objEntity.addAttribute(attr);
fireObjAttributeEvent(this, mediator, map, objEntity, attr);
}
use of org.apache.cayenne.modeler.ProjectController in project cayenne by apache.
the class CreateDataMapAction method performAction.
public void performAction(ActionEvent e) {
ProjectController mediator = getProjectController();
DataChannelDescriptor dataChannelDescriptor = (DataChannelDescriptor) mediator.getProject().getRootNode();
DataMap map = new DataMap();
map.setName(NameBuilder.builder(map, dataChannelDescriptor).name());
createDataMap(map);
application.getUndoManager().addEdit(new CreateDataMapUndoableEdit(dataChannelDescriptor, map));
}
use of org.apache.cayenne.modeler.ProjectController in project cayenne by apache.
the class CreateEmbeddableAction method performAction.
@Override
public void performAction(ActionEvent e) {
ProjectController mediator = getProjectController();
DataMap dataMap = mediator.getCurrentDataMap();
Embeddable embeddable = new Embeddable();
String baseName = NameBuilder.builder(embeddable, dataMap).name();
String nameWithPackage = dataMap.getNameWithDefaultPackage(baseName);
embeddable.setClassName(nameWithPackage);
createEmbeddable(dataMap, embeddable);
application.getUndoManager().addEdit(new CreateEmbeddableUndoableEdit(dataMap, embeddable));
}
Aggregations