Files
ILSpy/TestPlugin/ContextMenuCommand.cs
Siegfried Pammer 51aafa0fd9 Move ILSpy UI code back to the ICSharpCode.ILSpy root namespace
The Avalonia port had placed the UI app in an ILSpy.* namespace tree,
while the csproj RootNamespace and every prior release (through 10.1)
use ICSharpCode.ILSpy.*. Restoring the historical namespace reduces the
public API diff against release/10.1 for plugin authors and removes the
shadowing that forced global:: qualifiers in the test project. The
Images class and AccessOverlayIcon enum move back into the root
namespace (as in 10.1), since an ICSharpCode.ILSpy.Images namespace
would shadow the Images class for all code inside ICSharpCode.ILSpy.

Assisted-by: Claude:claude-fable-5:Claude Code
2026-06-12 21:12:07 +02:00

33 lines
1.0 KiB
C#

// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
// This code is distributed under MIT X11 license (for details please see \doc\license.txt)
using System.Composition;
using ICSharpCode.ILSpy;
namespace TestPlugin
{
// Demonstrates contributing an entry to the tree's context menu. (The real "Save Assembly"
// command ships with the app; the concrete assembly-node types are internal to ILSpy, so this
// sample only shows the extension point and operates on the selected nodes generically.)
[ExportContextMenuEntry(Header = "_Test Plugin Command")]
[Shared]
public class TestPluginContextCommand : IContextMenuEntry
{
public bool IsVisible(TextViewContext context)
{
return context.SelectedTreeNodes is { Length: > 0 };
}
public bool IsEnabled(TextViewContext context)
{
return context.SelectedTreeNodes is { Length: 1 };
}
public void Execute(TextViewContext context)
{
// A real plugin would act on context.SelectedTreeNodes here.
}
}
}