示例#1
0
 public CodeCompletion(IDEForm form, TextEditorControl editor)
 {
     this.form   = form;
     this.editor = editor;
     name        = editor.Name;
     database    = null;
     hashCode    = 0;
 }
示例#2
0
 public ViewerSet(IDEForm form, Target target, ContextMenu popupMenu, TabControl viewTab, ref int no)
     : base(form, viewTab, target.ToString("S"), popupMenu, ref no)
 {
     this.target = target;
     editor.Document.ReadOnly = true;
     tabPage.Controls.Add(editor);
     tabPage.Tag = this;
     if (new FileInfo(target.FileName).Exists)
     {
         LoadFromFile(target.FileName);
     }
 }
示例#3
0
 public EditSetBase(IDEForm form, TabControl tabControl, string name, ContextMenu popupMenu, ref int no)
 {
     this.form       = form;
     this.tabControl = tabControl;
     this.popupMenu  = popupMenu;
     tabPage         = new TabPage(name);
     tabControl.Controls.Add(tabPage);
     no                         = tabControl.TabCount - 1;
     editor                     = new TextEditorControl();
     editor.AllowDrop           = false;
     editor.Dock                = DockStyle.Fill;
     editor.ShowEOLMarkers      = false;
     editor.ShowInvalidLines    = false;
     editor.ShowSpaces          = false;
     editor.ShowTabs            = true;
     editor.ConvertTabsToSpaces = true;
     editor.IndentStyle         = IndentStyle.Smart;
     editor.TabIndent           = 2;
     editor.ContextMenu         = popupMenu;
     editor.Tag                 = this;
     editor.ActiveTextAreaControl.Caret.PositionChanged += new EventHandler(CaretPositionChanged);
     editor.Enter += new EventHandler(Enter);
 }
示例#4
0
        internal EditorSet(IDEForm form, Source source, ContextMenu popupMenu, TabControl editTab, ref int no)
            : base(form, editTab, source.ToString("S"), popupMenu, ref no)
        {
            this.source                 = source;
            topPanel                    = new Panel();
            topPanel.Dock               = DockStyle.Top;
            topPanel.Height             = 30;
            bottomPanel                 = new Panel();
            bottomPanel.Dock            = DockStyle.Bottom;
            bottomPanel.Height          = 120;
            bottomPanel.Visible         = false;
            splitter                    = new Splitter();
            splitter.Dock               = DockStyle.Bottom;
            splitter.Visible            = false;
            tableCombo                  = new ComboBox();
            tableCombo.DropDownStyle    = ComboBoxStyle.DropDownList;
            tableCombo.MaxDropDownItems = 20;
            tableCombo.Top              = 4;
            // The anchor right enforces a size change as a side effect
            tableCombo.Anchor       = AnchorStyles.Left | AnchorStyles.Right;
            tableCombo.SizeChanged += new EventHandler(TableComboSizeChanged);
            tableCombo.Click       += new EventHandler(TableComboClick);
            topPanel.Controls.Add(tableCombo);
            procsCombo = new ComboBox();
            procsCombo.DropDownStyle    = ComboBoxStyle.DropDownList;
            procsCombo.MaxDropDownItems = 20;
            procsCombo.Top = 4;
            // The anchor right enforces a size change as a side effect
            procsCombo.Anchor       = AnchorStyles.Left | AnchorStyles.Right;
            procsCombo.SizeChanged += new EventHandler(ProcsComboSizeChanged);
            procsCombo.Click       += new EventHandler(ProcsComboClick);
            topPanel.Controls.Add(procsCombo);
            //editor.Document.HighlightingStrategy = HighlightingStrategyFactory.CreateHighlightingStrategyForFile(source.FileName);
            code = new CodeCompletion(form, editor);
            editor.Document.DocumentChanged += new DocumentEventHandler(EditorDocumentChanged);
            tabPage.Controls.Add(editor);
            tabPage.Controls.Add(splitter);
            tabPage.Controls.Add(bottomPanel);
            tabPage.Controls.Add(topPanel);
            tabPage.Tag = this;
            bool setupNew = true;

            if (new FileInfo(source.FileName).Exists)
            {
                setupNew = false;
                if (source.Exists == false)
                {
                    DialogResult rc = MessageBox.Show(string.Format("The file {0} already exists, would you like to keep the existing file?"
                                                                    , source.FileName)
                                                      , "Add Source"
                                                      , MessageBoxButtons.YesNo);
                    if (rc == DialogResult.No)
                    {
                        setupNew = true;
                    }
                }
                if (setupNew == false)
                {
                    LoadFromFile(source.FileName);
                }
            }
            if (setupNew == true)
            {
                FillInNew(source.ToString("S"));
            }
            source.Modified = false;
            if (code.Run())
            {
                TableLoadCombo(code.GetTables());
                Table table = tableCombo.SelectedItem as Table;
                if (table != null)
                {
                    ProcsLoadCombo(code.GetProcs(table));
                }
            }
            tableCombo.SelectedIndexChanged += new EventHandler(TableComboSelectedIndexChanged);
            procsCombo.SelectedIndexChanged += new EventHandler(ProcsComboSelectedIndexChanged);
        }