public static void ShowNotification(string text) { if (windowInstance) { windowInstance.ShowNotification(new GUIContent(text)); } }
private void DrawMoreButton(GameObjectIssueRecord record) { if (!UIHelpers.RecordButton(record, "Shows menu with additional actions for this record.", CSIcons.More)) { return; } GenericMenu menu = new GenericMenu(); if (!string.IsNullOrEmpty(record.path)) { menu.AddItem(new GUIContent("Ignore/Add path to ignores"), false, () => { if (CSArrayTools.AddIfNotExists(ref MaintainerSettings.Issues.pathIgnores, record.path)) { MaintainerWindow.ShowNotification("Ignore added: " + record.path); IssuesFiltersWindow.Refresh(); } else { MaintainerWindow.ShowNotification("Such item already added to the ignores!"); } }); DirectoryInfo dir = Directory.GetParent(record.path); if (dir.Name != "Assets") { menu.AddItem(new GUIContent("Ignore/Add parent directory to ignores"), false, () => { if (CSArrayTools.AddIfNotExists(ref MaintainerSettings.Issues.pathIgnores, dir.ToString())) { MaintainerWindow.ShowNotification("Ignore added: " + dir); IssuesFiltersWindow.Refresh(); } else { MaintainerWindow.ShowNotification("Such item already added to the ignores!"); } }); } } if (!string.IsNullOrEmpty(record.componentName)) { menu.AddItem(new GUIContent("Ignore/Add component to ignores"), false, () => { if (CSArrayTools.AddIfNotExists(ref MaintainerSettings.Issues.componentIgnores, record.componentName)) { MaintainerWindow.ShowNotification("Ignore added: " + record.componentName); IssuesFiltersWindow.Refresh(); } else { MaintainerWindow.ShowNotification("Such item already added to the ignores!"); } }); } menu.ShowAsContext(); }
protected void DrawCopyButton(T record) { if (UIHelpers.RecordButton(record, "Copy", "Copies record text to the clipboard.", CSIcons.Copy)) { EditorGUIUtility.systemCopyBuffer = record.ToString(true); MaintainerWindow.ShowNotification("Record copied to clipboard!"); } }
protected void DrawCopyReportButton() { if (UIHelpers.ImageButton("Copy report to clipboard", CSIcons.Copy)) { EditorGUIUtility.systemCopyBuffer = ReportsBuilder.GenerateReport(GetModuleName(), filteredRecords, GetReportHeader(), GetReportFooter()); MaintainerWindow.ShowNotification("Report copied to clipboard!"); } }
private void DrawRecordButtons(RecordBase record) { using (UIHelpers.Horizontal(UIHelpers.panelWithBackground)) { AddShowButtonIfPossible(record); AssetRecord assetRecord = record as AssetRecord; if (assetRecord != null) { if (GUILayout.Button(new GUIContent("Reveal", "Reveals item in system default File Manager like Explorer on Windows or Finder on Mac."), UIHelpers.recordButton)) { EditorUtility.RevealInFinder(assetRecord.path); } if (GUILayout.Button("More ...", UIHelpers.recordButton)) { GenericMenu menu = new GenericMenu(); if (!string.IsNullOrEmpty(assetRecord.path)) { menu.AddItem(new GUIContent("Ignore/Add path to ignores"), false, () => { if (CSArrayTools.AddIfNotExists(ref MaintainerSettings.Cleaner.pathIgnores, assetRecord.assetDatabasePath)) { MaintainerSettings.Save(); MaintainerWindow.ShowNotification("Ignore added: " + assetRecord.assetDatabasePath); CleanerIgnoresWindow.Refresh(); } else { MaintainerWindow.ShowNotification("Such item already added to the ignores!"); } }); DirectoryInfo dir = Directory.GetParent(assetRecord.assetDatabasePath); if (dir.Name != "Assets") { menu.AddItem(new GUIContent("Ignore/Add parent directory to ignores"), false, () => { if (CSArrayTools.AddIfNotExists(ref MaintainerSettings.Cleaner.pathIgnores, dir.ToString())) { MaintainerSettings.Save(); MaintainerWindow.ShowNotification("Ignore added: " + dir); CleanerIgnoresWindow.Refresh(); } else { MaintainerWindow.ShowNotification("Such item already added to the ignores!"); } }); } } menu.ShowAsContext(); } } } }
protected void DrawExportReportButton() { if (UIHelpers.ImageButton("Export report...", CSIcons.Export)) { var filePath = EditorUtility.SaveFilePanel("Save " + GetModuleName() + " report", "", "Maintainer " + GetReportFileNamePart() + "Report.txt", "txt"); if (!string.IsNullOrEmpty(filePath)) { var sr = File.CreateText(filePath); sr.Write(ReportsBuilder.GenerateReport(GetModuleName(), filteredRecords, GetReportHeader(), GetReportFooter())); sr.Close(); MaintainerWindow.ShowNotification("Report saved!"); } } }
private void DrawFixButton(IssueRecord record, int recordIndex) { GUI.enabled = record.IsFixable; var label = "Fix"; var hint = "Automatically fixes issue (not available for this issue yet)."; if (record.Kind == IssueKind.MissingComponent) { label = "Remove"; hint = "Removes missing component."; } else if (record.Kind == IssueKind.MissingReference) { label = "Reset"; hint = "Resets missing reference to default None value."; } if (UIHelpers.RecordButton(record, label, hint, CSIcons.AutoFix)) { var fixResult = record.Fix(false); if (fixResult != null && fixResult.Success) { DeleteRecords(new[] { recordIndex }); var notificationExtra = ""; if (record.Location == RecordLocation.Prefab || record.Location == RecordLocation.Asset) { AssetDatabase.SaveAssets(); } MaintainerWindow.ShowNotification("Issue successfully fixed!" + notificationExtra); } else { var notificationText = "Could not fix the issue!"; if (fixResult != null && !string.IsNullOrEmpty(fixResult.ErrorText)) { notificationText = fixResult.ErrorText; } MaintainerWindow.ShowNotification(notificationText); } } GUI.enabled = true; }
protected override void DrawSearchBody() { if (GUILayout.Button("Find issues!")) { startSearch = true; } GUILayout.Space(10); if (records == null || records.Length == 0) { GUILayout.Label("No issues"); } else { ShowCollectionPages(); GUILayout.Space(5); using (UIHelpers.Horizontal()) { if (GUILayout.Button("Copy report to clipboard")) { EditorGUIUtility.systemCopyBuffer = ReportsBuilder.GenerateReport(IssuesFinder.MODULE_NAME, records); MaintainerWindow.ShowNotification("Report copied to clipboard!"); } if (GUILayout.Button("Export report...")) { string filePath = EditorUtility.SaveFilePanel("Save Issues Finder report", "", "MaintainerIssuesReport.txt", "txt"); if (!string.IsNullOrEmpty(filePath)) { StreamWriter sr = File.CreateText(filePath); sr.Write(ReportsBuilder.GenerateReport(IssuesFinder.MODULE_NAME, records)); sr.Close(); MaintainerWindow.ShowNotification("Report saved!"); } } if (GUILayout.Button("Clear results")) { records = null; SearchResultsStorage.IssuesSearchResults = null; } } } }
private static void ShowItem(ReferencesTreeViewItem <T> item) { var assetPath = item.data.assetPath; if (item.data.assetSettingsKind == AssetSettingsKind.NotSettings) { if (!CSSelectionTools.RevealAndSelectFileAsset(assetPath)) { MaintainerWindow.ShowNotification("Can't show it properly"); } } else { if (!CSEditorTools.RevealInSettings(item.data.assetSettingsKind, assetPath)) { MaintainerWindow.ShowNotification("Can't show it properly"); } } }
public void Refresh(bool newData) { treePanel.Refresh(newData); if (!string.IsNullOrEmpty(AutoSelectPath)) { EditorApplication.delayCall += () => { treePanel.SelectItemWithPath(AutoSelectPath); AutoSelectPath = null; }; } if (AutoShowExistsNotification) { window.ShowNotification(new GUIContent("Such item(s) already present in the list!")); AutoShowExistsNotification = false; } }
protected override void ShowItem(TreeViewItem clickedItem) { var item = (ProjectReferencesTreeViewItem <T>)clickedItem; var assetPath = item.data.assetPath; if (item.data.assetSettingsKind == AssetSettingsKind.NotSettings) { if (!CSSelectionTools.RevealAndSelectFileAsset(assetPath)) { MaintainerWindow.ShowNotification("Can't show it properly"); } } else { if (!CSEditorTools.RevealInSettings(item.data.assetSettingsKind, assetPath)) { MaintainerWindow.ShowNotification("Can't show it properly"); } } }
private void DrawFixButton(IssueRecord record, int recordIndex) { GUI.enabled = record.CanBeFixed(); string label = "Fix"; string hint = "Automatically fixes issue (not available for this issue yet)."; if (record.type == RecordType.MissingComponent) { label = "Remove"; hint = "Removes missing component."; } else if (record.type == RecordType.MissingReference) { label = "Reset"; hint = "Resets missing reference to default None value."; } if (UIHelpers.RecordButton(record, label, hint, CSIcons.AutoFix)) { if (record.Fix(false)) { HideRecord(recordIndex); string notificationExtra = ""; if (record.location == RecordLocation.Prefab || record.location == RecordLocation.Asset) { AssetDatabase.SaveAssets(); } else if (record.location == RecordLocation.Scene) { notificationExtra = "\nDon't forget to save the scene!"; } MaintainerWindow.ShowNotification("Issue successfully fixed!" + notificationExtra); } } GUI.enabled = true; }
private void DrawMoreButton(AssetRecord assetRecord) { if (UIHelpers.RecordButton(assetRecord, "Shows menu with additional actions for this record.", CSIcons.More)) { GenericMenu menu = new GenericMenu(); if (!string.IsNullOrEmpty(assetRecord.path)) { menu.AddItem(new GUIContent("Ignore/Add path to ignores"), false, () => { if (CSArrayTools.AddIfNotExists(ref MaintainerSettings.Cleaner.pathIgnores, assetRecord.assetDatabasePath)) { MaintainerWindow.ShowNotification("Ignore added: " + assetRecord.assetDatabasePath); CleanerFiltersWindow.Refresh(); } else { MaintainerWindow.ShowNotification("Such item already added to the ignores!"); } }); DirectoryInfo dir = Directory.GetParent(assetRecord.assetDatabasePath); if (dir.Name != "Assets") { menu.AddItem(new GUIContent("Ignore/Add parent directory to ignores"), false, () => { if (CSArrayTools.AddIfNotExists(ref MaintainerSettings.Cleaner.pathIgnores, dir.ToString())) { MaintainerWindow.ShowNotification("Ignore added: " + dir); CleanerFiltersWindow.Refresh(); } else { MaintainerWindow.ShowNotification("Such item already added to the ignores!"); } }); } } menu.ShowAsContext(); } }
protected override void DrawSearchBody() { //GUILayout.BeginHorizontal(); if (GUILayout.Button("1. Find garbage!")) { startSearch = true; } if (GUILayout.Button("2. Clean selected items!")) { startClean = true; } //GUILayout.EndHorizontal(); GUILayout.Space(10); if (records == null || records.Length == 0) { GUILayout.Label("No garbage"); } else { ShowCollectionPages(); GUILayout.Space(5); using (UIHelpers.Horizontal()) { if (GUILayout.Button("Select all")) { foreach (CleanerRecord record in records.OfType <CleanerRecord>()) { record.selected = true; } SearchResultsStorage.Save(); } if (GUILayout.Button("Select none")) { foreach (CleanerRecord record in records.OfType <CleanerRecord>()) { record.selected = false; } SearchResultsStorage.Save(); } if (GUILayout.Button("Clear results")) { records = null; SearchResultsStorage.CleanerSearchResults = null; } } using (UIHelpers.Horizontal()) { if (GUILayout.Button("Copy report to clipboard")) { EditorGUIUtility.systemCopyBuffer = ReportsBuilder.GenerateReport(ProjectCleaner.MODULE_NAME, records); MaintainerWindow.ShowNotification("Report copied to clipboard!"); } if (GUILayout.Button("Export report...")) { string filePath = EditorUtility.SaveFilePanel("Save " + ProjectCleaner.MODULE_NAME + " report", "", "MaintainerCleanerReport.txt", "txt"); if (!string.IsNullOrEmpty(filePath)) { StreamWriter sr = File.CreateText(filePath); sr.Write(ReportsBuilder.GenerateReport(ProjectCleaner.MODULE_NAME, records)); sr.Close(); MaintainerWindow.ShowNotification("Report saved!"); } } } } }
private static void DrawSearchSection() { GUILayout.BeginVertical(UIHelpers.panelWithBackground, GUILayout.ExpandHeight(true), GUILayout.ExpandWidth(true)); GUILayout.Space(10); if (GUILayout.Button("Find issues!")) { startSearch = true; } GUILayout.Space(10); if (issues == null || issues.Length == 0) { GUILayout.Label("No issues"); } else { int fromIssue = issuesCurrentPage * ISSUES_PER_PAGE; int toIssue = fromIssue + Math.Min(ISSUES_PER_PAGE, issues.Length - fromIssue); GUILayout.Label("Issues " + fromIssue + " - " + toIssue + " from " + issues.Length); searchSectionScrollPosition = GUILayout.BeginScrollView(searchSectionScrollPosition); for (int i = fromIssue; i < toIssue; i++) { IssueRecord issue = issues[i]; UIHelpers.Separator(); GUILayout.BeginVertical(); GUILayout.BeginHorizontal(); DrawIssueIcon(issue); if (issue.source == IssueSource.Prefab) { DrawPrefabIcon(); } GUILayout.Label(issue.GetHeader(), UIHelpers.richLabel, GUILayout.ExpandWidth(false)); GUILayout.EndHorizontal(); GUILayout.Label(issue.GetBody(), UIHelpers.richLabel); GUILayout.BeginHorizontal(UIHelpers.panelWithBackground); if (GUILayout.Button(new GUIContent("Show", "Selects Game Object with issue in the scene or Project Browser. Opens scene with needed Game Object if necessary and highlights this scene in the Project Browser."), GUILayout.Width(50))) { gotoIssue = issues[i]; } if (GUILayout.Button(new GUIContent("Copy", "Copies record text to the clipboard."), GUILayout.Width(50))) { textEditorForClipboard.content = new GUIContent(issue.ToString(true)); textEditorForClipboard.SelectAll(); textEditorForClipboard.Copy(); window.ShowNotification(new GUIContent("Issue record copied to clipboard!")); } GUILayout.EndHorizontal(); GUILayout.EndVertical(); } GUILayout.EndScrollView(); if (issuesTotalPages > 1) { GUILayout.Space(5); GUILayout.BeginHorizontal(); GUILayout.FlexibleSpace(); GUI.enabled = (issuesCurrentPage > 0); if (GUILayout.Button("<<", GUILayout.Width(50))) { window.RemoveNotification(); issuesCurrentPage = 0; searchSectionScrollPosition = Vector2.zero; } if (GUILayout.Button("<", GUILayout.Width(50))) { window.RemoveNotification(); issuesCurrentPage--; searchSectionScrollPosition = Vector2.zero; } GUI.enabled = true; GUILayout.Label((issuesCurrentPage + 1) + " of " + issuesTotalPages, UIHelpers.centeredLabel, GUILayout.Width(100)); GUI.enabled = (issuesCurrentPage < issuesTotalPages - 1); if (GUILayout.Button(">", GUILayout.Width(50))) { window.RemoveNotification(); issuesCurrentPage++; searchSectionScrollPosition = Vector2.zero; } if (GUILayout.Button(">>", GUILayout.Width(50))) { window.RemoveNotification(); issuesCurrentPage = issuesTotalPages - 1; searchSectionScrollPosition = Vector2.zero; } GUI.enabled = true; GUILayout.FlexibleSpace(); GUILayout.EndHorizontal(); } GUILayout.Space(5); GUILayout.BeginVertical(); GUILayout.BeginHorizontal(); if (GUILayout.Button("Copy report to clipboard")) { textEditorForClipboard.content = new GUIContent(IssuesFinder.GenerateReport(issues)); textEditorForClipboard.SelectAll(); textEditorForClipboard.Copy(); window.ShowNotification(new GUIContent("Report copied to clipboard!")); } if (GUILayout.Button("Export report...")) { string filePath = EditorUtility.SaveFilePanel("Save Issues Finder report", "", "MaintainerIssuesReport.txt", "txt"); if (!String.IsNullOrEmpty(filePath)) { StreamWriter sr = File.CreateText(filePath); sr.Write(IssuesFinder.GenerateReport(issues)); sr.Close(); window.ShowNotification(new GUIContent("Report saved!")); } } GUILayout.EndHorizontal(); GUILayout.EndVertical(); } GUILayout.EndVertical(); }
protected override void DrawRecord(int recordIndex, out bool recordRemoved) { recordRemoved = false; RecordBase record = records[recordIndex]; UIHelpers.Separator(); using (UIHelpers.Horizontal()) { DrawSeverityIcon(record); if (record.location == RecordLocation.Prefab) { UIHelpers.DrawPrefabIcon(); } GUILayout.Label(record.GetHeader(), UIHelpers.richLabel, GUILayout.ExpandWidth(false)); } GUILayout.Label(record.GetBody(), UIHelpers.richLabel); using (UIHelpers.Horizontal(UIHelpers.panelWithBackground)) { AddShowButtonIfPossible(record); if (GUILayout.Button(new GUIContent("Copy", "Copies record text to the clipboard."), UIHelpers.recordButton)) { EditorGUIUtility.systemCopyBuffer = record.ToString(true); MaintainerWindow.ShowNotification("Issue record copied to clipboard!"); } if (GUILayout.Button(new GUIContent("Hide", "Hide this issue from the results list.\nUseful when you fixed issue and wish to hide it away."), UIHelpers.recordButton)) { // ReSharper disable once CoVariantArrayConversion records = CSArrayTools.RemoveAt(records as IssueRecord[], recordIndex); SearchResultsStorage.IssuesSearchResults = (IssueRecord[])records; recordRemoved = true; return; } //UIHelpers.VerticalSeparator(); GameObjectIssueRecord objectIssue = record as GameObjectIssueRecord; if (objectIssue != null) { if (GUILayout.Button("More ...", UIHelpers.recordButton)) { GenericMenu menu = new GenericMenu(); if (!string.IsNullOrEmpty(objectIssue.path)) { menu.AddItem(new GUIContent("Ignore/Add path to ignores"), false, () => { if (CSArrayTools.AddIfNotExists(ref MaintainerSettings.Issues.pathIgnores, objectIssue.path)) { MaintainerSettings.Save(); MaintainerWindow.ShowNotification("Ignore added: " + objectIssue.path); IssuesIgnoresWindow.Refresh(); } else { MaintainerWindow.ShowNotification("Such item already added to the ignores!"); } }); DirectoryInfo dir = Directory.GetParent(objectIssue.path); if (dir.Name != "Assets") { menu.AddItem(new GUIContent("Ignore/Add parent directory to ignores"), false, () => { if (CSArrayTools.AddIfNotExists(ref MaintainerSettings.Issues.pathIgnores, dir.ToString())) { MaintainerSettings.Save(); MaintainerWindow.ShowNotification("Ignore added: " + dir); IssuesIgnoresWindow.Refresh(); } else { MaintainerWindow.ShowNotification("Such item already added to the ignores!"); } }); } } if (!string.IsNullOrEmpty(objectIssue.component)) { menu.AddItem(new GUIContent("Ignore/Add component to ignores"), false, () => { if (CSArrayTools.AddIfNotExists(ref MaintainerSettings.Issues.componentIgnores, objectIssue.component)) { MaintainerSettings.Save(); MaintainerWindow.ShowNotification("Ignore added: " + objectIssue.component); IssuesIgnoresWindow.Refresh(); } else { MaintainerWindow.ShowNotification("Such item already added to the ignores!"); } }); } menu.ShowAsContext(); } } } }
private void DrawMoreButton(AssetIssueRecord record) { if (!UIHelpers.RecordButton(record, "Shows menu with additional actions for this record.", CSIcons.More)) { return; } var menu = new GenericMenu(); if (!string.IsNullOrEmpty(record.Path)) { menu.AddItem(new GUIContent("Ignore/Full Path"), false, () => { if (!CSFilterTools.IsValueMatchesAnyFilter(record.Path, ProjectSettings.Issues.pathIgnoresFilters)) { var newFilter = FilterItem.Create(record.Path, FilterKind.Path); ArrayUtility.Add(ref ProjectSettings.Issues.pathIgnoresFilters, newFilter); ApplyNewIgnoreFilter(newFilter); MaintainerWindow.ShowNotification("Ignore added: " + record.Path); CleanerFiltersWindow.Refresh(); } else { MaintainerWindow.ShowNotification("Already added to the ignores!"); } }); var dir = Directory.GetParent(record.Path); if (!CSPathTools.IsAssetsRootPath(dir.FullName)) { menu.AddItem(new GUIContent("Ignore/Parent Folder"), false, () => { var dirPath = CSPathTools.EnforceSlashes(dir.ToString()); if (!CSFilterTools.IsValueMatchesAnyFilter(dirPath, ProjectSettings.Issues.pathIgnoresFilters)) { var newFilter = FilterItem.Create(dirPath, FilterKind.Directory); ArrayUtility.Add(ref ProjectSettings.Issues.pathIgnoresFilters, newFilter); ApplyNewIgnoreFilter(newFilter); MaintainerWindow.ShowNotification("Ignore added: " + dirPath); CleanerFiltersWindow.Refresh(); } else { MaintainerWindow.ShowNotification("Already added to the ignores!"); } }); } } var objectIssue = record as GameObjectIssueRecord; if (objectIssue != null) { if (!string.IsNullOrEmpty(objectIssue.componentName)) { menu.AddItem(new GUIContent("Ignore/\"" + objectIssue.componentName + "\" Component"), false, () => { if (!CSFilterTools.IsValueMatchesAnyFilter(objectIssue.componentName, ProjectSettings.Issues.componentIgnoresFilters)) { var newFilter = FilterItem.Create(objectIssue.componentName, FilterKind.Type); ArrayUtility.Add(ref ProjectSettings.Issues.componentIgnoresFilters, newFilter); ApplyNewIgnoreFilter(newFilter); MaintainerWindow.ShowNotification("Ignore added: " + objectIssue.componentName); CleanerFiltersWindow.Refresh(); } else { MaintainerWindow.ShowNotification("Already added to the ignores!"); } }); } } menu.ShowAsContext(); }
private static void ShowItem(ExactReferencesListItem <T> item) { var assetPath = item.data.assetPath; var referencingEntry = item.data.entry; if (referencingEntry.location == Location.SceneLightingSettings || referencingEntry.location == Location.SceneNavigationSettings) { var sceneOpenResult = CSSceneTools.OpenSceneWithSavePrompt(assetPath); if (!sceneOpenResult.success) { Debug.LogError(Maintainer.ConstructError("Can't open scene " + assetPath)); MaintainerWindow.ShowNotification("Can't show it properly"); return; } } switch (referencingEntry.location) { case Location.ScriptAsset: case Location.ScriptableObjectAsset: if (!CSSelectionTools.RevealAndSelectFileAsset(assetPath)) { MaintainerWindow.ShowNotification("Can't show it properly"); } break; case Location.PrefabAssetObject: if (!CSSelectionTools.RevealAndSelectSubAsset(assetPath, referencingEntry.transformPath, referencingEntry.objectId)) { MaintainerWindow.ShowNotification("Can't show it properly"); } break; case Location.PrefabAssetGameObject: case Location.SceneGameObject: if (!CSSelectionTools.RevealAndSelectGameObject(assetPath, referencingEntry.transformPath, referencingEntry.objectId, referencingEntry.componentId)) { MaintainerWindow.ShowNotification("Can't show it properly"); } break; case Location.SceneLightingSettings: if (!CSMenuTools.ShowSceneSettingsLighting()) { Debug.LogError(Maintainer.ConstructError("Can't open Lighting settings!")); MaintainerWindow.ShowNotification("Can't show it properly"); } break; case Location.SceneNavigationSettings: if (!CSMenuTools.ShowSceneSettingsNavigation()) { Debug.LogError(Maintainer.ConstructError("Can't open Navigation settings!")); MaintainerWindow.ShowNotification("Can't show it properly"); } break; case Location.NotFound: case Location.Invisible: break; case Location.TileMap: if (!CSSelectionTools.RevealAndSelectGameObject(assetPath, referencingEntry.transformPath, referencingEntry.objectId, referencingEntry.componentId)) { MaintainerWindow.ShowNotification("Can't show it properly"); } // TODO: open tile map editor window? break; default: throw new ArgumentOutOfRangeException(); } }
private void DrawMoreButton(AssetRecord assetRecord) { if (UIHelpers.RecordButton(assetRecord, "Shows menu with additional actions for this record.", CSIcons.More)) { var menu = new GenericMenu(); if (!string.IsNullOrEmpty(assetRecord.path)) { menu.AddItem(new GUIContent("Ignore/Full Path"), false, () => { if (!CSFilterTools.IsValueMatchesAnyFilter(assetRecord.assetDatabasePath, MaintainerSettings.Cleaner.pathIgnoresFilters)) { var newFilter = FilterItem.Create(assetRecord.assetDatabasePath, FilterKind.Path); ArrayUtility.Add(ref MaintainerSettings.Cleaner.pathIgnoresFilters, newFilter); MaintainerWindow.ShowNotification("Ignore added: " + assetRecord.assetDatabasePath); CleanerFiltersWindow.Refresh(); if (MaintainerSettings.Cleaner.rescanAfterContextIgnore) { StartSearch(); } } else { MaintainerWindow.ShowNotification("Already added to the ignores!"); } }); var dir = Directory.GetParent(assetRecord.assetDatabasePath); if (!CSPathTools.IsAssetsRootPath(dir.FullName)) { menu.AddItem(new GUIContent("Ignore/Parent Folder"), false, () => { var dirPath = CSPathTools.EnforceSlashes(dir.ToString()); if (!CSFilterTools.IsValueMatchesAnyFilter(dirPath, MaintainerSettings.Cleaner.pathIgnoresFilters)) { var newFilter = FilterItem.Create(dirPath, FilterKind.Directory); ArrayUtility.Add(ref MaintainerSettings.Cleaner.pathIgnoresFilters, newFilter); MaintainerWindow.ShowNotification("Ignore added: " + dirPath); CleanerFiltersWindow.Refresh(); if (MaintainerSettings.Cleaner.rescanAfterContextIgnore) { StartSearch(); } } else { MaintainerWindow.ShowNotification("Already added to the ignores!"); } }); } var extension = Path.GetExtension(assetRecord.path); if (!string.IsNullOrEmpty(extension)) { menu.AddItem(new GUIContent("Ignore/\"" + extension + "\" Extension"), false, () => { if (!CSFilterTools.IsValueMatchesAnyFilterOfKind(extension, MaintainerSettings.Cleaner.pathIgnoresFilters, FilterKind.Extension)) { var newFilter = FilterItem.Create(extension, FilterKind.Extension, true); ArrayUtility.Add(ref MaintainerSettings.Cleaner.pathIgnoresFilters, newFilter); MaintainerWindow.ShowNotification("Ignore added: " + extension); CleanerFiltersWindow.Refresh(); if (MaintainerSettings.Cleaner.rescanAfterContextIgnore) { StartSearch(); } } else { MaintainerWindow.ShowNotification("Already added to the ignores!"); } }); } } menu.ShowAsContext(); } }