예제 #1
0
        private void _menuItem_LeftClick(object sender, EventArgs e)
        {
            ToolStripItem _menuItem = sender as ToolStripItem;
            string        key       = _menuItem.Tag as string;
            IEditorPlugin _plugin   = _Plugins.Get(key).GetPlugin();

            PluginHelper _pluginSettingsHelper = new PluginHelper(_plugin);

            _pluginSettingsHelper.LoadSettings();

            if (_plugin.IsExtension)
            {
                bool _result = _plugin.Configure();
                if (!_result)
                {
                    return;
                }

                _pluginSettingsHelper.SaveSettings();
            }

            _pluginSettingsHelper.LoadSettings();

            SelInfo _selInfo = new SelInfo()
            {
                Text         = editor.Editor.Text,
                SelectedText = editor.Editor.SelectedText,
                CurrentLine  = editor.Editor.CurrentLine()
            };

            try
            {
                if (!_plugin.OmitResult)
                {
                    _plugin.Apply(_selInfo);
                    editor.Editor.SelectedText = _selInfo.SelectedText;
                }
                else
                {
                    _plugin.Apply(_selInfo);
                }
            }
            catch (Exception)
            {
            }

            _pluginSettingsHelper.SaveSettings();
        }
예제 #2
0
        private void _menuItem_RightClick(object sender, EventArgs e)
        {
            ToolStripItem _menuItem = sender as ToolStripItem;
            string        key       = _menuItem.Tag as string;
            IEditorPlugin _plugin   = _Plugins.Get(key).GetPlugin();

            if (_plugin.IsExtension)
            {
                return;
            }

            PluginHelper _pluginSettingsHelper = new PluginHelper(_plugin);

            _pluginSettingsHelper.LoadSettings();

            bool _result = _plugin.Configure();

            if (!_result)
            {
                return;
            }

            _pluginSettingsHelper.SaveSettings();
        }