Browse Source

Worked on main menu. Complex conditions now support failed actions

git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/trunk@41 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61
shortcuts
Mike Krüger 21 years ago
parent
commit
658d958414
  1. 88
      AddIns/ICSharpCode.SharpDevelop.addin
  2. 21
      src/Main/Base/Project/Src/Commands/CustomStringTagProvider.cs
  3. 5
      src/Main/Base/Project/Src/Internal/Auswerter/ProjectActiveAuswerter.cs
  4. 18
      src/Main/Core/Project/Src/AddInTree/AddIn/ComplexCondition.cs
  5. 24
      src/Main/Core/Project/Src/AddInTree/AddIn/Condition.cs
  6. 1
      src/Main/Core/Project/Src/AddInTree/AddIn/ICondition.cs
  7. 15
      src/Main/Core/Project/Src/AddInTree/AddIn/StandardErbauer/MenuItem/Gui/Menu.cs
  8. 7
      src/Main/Core/Project/Src/AddInTree/AddIn/StandardErbauer/MenuItem/Gui/MenuCommand.cs

88
AddIns/ICSharpCode.SharpDevelop.addin

@ -15,7 +15,6 @@ @@ -15,7 +15,6 @@
class = "ICSharpCode.Core.NetAmbience"/>
</Path>
<Path name = "/SharpDevelop/Workbench/DisplayBindings">
<DisplayBinding id = "Browser"
supportedformats = "Web Pages"
@ -53,6 +52,7 @@ @@ -53,6 +52,7 @@
<Pad id = "ErrorList"
category = "Main"
title = "Error List"
shortcut = "Control|Alt|K"
icon = "PadIcons.ErrorList"
class = "ICSharpCode.SharpDevelop.Gui.ErrorList"/>
@ -60,7 +60,6 @@ @@ -60,7 +60,6 @@
category = "Main"
title = "${res:MainWindow.Windows.TaskList}"
icon = "PadIcons.TaskList"
shortcut = "Control|Alt|K"
class = "ICSharpCode.SharpDevelop.Gui.OpenTaskView"/>
<Pad id = "CompilerMessageView"
@ -90,9 +89,20 @@ @@ -90,9 +89,20 @@
icon = "Icons.16x16.HelpIcon"
shortcut = "Control|Alt|H"
class = "ICSharpCode.SharpDevelop.Gui.HelpBrowser"/>
<Pad id = "SearchResults"
category = "Tools"
title = "Search Results"
icon = "PadIcons.FindResults"
class = "SearchAndReplace.SearchResultPanel"/>
<Pad id = "Bookmarks"
category = "Tools"
title = "Bookmarks"
icon = "PadIcons.Bookmarks"
class = "Bookmark.BookmarkPad"/>
</Path>
<Path name = "/SharpDevelop/Workbench/Combine/FileFilter">
<FileFilter id = "Solution"
name = "Solutions"
@ -138,17 +148,16 @@ @@ -138,17 +148,16 @@
<Path path = "/SharpDevelop/Pads/ProjectBrowser/ContextMenu/SolutionNode">
<MenuItem id = "Build"
label = "Build"
label = "&amp;Build"
shortcut = "F8"
icon = "Icons.16x16.BuildCombine"
class = "ICSharpCode.SharpDevelop.Project.Commands.Build"/>
<MenuItem id = "Rebuild"
label = "Rebuild"
icon = "Icons.16x16.BuildCombine"
label = "&amp;Rebuild"
shortcut = "Alt|F8"
class = "ICSharpCode.SharpDevelop.Project.Commands.Rebuild"/>
<MenuItem id = "Clean"
<MenuItem id = "&amp;Clean"
label = "Clean"
icon = "Icons.16x16.BuildCombine"
class = "ICSharpCode.SharpDevelop.Project.Commands.Clean"/>
<MenuItem id = "CombineBuildGroupSeparator" type = "Separator"/>
@ -256,20 +265,17 @@ @@ -256,20 +265,17 @@
<Path path = "/SharpDevelop/Pads/ProjectBrowser/ContextMenu/ProjectNode">
<MenuItem id = "Build project"
label = "Build project"
label = "B&amp;uild"
icon = "Icons.16x16.BuildCurrentSelectedProject"
class = "ICSharpCode.SharpDevelop.Project.Commands.BuildProject"/>
<MenuItem id = "Rebuild project"
label = "Rebuild project"
icon = "Icons.16x16.BuildCurrentSelectedProject"
label = "R&amp;ebuild"
class = "ICSharpCode.SharpDevelop.Project.Commands.RebuildProject"/>
<MenuItem id = "Clean project"
label = "Clean project"
icon = "Icons.16x16.BuildCurrentSelectedProject"
label = "Clea&amp;n"
class = "ICSharpCode.SharpDevelop.Project.Commands.CleanProject"/>
<MenuItem id = "Publish project"
label = "Publish project"
icon = "Icons.16x16.BuildCurrentSelectedProject"
label = "Publis ${CurrentProjectName}h"
class = "ICSharpCode.SharpDevelop.Project.Commands.PublishProject"/>
<MenuItem id = "CombineBuildGroupSeparator" type = "Separator"/>
@ -1099,7 +1105,6 @@ @@ -1099,7 +1105,6 @@
</ComplexCondition>
</MenuItem> <!-- end EDIT menu -->
<MenuItem id = "View" label = "${res:XML.MainMenu.ViewMenu}" type="Menu">
<MenuItem id = "MainViewMenuBuilder"
type = "Builder"
@ -1148,46 +1153,33 @@ @@ -1148,46 +1153,33 @@
<Condition name = "CombineOpen" iscombineopen="True"/>
</Or>
<MenuItem id = "Build"
label = "Build"
label = "&amp;Build Solution"
shortcut = "F8"
icon = "Icons.16x16.BuildCombine"
class = "ICSharpCode.SharpDevelop.Project.Commands.Build"/>
<MenuItem id = "Rebuild"
label = "Rebuild"
shortcut = "F8"
icon = "Icons.16x16.BuildCombine"
label = "&amp;Rebuild Solution"
shortcut = "Alt|F8"
class = "ICSharpCode.SharpDevelop.Project.Commands.Rebuild"/>
<MenuItem id = "Clean"
label = "Clean"
shortcut = "F8"
icon = "Icons.16x16.BuildCombine"
label = "&amp;Clean Solution"
class = "ICSharpCode.SharpDevelop.Project.Commands.Clean"/>
<MenuItem id = "Publish"
label = "Publish"
shortcut = "F8"
icon = "Icons.16x16.BuildCombine"
class = "ICSharpCode.SharpDevelop.Project.Commands.Publish"/>
<Condition name = "ProjectActive" activeproject="*">
<MenuItem id = "Separator1" type = "Separator" />
<MenuItem id = "Build project"
label = "Build project"
label = "B&amp;uild ${CurrentProjectName}"
shortcut = "F9"
icon = "Icons.16x16.BuildCurrentSelectedProject"
class = "ICSharpCode.SharpDevelop.Project.Commands.BuildProject"/>
<MenuItem id = "Rebuild project"
label = "Rebuild project"
shortcut = "F9"
icon = "Icons.16x16.BuildCurrentSelectedProject"
label = "R&amp;ebuild ${CurrentProjectName}"
shortcut = "ALT|F9"
class = "ICSharpCode.SharpDevelop.Project.Commands.RebuildProject"/>
<MenuItem id = "Clean project"
label = "Clean project"
shortcut = "F9"
icon = "Icons.16x16.BuildCurrentSelectedProject"
label = "Clea&amp;n ${CurrentProjectName}"
class = "ICSharpCode.SharpDevelop.Project.Commands.CleanProject"/>
<MenuItem id = "Publish project"
label = "Publish project"
shortcut = "F9"
icon = "Icons.16x16.BuildCurrentSelectedProject"
<MenuItem id = "Publis&amp;h project"
label = "Publish ${CurrentProjectName}"
class = "ICSharpCode.SharpDevelop.Project.Commands.PublishProject"/>
</Condition>
</ComplexCondition>
@ -1748,22 +1740,6 @@ @@ -1748,22 +1740,6 @@
<EditAction id = "IndentSelection" class = "ICSharpCode.TextEditor.Actions.IndentSelection" keys = "Control|I"/>
</Path>
<Path name = "/SharpDevelop/Workbench/Pads">
<Pad id = "SearchResults"
category = "Main"
title = "Search Results"
icon = "PadIcons.FindResults"
class = "SearchAndReplace.SearchResultPanel"/>
<Pad id = "Bookmarks"
category = "Main"
title = "Bookmarks"
icon = "PadIcons.Bookmarks"
class = "Bookmark.BookmarkPad"/>
</Path>
<Path name = "/SharpDevelop/Pads/BookmarkPad/Toolbar">
<ToolbarItem id = "GotoPrev"
icon = "Bookmarks.GotoPrev"
@ -1823,7 +1799,5 @@ @@ -1823,7 +1799,5 @@
type = "ComboBox"
tooltip = "Search"
class = "SearchAndReplace.FindComboBox"/>
</Path>
</AddIn>

