Exemplo n.º 1
0
 internal static bool IsDefaultInterpreter(InterpreterOptions interpreter)
 {
     Version vers;
     return interpreter.Id == JToolsPackage.Instance.InterpreterOptionsPage.DefaultInterpreterValue &&
             Version.TryParse(interpreter.Version, out vers) &&
             vers == JToolsPackage.Instance.InterpreterOptionsPage.DefaultInterpreterVersionValue;
 }
Exemplo n.º 2
0
        public GenerateIntellisenseDbDialog(InterpreterOptions interpreter, Action completed)
        {
            InitializeComponent();

            _interpreter = interpreter;
            _completed = completed;
        }
Exemplo n.º 3
0
        private void AddInterpreterClick(object sender, EventArgs e)
        {
            var newInterp = new NewInterpreter();
            if (newInterp.ShowDialog() == DialogResult.OK) {
                if (!_showSettingsFor.Enabled) {
                    // previously we had no interpreters, re-enable the control
                    _showSettingsFor.Items.Clear();
                    _defaultInterpreter.Items.Clear();
                    _defaultInterpreter.Enabled = true;
                    _showSettingsFor.Enabled = true;
                }
                var newOptions = new InterpreterOptions() {
                    Display = newInterp.InterpreterDescription,
                    Added = true,
                    IsConfigurable = true,
                    SupportsCompletionDb = true
                };

                // two indicies to track: the indicies in our drop down (the realIndex) and the indicies in our
                // options list which may still have uncommitted changes.
                int realIndex = 0, optionsIndex = OptionsPage._options.Count;
                for (int i = 0; i < OptionsPage._options.Count; i++) {
                    var curOption = OptionsPage._options[i];
                    if (String.Compare(newOptions.Display, curOption.Display) < 0) {
                        optionsIndex = i;
                        break;
                    }
                    if (!curOption.Removed) {
                        realIndex++;
                    }
                }

                OptionsPage._options.Insert(optionsIndex, newOptions);
                _showSettingsFor.Items.Insert(realIndex, newInterp.InterpreterDescription);
                _showSettingsFor.SelectedIndex = realIndex;
                _defaultInterpreter.Items.Insert(realIndex, newInterp.InterpreterDescription);
                if (_defaultInterpreter.SelectedIndex == -1) {
                    _defaultInterpreter.SelectedIndex = 0;
                }
            }
        }