Search in sources :

Example 1 with ProjectView

use of com.twinsoft.convertigo.engine.studio.views.projectexplorer.model.ProjectView 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 ProjectView

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

the class SequenceExecuteSelectedAction method run2.

@Override
protected void run2() throws Exception {
    try {
        WrapDatabaseObject treeObject = (WrapDatabaseObject) studio.getFirstSelectedTreeObject();
        if (treeObject != null && treeObject.instanceOf(Sequence.class)) {
            SequenceView sequenceTreeObject = (SequenceView) treeObject;
            openEditors(/*explorerView, */
            sequenceTreeObject);
            Sequence sequence = sequenceTreeObject.getObject();
            ProjectView projectTreeObject = sequenceTreeObject.getProjectView();
            SequenceEditorWrap sequenceEditor = projectTreeObject.getSequenceEditor(sequence);
            if (sequenceEditor != null) {
                // getActivePage().activate(sequenceEditor);
                sequenceEditor.getDocument(sequence.getName(), null, isStubRequested());
            }
        }
    } catch (Exception e) {
        throw e;
    }
}
Also used : SequenceView(com.twinsoft.convertigo.engine.studio.views.projectexplorer.model.SequenceView) WrapDatabaseObject(com.twinsoft.convertigo.engine.studio.views.projectexplorer.model.WrapDatabaseObject) Sequence(com.twinsoft.convertigo.beans.core.Sequence) ProjectView(com.twinsoft.convertigo.engine.studio.views.projectexplorer.model.ProjectView) SequenceEditorWrap(com.twinsoft.convertigo.engine.studio.editors.sequences.SequenceEditorWrap) EngineException(com.twinsoft.convertigo.engine.EngineException)

Example 3 with ProjectView

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

the class TestCaseExecuteSelectedAction method run2.