21
src/Main/Base/Project/Src/Commands/CustomStringTagProvider.cs

@ -23,15 +23,15 @@ namespace ICSharpCode.SharpDevelop.Commands @@ -23,15 +23,15 @@ namespace ICSharpCode.SharpDevelop.Commands
{
public class SharpDevelopStringTagProvider : IStringTagProvider
{
readonly static string[] tags = new string[] { "ItemPath", "ItemDir", "ItemFilename", "ItemExt",
"CurLine", "CurCol", "CurText",
"TargetPath", "TargetDir", "TargetName", "TargetExt",
"ProjectDir", "ProjectFilename",
"CombineDir", "CombineFilename",
"Startuppath",
"TaskService.Warnings",
"TaskService.Errors",
"TaskService.Messages"
readonly static string[] tags = new string[] {
"ItemPath", "ItemDir", "ItemFilename", "ItemExt",
"CurLine", "CurCol", "CurText",
"TargetPath", "TargetDir", "TargetName", "TargetExt",
"CurrentProjectName",
"ProjectDir", "ProjectFilename",
"CombineDir", "CombineFilename",
"Startuppath",
"TaskService.Warnings", "TaskService.Errors", "TaskService.Messages"
};
@ -71,6 +71,9 @@ namespace ICSharpCode.SharpDevelop.Commands @@ -71,6 +71,9 @@ namespace ICSharpCode.SharpDevelop.Commands
return TaskService.GetCount(TaskType.Error).ToString();
case "TaskService.Messages":
return TaskService.GetCount(TaskType.Message).ToString();
case "CurrentProjectName":
// TODO: Translate "<empty>"!!!!
return ProjectService.CurrentProject == null ? "<empty>" : ProjectService.CurrentProject.Name;
}
switch (tag.ToUpper()) {

5
src/Main/Base/Project/Src/Internal/Auswerter/ProjectActiveAuswerter.cs

@ -20,14 +20,13 @@ namespace ICSharpCode.Core @@ -20,14 +20,13 @@ namespace ICSharpCode.Core
{
public bool IsValid(object caller, Condition condition)
{
IProject project = ProjectService.CurrentProject;
string activeproject = condition.Properties["activeproject"];
IProject project = ProjectService.CurrentProject;
if (activeproject == "*") {
return project != null;
}
return project != null && project.Language == activeproject;
}
}

18
src/Main/Core/Project/Src/AddInTree/AddIn/ComplexCondition.cs

@ -25,9 +25,13 @@ namespace ICSharpCode.Core @@ -25,9 +25,13 @@ namespace ICSharpCode.Core
}
}
ConditionFailedAction action = ConditionFailedAction.Exclude;
public ConditionFailedAction Action {
get {
return ConditionFailedAction.Exclude;
return action;
}
set {
action = value;
}
}
@ -68,9 +72,13 @@ namespace ICSharpCode.Core @@ -68,9 +72,13 @@ namespace ICSharpCode.Core
}
}
ConditionFailedAction action = ConditionFailedAction.Exclude;
public ConditionFailedAction Action {
get {
return ConditionFailedAction.Exclude;
return action;
}
set {
action = value;
}
}
@ -117,9 +125,13 @@ namespace ICSharpCode.Core @@ -117,9 +125,13 @@ namespace ICSharpCode.Core
}
}
ConditionFailedAction action = ConditionFailedAction.Exclude;
public ConditionFailedAction Action {
get {
return ConditionFailedAction.Exclude;
return action;
}
set {
action = value;
}
}

