Search in sources :

Example 6 with SequenceTreeObject

use of com.twinsoft.convertigo.eclipse.views.projectexplorer.model.SequenceTreeObject in project convertigo by convertigo.

the class TestCaseExecuteSelectedAction method run.

public void run() {
    Display display = Display.getDefault();
    Cursor waitCursor = new Cursor(display, SWT.CURSOR_WAIT);
    Shell shell = getParentShell();
    shell.setCursor(waitCursor);
    try {
        ProjectExplorerView explorerView = getProjectExplorerView();
        if (explorerView != null) {
            TreeObject treeObject = explorerView.getFirstSelectedTreeObject();
            if ((treeObject != null) && (treeObject instanceof TestCaseTreeObject)) {
                TestCase testCase = (TestCase) treeObject.getObject();
                ProjectTreeObject projectTreeObject = treeObject.getProjectTreeObject();
                RequestableObject requestable = (RequestableObject) testCase.getParent();
                if (requestable instanceof Transaction) {
                    TransactionTreeObject transactionTreeObject = (TransactionTreeObject) treeObject.getParent().getParent();
                    transactionTreeObject.getConnectorTreeObject().openConnectorEditor();
                    Transaction transaction = (Transaction) testCase.getParent();
                    Connector connector = (Connector) transaction.getParent();
                    ConnectorEditor connectorEditor = projectTreeObject.getConnectorEditor(connector);
                    if (connectorEditor != null) {
                        getActivePage().activate(connectorEditor);
                        connectorEditor.getDocument(transaction.getName(), testCase.getName(), false);
                    }
                }
                if (requestable instanceof Sequence) {
                    SequenceTreeObject sequenceTreeObject = (SequenceTreeObject) treeObject.getParent().getParent();
                    new SequenceExecuteSelectedAction().openEditors(explorerView, sequenceTreeObject);
                    Sequence sequence = (Sequence) testCase.getParent();
                    SequenceEditor sequenceEditor = projectTreeObject.getSequenceEditor(sequence);
                    if (sequenceEditor != null) {
                        getActivePage().activate(sequenceEditor);
                        sequenceEditor.getDocument(sequence.getName(), testCase.getName(), false);
                    }
                }
            }
        }
    } catch (Throwable e) {
        ConvertigoPlugin.logException(e, "Unable to execute the selected test case!");
    } finally {
        shell.setCursor(null);
        waitCursor.dispose();
    }
}
Also used : TransactionTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.TransactionTreeObject) Connector(com.twinsoft.convertigo.beans.core.Connector) ProjectExplorerView(com.twinsoft.convertigo.eclipse.views.projectexplorer.ProjectExplorerView) RequestableObject(com.twinsoft.convertigo.beans.core.RequestableObject) SequenceTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.SequenceTreeObject) Sequence(com.twinsoft.convertigo.beans.core.Sequence) SequenceEditor(com.twinsoft.convertigo.eclipse.editors.sequence.SequenceEditor) Cursor(org.eclipse.swt.graphics.Cursor) ConnectorEditor(com.twinsoft.convertigo.eclipse.editors.connector.ConnectorEditor) TestCaseTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.TestCaseTreeObject) Shell(org.eclipse.swt.widgets.Shell) Transaction(com.twinsoft.convertigo.beans.core.Transaction) TestCase(com.twinsoft.convertigo.beans.core.TestCase) TestCaseTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.TestCaseTreeObject) SequenceTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.SequenceTreeObject) TreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.TreeObject) ProjectTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.ProjectTreeObject) TransactionTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.TransactionTreeObject) ProjectTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.ProjectTreeObject) Display(org.eclipse.swt.widgets.Display)

Example 7 with SequenceTreeObject

use of com.twinsoft.convertigo.eclipse.views.projectexplorer.model.SequenceTreeObject in project convertigo by convertigo.

the class StepExportVariablesToSequenceAction method run.

