use of org.apache.cayenne.configuration.DataChannelDescriptor in project cayenne by apache.
the class CreateProcedureParameterAction method fireProcedureParameterEvent.
/**
* Fires events when an proc parameter was added
*/
static void fireProcedureParameterEvent(Object src, ProjectController mediator, Procedure procedure, ProcedureParameter parameter) {
mediator.fireProcedureParameterEvent(new ProcedureParameterEvent(src, parameter, MapEvent.ADD));
mediator.fireProcedureParameterDisplayEvent(new ProcedureParameterDisplayEvent(src, parameter, procedure, mediator.getCurrentDataMap(), (DataChannelDescriptor) mediator.getProject().getRootNode()));
}
use of org.apache.cayenne.configuration.DataChannelDescriptor in project cayenne by apache.
the class CreateRelationshipUndoableEdit method undo.
@Override
public void undo() throws CannotUndoException {
RemoveRelationshipAction action = actionManager.getAction(RemoveRelationshipAction.class);
if (objEnt != null) {
action.removeObjRelationships(objEnt, objectRel);
controller.fireObjEntityDisplayEvent(new EntityDisplayEvent(this, objEnt, objEnt.getDataMap(), (DataChannelDescriptor) controller.getProject().getRootNode()));
}
if (dbEnt != null) {
action.removeDbRelationships(dbEnt, dbRel);
controller.fireDbEntityDisplayEvent(new EntityDisplayEvent(this, dbEnt, dbEnt.getDataMap(), (DataChannelDescriptor) controller.getProject().getRootNode()));
}
}
use of org.apache.cayenne.configuration.DataChannelDescriptor in project cayenne by apache.
the class CayenneAction method buildTreePath.
/**
* Builds a tree path for a given entity. Urgent for later selection.
*
* @param entity to build path for
* @return tree path
*/
protected static TreePath buildTreePath(Entity entity) {
DataChannelDescriptor domain = (DataChannelDescriptor) Application.getInstance().getProject().getRootNode();
Object[] path = new Object[] { domain, entity.getDataMap(), entity };
Object[] mutableTreeNodes = new Object[path.length];
mutableTreeNodes[0] = ((ProjectTreeModel) editor().getProjectTreeView().getModel()).getRootNode();
Object[] helper;
for (int i = 1; i < path.length; i++) {
helper = new Object[i];
for (int j = 0; j < i; ) {
helper[j] = path[++j];
}
mutableTreeNodes[i] = ((ProjectTreeModel) editor().getProjectTreeView().getModel()).getNodeForObjectPath(helper);
}
return new TreePath(mutableTreeNodes);
}
use of org.apache.cayenne.configuration.DataChannelDescriptor in project cayenne by apache.
the class FindAction method jumpToResult.
/**
* Navigate to search result
* Used also in {@link org.apache.cayenne.modeler.graph.action.EntityDisplayAction}
*/
public static void jumpToResult(FindAction.SearchResultEntry searchResultEntry) {
EditorView editor = ((CayenneModelerFrame) Application.getInstance().getFrameController().getView()).getView();
DataChannelDescriptor domain = (DataChannelDescriptor) Application.getInstance().getProject().getRootNode();
if (searchResultEntry.getObject() instanceof Entity) {
jumpToEntityResult((Entity) searchResultEntry.getObject(), editor, domain);
} else if (searchResultEntry.getObject() instanceof QueryDescriptor) {
jumpToQueryResult((QueryDescriptor) searchResultEntry.getObject(), editor, domain);
} else if (searchResultEntry.getObject() instanceof Embeddable) {
jumpToEmbeddableResult((Embeddable) searchResultEntry.getObject(), editor, domain);
} else if (searchResultEntry.getObject() instanceof EmbeddableAttribute) {
jumpToEmbeddableAttributeResult((EmbeddableAttribute) searchResultEntry.getObject(), editor, domain);
} else if (searchResultEntry.getObject() instanceof Attribute || searchResultEntry.getObject() instanceof Relationship) {
jumpToAttributeResult(searchResultEntry, editor, domain);
}
}
use of org.apache.cayenne.configuration.DataChannelDescriptor in project cayenne by apache.
the class FindAction method search.
private List<SearchResultEntry> search(String searchStr) {
Pattern pattern = Pattern.compile(searchStr, Pattern.CASE_INSENSITIVE);
List<SearchResultEntry> result = new ArrayList<>();
for (DataMap dataMap : ((DataChannelDescriptor) getProjectController().getProject().getRootNode()).getDataMaps()) {
searchInQueryDescriptors(pattern, result, dataMap);
searchInEmbeddables(pattern, result, dataMap);
searchInDbEntities(pattern, result, dataMap);
searchInObjEntities(pattern, result, dataMap);
}
Collections.sort(result);
return result;
}
Aggregations