24
src/Main/Core/Project/Src/AddInTree/AddIn/Condition.cs

@ -19,6 +19,9 @@ namespace ICSharpCode.Core @@ -19,6 +19,9 @@ namespace ICSharpCode.Core
get {
return action;
}
set {
action = value;
}
}
public string Name {
get {
@ -64,24 +67,35 @@ namespace ICSharpCode.Core @@ -64,24 +67,35 @@ namespace ICSharpCode.Core
public static ICondition ReadComplexCondition(XmlTextReader reader)
{
Properties properties = Properties.ReadFromAttributes(reader);
reader.Read();
ICondition condition = null;
while (reader.Read()) {
switch (reader.NodeType) {
case XmlNodeType.Element:
switch (reader.LocalName) {
case "And":
return AndCondition.Read(reader);
condition = AndCondition.Read(reader);
goto exit;
case "Or":
return OrCondition.Read(reader);
condition = OrCondition.Read(reader);
goto exit;
case "Not":
return NegatedCondition.Read(reader);
condition = NegatedCondition.Read(reader);
goto exit;
case "Condition":
return Condition.Read(reader);
condition = Condition.Read(reader);
goto exit;
}
break;
}
}
return null;
exit:
if (condition != null) {
ConditionFailedAction action = properties.Get("action", ConditionFailedAction.Exclude);
condition.Action = action;
}
return condition;
}
public static ICondition[] ReadConditionList(XmlTextReader reader, string endElement)

1
src/Main/Core/Project/Src/AddInTree/AddIn/ICondition.cs

@ -33,6 +33,7 @@ namespace ICSharpCode.Core @@ -33,6 +33,7 @@ namespace ICSharpCode.Core
/// </summary>
ConditionFailedAction Action {
get;
set;
}
/// <summary>

15
src/Main/Core/Project/Src/AddInTree/AddIn/StandardErbauer/MenuItem/Gui/Menu.cs

@ -38,6 +38,7 @@ namespace ICSharpCode.Core @@ -38,6 +38,7 @@ namespace ICSharpCode.Core
{
DropDownItems.Clear();
foreach (object item in subItems) {
Console.WriteLine(item);
if (item is ToolStripItem) {
DropDownItems.Add((ToolStripItem)item);
((IStatusUpdate)item).UpdateStatus();
@ -51,13 +52,13 @@ namespace ICSharpCode.Core @@ -51,13 +52,13 @@ namespace ICSharpCode.Core
{
base.OnDropDownShow(e);
CreateDropDownItems();
// foreach (object item in subItems) {
// if (item is ToolStripItem) {
// if (item is IStatusUpdate) {
// ((IStatusUpdate)item).UpdateStatus();
// }
// }
// }
foreach (object item in subItems) {
if (item is ToolStripItem) {
if (item is IStatusUpdate) {
((IStatusUpdate)item).UpdateStatus();
}
}
}
}
protected override void OnDropDownOpened(System.EventArgs e)

7
src/Main/Core/Project/Src/AddInTree/AddIn/StandardErbauer/MenuItem/Gui/MenuCommand.cs

@ -132,11 +132,8 @@ namespace ICSharpCode.Core @@ -132,11 +132,8 @@ namespace ICSharpCode.Core
Image = ResourceService.GetBitmap(codon.Properties["icon"]);
}
ConditionFailedAction failedAction = codon.GetFailedAction(caller);
bool isVisible = failedAction != ConditionFailedAction.Exclude;
if (base.Visible != isVisible) {
base.Visible = isVisible;
}
Console.WriteLine("failed action {0}", failedAction);
Visible = failedAction != ConditionFailedAction.Exclude;
if (localizedText == null) {
localizedText = codon.Properties["label"];

Loading…
Cancel
Save