public void run() {
    Display display = Display.getDefault();
    Cursor waitCursor = new Cursor(display, SWT.CURSOR_WAIT);
    Shell shell = getParentShell();
    shell.setCursor(waitCursor);
    try {
        ProjectExplorerView explorerView = getProjectExplorerView();
        if (explorerView != null) {
            TreeObject treeObject = explorerView.getFirstSelectedTreeObject();
            Object databaseObject = treeObject.getObject();
            if ((databaseObject != null) && (databaseObject instanceof RequestableStep)) {
                RequestableStep requestableStep = (RequestableStep) databaseObject;
                requestableStep.exportVariableDefinition();
                Sequence sequence = requestableStep.getSequence();
                if (sequence.hasChanged) {
                    SequenceTreeObject sequenceTreeObject = (SequenceTreeObject) explorerView.findTreeObjectByUserObject(sequence);
                    explorerView.reloadTreeObject(sequenceTreeObject);
                    explorerView.setSelectedTreeObject(sequenceTreeObject);
                    StructuredSelection structuredSelection = new StructuredSelection(sequenceTreeObject);
                    ConvertigoPlugin.getDefault().getPropertiesView().selectionChanged((IWorkbenchPart) explorerView, structuredSelection);
                }
            }
        }
    } catch (Throwable e) {
        ConvertigoPlugin.logException(e, "Unable to export step variables to main sequence!");
    } finally {
        shell.setCursor(null);
        waitCursor.dispose();
    }
}
Also used : Shell(org.eclipse.swt.widgets.Shell) ProjectExplorerView(com.twinsoft.convertigo.eclipse.views.projectexplorer.ProjectExplorerView) SequenceTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.SequenceTreeObject) RequestableStep(com.twinsoft.convertigo.beans.core.RequestableStep) StructuredSelection(org.eclipse.jface.viewers.StructuredSelection) SequenceTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.SequenceTreeObject) TreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.TreeObject) SequenceTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.SequenceTreeObject) TreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.TreeObject) Sequence(com.twinsoft.convertigo.beans.core.Sequence) Cursor(org.eclipse.swt.graphics.Cursor) Display(org.eclipse.swt.widgets.Display)

Example 8 with SequenceTreeObject

use of com.twinsoft.convertigo.eclipse.views.projectexplorer.model.SequenceTreeObject 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);
                    Sequence subSequence = projectTreeObject.getObject().getSequenceByName(sequenceStep.getSequenceName());
                    SequenceTreeObject subSequenceTreeObject = (SequenceTreeObject) explorerView.findTreeObjectByUserObject(subSequence);
                    // recurse on sequence
                    openEditors(explorerView, subSequenceTreeObject, alreadyOpened);
                } catch (EngineException e) {
                    e.printStackTrace();
                }
            } else if (step instanceof TransactionStep) {
                TransactionStep transactionStep = (TransactionStep) step;
                String projectName = transactionStep.getProjectName();
                if (!step.getSequence().getProject().getName().equals(projectName))
                    // load project if necessary
                    loadProject(explorerView, projectName);
                try {
                    ProjectTreeObject projectTreeObject = (ProjectTreeObject) explorerView.getProjectRootObject(projectName);
                    Connector connector = projectTreeObject.getObject().getConnectorByName(transactionStep.getConnectorName());
                    ConnectorTreeObject connectorTreeObject = (ConnectorTreeObject) explorerView.findTreeObjectByUserObject(connector);
                    // open connector editor
                    connectorTreeObject.openConnectorEditor();
                } catch (EngineException e) {
                    e.printStackTrace();
                }
            } else if (step instanceof StepWithExpressions) {
                openEditors(explorerView, ((StepWithExpressions) step).getSteps(), alreadyOpened);
            }
        }
    }
}
Also used : TransactionStep(com.twinsoft.convertigo.beans.steps.TransactionStep) ConnectorTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.ConnectorTreeObject) Connector(com.twinsoft.convertigo.beans.core.Connector) SequenceStep(com.twinsoft.convertigo.beans.steps.SequenceStep) SequenceTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.SequenceTreeObject) EngineException(com.twinsoft.convertigo.engine.EngineException) StepWithExpressions(com.twinsoft.convertigo.beans.core.StepWithExpressions) UnloadedProjectTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.UnloadedProjectTreeObject) ProjectTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.ProjectTreeObject) 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)

Example 9 with SequenceTreeObject

use of com.twinsoft.convertigo.eclipse.views.projectexplorer.model.SequenceTreeObject in project convertigo by convertigo.

the class SequenceExecuteSelectedAction method run.

