Goto() public static method

Switch to a document, can be already opended or not
public static Goto ( string document, int line = -1, int column = -1 ) : void
document string
line int
column int
return void
Beispiel #1
0
        /// <summary>
        /// Called when the user saves the current document (just before it saves itself)
        /// </summary>
        public static void OnNppFileBeforeSaved()
        {
            // check for block that are too long and display a warning
            if (Abl.IsCurrentFileFromAppBuilder && !CurrentFileObject.WarnedTooLong)
            {
                var warningMessage    = new StringBuilder();
                var explorerItemsList = ParserHandler.ParserVisitor.ParsedExplorerItemsList;

                if (explorerItemsList != null)
                {
                    foreach (var codeExplorerItem in explorerItemsList.Where(codeExplorerItem => codeExplorerItem.Flag.HasFlag(CodeExplorerFlag.IsTooLong)))
                    {
                        warningMessage.AppendLine("<div><img src='IsTooLong'><img src='" + codeExplorerItem.Branch + "' style='padding-right: 10px'><a href='" + codeExplorerItem.GoToLine + "'>" + codeExplorerItem.DisplayText + "</a></div>");
                    }
                    if (warningMessage.Length > 0)
                    {
                        warningMessage.Insert(0, "<h2>Friendly warning :</h2>It seems that your file can be opened in the appbuilder as a structured procedure, but i detected that one or several procedure/function blocks contains more than " + Config.Instance.GlobalMaxNbCharInBlock + " characters. A direct consequence is that you won't be able to open this file in the appbuilder, it will generate errors and it will be unreadable. Below is a list of incriminated blocks :<br><br>");
                        warningMessage.Append("<br><i>To prevent this, reduce the number of chararacters in the above blocks, deleting dead code and trimming spaces is a good place to start!</i>");
                        var curPath = CurrentFilePath;
                        UserCommunication.NotifyUnique("AppBuilderLimit", warningMessage.ToString(), MessageImg.MsgHighImportance, "File saved", "Appbuilder limitations", args => {
                            Npp.Goto(curPath, Int32.Parse(args.Link));
                            UserCommunication.CloseUniqueNotif("AppBuilderLimit");
                        }, 20);
                        CurrentFileObject.WarnedTooLong = true;
                    }
                }
            }

            // for debug purposes, check if the document can be parsed
            if (Config.IsDevelopper && ParserHandler.AblParser.ParserErrors.Count > 0)
            {
                UserCommunication.Notify("The parser found erros on this file:<br>" + ProCodeFormat.GetParserErrorDescription(), MessageImg.MsgInfo, "Parser message", "Errors found", 3);
            }
        }