Exemplo n.º 1
0
        /// <summary>
        /// Output Help of macros and templates in a text editor
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        void templatesAndMacrosToolStripMenuItem_Click(object sender, EventArgs e)
        {
            string content = SqlTemplates.GetTemplateText(SqlTemplates.SqlTemplateId.MacrosHelp);

            // write it do EA home (%appdata%Sparx System\EA\hoTools_SqlTemplatesAndMacros.txt)
            SqlError.WriteSqlTemplatesAndMacros(content);
            // Show it in Editor
            Util.StartFile(SqlError.GetSqlTemplatesAndMacrosFilePath());
        }
Exemplo n.º 2
0
        /// <summary>
        /// Initialize setting. Only call after Repository is known.
        /// <para/>- Tag (
        /// <para/>- Model
        /// <para/>- Settings
        /// updated
        /// </summary>
        /// <returns></returns>
        bool InitializeSettings()
        {
            // default
            _addinType    = AddinType.Sql;
            _addinTabName = TabulatorSql;
            if ((string)Tag != TabulatorSql)
            {
                _addinType    = AddinType.Script;
                _addinTabName = TabulatorScript;
            }
            // set title
            lblTitle.Text = _addinTabName;

            // Tab Pages for *.sql queries update
            // Make sure the Container is initialized
            if (components == null)
            {
                components = new System.ComponentModel.Container();
            }
            // the sql tabulators might already be available
            if (_sqlTabCntrls == null)
            {
                _sqlTabCntrls = new SqlTabPagesCntrl(Model, AddinSettings, components, tabControlSql, txtSearchTerm,
                                                     _newTabFromRecentToolStripMenuItem,
                                                     _loadTabFromRecentToolStripMenuItem, _addinTabName);
            }

            if (tabControlSql.TabPages.Count == 0)
            {
                // first tab with Element Template
                _sqlTabCntrls.AddTab(SqlTemplates.GetTemplateText(SqlTemplates.SqlTemplateId.ElementTemplate));
            }


            // run for SQL / Query
            if (_addinType == AddinType.Sql)
            {
                // don't show Script container
                splitContainer.Panel2Collapsed = true;
                // don't show Menu item LoadScripts
                //loadStandardScriptsToolStripMenuItem.Visible = false;
            }
            else // run for Script (includes SQL / Query)
            {
                float distance = splitContainer.Height * (float)0.5;
                try
                {
                    splitContainer.SplitterDistance = (int)distance;
                }
                catch // suppress any error, use default SplitterDistance
                { }
                // available script updates
                ReloadScripts();
            }

            return(true);
        }