private bool ConfirmSaveFeatureFile()
        {
            if (CurrentFilePath == "")
            {
                if (GherkinSettings.SaveCurrentFileWithRequesting(CurrentEditor) == MessageBoxResult.Cancel)
                {
                    return(false);
                }
            }

            if (CurrentFilePath == "")
            {
                MessageBox.Show(Properties.Resources.Message_SaveFileBeforeGenCode,
                                Properties.Resources.Message_SaveFileBeforeGenCodeTitle,
                                MessageBoxButton.OK,
                                MessageBoxImage.Error);
                return(false);
            }
            return(true);
        }
        private void OnDeleteEditorTab(object sender, DeleteEditorTabRequestedArg arg)
        {
            EditorTabContentViewModel editorViewModel = arg.EditorViewModel;
            MessageBoxResult          result          = GherkinSettings.SaveCurrentFileWithRequesting(editorViewModel);

            if (result == MessageBoxResult.Cancel)
            {
                return;
            }

            EventAggregator <EditorClosedArg> .Instance.Publish(this, new EditorClosedArg(editorViewModel.CurrentFilePath));

            if (TabPanels.Count == 1)
            {
                CurrentEditor?.ChangeToEmptyFile();
                NotifyCurrentFilePathChanged();
                base.OnPropertyChanged(nameof(IsShowScenarioIndexEnabled));
            }
            else
            {
                EditorTabItem editorTab            = TabPanels.FirstOrDefault(x => x.EditorTabContentViewModel == editorViewModel);
                int           index                = TabPanels.IndexOf(editorTab);
                bool          isDeletingCurrentTab = (index == SelectedTabIndex);
                if (isDeletingCurrentTab)
                {
                    // Force select a tab before removing tab.
                    // Note: property changed notification would not be raised if index is same as SelectedTabIndex.
                    // Therefore we select another tab at first and then select agian the indexed tab if index == SelectedTabIndex
                    int other_index = (index + 1) % TabPanels.Count;
                    SelectedTabIndex = other_index;
                }

                TabPanels.Remove(editorTab);

                if (isDeletingCurrentTab)
                {
                    SelectedTabIndex = Math.Min(index, TabPanels.Count - 1);
                }
            }
        }