Search in sources :

Example 1 with SequenceEditor

use of com.twinsoft.convertigo.eclipse.editors.sequence.SequenceEditor in project convertigo by convertigo.

the class SequenceExecuteSelectedFromStubAction 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 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);
                    sequenceEditor.getDocument(sequence.getName(), true);
                }
            }
        }
    } 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 2 with SequenceEditor

use of com.twinsoft.convertigo.eclipse.editors.sequence.SequenceEditor in project convertigo by convertigo.

the class CreateStubFromXMLAction method getXML.

public Document getXML(TreeObject treeObject) throws Exception {
    Document dom = XMLUtils.createDom("java");
    ProjectTreeObject projectTreeObject = treeObject.getProjectTreeObject();
    Object requestable = treeObject.getObject();
    if (requestable instanceof Transaction) {
        Transaction transaction = (Transaction) requestable;
        ConnectorEditor connectorEditor = projectTreeObject.getConnectorEditor((Connector) transaction.getParent());
        dom = connectorEditor.getLastGeneratedDocument();
    } else if (requestable instanceof Sequence) {
        SequenceEditor sequenceEditor = projectTreeObject.getSequenceEditor((Sequence) requestable);
        dom = sequenceEditor.getLastGeneratedDocument();
    }
    if (dom == null) {
        throw new NoSuchElementException();
    }
    return dom;
}
Also used : Transaction(com.twinsoft.convertigo.beans.core.Transaction) ProjectTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.ProjectTreeObject) DatabaseObject(com.twinsoft.convertigo.beans.core.DatabaseObject) TreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.TreeObject) ProjectTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.ProjectTreeObject) Sequence(com.twinsoft.convertigo.beans.core.Sequence) SequenceEditor(com.twinsoft.convertigo.eclipse.editors.sequence.SequenceEditor) Document(org.w3c.dom.Document) ConnectorEditor(com.twinsoft.convertigo.eclipse.editors.connector.ConnectorEditor) NoSuchElementException(java.util.NoSuchElementException)

Example 3 with SequenceEditor

use of com.twinsoft.convertigo.eclipse.editors.sequence.SequenceEditor 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 4 with SequenceEditor

use of com.twinsoft.convertigo.eclipse.editors.sequence.SequenceEditor 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 5 with SequenceEditor

use of com.twinsoft.convertigo.eclipse.editors.sequence.SequenceEditor in project convertigo by convertigo.

the class ProjectTreeObject method getSequenceEditor.

public SequenceEditor getSequenceEditor(Sequence sequence) {
    SequenceEditor sequenceEditor = null;
    IWorkbenchPage activePage = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
    if (activePage != null) {
        if (sequence != null) {
            IEditorReference[] editorRefs = activePage.getEditorReferences();
            for (int i = 0; i < editorRefs.length; i++) {
                IEditorReference editorRef = (IEditorReference) editorRefs[i];
                try {
                    IEditorInput editorInput = editorRef.getEditorInput();
                    if ((editorInput != null) && (editorInput instanceof SequenceEditorInput)) {
                        if (((SequenceEditorInput) editorInput).is(sequence)) {
                            sequenceEditor = (SequenceEditor) editorRef.getEditor(true);
                            break;
                        }
                    }
                } catch (PartInitException e) {
                    ConvertigoPlugin.logException(e, "Error while retrieving the sequence editor '" + editorRef.getName() + "'");
                }
            }
        }
    }
    return sequenceEditor;
}
Also used : IEditorReference(org.eclipse.ui.IEditorReference) IWorkbenchPage(org.eclipse.ui.IWorkbenchPage) SequenceEditor(com.twinsoft.convertigo.eclipse.editors.sequence.SequenceEditor) PartInitException(org.eclipse.ui.PartInitException) IEditorInput(org.eclipse.ui.IEditorInput) SequenceEditorInput(com.twinsoft.convertigo.eclipse.editors.sequence.SequenceEditorInput)

Aggregations

SequenceEditor (com.twinsoft.convertigo.eclipse.editors.sequence.SequenceEditor)6 Sequence (com.twinsoft.convertigo.beans.core.Sequence)4 ProjectExplorerView (com.twinsoft.convertigo.eclipse.views.projectexplorer.ProjectExplorerView)4 ProjectTreeObject (com.twinsoft.convertigo.eclipse.views.projectexplorer.model.ProjectTreeObject)4 TreeObject (com.twinsoft.convertigo.eclipse.views.projectexplorer.model.TreeObject)4 ConnectorEditor (com.twinsoft.convertigo.eclipse.editors.connector.ConnectorEditor)3 SequenceTreeObject (com.twinsoft.convertigo.eclipse.views.projectexplorer.model.SequenceTreeObject)3 Cursor (org.eclipse.swt.graphics.Cursor)3 Display (org.eclipse.swt.widgets.Display)3 Shell (org.eclipse.swt.widgets.Shell)3 Transaction (com.twinsoft.convertigo.beans.core.Transaction)2 ConnectorTreeObject (com.twinsoft.convertigo.eclipse.views.projectexplorer.model.ConnectorTreeObject)2 UnloadedProjectTreeObject (com.twinsoft.convertigo.eclipse.views.projectexplorer.model.UnloadedProjectTreeObject)2 IEditorInput (org.eclipse.ui.IEditorInput)2 Connector (com.twinsoft.convertigo.beans.core.Connector)1 DatabaseObject (com.twinsoft.convertigo.beans.core.DatabaseObject)1 RequestableObject (com.twinsoft.convertigo.beans.core.RequestableObject)1 TestCase (com.twinsoft.convertigo.beans.core.TestCase)1 JScriptEditorInput (com.twinsoft.convertigo.eclipse.editors.jscript.JScriptEditorInput)1 SequenceEditorInput (com.twinsoft.convertigo.eclipse.editors.sequence.SequenceEditorInput)1