Browse Source

disable ReferenceNode, ReferenceFolder and other node actions in Project Browser if project is readonly

4.1
Siegfried Pammer 15 years ago
parent
commit
37516c1a01
  1. 196
      src/Main/Base/Project/ICSharpCode.SharpDevelop.addin
  2. 2
      src/Main/Base/Project/Src/Gui/Pads/ProjectBrowser/TreeNodes/ReferenceNode.cs

196
src/Main/Base/Project/ICSharpCode.SharpDevelop.addin

@ -367,12 +367,14 @@
</Path> </Path>
<Path name = "/SharpDevelop/Pads/ProjectBrowser/ContextMenu/ReferenceFolderNode"> <Path name = "/SharpDevelop/Pads/ProjectBrowser/ContextMenu/ReferenceFolderNode">
<MenuItem id = "AddReference" <Condition name="WriteableProject" action="Disable">
label = "${res:ProjectComponent.ContextMenu.AddReference}" <MenuItem id = "AddReference"
class = "ICSharpCode.SharpDevelop.Project.Commands.AddReferenceToProject"/> label = "${res:ProjectComponent.ContextMenu.AddReference}"
<MenuItem id = "AddWebReference" class = "ICSharpCode.SharpDevelop.Project.Commands.AddReferenceToProject"/>
label = "${res:ProjectComponent.ContextMenu.AddWebReference}" <MenuItem id = "AddWebReference"
class = "ICSharpCode.SharpDevelop.Project.Commands.AddWebReferenceToProject"/> label = "${res:ProjectComponent.ContextMenu.AddWebReference}"
class = "ICSharpCode.SharpDevelop.Project.Commands.AddWebReferenceToProject"/>
</Condition>
</Path> </Path>
<Path name = "/SharpDevelop/Pads/ProjectBrowser/ContextMenu/FileNode"> <Path name = "/SharpDevelop/Pads/ProjectBrowser/ContextMenu/FileNode">
@ -402,23 +404,25 @@
<Not> <Not>
<Condition name = "Ownerstate" ownerstate = "Missing"/> <Condition name = "Ownerstate" ownerstate = "Missing"/>
</Not> </Not>
<MenuItem id = "OpenSeparator" type = "Separator" /> <Condition name="WriteableProject" action="Disable">
<MenuItem id = "OpenSeparator" type = "Separator" />
<Condition name = "Ownerstate" ownerstate = "InProject"> <Condition name = "Ownerstate" ownerstate = "InProject">
<MenuItem id = "Add" label = "${res:ProjectComponent.ContextMenu.AddMenu}" type="Menu"> <MenuItem id = "Add" label = "${res:ProjectComponent.ContextMenu.AddMenu}" type="Menu">
<Include path="/SharpDevelop/Pads/ProjectBrowser/ContextMenu/FolderNode/Add"/> <Include path="/SharpDevelop/Pads/ProjectBrowser/ContextMenu/FolderNode/Add"/>
<MenuItem id = "AddDependentSeparator" <MenuItem id = "AddDependentSeparator"
type = "Separator" /> type = "Separator" />
<MenuItem id = "NewDependentItem" <MenuItem id = "NewDependentItem"
label = "${res:ProjectComponent.ContextMenu.NewDependentItem}" label = "${res:ProjectComponent.ContextMenu.NewDependentItem}"
icon = "ProjectBrowser.CodeBehind" icon = "ProjectBrowser.CodeBehind"
class = "ICSharpCode.SharpDevelop.Project.Commands.AddNewDependentItemsToProject"/> class = "ICSharpCode.SharpDevelop.Project.Commands.AddNewDependentItemsToProject"/>
<MenuItem id = "ExistingItemAsDependent" <MenuItem id = "ExistingItemAsDependent"
label = "${res:ProjectComponent.ContextMenu.ExistingItemAsDependent}" label = "${res:ProjectComponent.ContextMenu.ExistingItemAsDependent}"
icon = "ProjectBrowser.CodeBehind" icon = "ProjectBrowser.CodeBehind"
class = "ICSharpCode.SharpDevelop.Project.Commands.AddExistingItemsToProjectAsDependent"/> class = "ICSharpCode.SharpDevelop.Project.Commands.AddExistingItemsToProjectAsDependent"/>
</MenuItem> </MenuItem>
<MenuItem id = "AddSeparator" type = "Separator" /> <MenuItem id = "AddSeparator" type = "Separator" />
</Condition>
</Condition> </Condition>
<ComplexCondition> <ComplexCondition>
@ -432,9 +436,11 @@
<Condition name = "Ownerstate" ownerstate = "InProject"/> <Condition name = "Ownerstate" ownerstate = "InProject"/>
<Condition name = "Ownerstate" ownerstate = "BehindFile"/> <Condition name = "Ownerstate" ownerstate = "BehindFile"/>
</Or> </Or>
<MenuItem id = "ExcludeFile" <Condition name="WriteableProject" action="Disable">
label = "${res:ProjectComponent.ContextMenu.ExcludeFileFromProject}" <MenuItem id = "ExcludeFile"
class = "ICSharpCode.SharpDevelop.Project.Commands.ExcludeFileFromProject"/> label = "${res:ProjectComponent.ContextMenu.ExcludeFileFromProject}"
class = "ICSharpCode.SharpDevelop.Project.Commands.ExcludeFileFromProject"/>
</Condition>
<MenuItem id = "ExecuteCustomTool" <MenuItem id = "ExecuteCustomTool"
label = "${res:ProjectComponent.ContextMenu.ExecuteCustomTool}" label = "${res:ProjectComponent.ContextMenu.ExecuteCustomTool}"
class = "ICSharpCode.SharpDevelop.Project.ExecuteCustomToolCommand"/> class = "ICSharpCode.SharpDevelop.Project.ExecuteCustomToolCommand"/>
@ -458,84 +464,94 @@
</Path> </Path>
<Path name = "/SharpDevelop/Pads/ProjectBrowser/ContextMenu/CutCopyRemoveRename"> <Path name = "/SharpDevelop/Pads/ProjectBrowser/ContextMenu/CutCopyRemoveRename">
<MenuItem id = "Cut" <Condition name="WriteableProject" action="Disable">
label = "${res:XML.MainMenu.EditMenu.Cut}" <MenuItem id = "Cut"
type = "Item" label = "${res:XML.MainMenu.EditMenu.Cut}"
icon = "Icons.16x16.CutIcon" type = "Item"
loadclasslazy = "false" icon = "Icons.16x16.CutIcon"
class = "ICSharpCode.SharpDevelop.Project.Commands.CutProjectBrowserNode"/> loadclasslazy = "false"
class = "ICSharpCode.SharpDevelop.Project.Commands.CutProjectBrowserNode"/>
</Condition>
<MenuItem id = "Copy" <MenuItem id = "Copy"
label = "${res:XML.MainMenu.EditMenu.Copy}" label = "${res:XML.MainMenu.EditMenu.Copy}"
type = "Item" type = "Item"
icon = "Icons.16x16.CopyIcon" icon = "Icons.16x16.CopyIcon"
loadclasslazy = "false" loadclasslazy = "false"
class = "ICSharpCode.SharpDevelop.Project.Commands.CopyProjectBrowserNode"/> class = "ICSharpCode.SharpDevelop.Project.Commands.CopyProjectBrowserNode"/>
<MenuItem id = "Remove" <Condition name="WriteableProject" action="Disable">
label = "${res:Global.RemoveButtonText}" <MenuItem id = "Remove"
type = "Item" label = "${res:Global.RemoveButtonText}"
icon = "Icons.16x16.DeleteIcon" type = "Item"
loadclasslazy = "false" icon = "Icons.16x16.DeleteIcon"
class = "ICSharpCode.SharpDevelop.Project.Commands.DeleteProjectBrowserNode"/> loadclasslazy = "false"
<MenuItem id = "Rename" class = "ICSharpCode.SharpDevelop.Project.Commands.DeleteProjectBrowserNode"/>
label = "${res:ProjectComponent.ContextMenu.Rename}" <MenuItem id = "Rename"
shortcut = "F2" label = "${res:ProjectComponent.ContextMenu.Rename}"
class = "ICSharpCode.SharpDevelop.Project.Commands.RenameEntryEvent"/> shortcut = "F2"
class = "ICSharpCode.SharpDevelop.Project.Commands.RenameEntryEvent"/>
</Condition>
</Path> </Path>
<Path name = "/SharpDevelop/Pads/ProjectBrowser/ContextMenu/CutPasteRemoveRename"> <Path name = "/SharpDevelop/Pads/ProjectBrowser/ContextMenu/CutPasteRemoveRename">
<MenuItem id = "Cut" <Condition name="WriteableProject" action="Disable">
label = "${res:XML.MainMenu.EditMenu.Cut}" <MenuItem id = "Cut"
type = "Item" label = "${res:XML.MainMenu.EditMenu.Cut}"
icon = "Icons.16x16.CutIcon" type = "Item"
loadclasslazy = "false" icon = "Icons.16x16.CutIcon"
class = "ICSharpCode.SharpDevelop.Project.Commands.CutProjectBrowserNode"/> loadclasslazy = "false"
<MenuItem id = "Paste" class = "ICSharpCode.SharpDevelop.Project.Commands.CutProjectBrowserNode"/>
label = "${res:XML.MainMenu.EditMenu.Paste}" <MenuItem id = "Paste"
type = "Item" label = "${res:XML.MainMenu.EditMenu.Paste}"
icon = "Icons.16x16.PasteIcon" type = "Item"
loadclasslazy = "false" icon = "Icons.16x16.PasteIcon"
class = "ICSharpCode.SharpDevelop.Project.Commands.PasteProjectBrowserNode"/> loadclasslazy = "false"
<MenuItem id = "Remove" class = "ICSharpCode.SharpDevelop.Project.Commands.PasteProjectBrowserNode"/>
label = "${res:Global.RemoveButtonText}" <MenuItem id = "Remove"
type = "Item" label = "${res:Global.RemoveButtonText}"
icon = "Icons.16x16.DeleteIcon" type = "Item"
loadclasslazy = "false" icon = "Icons.16x16.DeleteIcon"
class = "ICSharpCode.SharpDevelop.Project.Commands.DeleteProjectBrowserNode"/> loadclasslazy = "false"
<MenuItem id = "Rename" class = "ICSharpCode.SharpDevelop.Project.Commands.DeleteProjectBrowserNode"/>
label = "${res:ProjectComponent.ContextMenu.Rename}" <MenuItem id = "Rename"
shortcut = "F2" label = "${res:ProjectComponent.ContextMenu.Rename}"
class = "ICSharpCode.SharpDevelop.Project.Commands.RenameEntryEvent"/> shortcut = "F2"
class = "ICSharpCode.SharpDevelop.Project.Commands.RenameEntryEvent"/>
</Condition>
</Path> </Path>
<Path name = "/SharpDevelop/Pads/ProjectBrowser/ContextMenu/CutCopyPasteDeleteRename"> <Path name = "/SharpDevelop/Pads/ProjectBrowser/ContextMenu/CutCopyPasteDeleteRename">
<MenuItem id = "Cut" <Condition name="WriteableProject" action="Disable">
label = "${res:XML.MainMenu.EditMenu.Cut}" <MenuItem id = "Cut"
type = "Item" label = "${res:XML.MainMenu.EditMenu.Cut}"
icon = "Icons.16x16.CutIcon" type = "Item"
loadclasslazy = "false" icon = "Icons.16x16.CutIcon"
class = "ICSharpCode.SharpDevelop.Project.Commands.CutProjectBrowserNode"/> loadclasslazy = "false"
class = "ICSharpCode.SharpDevelop.Project.Commands.CutProjectBrowserNode"/>
</Condition>
<MenuItem id = "Copy" <MenuItem id = "Copy"
label = "${res:XML.MainMenu.EditMenu.Copy}" label = "${res:XML.MainMenu.EditMenu.Copy}"
type = "Item" type = "Item"
icon = "Icons.16x16.CopyIcon" icon = "Icons.16x16.CopyIcon"
loadclasslazy = "false" loadclasslazy = "false"
class = "ICSharpCode.SharpDevelop.Project.Commands.CopyProjectBrowserNode"/> class = "ICSharpCode.SharpDevelop.Project.Commands.CopyProjectBrowserNode"/>
<MenuItem id = "Paste" <Condition name="WriteableProject" action="Disable">
label = "${res:XML.MainMenu.EditMenu.Paste}" <MenuItem id = "Paste"
type = "Item" label = "${res:XML.MainMenu.EditMenu.Paste}"
icon = "Icons.16x16.PasteIcon" type = "Item"
loadclasslazy = "false" icon = "Icons.16x16.PasteIcon"
class = "ICSharpCode.SharpDevelop.Project.Commands.PasteProjectBrowserNode"/> loadclasslazy = "false"
<MenuItem id = "Delete" class = "ICSharpCode.SharpDevelop.Project.Commands.PasteProjectBrowserNode"/>
label = "${res:XML.MainMenu.EditMenu.Delete}" <MenuItem id = "Delete"
type = "Item" label = "${res:XML.MainMenu.EditMenu.Delete}"
icon = "Icons.16x16.DeleteIcon" type = "Item"
loadclasslazy = "false" icon = "Icons.16x16.DeleteIcon"
class = "ICSharpCode.SharpDevelop.Project.Commands.DeleteProjectBrowserNode"/> loadclasslazy = "false"
<MenuItem id = "Rename" class = "ICSharpCode.SharpDevelop.Project.Commands.DeleteProjectBrowserNode"/>
label = "${res:ProjectComponent.ContextMenu.Rename}" <MenuItem id = "Rename"
shortcut = "F2" label = "${res:ProjectComponent.ContextMenu.Rename}"
class = "ICSharpCode.SharpDevelop.Project.Commands.RenameEntryEvent"/> shortcut = "F2"
class = "ICSharpCode.SharpDevelop.Project.Commands.RenameEntryEvent"/>
</Condition>
</Path> </Path>
<Path name = "/SharpDevelop/Pads/ProjectBrowser/ContextMenu/FolderNode"> <Path name = "/SharpDevelop/Pads/ProjectBrowser/ContextMenu/FolderNode">
@ -668,10 +684,12 @@
icon = "Icons.16x16.BrowserRefresh" icon = "Icons.16x16.BrowserRefresh"
label = "${res:AddIns.HtmlHelp2.Refresh}" label = "${res:AddIns.HtmlHelp2.Refresh}"
class = "ICSharpCode.SharpDevelop.Project.Commands.RefreshReference"/> class = "ICSharpCode.SharpDevelop.Project.Commands.RefreshReference"/>
<MenuItem id = "Remove" <Condition name="WriteableProject" action="Disable">
label = "${res:Global.RemoveButtonText}" <MenuItem id = "Remove"
icon = "Icons.16x16.DeleteIcon" label = "${res:Global.RemoveButtonText}"
class = "ICSharpCode.SharpDevelop.Project.Commands.DeleteProjectBrowserNode"/> icon = "Icons.16x16.DeleteIcon"
class = "ICSharpCode.SharpDevelop.Project.Commands.DeleteProjectBrowserNode"/>
</Condition>
<MenuItem id = "RemoveSeparator" type = "Separator" /> <MenuItem id = "RemoveSeparator" type = "Separator" />
<MenuItem id = "Properties" <MenuItem id = "Properties"
icon = "Icons.16x16.PropertiesIcon" icon = "Icons.16x16.PropertiesIcon"

2
src/Main/Base/Project/Src/Gui/Pads/ProjectBrowser/TreeNodes/ReferenceNode.cs

@ -31,7 +31,7 @@ namespace ICSharpCode.SharpDevelop.Project
#region Cut & Paste #region Cut & Paste
public override bool EnableDelete { public override bool EnableDelete {
get { get {
return true; return !Project.ReadOnly;
} }
} }

Loading…
Cancel
Save