Browse Source

Primary Selection but only when multiple Items

Extension Server should be Reapplied on Selection changed
pull/604/head
jkuehner 12 years ago
parent
commit
994a1561f5
  1. 7
      src/AddIns/DisplayBindings/WpfDesign/WpfDesign/Project/DesignItem.cs
  2. 8
      src/AddIns/DisplayBindings/WpfDesign/WpfDesign/Project/Extensions/ExtensionServer.cs
  3. 5
      src/AddIns/DisplayBindings/WpfDesign/WpfDesign/Project/Extensions/SelectionExtensionServer.cs

7
src/AddIns/DisplayBindings/WpfDesign/WpfDesign/Project/DesignItem.cs

@ -161,6 +161,13 @@ namespace ICSharpCode.WpfDesign
for (int i = 0; i < _extensionServers.Length; i++) { for (int i = 0; i < _extensionServers.Length; i++) {
if (_extensionServers[i] == server) { if (_extensionServers[i] == server) {
bool shouldApply = server.ShouldApplyExtensions(this); bool shouldApply = server.ShouldApplyExtensions(this);
if (server.ShouldBeReApplied() && shouldApply && shouldApply == _extensionServerIsApplied[i])
{
_extensionServerIsApplied[i] = false;
ApplyUnapplyExtensionServer(extensionManager, false, server);
}
if (shouldApply != _extensionServerIsApplied[i]) { if (shouldApply != _extensionServerIsApplied[i]) {
_extensionServerIsApplied[i] = shouldApply; _extensionServerIsApplied[i] = shouldApply;
ApplyUnapplyExtensionServer(extensionManager, shouldApply, server); ApplyUnapplyExtensionServer(extensionManager, shouldApply, server);

8
src/AddIns/DisplayBindings/WpfDesign/WpfDesign/Project/Extensions/ExtensionServer.cs

@ -74,6 +74,14 @@ namespace ICSharpCode.WpfDesign.Extensions
/// </summary> /// </summary>
public abstract bool ShouldApplyExtensions(DesignItem extendedItem); public abstract bool ShouldApplyExtensions(DesignItem extendedItem);
// <summary>
/// Set if the Extension Server should be reaplied (For multiple Selection extension Server for Example!)
/// </summary>
public virtual bool ShouldBeReApplied()
{
return false;
}
/// <summary> /// <summary>
/// Create an extension of the specified type. /// Create an extension of the specified type.
/// Is called by the ExtensionManager. /// Is called by the ExtensionManager.

5
src/AddIns/DisplayBindings/WpfDesign/WpfDesign/Project/Extensions/SelectionExtensionServer.cs

@ -121,6 +121,11 @@ namespace ICSharpCode.WpfDesign.Extensions
ReapplyExtensions(this.Services.Selection.SelectedItems); ReapplyExtensions(this.Services.Selection.SelectedItems);
} }
public override bool ShouldBeReApplied()
{
return true;
}
/// <summary> /// <summary>
/// Gets if the item is in the secondary selection. /// Gets if the item is in the secondary selection.
/// </summary> /// </summary>

Loading…
Cancel
Save