use of org.apache.cayenne.modeler.editor.EditorView 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);
} else if (searchResultEntry.getObject() instanceof Procedure) {
jumpToProcedureResult((Procedure) searchResultEntry.getObject(), editor, domain);
} else if (searchResultEntry.getObject() instanceof ProcedureParameter) {
jumpToProcedureResult((ProcedureParameter) searchResultEntry.getObject(), editor, domain);
}
}
use of org.apache.cayenne.modeler.editor.EditorView in project cayenne by apache.
the class TextCompoundEdit method restoreSelections.
private void restoreSelections() {
EditorView editorView = ((CayenneModelerFrame) Application.getInstance().getFrameController().getView()).getView();
editorView.getProjectTreeView().getSelectionModel().setSelectionPath(treePath);
if (tabbedPane != null) {
tabbedPane.setSelectedIndex(selectedTabIndex);
if (tabbedPane instanceof SQLTemplateTabbedView) {
((SQLTemplateTabbedView) tabbedPane).getScriptsTab().setSelectedIndex(selectedItem);
}
}
}
use of org.apache.cayenne.modeler.editor.EditorView in project cayenne by apache.
the class ShowGraphEntityAction method showEntity.
void showEntity(Entity entity) {
// we're always in same domain
EditorView editor = ((CayenneModelerFrame) Application.getInstance().getFrameController().getView()).getView();
editor.getProjectTreeView().getSelectionModel().setSelectionPath(editor.getProjectTreeView().getSelectionPath().getParentPath().getParentPath());
DomainDisplayEvent event = new EntityDisplayEvent(editor.getProjectTreeView(), entity, entity.getDataMap(), (DataChannelDescriptor) getProjectController().getProject().getRootNode());
getProjectController().fireDomainDisplayEvent(event);
}
use of org.apache.cayenne.modeler.editor.EditorView in project cayenne by apache.
the class CayenneModelerController method projectOpenedAction.
/**
* Handles project opening control. Updates main frame, then delegates control to
* child controllers.
*/
public void projectOpenedAction(Project project) {
projectController.setProject(project);
editorView = new EditorView(projectController);
frame.setView(editorView);
projectController.projectOpened();
application.getActionManager().projectOpened();
// do status update AFTER the project is actually opened...
if (project.getConfigurationResource() == null) {
updateStatus("New project created...");
} else {
updateStatus("Project opened...");
try {
// update preferences
File file = new File(project.getConfigurationResource().getURL().toURI());
getLastDirectory().setDirectory(file);
frame.fireRecentFileListChanged();
} catch (URISyntaxException ignore) {
}
}
frame.setTitle(getProjectLocationString());
PROJECT_STATE_UTIL.fireLastState(projectController);
// for validation purposes combine load failures with post-load validation (not
// sure if that'll cause duplicate messages?).
List<ValidationFailure> allFailures = new ArrayList<>();
Collection<ValidationFailure> loadFailures = project.getConfigurationTree().getLoadFailures();
if (!loadFailures.isEmpty()) {
// mark project as unsaved
project.setModified(true);
projectController.setDirty(true);
allFailures.addAll(loadFailures);
}
ProjectValidator projectValidator = getApplication().getInjector().getInstance(ProjectValidator.class);
ValidationResult validationResult = projectValidator.validate(project.getRootNode());
allFailures.addAll(validationResult.getFailures());
if (!allFailures.isEmpty()) {
ValidatorDialog.showDialog(frame, validationResult.getFailures());
}
}
Aggregations