Search in sources :

Example 1 with ConnectorView

use of com.twinsoft.convertigo.engine.studio.views.projectexplorer.model.ConnectorView in project convertigo by convertigo.

the class SequenceExecuteSelectedAction method openEditors.

private void openEditors(/*ProjectExplorerView explorerView, */
List<Step> steps, Set<SequenceStep> alreadyOpened) {
    for (Step step : steps) {
        if (step.isEnabled()) {
            if (step instanceof SequenceStep) {
                SequenceStep sequenceStep = (SequenceStep) step;
                String projectName = sequenceStep.getProjectName();
                // load project if necessary
                if (!step.getSequence().getProject().getName().equals(projectName)) {
                // loadProject(explorerView, projectName);
                }
                if (alreadyOpened.contains(sequenceStep)) {
                    // avoid sequence recursion
                    return;
                }
                alreadyOpened.add(sequenceStep);
                try {
                    // ProjectTreeObject projectTreeObject = (ProjectTreeObject)explorerView.getProjectRootObject(projectName);
                    Project p = step.getProject();
                    Sequence subSequence = p.getSequenceByName(sequenceStep.getSequenceName());
                    SequenceView subSequenceTreeObject = (SequenceView) Studio.getViewFromDbo(subSequence, studio);
                    // recurse on sequence
                    openEditors(/*explorerView, */
                    subSequenceTreeObject, alreadyOpened);
                } catch (EngineException e) {
                }
            } else if (step instanceof TransactionStep) {
                TransactionStep transactionStep = (TransactionStep) step;
                String projectName = transactionStep.getProjectName();
                if (!step.getSequence().getProject().getName().equals(projectName)) {
                // loadProject(explorerView, projectName); // load project if necessary
                }
                try {
                    // ProjectTreeObject projectTreeObject = (ProjectTreeObject)explorerView.getProjectRootObject(projectName);
                    Project project = Engine.theApp.databaseObjectsManager.getProjectByName(projectName);
                    ProjectView projectTreeObject = new ProjectView(project, studio);
                    Connector connector = projectTreeObject.getObject().getConnectorByName(transactionStep.getConnectorName());
                    ConnectorView connectorTreeObject = new ConnectorView(connector, studio);
                    // open connector editor
                    connectorTreeObject.openConnectorEditor();
                } catch (EngineException e) {
                }
            } else if (step instanceof StepWithExpressions) {
                openEditors(/*explorerView, */
                ((StepWithExpressions) step).getSteps(), alreadyOpened);
            }
        }
    }
}
Also used : TransactionStep(com.twinsoft.convertigo.beans.steps.TransactionStep) Project(com.twinsoft.convertigo.beans.core.Project) Connector(com.twinsoft.convertigo.beans.core.Connector) SequenceStep(com.twinsoft.convertigo.beans.steps.SequenceStep) SequenceView(com.twinsoft.convertigo.engine.studio.views.projectexplorer.model.SequenceView) ConnectorView(com.twinsoft.convertigo.engine.studio.views.projectexplorer.model.ConnectorView) EngineException(com.twinsoft.convertigo.engine.EngineException) StepWithExpressions(com.twinsoft.convertigo.beans.core.StepWithExpressions) Step(com.twinsoft.convertigo.beans.core.Step) SequenceStep(com.twinsoft.convertigo.beans.steps.SequenceStep) TransactionStep(com.twinsoft.convertigo.beans.steps.TransactionStep) Sequence(com.twinsoft.convertigo.beans.core.Sequence) ProjectView(com.twinsoft.convertigo.engine.studio.views.projectexplorer.model.ProjectView)

Example 2 with ConnectorView

use of com.twinsoft.convertigo.engine.studio.views.projectexplorer.model.ConnectorView in project convertigo by convertigo.

the class LaunchConnectorEditorAction method run2.

@Override
protected void run2() throws Exception {
    try {
        WrapDatabaseObject treeObject = (WrapDatabaseObject) studio.getFirstSelectedTreeObject();
        ((ConnectorView) treeObject).launchEditor();
    } catch (Exception e) {
        throw e;
    }
}
Also used : ConnectorView(com.twinsoft.convertigo.engine.studio.views.projectexplorer.model.ConnectorView) WrapDatabaseObject(com.twinsoft.convertigo.engine.studio.views.projectexplorer.model.WrapDatabaseObject)

Example 3 with ConnectorView

use of com.twinsoft.convertigo.engine.studio.views.projectexplorer.model.ConnectorView in project convertigo by convertigo.

the class TransactionExecuteDefaultAction method run2.

@Override
protected void run2() throws Exception {
    try {
        WrapDatabaseObject treeObject = (WrapDatabaseObject) studio.getFirstSelectedTreeObject();
        if (treeObject != null) {
            ProjectView projectTreeObject = treeObject.getProjectViewObject();
            Connector connector = null;
            if (treeObject.instanceOf(Connector.class)) {
                ConnectorView connectorTreeObject = (ConnectorView) treeObject;
                connectorTreeObject.openConnectorEditor();
                connector = connectorTreeObject.getObject();
            } else {
                connector = ((Project) projectTreeObject.getObject()).getDefaultConnector();
                ConnectorView connectorTreeObject = (ConnectorView) Studio.getViewFromDbo(connector, studio);
                if (connectorTreeObject != null) {
                    connectorTreeObject.openConnectorEditor();
                }
            }
            Transaction transaction = connector.getDefaultTransaction();
            ConnectorEditorWrap connectorEditor = projectTreeObject.getConnectorEditor(connector);
            if (connectorEditor != null) {
                // getActivePage().activate(connectorEditor);
                connectorEditor.getDocument(transaction.getName(), false);
            }
        }
    } catch (Exception e) {
        throw e;
    }
}
Also used : Connector(com.twinsoft.convertigo.beans.core.Connector) ConnectorEditorWrap(com.twinsoft.convertigo.engine.studio.editors.connectors.ConnectorEditorWrap) Transaction(com.twinsoft.convertigo.beans.core.Transaction) ConnectorView(com.twinsoft.convertigo.engine.studio.views.projectexplorer.model.ConnectorView) WrapDatabaseObject(com.twinsoft.convertigo.engine.studio.views.projectexplorer.model.WrapDatabaseObject) ProjectView(com.twinsoft.convertigo.engine.studio.views.projectexplorer.model.ProjectView)

Aggregations

ConnectorView (com.twinsoft.convertigo.engine.studio.views.projectexplorer.model.ConnectorView)3 Connector (com.twinsoft.convertigo.beans.core.Connector)2 ProjectView (com.twinsoft.convertigo.engine.studio.views.projectexplorer.model.ProjectView)2 WrapDatabaseObject (com.twinsoft.convertigo.engine.studio.views.projectexplorer.model.WrapDatabaseObject)2 Project (com.twinsoft.convertigo.beans.core.Project)1 Sequence (com.twinsoft.convertigo.beans.core.Sequence)1 Step (com.twinsoft.convertigo.beans.core.Step)1 StepWithExpressions (com.twinsoft.convertigo.beans.core.StepWithExpressions)1 Transaction (com.twinsoft.convertigo.beans.core.Transaction)1 SequenceStep (com.twinsoft.convertigo.beans.steps.SequenceStep)1 TransactionStep (com.twinsoft.convertigo.beans.steps.TransactionStep)1 EngineException (com.twinsoft.convertigo.engine.EngineException)1 ConnectorEditorWrap (com.twinsoft.convertigo.engine.studio.editors.connectors.ConnectorEditorWrap)1 SequenceView (com.twinsoft.convertigo.engine.studio.views.projectexplorer.model.SequenceView)1