@Override
public void run() {
    Display display = Display.getDefault();
    Cursor waitCursor = new Cursor(display, SWT.CURSOR_WAIT);
    Shell shell = getParentShell();
    shell.setCursor(waitCursor);
    try {
        ProjectExplorerView explorerView = getProjectExplorerView();
        if (explorerView != null) {
            TreeObject treeObject = explorerView.getFirstSelectedTreeObject();
            if ((treeObject != null) && (treeObject instanceof SequenceTreeObject)) {
                SequenceTreeObject sequenceTreeObject = (SequenceTreeObject) treeObject;
                openEditors(explorerView, sequenceTreeObject);
                Sequence sequence = sequenceTreeObject.getObject();
                ProjectTreeObject projectTreeObject = sequenceTreeObject.getProjectTreeObject();
                SequenceEditor sequenceEditor = projectTreeObject.getSequenceEditor(sequence);
                if (sequenceEditor != null) {
                    getActivePage().activate(sequenceEditor);
                    boolean fromStub = action.getId().contains("FromStub");
                    sequenceEditor.getSequenceEditorPart().getDocument(sequence.getName(), null, fromStub);
                }
            }
        }
    } catch (Throwable e) {
        ConvertigoPlugin.logException(e, "Unable to execute the selected sequence!");
    } finally {
        shell.setCursor(null);
        waitCursor.dispose();
    }
}
Also used : Shell(org.eclipse.swt.widgets.Shell) ProjectExplorerView(com.twinsoft.convertigo.eclipse.views.projectexplorer.ProjectExplorerView) SequenceTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.SequenceTreeObject) UnloadedProjectTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.UnloadedProjectTreeObject) SequenceTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.SequenceTreeObject) TreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.TreeObject) ConnectorTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.ConnectorTreeObject) ProjectTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.ProjectTreeObject) UnloadedProjectTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.UnloadedProjectTreeObject) ProjectTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.ProjectTreeObject) Sequence(com.twinsoft.convertigo.beans.core.Sequence) SequenceEditor(com.twinsoft.convertigo.eclipse.editors.sequence.SequenceEditor) Cursor(org.eclipse.swt.graphics.Cursor) Display(org.eclipse.swt.widgets.Display)

Example 10 with SequenceTreeObject

use of com.twinsoft.convertigo.eclipse.views.projectexplorer.model.SequenceTreeObject in project convertigo by convertigo.

the class SequenceExecuteSelectedAction method openEditors.

private void openEditors(ProjectExplorerView explorerView, TreeObject treeObject, Set<SequenceStep> alreadyOpened) {
    if (treeObject instanceof SequenceTreeObject) {
        SequenceTreeObject sequenceTreeObject = (SequenceTreeObject) treeObject;
        openEditors(explorerView, sequenceTreeObject.getObject().getSteps(), alreadyOpened);
        sequenceTreeObject.openSequenceEditor();
    }
}
Also used : SequenceTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.SequenceTreeObject)

Aggregations

SequenceTreeObject (com.twinsoft.convertigo.eclipse.views.projectexplorer.model.SequenceTreeObject)17 Sequence (com.twinsoft.convertigo.beans.core.Sequence)13 ProjectExplorerView (com.twinsoft.convertigo.eclipse.views.projectexplorer.ProjectExplorerView)10 TreeObject (com.twinsoft.convertigo.eclipse.views.projectexplorer.model.TreeObject)10 Shell (org.eclipse.swt.widgets.Shell)10 ProjectTreeObject (com.twinsoft.convertigo.eclipse.views.projectexplorer.model.ProjectTreeObject)9 Cursor (org.eclipse.swt.graphics.Cursor)9 Display (org.eclipse.swt.widgets.Display)9 ConnectorTreeObject (com.twinsoft.convertigo.eclipse.views.projectexplorer.model.ConnectorTreeObject)8 UnloadedProjectTreeObject (com.twinsoft.convertigo.eclipse.views.projectexplorer.model.UnloadedProjectTreeObject)7 Step (com.twinsoft.convertigo.beans.core.Step)6 DatabaseObjectTreeObject (com.twinsoft.convertigo.eclipse.views.projectexplorer.model.DatabaseObjectTreeObject)6 TransactionTreeObject (com.twinsoft.convertigo.eclipse.views.projectexplorer.model.TransactionTreeObject)5 Connector (com.twinsoft.convertigo.beans.core.Connector)4 DatabaseObject (com.twinsoft.convertigo.beans.core.DatabaseObject)4 StepWithExpressions (com.twinsoft.convertigo.beans.core.StepWithExpressions)4 TestCaseTreeObject (com.twinsoft.convertigo.eclipse.views.projectexplorer.model.TestCaseTreeObject)4 EngineException (com.twinsoft.convertigo.engine.EngineException)4 SequenceEditor (com.twinsoft.convertigo.eclipse.editors.sequence.SequenceEditor)3 CriteriaTreeObject (com.twinsoft.convertigo.eclipse.views.projectexplorer.model.CriteriaTreeObject)3