Search in sources :

Example 11 with TransactionTreeObject

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

the class SetDefaultTransactionAction 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) {
            TransactionTreeObject transactionTreeObject = (TransactionTreeObject) explorerView.getFirstSelectedTreeObject();
            Transaction transaction = (Transaction) explorerView.getFirstSelectedDatabaseObject();
            Connector connector = (Connector) transaction.getParent();
            // Report from 4.5: fix #401
            TransactionTreeObject defaultTransactionTreeObject = null;
            Transaction defaultTransaction = connector.getDefaultTransaction();
            if (defaultTransaction != null) {
                defaultTransactionTreeObject = (TransactionTreeObject) explorerView.findTreeObjectByUserObject(defaultTransaction);
            }
            connector.setDefaultTransaction(transaction);
            if (defaultTransactionTreeObject != null) {
                defaultTransactionTreeObject.isDefault = false;
                defaultTransactionTreeObject.hasBeenModified(true);
            }
            transactionTreeObject.isDefault = true;
            transactionTreeObject.hasBeenModified(true);
            // Updating the tree
            explorerView.refreshTreeObject(transactionTreeObject.getParentDatabaseObjectTreeObject());
        }
    } catch (Throwable e) {
        ConvertigoPlugin.logException(e, "Unable to set transaction to default one!");
    } finally {
        shell.setCursor(null);
        waitCursor.dispose();
    }
}
Also used : TransactionTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.TransactionTreeObject) Connector(com.twinsoft.convertigo.beans.core.Connector) Shell(org.eclipse.swt.widgets.Shell) ProjectExplorerView(com.twinsoft.convertigo.eclipse.views.projectexplorer.ProjectExplorerView) Transaction(com.twinsoft.convertigo.beans.core.Transaction) Cursor(org.eclipse.swt.graphics.Cursor) Display(org.eclipse.swt.widgets.Display)

Example 12 with TransactionTreeObject

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

the class AbstractConnectorComposite method selectionChanged.

/**
 * Handles tree view selection
 */
public void selectionChanged(SelectionChangedEvent event) {
    if (event.getSource() instanceof ISelectionProvider) {
        IStructuredSelection selection = (IStructuredSelection) event.getSelection();
        TreeObject treeObject = (TreeObject) selection.getFirstElement();
        if (treeObject != null) {
            if (ILearnable.class.isAssignableFrom(this.getClass()) && (!HttpConnectorComposite.class.equals(this.getClass()))) {
                ConnectorTreeObject connectorTreeObject = treeObject.getConnectorTreeObject();
                if (connectorTreeObject != null) {
                    Connector connector = (Connector) connectorTreeObject.getObject();
                    if (connector.equals(this.connector)) {
                        if (treeObject instanceof TransactionTreeObject) {
                            if (!this.connector.isLearning())
                                toolBarSetEnable("Learn", true);
                        } else {
                            if (!this.connector.isLearning())
                                toolBarSetEnable("Learn", false);
                        }
                    } else {
                        if (!this.connector.isLearning())
                            toolBarSetEnable("Learn", false);
                    }
                }
            }
        }
    }
}
Also used : ConnectorTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.ConnectorTreeObject) Connector(com.twinsoft.convertigo.beans.core.Connector) TransactionTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.TransactionTreeObject) ISelectionProvider(org.eclipse.jface.viewers.ISelectionProvider) TreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.TreeObject) ConnectorTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.ConnectorTreeObject) TransactionTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.TransactionTreeObject) IStructuredSelection(org.eclipse.jface.viewers.IStructuredSelection)

Example 13 with TransactionTreeObject

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

the class AbstractStubAction 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;
                Sequence sequence = sequenceTreeObject.getObject();
                File stubDir = new File(sequence.getProject().getDirPath() + "/stubs");
                stubDir.mkdirs();
                File stubFile = new File(stubDir, sequence.getName() + ".xml");
                Document dom = getXML(treeObject);
                writeStub(dom, stubFile);
            } else if ((treeObject != null) && (treeObject instanceof TransactionTreeObject)) {
                TransactionTreeObject transactionTreeObject = (TransactionTreeObject) treeObject;
                Transaction transaction = transactionTreeObject.getObject();
                File stubDir = new File(transaction.getProject().getDirPath() + "/stubs");
                stubDir.mkdirs();
                File stubFile = new File(stubDir, transaction.getParent().getName() + "." + transaction.getName() + ".xml");
                Document dom = getXML(treeObject);
                writeStub(dom, stubFile);
            }
        }
    } catch (NoSuchElementException e) {
        ConvertigoPlugin.logException(e, "No previous XML file found");
    } catch (Throwable e) {
        ConvertigoPlugin.logException(e, "Unable to execute the selected sequence!");
    } finally {
        shell.setCursor(null);
        waitCursor.dispose();
    }
}
Also used : TransactionTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.TransactionTreeObject) ProjectExplorerView(com.twinsoft.convertigo.eclipse.views.projectexplorer.ProjectExplorerView) SequenceTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.SequenceTreeObject) Sequence(com.twinsoft.convertigo.beans.core.Sequence) Cursor(org.eclipse.swt.graphics.Cursor) Document(org.w3c.dom.Document) Shell(org.eclipse.swt.widgets.Shell) Transaction(com.twinsoft.convertigo.beans.core.Transaction) SequenceTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.SequenceTreeObject) TreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.TreeObject) TransactionTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.TransactionTreeObject) File(java.io.File) NoSuchElementException(java.util.NoSuchElementException) Display(org.eclipse.swt.widgets.Display)