@Override
protected void run2() throws Exception {
    try {
        WrapDatabaseObject treeObject = (WrapDatabaseObject) studio.getFirstSelectedTreeObject();
        if ((treeObject != null) && (treeObject.instanceOf(TestCase.class))) {
            TestCase testCase = (TestCase) treeObject.getObject();
            ProjectView projectTreeObject = treeObject.getProjectViewObject();
            RequestableObject requestable = (RequestableObject) testCase.getParent();
            if (requestable instanceof Transaction) {
                TransactionView transactionTreeObject = (TransactionView) treeObject.getParent();
                transactionTreeObject.getConnectorTreeObject().openConnectorEditor();
                Transaction transaction = (Transaction) testCase.getParent();
                Connector connector = (Connector) transaction.getParent();
                ConnectorEditorWrap connectorEditor = projectTreeObject.getConnectorEditor(connector);
                if (connectorEditor != null) {
                    // getActivePage().activate(connectorEditor);
                    connectorEditor.getDocument(transaction.getName(), testCase.getName(), false);
                }
            } else if (requestable instanceof Sequence) {
                SequenceView sequenceTreeObject = (SequenceView) treeObject.getParent();
                new SequenceExecuteSelectedAction(studio).openEditors(sequenceTreeObject);
                Sequence sequence = (Sequence) testCase.getParent();
                SequenceEditorWrap sequenceEditor = projectTreeObject.getSequenceEditor(sequence);
                if (sequenceEditor != null) {
                    // getActivePage().activate(sequenceEditor);
                    sequenceEditor.getDocument(sequence.getName(), testCase.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) RequestableObject(com.twinsoft.convertigo.beans.core.RequestableObject) Sequence(com.twinsoft.convertigo.beans.core.Sequence) Transaction(com.twinsoft.convertigo.beans.core.Transaction) TestCase(com.twinsoft.convertigo.beans.core.TestCase) SequenceView(com.twinsoft.convertigo.engine.studio.views.projectexplorer.model.SequenceView) TransactionView(com.twinsoft.convertigo.engine.studio.views.projectexplorer.model.TransactionView) WrapDatabaseObject(com.twinsoft.convertigo.engine.studio.views.projectexplorer.model.WrapDatabaseObject) ProjectView(com.twinsoft.convertigo.engine.studio.views.projectexplorer.model.ProjectView) SequenceEditorWrap(com.twinsoft.convertigo.engine.studio.editors.sequences.SequenceEditorWrap)

Example 4 with ProjectView

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

the class TransactionExecuteSelectedAction method run2.

@Override
public void run2() throws Exception {
    try {
        WrapDatabaseObject treeObject = (WrapDatabaseObject) studio.getFirstSelectedTreeObject();
        if ((treeObject != null) && (treeObject.instanceOf(Transaction.class))) {
            TransactionView transactionTreeObject = (TransactionView) treeObject;
            Transaction transaction = transactionTreeObject.getObject();
            transactionTreeObject.getConnectorTreeObject().openConnectorEditor();
            Connector connector = (Connector) transaction.getParent();
            ProjectView projectTreeObject = transactionTreeObject.getProjectView();
            ConnectorEditorWrap connectorEditor = projectTreeObject.getConnectorEditor(connector);
            if (connectorEditor != null) {
                // getActivePage().activate(connectorEditor);
                connectorEditor.getDocument(transaction.getName(), isStubRequested());
            }
        }
    } catch (Throwable e) {
        // ConvertigoPlugin.logException(e, "Unable to execute the selected transaction!");
        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) TransactionView(com.twinsoft.convertigo.engine.studio.views.projectexplorer.model.TransactionView) WrapDatabaseObject(com.twinsoft.convertigo.engine.studio.views.projectexplorer.model.WrapDatabaseObject) ProjectView(com.twinsoft.convertigo.engine.studio.views.projectexplorer.model.ProjectView)

Example 5 with ProjectView

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

the class DatabaseObjectDeleteAction method run2.

@Override
protected void run2() throws Exception {
    String qname = null;
    try {
        treeNodesToUpdate = new ArrayList<WrapDatabaseObject>();
        WrapDatabaseObject treeObject = null;
        WrapObject[] treeObjects = studio.getSelectedObjects().toArray(new WrapObject[0]);
        dboDoDelete = new HashMap<>(treeObjects.length);
        if (treeObjects != null) {
            MultipleDeletionDialog dialog = new MultipleDeletionDialog(studio, "Object Deletion", treeObjects.length > 1);
            for (int i = 0; i < treeObjects.length; ++i) {
                treeObject = (WrapDatabaseObject) treeObjects[i];
                String message = treeObject.instanceOf(Project.class) ? java.text.MessageFormat.format("Do you really want to delete the project \"{0}\" and all its sub-objects?", new Object[] { treeObject.getName() }) : java.text.MessageFormat.format("Do you really want to delete the object \"{0}\" and all its sub-objects?", new Object[] { treeObject.getName() });
                qname = ((DatabaseObject) treeObject.getObject()).getQName();
                if (!dialog.shouldBeDeleted(message)) {
                    dboDoDelete.put(qname, false);
                    continue;
                }
                dboDoDelete.put(qname, true);
                if (treeObject.instanceOf(Project.class)) {
                    ((ProjectView) treeObject).closeAllEditors();
                } else if (treeObject.instanceOf(Sequence.class)) {
                    ((ProjectView) ((SequenceView) treeObject).getParent()).closeSequenceEditors((Sequence) treeObject.getObject());
                } else if (treeObject.instanceOf(Connector.class)) {
                    ((ProjectView) ((ConnectorView) treeObject).getParent()).closeConnectorEditors((Connector) treeObject.getObject());
                } else if (treeObject.instanceOf(Step.class)) {
                // // We close the editor linked with the SimpleStep (=SequenceJsStep)
                // if (treeObject.getObject() instanceof SimpleStep) {
                // boolean find = false;
                // SimpleStep simpleStep = (SimpleStep) treeObject.getObject();
                // IWorkbenchPage page = this.getActivePage();
                // IEditorReference[] editors = page.getEditorReferences();
                // int _i = 0;
                // while (find != true && _i < editors.length) {
                // IEditorReference editor = editors[_i];
                // IEditorPart editorPart = page.findEditor(editor.getEditorInput());
                // if (editorPart != null && editorPart instanceof JscriptStepEditor) {
                // JscriptStepEditor jscriptEditor = (JscriptStepEditor) editorPart;
                // if (jscriptEditor.getSimpleStepLinked().equals(simpleStep)) {
                // find = true;
                // page.activate(editorPart);
                // page.closeEditor(editorPart, false);
                // }
                // }
                // ++_i;
                // }
                }
                delete(treeObject);
                if (treeObject.instanceOf(Project.class)) {
                // explorerView.removeProjectTreeObject(treeObject);
                } else {
                // // prevents treeObject and its childs to receive further TreeObjectEvents
                // if (treeObject instanceof TreeObjectListener)
                // explorerView.removeTreeObjectListener(treeObject);
                // treeObject.removeAllChildren();
                }
            // 
            // explorerView.fireTreeObjectRemoved(new TreeObjectEvent(treeObject));
            }
        }
        // Updating the tree and the properties panel
        Enumeration<WrapDatabaseObject> enumeration = Collections.enumeration(treeNodesToUpdate);
        WrapDatabaseObject parentTreeObject;
        while (enumeration.hasMoreElements()) {
            parentTreeObject = enumeration.nextElement();
            if (parentTreeObject != null) {
            // explorerView.reloadTreeObject(parentTreeObject);
            // explorerView.setSelectedTreeObject(parentTreeObject);
            }
        }
    // 
    // Refresh tree to show potential 'broken' steps
    // explorerView.refreshTree();
    } catch (Exception e) {
        throw e;
    }
}
Also used : WrapObject(com.twinsoft.convertigo.engine.studio.views.projectexplorer.model.WrapObject) MultipleDeletionDialog(com.twinsoft.convertigo.engine.studio.dialogs.MultipleDeletionDialog) Sequence(com.twinsoft.convertigo.beans.core.Sequence) ThenStep(com.twinsoft.convertigo.beans.steps.ThenStep) Step(com.twinsoft.convertigo.beans.core.Step) ElseStep(com.twinsoft.convertigo.beans.steps.ElseStep) ConvertigoException(com.twinsoft.convertigo.engine.ConvertigoException) IOException(java.io.IOException) EngineException(com.twinsoft.convertigo.engine.EngineException) Project(com.twinsoft.convertigo.beans.core.Project) SequenceView(com.twinsoft.convertigo.engine.studio.views.projectexplorer.model.SequenceView) WrapObject(com.twinsoft.convertigo.engine.studio.views.projectexplorer.model.WrapObject) DatabaseObject(com.twinsoft.convertigo.beans.core.DatabaseObject) WrapDatabaseObject(com.twinsoft.convertigo.engine.studio.views.projectexplorer.model.WrapDatabaseObject) WrapDatabaseObject(com.twinsoft.convertigo.engine.studio.views.projectexplorer.model.WrapDatabaseObject) ProjectView(com.twinsoft.convertigo.engine.studio.views.projectexplorer.model.ProjectView)

Aggregations

ProjectView (com.twinsoft.convertigo.engine.studio.views.projectexplorer.model.ProjectView)6 WrapDatabaseObject (com.twinsoft.convertigo.engine.studio.views.projectexplorer.model.WrapDatabaseObject)5 Connector (com.twinsoft.convertigo.beans.core.Connector)4 Sequence (com.twinsoft.convertigo.beans.core.Sequence)4 SequenceView (com.twinsoft.convertigo.engine.studio.views.projectexplorer.model.SequenceView)4 Transaction (com.twinsoft.convertigo.beans.core.Transaction)3 EngineException (com.twinsoft.convertigo.engine.EngineException)3 ConnectorEditorWrap (com.twinsoft.convertigo.engine.studio.editors.connectors.ConnectorEditorWrap)3 Project (com.twinsoft.convertigo.beans.core.Project)2 Step (com.twinsoft.convertigo.beans.core.Step)2 SequenceEditorWrap (com.twinsoft.convertigo.engine.studio.editors.sequences.SequenceEditorWrap)2 ConnectorView (com.twinsoft.convertigo.engine.studio.views.projectexplorer.model.ConnectorView)2 TransactionView (com.twinsoft.convertigo.engine.studio.views.projectexplorer.model.TransactionView)2 DatabaseObject (com.twinsoft.convertigo.beans.core.DatabaseObject)1 RequestableObject (com.twinsoft.convertigo.beans.core.RequestableObject)1 StepWithExpressions (com.twinsoft.convertigo.beans.core.StepWithExpressions)1 TestCase (com.twinsoft.convertigo.beans.core.TestCase)1 ElseStep (com.twinsoft.convertigo.beans.steps.ElseStep)1 SequenceStep (com.twinsoft.convertigo.beans.steps.SequenceStep)1 ThenStep (com.twinsoft.convertigo.beans.steps.ThenStep)1