private void DisplayResult(ParseResult result)
        {
            if (result.Status != ParseResult.StatusCode.Found)
            {
                var content = new ParseMessageContent();

                switch (result.Status)
                {
                case ParseResult.StatusCode.InvalidInput:
                    content.Message = "Parser had Invalid Input.";
                    break;

                case ParseResult.StatusCode.ParseFailed:
                    content.Message = "Errors found while parsing.\nUpdate the Extension's options as needed for a succesful compilation.\nCheck the 'Struct Layout' output pane for more information.";
                    break;

                case ParseResult.StatusCode.NotFound:
                    content.Message = "No structure found at the given position.\nTry performing the query from a structure definition or initialization.";
                    break;
                }

                content.Log         = result.ParserLog;
                content.ShowOptions = result.Status == ParseResult.StatusCode.ParseFailed;

                CheckForSpecialResults(content);

                ParseMessageWindow.Display(content);
            }
        }
 public ParseMessageWindow(ParseMessageContent content)
 {
     Title = "Struct Layout";
     WindowStartupLocation = WindowStartupLocation.CenterScreen;
     SizeToContent         = SizeToContent.WidthAndHeight;
     ResizeMode            = ResizeMode.NoResize;
     this.Content          = new ParseMessageControl(this, content);
 }
        public ParseMessageControl(Window parentWindow, ParseMessageContent msgContent)
        {
            InitializeComponent();

            ParentWindow = parentWindow;
            MsgContent   = msgContent;
            ShowMessage();
            ShowLog();
            ShowOptionsButton();
            ShowDocumentationButton();
        }
 private void CheckForSpecialResults(ParseMessageContent content)
 {
     if (content.Log != null && content.Log.Length > 0)
     {
         //Special Issue Messages
         if (content.Log.Contains("error: use of overloaded operator '==' is ambiguous (with operand types 'const FName' and 'const FPrimaryAssetType')"))
         {
             content.Doc     = Documentation.Link.UnrealIssue_1;
             content.Message = "Errors found while parsing.\nThis is a known Unreal Engine issue.\nPress the Documentation Button for more details.";
         }
     }
 }
예제 #5
0
        static public void OpenFile(string filename, uint line, uint column)
        {
            ThreadHelper.ThrowIfNotOnUIThread();
            DTE2 applicationObject = ServiceProvider.GetService(typeof(SDTE)) as DTE2;

            Assumes.Present(applicationObject);

            Window   window = null;
            Document doc    = null;

            try
            {
                window = applicationObject.ItemOperations.OpenFile(filename.Replace('/', '\\'));
            }
            catch (Exception)
            {
                var content = new ParseMessageContent();
                content.Message = "Unable to open file " + filename;
                ParseMessageWindow.Display(content);
                return;
            }

            if (window == null)
            {
                //sometimes it opens but it does not give a window element ( check if opened already )
                Document activeDoc = GetActiveDocument();
                if (activeDoc != null && Path.GetFileName(activeDoc.FullName) == Path.GetFileName(filename))
                {
                    doc = activeDoc;
                }
            }
            else
            {
                window.Activate();
                doc = window.Document;
            }

            if (doc != null)
            {
                TextSelection sel = (TextSelection)doc.Selection;
                sel.MoveTo((int)line, (int)column);
            }
        }
        static public void Display(ParseMessageContent content)
        {
            var messageWin = new ParseMessageWindow(content);

            messageWin.ShowDialog();
        }