Skip to content

Commit

Permalink
Improved Find & Replace (#1917)
Browse files Browse the repository at this point in the history
* add new dialog

* nice search

* imporved search

* updates

* add filtering on focus item

* aadd todo

* working search prefilter

* more search improvements

* restore dialog

* fix removed files

* add missing file

* add filter

* update filter

* add docs

* add changelog

* tidy up code

* tidy up from codeql

* tidy up

* replace only click
  • Loading branch information
JFriel committed Aug 7, 2024
1 parent db0e0db commit 241dd2d
Show file tree
Hide file tree
Showing 11 changed files with 1,097 additions and 18 deletions.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) The University of Dundee 2018-2019
// Copyright (c) The University of Dundee 2018-2024
// This file is part of the Research Data Management Platform (RDMP).
// RDMP is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
// RDMP is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
Expand Down Expand Up @@ -443,6 +443,19 @@ private void openToolStripMenuItem_Click(object sender, EventArgs e)
}, o => Activator.WindowArranger.SetupEditAnything(this, o));
}

private void newFindToolStripMenuItem_Click(object sender, EventArgs e)
{
var focusItem = _windowManager.GetAllWindows<RDMPUserControl>().Where(c => c.ContainsFocus).FirstOrDefault();
var nf = new NewfindUI(Activator, false,focusItem);
nf.ShowDialog();
}
private void newReplaceToolStripMenuItem_Click(object sender, EventArgs e)
{
var nf = new NewfindUI(Activator, true);
nf.ShowDialog();
}


private void findToolStripMenuItem_Click(object sender, EventArgs e)
{
Activator.SelectAnythingThen(new DialogArgs
Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [8.2.4] - Unreleased

- Add New Find & Replace, currently available via User Settings
- Add instance setting to prompt for cohort versioning when comitting
- Improve Cohort Versioning Interface

Expand Down
6 changes: 6 additions & 0 deletions Rdmp.Core/ReusableLibraryCode/Settings/UserSettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,12 @@ public static bool PromptRenameOnCohortFilterChange
set => AppSettings.AddOrUpdateValue("PromptRenameOnCohortFilterChange", value);
}

public static bool NewFindAndReplace
{
get => AppSettings.GetValueOrDefault("NewFindAndReplace", false);
set => AppSettings.AddOrUpdateValue("NewFindAndReplace", value);
}


#region Catalogue flag visibility settings

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
// Copyright (c) The University of Dundee 2024-2024
// This file is part of the Research Data Management Platform (RDMP).
// RDMP is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
// RDMP is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
// You should have received a copy of the GNU General Public License along with RDMP. If not, see <https://www.gnu.org/licenses/>.

using BrightIdeasSoftware;
using Rdmp.Core.Curation.Data;
using Rdmp.Core.Curation.Data.Cohort;
using Rdmp.Core.ReusableLibraryCode.Settings;
using Rdmp.UI.SimpleDialogs;

namespace Rdmp.UI.Collections.Providers.Filtering;

/// <summary>
/// Filters objects in a <see cref="NewfindUI"/> based on whether the <see cref="Catalogue"/> is marked
/// with various flags (e.g. <see cref="Catalogue.IsDeprecated"/>
/// </summary>
public class CohortAggregateContainerFilter : IModelFilter
{
private readonly bool _filter = false;

public CohortAggregateContainerFilter()
{
_filter = UserSettings.ScoreZeroForCohortAggregateContainers;
}
public bool Filter(object modelObject)
{
if (_filter)
{
return modelObject is CohortAggregateContainer;
}
return true;
}
}

Loading

0 comments on commit 241dd2d

Please sign in to comment.