Search in sources :

Example 6 with ConnectorTreeObject

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

the class TransactionExecuteDefaultAction 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) {
                ProjectTreeObject projectTreeObject = treeObject.getProjectTreeObject();
                Connector connector = null;
                if (treeObject instanceof ConnectorTreeObject) {
                    ConnectorTreeObject connectorTreeObject = (ConnectorTreeObject) treeObject;
                    connectorTreeObject.openConnectorEditor();
                    connector = connectorTreeObject.getObject();
                } else {
                    connector = ((Project) projectTreeObject.getObject()).getDefaultConnector();
                    ConnectorTreeObject connectorTreeObject = (ConnectorTreeObject) explorerView.findTreeObjectByUserObject(connector);
                    if (connectorTreeObject != null)
                        connectorTreeObject.openConnectorEditor();
                }
                Transaction transaction = connector.getDefaultTransaction();
                ConnectorEditor connectorEditor = projectTreeObject.getConnectorEditor(connector);
                if (connectorEditor != null) {
                    getActivePage().activate(connectorEditor);
                    connectorEditor.getDocument(transaction.getName(), false);
                }
            }
        }
    } catch (Throwable e) {
        ConvertigoPlugin.logException(e, "Unable to execute the default transaction!");
    } finally {
        shell.setCursor(null);
        waitCursor.dispose();
    }
}
Also used : ConnectorTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.ConnectorTreeObject) 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) 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) ProjectTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.ProjectTreeObject) Cursor(org.eclipse.swt.graphics.Cursor) ConnectorEditor(com.twinsoft.convertigo.eclipse.editors.connector.ConnectorEditor) Display(org.eclipse.swt.widgets.Display)

Example 7 with ConnectorTreeObject

use of com.twinsoft.convertigo.eclipse.views.projectexplorer.model.ConnectorTreeObject 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 8 with ConnectorTreeObject

use of com.twinsoft.convertigo.eclipse.views.projectexplorer.model.ConnectorTreeObject 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 9 with ConnectorTreeObject

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

the class JavelinConnectorComposite method initJavelin.

protected void initJavelin(boolean bRecord) {
    String traceFilePath = null;
    if (bRecord) {
        Timestamp ts = new Timestamp(System.currentTimeMillis());
        traceFilePath = connector.getProject().getDirPath() + "/Traces/" + connector.getName() + "/";
        traceFilePath += ts.toString().substring(0, 10) + "_trace.etr";
        File file = new File(traceFilePath);
        if (!file.exists()) {
            try {
                file.createNewFile();
                ProjectExplorerView explorerView = ConvertigoPlugin.getDefault().getProjectExplorerView();
                if (explorerView != null) {
                    ConnectorTreeObject connectorTreeObject = (ConnectorTreeObject) explorerView.findTreeObjectByUserObject(connector);
                    for (TreeObject treeObject : connectorTreeObject.getChildren()) {
                        if (treeObject instanceof FolderTreeObject) {
                            if (treeObject.getName().equals("Traces")) {
                                TraceTreeObject traceTreeObject = new TraceTreeObject(explorerView.viewer, file);
                                ((FolderTreeObject) treeObject).addChild(traceTreeObject);
                                explorerView.refreshTreeObject(treeObject);
                                explorerView.setSelectedTreeObject(traceTreeObject);
                            }
                        }
                    }
                }
            } catch (IOException e) {
                ConvertigoPlugin.errorMessageBox("Unable to create the trace file");
            }
        }
    }
    // The following code allows to push relevant MDC values into Javelin's
    // threads
    JavelinObjectCreatorThread javelinObjectCreatorThread = new JavelinObjectCreatorThread(this, traceFilePath);
    javelinObjectCreatorThread.start();
    while (javelinObjectCreatorThread.isAlive()) {
        try {
            Thread.sleep(300);
        } catch (InterruptedException e) {
        }
    }
}
Also used : ConnectorTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.ConnectorTreeObject) ProjectExplorerView(com.twinsoft.convertigo.eclipse.views.projectexplorer.ProjectExplorerView) FolderTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.FolderTreeObject) TreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.TreeObject) DatabaseObjectTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.DatabaseObjectTreeObject) TraceTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.TraceTreeObject) ConnectorTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.ConnectorTreeObject) TraceTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.TraceTreeObject) IOException(java.io.IOException) FolderTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.FolderTreeObject) Timestamp(java.sql.Timestamp) File(java.io.File)

Example 10 with ConnectorTreeObject

use of com.twinsoft.convertigo.eclipse.views.projectexplorer.model.ConnectorTreeObject 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)

Aggregations

ConnectorTreeObject (com.twinsoft.convertigo.eclipse.views.projectexplorer.model.ConnectorTreeObject)15 TreeObject (com.twinsoft.convertigo.eclipse.views.projectexplorer.model.TreeObject)11 Connector (com.twinsoft.convertigo.beans.core.Connector)8 ProjectTreeObject (com.twinsoft.convertigo.eclipse.views.projectexplorer.model.ProjectTreeObject)8 ProjectExplorerView (com.twinsoft.convertigo.eclipse.views.projectexplorer.ProjectExplorerView)7 EngineException (com.twinsoft.convertigo.engine.EngineException)6 Sequence (com.twinsoft.convertigo.beans.core.Sequence)5 SequenceTreeObject (com.twinsoft.convertigo.eclipse.views.projectexplorer.model.SequenceTreeObject)5 TraceTreeObject (com.twinsoft.convertigo.eclipse.views.projectexplorer.model.TraceTreeObject)5 UnloadedProjectTreeObject (com.twinsoft.convertigo.eclipse.views.projectexplorer.model.UnloadedProjectTreeObject)5 Step (com.twinsoft.convertigo.beans.core.Step)4 DatabaseObjectTreeObject (com.twinsoft.convertigo.eclipse.views.projectexplorer.model.DatabaseObjectTreeObject)4 TransactionTreeObject (com.twinsoft.convertigo.eclipse.views.projectexplorer.model.TransactionTreeObject)4 Project (com.twinsoft.convertigo.beans.core.Project)3 CriteriaTreeObject (com.twinsoft.convertigo.eclipse.views.projectexplorer.model.CriteriaTreeObject)3 DesignDocumentFilterTreeObject (com.twinsoft.convertigo.eclipse.views.projectexplorer.model.DesignDocumentFilterTreeObject)3 DesignDocumentFunctionTreeObject (com.twinsoft.convertigo.eclipse.views.projectexplorer.model.DesignDocumentFunctionTreeObject)3 DesignDocumentTreeObject (com.twinsoft.convertigo.eclipse.views.projectexplorer.model.DesignDocumentTreeObject)3 DesignDocumentUpdateTreeObject (com.twinsoft.convertigo.eclipse.views.projectexplorer.model.DesignDocumentUpdateTreeObject)3 DesignDocumentValidateTreeObject (com.twinsoft.convertigo.eclipse.views.projectexplorer.model.DesignDocumentValidateTreeObject)3