protected override void OnSyntaxEditorTriggerActivated(ActiproSoftware.SyntaxEditor.SyntaxEditor syntaxEditor, TriggerEventArgs e)
 {
     string str = e.get_Trigger().get_Key();
     if (((str != null) && (str == "TagAutoCompleteTrigger")) && !syntaxEditor.get_SelectedView().get_Selection().get_IsReadOnly())
     {
         this.CompleteElementTag(syntaxEditor, syntaxEditor.get_Caret().get_Offset());
     }
 }
Ejemplo n.º 2
0
 private void ScrollActiProEditor(ActiproSoftware.SyntaxEditor.SyntaxEditor editor, VerticalScrollAmount amount, bool down)
 {
     if ((amount == VerticalScrollAmount.Line) && down)
     {
         editor.get_SelectedView().ScrollDown();
     }
     else if (amount == VerticalScrollAmount.Line)
     {
         editor.get_SelectedView().ScrollUp();
     }
     else if ((amount == VerticalScrollAmount.Page) && down)
     {
         editor.get_SelectedView().ScrollPageDown();
     }
     else if (amount == VerticalScrollAmount.Page)
     {
         editor.get_SelectedView().ScrollPageUp();
     }
     else if ((amount == VerticalScrollAmount.Document) && down)
     {
         editor.get_SelectedView().ScrollToDocumentEnd();
     }
     else if (amount == VerticalScrollAmount.Document)
     {
         editor.get_SelectedView().ScrollToDocumentStart();
     }
 }
        private void CompleteElementTag(ActiproSoftware.SyntaxEditor.SyntaxEditor syntaxEditor, int offset)
        {
            string str = null;
            TextStream textStream = syntaxEditor.get_Document().GetTextStream(offset);
            if (textStream.GoToPreviousToken() && ((textStream.get_Token().get_Key() == "StartTagEndToken") && ((offset - textStream.get_Offset()) == 1)))
            {
                bool flag = false;
                while (textStream.GoToPreviousToken())
                {
                    string str2 = textStream.get_Token().get_Key();
                    if (str2 != null)
                    {
                        if (!(str2 == "StartTagNameToken"))
                        {
                            if ((str2 == "StartTagStartToken") || (str2 == "EndTagEndToken"))
                            {
                                return;
                            }
                        }
                        else
                        {
                            str = textStream.get_TokenText().Trim();
                            flag = true;
                        }
                    }
                    if (flag)
                    {
                        break;
                    }
                }
                if (str != null)
                {
                    textStream.set_Offset(offset);
                    flag = false;
                    while (!textStream.get_IsAtDocumentEnd())
                    {
                        switch (textStream.get_Token().get_Key())
                        {
                            case "EndTagDefaultToken":
                                if (str == textStream.get_TokenText().Trim())
                                {
                                    return;
                                }
                                flag = true;
                                break;

                            case "StartTagStartToken":
                            case "EndTagEndToken":
                                flag = true;
                                break;
                        }
                        if (flag)
                        {
                            break;
                        }
                        textStream.GoToNextToken();
                    }
                    syntaxEditor.get_SelectedView().InsertSurroundingText(0, null, "</" + str + ">");
                }
            }
        }