Search in sources :

Example 1 with ExitHandlerNode

use of com.twinsoft.convertigo.eclipse.views.references.model.ExitHandlerNode in project convertigo by convertigo.

the class ReferencesView method handleScreenClassSelection.

private void handleScreenClassSelection(Object firstElement) {
    ScreenClassTreeObject screenClassTreeObject = (ScreenClassTreeObject) firstElement;
    ScreenClass screenClass = screenClassTreeObject.getObject();
    String screenClassName = screenClassTreeObject.getName();
    // Get the referencing transactions
    Connector connector = screenClass.getConnector();
    List<Transaction> transactions = connector.getTransactionsList();
    RootNode root = new RootNode();
    ScreenClassNode screenClassFolder = new ScreenClassNode(root, screenClassName, screenClass);
    root.addChild(screenClassFolder);
    IsUsedByNode isUsedByNode = new IsUsedByNode(screenClassFolder, "Is used by");
    EntryHandlerNode entryFolder = new EntryHandlerNode(isUsedByNode, "Transaction entry handlers", null);
    ExitHandlerNode exitFolder = new ExitHandlerNode(isUsedByNode, "Transaction exit handlers", null);
    if (connector instanceof HtmlConnector) {
        for (Transaction transaction : transactions) {
            HtmlTransaction htmlTransaction = (HtmlTransaction) transaction;
            List<Statement> statements = htmlTransaction.getStatements();
            for (Statement statement : statements) {
                if (statement instanceof ScHandlerStatement) {
                    ScHandlerStatement scHandlerStatement = (ScHandlerStatement) statement;
                    if (scHandlerStatement.getNormalizedScreenClassName().equals(screenClassName)) {
                        if (scHandlerStatement.getName().endsWith("Entry")) {
                            entryFolder.addChild(new TransactionNode(entryFolder, transaction.getName(), scHandlerStatement));
                        } else {
                            exitFolder.addChild(new TransactionNode(exitFolder, transaction.getName(), scHandlerStatement));
                        }
                    }
                }
            }
        }
    } else if (connector instanceof JavelinConnector) {
        for (Transaction transaction : transactions) {
            JavelinTransaction javelinTransaction = (JavelinTransaction) transaction;
            if (javelinTransaction.handlers.indexOf("function on" + screenClassName + "Entry()") != -1) {
                entryFolder.addChild(new TransactionNode(entryFolder, transaction.getName(), transaction));
            }
            if (javelinTransaction.handlers.indexOf("function on" + screenClassName + "Exit()") != -1) {
                exitFolder.addChild(new TransactionNode(exitFolder, transaction.getName(), transaction));
            }
        }
    }
    if (entryFolder.hasChildren()) {
        isUsedByNode.addChild(entryFolder);
    }
    if (exitFolder.hasChildren()) {
        isUsedByNode.addChild(exitFolder);
    }
    if (!isUsedByNode.hasChildren()) {
        screenClassFolder.addChild(new InformationNode(screenClassFolder, "This screen class is not used in any transaction"));
    } else {
        screenClassFolder.addChild(isUsedByNode);
    }
    // Build the treeviewer model
    treeViewer.setInput(null);
    treeViewer.setInput(root);
    treeViewer.expandAll();
}
Also used : HtmlConnector(com.twinsoft.convertigo.beans.connectors.HtmlConnector) JavelinConnector(com.twinsoft.convertigo.beans.connectors.JavelinConnector) HttpConnector(com.twinsoft.convertigo.beans.connectors.HttpConnector) ProxyHttpConnector(com.twinsoft.convertigo.beans.connectors.ProxyHttpConnector) Connector(com.twinsoft.convertigo.beans.core.Connector) CicsConnector(com.twinsoft.convertigo.beans.connectors.CicsConnector) SiteClipperConnector(com.twinsoft.convertigo.beans.connectors.SiteClipperConnector) SqlConnector(com.twinsoft.convertigo.beans.connectors.SqlConnector) RootNode(com.twinsoft.convertigo.eclipse.views.references.model.RootNode) HtmlConnector(com.twinsoft.convertigo.beans.connectors.HtmlConnector) JavelinScreenClass(com.twinsoft.convertigo.beans.screenclasses.JavelinScreenClass) ScreenClass(com.twinsoft.convertigo.beans.core.ScreenClass) FunctionStatement(com.twinsoft.convertigo.beans.statements.FunctionStatement) Statement(com.twinsoft.convertigo.beans.core.Statement) ContinueWithSiteClipperStatement(com.twinsoft.convertigo.beans.statements.ContinueWithSiteClipperStatement) ScHandlerStatement(com.twinsoft.convertigo.beans.statements.ScHandlerStatement) HtmlTransaction(com.twinsoft.convertigo.beans.transactions.HtmlTransaction) EntryHandlerNode(com.twinsoft.convertigo.eclipse.views.references.model.EntryHandlerNode) ExitHandlerNode(com.twinsoft.convertigo.eclipse.views.references.model.ExitHandlerNode) JavelinTransaction(com.twinsoft.convertigo.beans.transactions.JavelinTransaction) JavelinConnector(com.twinsoft.convertigo.beans.connectors.JavelinConnector) ScreenClassNode(com.twinsoft.convertigo.eclipse.views.references.model.ScreenClassNode) Transaction(com.twinsoft.convertigo.beans.core.Transaction) HtmlTransaction(com.twinsoft.convertigo.beans.transactions.HtmlTransaction) JavelinTransaction(com.twinsoft.convertigo.beans.transactions.JavelinTransaction) ScreenClassTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.ScreenClassTreeObject) IsUsedByNode(com.twinsoft.convertigo.eclipse.views.references.model.IsUsedByNode) TransactionNode(com.twinsoft.convertigo.eclipse.views.references.model.TransactionNode) InformationNode(com.twinsoft.convertigo.eclipse.views.references.model.InformationNode) ScHandlerStatement(com.twinsoft.convertigo.beans.statements.ScHandlerStatement)

