Changeset 10876


Ignore:
Timestamp:
05/21/14 13:38:59 (5 years ago)
Author:
rstoll
Message:
  • Do not open Search and Replace twice
  • SelectionChanged event caused a NullPointer fixed
File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/DataPreprocessing/HeuristicLab.DataPreprocessing.Views/3.3/DataGridContentView.cs

    r10875 r10876  
    7878
    7979    void DataGridView_SelectionChanged(object sender, EventArgs e) {
    80       if (!isSearching) {
     80      if (!isSearching && Content != null) {
    8181        Content.DataGridLogic.SetSelection(GetSelectedCells());
    8282      }
     
    155155
    156156    private void CreateFindAndReplaceDialog() {
    157       findAndReplaceDialog = new SearchAndReplaceDialog();
    158       findAndReplaceDialog.Show(this);
    159       if (AreMultipleCellsSelected()) {
    160         ResetHighlightedCellsBackground();
    161         HightlightedCellsBackground = GetSelectedCells();
    162         dataGridView.ClearSelection();
    163       }
    164       findAndReplaceDialog.FindAllEvent += findAndReplaceDialog_FindAllEvent;
    165       findAndReplaceDialog.FindNextEvent += findAndReplaceDialog_FindNextEvent;
    166       findAndReplaceDialog.ReplaceAllEvent += findAndReplaceDialog_ReplaceAllEvent;
    167       findAndReplaceDialog.ReplaceNextEvent += findAndReplaceDialog_ReplaceEvent;
    168       findAndReplaceDialog.FormClosing += findAndReplaceDialog_FormClosing;
    169       searchIterator = null;
    170       DataGridView.SelectionChanged += DataGridView_SelectionChanged_FindAndReplace;
     157      if (findAndReplaceDialog == null || findAndReplaceDialog.IsDisposed) {
     158        findAndReplaceDialog = new SearchAndReplaceDialog();
     159        findAndReplaceDialog.Show(this);
     160        if (AreMultipleCellsSelected()) {
     161          ResetHighlightedCellsBackground();
     162          HightlightedCellsBackground = GetSelectedCells();
     163          dataGridView.ClearSelection();
     164        }
     165        findAndReplaceDialog.FindAllEvent += findAndReplaceDialog_FindAllEvent;
     166        findAndReplaceDialog.FindNextEvent += findAndReplaceDialog_FindNextEvent;
     167        findAndReplaceDialog.ReplaceAllEvent += findAndReplaceDialog_ReplaceAllEvent;
     168        findAndReplaceDialog.ReplaceNextEvent += findAndReplaceDialog_ReplaceEvent;
     169        findAndReplaceDialog.FormClosing += findAndReplaceDialog_FormClosing;
     170        searchIterator = null;
     171        DataGridView.SelectionChanged += DataGridView_SelectionChanged_FindAndReplace;
     172      }
    171173    }
    172174
     
    198200
    199201    void findAndReplaceDialog_FindNextEvent(object sender, EventArgs e) {
    200       if (searchIterator == null || 
    201         currentSearchText != findAndReplaceDialog.GetSearchText() || 
     202      if (searchIterator == null ||
     203        currentSearchText != findAndReplaceDialog.GetSearchText() ||
    202204        currentComparisonOperation != findAndReplaceDialog.GetComparisonOperation()) {
    203205        searchIterator = new FindPreprocessingItemsIterator(FindAll(findAndReplaceDialog.GetSearchText()));
Note: See TracChangeset for help on using the changeset viewer.