Exemple #1
0
        public bool InList(baseSymbolType symbols)
        {
            if (symbols == null)
            {
                return(false);
            }
            return(InList(symbols.symbols));

            /*
             * for (int a = 0; a < symbols.symbols.Count; a++)
             * {
             *  if (symbols.symbols[a].lineNo == this.lineNo &&
             *          symbols.symbols[a].moduleName == this.moduleName &&
             *      symbols.symbols[a].Operation == this.Operation &&
             *      symbols.symbols[a].Type == this.Type)
             *  {
             *      return true;
             *  }
             * }
             * return false;
             * */
        }
Exemple #2
0
        public void setContextDialog(baseSymbolType type)
        {
            miFindCursor.Visible    = false;
            miFindForm.Visible      = false;
            miFindStatement.Visible = false;
            miFindVariable.Visible  = false;
            miFindWindow.Visible    = false;
            miFindFunction.Visible  = false;


            if (type is symbolCursor)
            {
                symbolCursor c = (symbolCursor)type;

                miFindCursor.Visible  = true;
                miCursorClose.Visible = c.hasClose;
                setSymbols(miCursorClose, c.symbols, "CLOSE");
                miCursorDeclare.Visible = c.hasDeclare;
                setSymbols(miCursorDeclare, c.symbols, "DECLARE");
                miCursorFetch.Visible = c.hasFetch;
                setSymbols(miCursorFetch, c.symbols, "FETCH");
                miCursorOpen.Visible = c.hasOpen;
                setSymbols(miCursorOpen, c.symbols, "OPEN");
            }

            if (type is symbolFunction)
            {
                symbolFunction f = (symbolFunction)type;
                miFindFunction.Visible   = true;
                miFunctionCalled.Visible = true;


                // Look in the calltree for all routes that this function can be called
                miFunctionCalled.Click -= new EventHandler(miFunctionCalled_Click);
                miFunctionCalled.Click += new EventHandler(miFunctionCalled_Click);

                // Just look for the immediate callers - dont worry about the calltree...
                miFunctionCall.Click -= new EventHandler(miFunctionCall_Click);
                miFunctionCall.Click += new EventHandler(miFunctionCall_Click);

                miFunctionDefine.Visible = f.hasDefinition;

                setSymbols(miFunctionDefine, f.symbols, "DEFINITION");
                setSymbols(miFunctionCall, f.symbols, "CALLS");
                if (miFunctionCall.DropDownItems.Count > 0)
                {
                    miFunctionCall.Visible = true;
                    miFunctionCall.Enabled = true;
                }
                else
                {
                    // SHould be visible - but for now .....
                    miFunctionCall.Enabled = false;
                }
            }

            if (type is symbolForm)
            {
                symbolForm f = (symbolForm)type;
                miFindForm.Visible  = true;
                miFormClose.Visible = f.hasClose;
                setSymbols(miFormClose, f.symbols, "CLOSE");
                miFormDisplay.Visible = f.hasDisplay;
                setSymbols(miFormDisplay, f.symbols, "DISPLAY");
                miFormOpen.Visible = f.hasOpen;
                setSymbols(miFormOpen, f.symbols, "OPEN");
            }

            if (type is symbolStatement)
            {
                symbolStatement s = (symbolStatement)type;

                miFindStatement.Visible    = true;
                miStatementDeclare.Visible = s.hasDeclare;
                setSymbols(miStatementDeclare, s.symbols, "DECLARE");
                miStatementExecute.Visible = s.hasExecute;
                setSymbols(miStatementExecute, s.symbols, "EXECUTE");
                miStatementPrepare.Visible = s.hasPrepare;
                setSymbols(miStatementPrepare, s.symbols, "PREPARE");
                miStatementSQL.Text = s.likelySQL;
            }

            if (type is symbolVariable)
            {
                symbolVariable s = (symbolVariable)type;
                miFindVariable.Visible   = true;
                miVariableAssign.Visible = s.hasAssign;
                setSymbols(miVariableAssign, s.symbols, "ASSIGN");
                miVariableDefinition.Visible = s.hasDefine;
                setSymbols(miVariableDefinition, s.symbols, "DEFINE");
                miVariableRead.Visible = s.hasRead;
                setSymbols(miVariableRead, s.symbols, "USE");

                miVariableValue.Click -= new EventHandler(miVariableValue_Click);
                miVariableValue.Click += new EventHandler(miVariableValue_Click);

                if (s.possibleValue == null)
                {
                    miVariableValue.Text        = "";
                    miVariableValue.ToolTipText = "No Values Detected";
                }
                else
                {
                    if (s.possibleValue.Length < 60)
                    {
                        miVariableValue.Text        = s.possibleValue;
                        miVariableValue.ToolTipText = "Possible Value";
                    }
                    else
                    {
                        miVariableValue.Text        = s.possibleValue.Substring(0, 60) + "...";
                        miVariableValue.ToolTipText = "Possible Value:" + s.possibleValue;
                    }
                }
            }

            if (type is symbolWindow)
            {
                symbolWindow s = (symbolWindow)type;
                miFindWindow.Visible = true;
                setSymbols(miWindowClose, s.symbols, "CLOSE");
                setSymbols(miWindowHide, s.symbols, "HIDE");
                setSymbols(miWindowMove, s.symbols, "MOVE");
                setSymbols(miWindowOpen, s.symbols, "OPEN");
                setSymbols(miWindowShow, s.symbols, "SHOW");
                miWindowClose.Visible = s.hasClose;
                miWindowHide.Visible  = s.hasHide;
                miWindowMove.Visible  = s.hasMove;
                miWindowOpen.Visible  = s.hasOpen;
                miWindowShow.Visible  = s.hasShow;
            }
        }