Example 14 with TransactionTreeObject

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

the class HtmlConnectorDesignComposite method selectionChanged.

public void selectionChanged(SelectionChangedEvent event) {
    if (event.getSource() instanceof ISelectionProvider) {
        IStructuredSelection selection = (IStructuredSelection) event.getSelection();
        TreeObject treeObject = (TreeObject) selection.getFirstElement();
        if (treeObject != null) {
            ConnectorTreeObject connectorTreeObject = treeObject.getConnectorTreeObject();
            if (connectorTreeObject != null) {
                Connector connector = (Connector) connectorTreeObject.getObject();
                if (connector.equals(htmlConnector)) {
                    if (treeObject instanceof TransactionTreeObject) {
                        if (!htmlConnector.isLearning())
                            toolLearn.setEnabled(true);
                    } else {
                        if (!htmlConnector.isLearning())
                            toolLearn.setEnabled(false);
                    }
                } else {
                    if (!htmlConnector.isLearning())
                        toolLearn.setEnabled(false);
                }
            }
        }
    }
}
Also used : ConnectorTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.ConnectorTreeObject) HtmlConnector(com.twinsoft.convertigo.beans.connectors.HtmlConnector) HttpConnector(com.twinsoft.convertigo.beans.connectors.HttpConnector) Connector(com.twinsoft.convertigo.beans.core.Connector) TransactionTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.TransactionTreeObject) ISelectionProvider(org.eclipse.jface.viewers.ISelectionProvider) TransactionTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.TransactionTreeObject) TreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.TreeObject) ConnectorTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.ConnectorTreeObject) IStructuredSelection(org.eclipse.jface.viewers.IStructuredSelection)

Example 15 with TransactionTreeObject

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

the class SetDefaultTransactionAction method selectionChanged.

public void selectionChanged(IAction action, ISelection selection) {
    super.selectionChanged(action, selection);
    IStructuredSelection structuredSelection = (IStructuredSelection) selection;
    TreeObject treeObject = (TreeObject) structuredSelection.getFirstElement();
    if (treeObject instanceof TransactionTreeObject) {
        DatabaseObject dbo = (DatabaseObject) treeObject.getObject();
        ActionModel actionModel = DatabaseObjectsAction.selectionChanged(getClass().getName(), dbo);
        action.setChecked(actionModel.isChecked);
    }
}
Also used : TransactionTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.TransactionTreeObject) TreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.TreeObject) TransactionTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.TransactionTreeObject) DatabaseObject(com.twinsoft.convertigo.beans.core.DatabaseObject) IStructuredSelection(org.eclipse.jface.viewers.IStructuredSelection) ActionModel(com.twinsoft.convertigo.engine.studio.ActionModel)

Aggregations

TransactionTreeObject (com.twinsoft.convertigo.eclipse.views.projectexplorer.model.TransactionTreeObject)17 TreeObject (com.twinsoft.convertigo.eclipse.views.projectexplorer.model.TreeObject)15 Connector (com.twinsoft.convertigo.beans.core.Connector)9 Transaction (com.twinsoft.convertigo.beans.core.Transaction)9 ProjectExplorerView (com.twinsoft.convertigo.eclipse.views.projectexplorer.ProjectExplorerView)9 Shell (org.eclipse.swt.widgets.Shell)9 Cursor (org.eclipse.swt.graphics.Cursor)8 Display (org.eclipse.swt.widgets.Display)8 IStructuredSelection (org.eclipse.jface.viewers.IStructuredSelection)7 DatabaseObject (com.twinsoft.convertigo.beans.core.DatabaseObject)6 ProjectTreeObject (com.twinsoft.convertigo.eclipse.views.projectexplorer.model.ProjectTreeObject)6 ConnectorTreeObject (com.twinsoft.convertigo.eclipse.views.projectexplorer.model.ConnectorTreeObject)5 IEditableTreeObject (com.twinsoft.convertigo.eclipse.views.projectexplorer.model.IEditableTreeObject)5 ObjectsFolderTreeObject (com.twinsoft.convertigo.eclipse.views.projectexplorer.model.ObjectsFolderTreeObject)5 SequenceTreeObject (com.twinsoft.convertigo.eclipse.views.projectexplorer.model.SequenceTreeObject)5 Sequence (com.twinsoft.convertigo.beans.core.Sequence)4 TestCaseTreeObject (com.twinsoft.convertigo.eclipse.views.projectexplorer.model.TestCaseTreeObject)4 EngineException (com.twinsoft.convertigo.engine.EngineException)4 Statement (com.twinsoft.convertigo.beans.core.Statement)3 ConnectorEditor (com.twinsoft.convertigo.eclipse.editors.connector.ConnectorEditor)3