Search in sources :

Example 1 with EditorView

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);
    }
}
Also used : ProcedureParameter(org.apache.cayenne.map.ProcedureParameter) ObjEntity(org.apache.cayenne.map.ObjEntity) Entity(org.apache.cayenne.map.Entity) DetectedDbEntity(org.apache.cayenne.dbsync.model.DetectedDbEntity) DbEntity(org.apache.cayenne.map.DbEntity) EJBQLQueryDescriptor(org.apache.cayenne.map.EJBQLQueryDescriptor) SelectQueryDescriptor(org.apache.cayenne.map.SelectQueryDescriptor) QueryDescriptor(org.apache.cayenne.map.QueryDescriptor) ProcedureQueryDescriptor(org.apache.cayenne.map.ProcedureQueryDescriptor) DataChannelDescriptor(org.apache.cayenne.configuration.DataChannelDescriptor) DbAttribute(org.apache.cayenne.map.DbAttribute) ObjAttribute(org.apache.cayenne.map.ObjAttribute) Attribute(org.apache.cayenne.map.Attribute) EmbeddableAttribute(org.apache.cayenne.map.EmbeddableAttribute) Relationship(org.apache.cayenne.map.Relationship) DbRelationship(org.apache.cayenne.map.DbRelationship) ObjRelationship(org.apache.cayenne.map.ObjRelationship) Procedure(org.apache.cayenne.map.Procedure) EditorView(org.apache.cayenne.modeler.editor.EditorView) EmbeddableAttribute(org.apache.cayenne.map.EmbeddableAttribute) CayenneModelerFrame(org.apache.cayenne.modeler.CayenneModelerFrame) Embeddable(org.apache.cayenne.map.Embeddable)

Example 2 with EditorView

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);
        }
    }
}
Also used : SQLTemplateTabbedView(org.apache.cayenne.modeler.editor.SQLTemplateTabbedView) EditorView(org.apache.cayenne.modeler.editor.EditorView) CayenneModelerFrame(org.apache.cayenne.modeler.CayenneModelerFrame)

Example 3 with EditorView

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);
}
Also used : DomainDisplayEvent(org.apache.cayenne.modeler.event.DomainDisplayEvent) EntityDisplayEvent(org.apache.cayenne.modeler.event.EntityDisplayEvent) EditorView(org.apache.cayenne.modeler.editor.EditorView) CayenneModelerFrame(org.apache.cayenne.modeler.CayenneModelerFrame)

Example 4 with EditorView

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());
    }
}
Also used : ArrayList(java.util.ArrayList) ProjectValidator(org.apache.cayenne.project.validation.ProjectValidator) URISyntaxException(java.net.URISyntaxException) EditorView(org.apache.cayenne.modeler.editor.EditorView) ValidationResult(org.apache.cayenne.validation.ValidationResult) File(java.io.File) ValidationFailure(org.apache.cayenne.validation.ValidationFailure)

Aggregations

EditorView (org.apache.cayenne.modeler.editor.EditorView)4 CayenneModelerFrame (org.apache.cayenne.modeler.CayenneModelerFrame)3 File (java.io.File)1 URISyntaxException (java.net.URISyntaxException)1 ArrayList (java.util.ArrayList)1 DataChannelDescriptor (org.apache.cayenne.configuration.DataChannelDescriptor)1 DetectedDbEntity (org.apache.cayenne.dbsync.model.DetectedDbEntity)1 Attribute (org.apache.cayenne.map.Attribute)1 DbAttribute (org.apache.cayenne.map.DbAttribute)1 DbEntity (org.apache.cayenne.map.DbEntity)1 DbRelationship (org.apache.cayenne.map.DbRelationship)1 EJBQLQueryDescriptor (org.apache.cayenne.map.EJBQLQueryDescriptor)1 Embeddable (org.apache.cayenne.map.Embeddable)1 EmbeddableAttribute (org.apache.cayenne.map.EmbeddableAttribute)1 Entity (org.apache.cayenne.map.Entity)1 ObjAttribute (org.apache.cayenne.map.ObjAttribute)1 ObjEntity (org.apache.cayenne.map.ObjEntity)1 ObjRelationship (org.apache.cayenne.map.ObjRelationship)1 Procedure (org.apache.cayenne.map.Procedure)1 ProcedureParameter (org.apache.cayenne.map.ProcedureParameter)1