Aggregations

CicsConnector (com.twinsoft.convertigo.beans.connectors.CicsConnector)1 HtmlConnector (com.twinsoft.convertigo.beans.connectors.HtmlConnector)1 HttpConnector (com.twinsoft.convertigo.beans.connectors.HttpConnector)1 JavelinConnector (com.twinsoft.convertigo.beans.connectors.JavelinConnector)1 ProxyHttpConnector (com.twinsoft.convertigo.beans.connectors.ProxyHttpConnector)1 SiteClipperConnector (com.twinsoft.convertigo.beans.connectors.SiteClipperConnector)1 SqlConnector (com.twinsoft.convertigo.beans.connectors.SqlConnector)1 Connector (com.twinsoft.convertigo.beans.core.Connector)1 ScreenClass (com.twinsoft.convertigo.beans.core.ScreenClass)1 Statement (com.twinsoft.convertigo.beans.core.Statement)1 Transaction (com.twinsoft.convertigo.beans.core.Transaction)1 JavelinScreenClass (com.twinsoft.convertigo.beans.screenclasses.JavelinScreenClass)1 ContinueWithSiteClipperStatement (com.twinsoft.convertigo.beans.statements.ContinueWithSiteClipperStatement)1 FunctionStatement (com.twinsoft.convertigo.beans.statements.FunctionStatement)1 ScHandlerStatement (com.twinsoft.convertigo.beans.statements.ScHandlerStatement)1 HtmlTransaction (com.twinsoft.convertigo.beans.transactions.HtmlTransaction)1 JavelinTransaction (com.twinsoft.convertigo.beans.transactions.JavelinTransaction)1 ScreenClassTreeObject (com.twinsoft.convertigo.eclipse.views.projectexplorer.model.ScreenClassTreeObject)1 EntryHandlerNode (com.twinsoft.convertigo.eclipse.views.references.model.EntryHandlerNode)1 ExitHandlerNode (com.twinsoft.convertigo.eclipse.views.references.model.ExitHandlerNode)1