Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/monodevelop.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarius Ungureanu <marius.ungureanu@xamarin.com>2016-01-15 14:24:01 +0300
committerMarius Ungureanu <marius.ungureanu@xamarin.com>2016-01-15 14:24:01 +0300
commitfd387b94d12cda4244df09e2f85e2606e1c0e2d6 (patch)
treebcf2c04d08ce33678c33b2a1a2b443730063ca1e
parent4ebeb70f0cdd9e9724080d327e6a8f6168af1e90 (diff)
parentcea70d807fd207467097b7c10d86a6260a6a6958 (diff)
Merge remote-tracking branch 'origin/master' into roslyn-dark-skin
-rw-r--r--.gitignore1
-rw-r--r--.gitmodules2
m---------main/external/RefactoringEssentials0
m---------main/external/debugger-libs0
m---------main/external/fsharpbinding14
-rw-r--r--main/src/addins/AspNet/Execution/XspOptionsPanel.cs4
-rw-r--r--main/src/addins/AspNet/Projects/AspMvcProjectConfiguration.cs4
-rw-r--r--main/src/addins/AspNet/Projects/AspNetAppProjectConfiguration.cs14
-rw-r--r--main/src/addins/CBinding/Gui/CTextEditorExtension.cs2
-rw-r--r--main/src/addins/CBinding/Gui/CodeGenerationPanel.cs2
-rw-r--r--main/src/addins/CBinding/Gui/CompilerPanel.cs3
-rw-r--r--main/src/addins/CBinding/Gui/GeneralOptionsPanel.cs3
-rw-r--r--main/src/addins/CBinding/Gui/OutputOptionsPanel.cs3
-rw-r--r--main/src/addins/CBinding/Navigation/LanguageItemCommandHandler.cs4
-rw-r--r--main/src/addins/CBinding/Project/CProject.cs8
-rw-r--r--main/src/addins/CBinding/Project/CProjectConfiguration.cs8
-rw-r--r--main/src/addins/CSharpBinding/CSharpBinding.addin.xml1
-rw-r--r--main/src/addins/CSharpBinding/CSharpBinding.csproj2
-rw-r--r--main/src/addins/CSharpBinding/MonoDevelop.CSharp.CodeFixes/AddImport/AbstractAddImportCodeFixProvider.cs4
-rw-r--r--main/src/addins/CSharpBinding/MonoDevelop.CSharp.CodeFixes/FullyQualify/CSharpFullyQualifyCodeFixProvider.cs1
-rw-r--r--main/src/addins/CSharpBinding/MonoDevelop.CSharp.CodeFixes/GenerateConstructor/AbstractGenerateMemberCodeFixProvider.cs2
-rw-r--r--main/src/addins/CSharpBinding/MonoDevelop.CSharp.CodeFixes/ImplementAbstractClass/ImplementAbstractClassCodeFixProvider.cs2
-rw-r--r--main/src/addins/CSharpBinding/MonoDevelop.CSharp.CodeGeneration/GenerateCodeWindow.cs4
-rw-r--r--main/src/addins/CSharpBinding/MonoDevelop.CSharp.CodeRefactorings/InlineTemporary/InlineTemporaryCodeRefactoringProvider.InitializerRewriter.cs2
-rw-r--r--main/src/addins/CSharpBinding/MonoDevelop.CSharp.Completion/CSharpCompletionTextEditorExtension.cs3
-rw-r--r--main/src/addins/CSharpBinding/MonoDevelop.CSharp.Completion/EventCreationCompletionData.cs8
-rw-r--r--main/src/addins/CSharpBinding/MonoDevelop.CSharp.Completion/RoslynCodeCompletionFactory.cs6
-rw-r--r--main/src/addins/CSharpBinding/MonoDevelop.CSharp.Completion/RoslynCompletionData.cs2
-rw-r--r--main/src/addins/CSharpBinding/MonoDevelop.CSharp.Diagnostics/InconsistentNaming/NameConventionPanel.cs4
-rw-r--r--main/src/addins/CSharpBinding/MonoDevelop.CSharp.Diagnostics/RemoveUnnecessaryImports/CSharpRemoveUnnecessaryImportsDiagnosticAnalyzer.cs2
-rw-r--r--main/src/addins/CSharpBinding/MonoDevelop.CSharp.Diagnostics/RemoveUnnecessaryImports/RemoveUnnecessaryImportsDiagnosticAnalyzerBase.cs12
-rw-r--r--main/src/addins/CSharpBinding/MonoDevelop.CSharp.Diagnostics/SimplifyTypeNames/SimplifyTypeNamesDiagnosticAnalyzerBase.cs1
-rw-r--r--main/src/addins/CSharpBinding/MonoDevelop.CSharp.Features/CodeGeneration/CSharpCodeGenerationService.cs2
-rw-r--r--main/src/addins/CSharpBinding/MonoDevelop.CSharp.Features/Completion/CompletionEngine.cs5
-rw-r--r--main/src/addins/CSharpBinding/MonoDevelop.CSharp.Features/Completion/ContextHandler/AttributeNamedParameterContextHandler.cs6
-rw-r--r--main/src/addins/CSharpBinding/MonoDevelop.CSharp.Features/Completion/ContextHandler/CastCompletionContextHandler.cs12
-rw-r--r--main/src/addins/CSharpBinding/MonoDevelop.CSharp.Features/Completion/ContextHandler/DelegateCreationContextHandler.cs8
-rw-r--r--main/src/addins/CSharpBinding/MonoDevelop.CSharp.Features/Completion/ContextHandler/KeywordContextHandler.cs10
-rw-r--r--main/src/addins/CSharpBinding/MonoDevelop.CSharp.Features/Completion/ContextHandler/OverrideContextHandler.cs21
-rw-r--r--main/src/addins/CSharpBinding/MonoDevelop.CSharp.Features/Completion/ContextHandler/PartialContextHandler.cs20
-rw-r--r--main/src/addins/CSharpBinding/MonoDevelop.CSharp.Features/Completion/ContextHandler/PreProcessorExpressionContextHandler.cs4
-rw-r--r--main/src/addins/CSharpBinding/MonoDevelop.CSharp.Features/Completion/ContextHandler/RegexContextHandler.cs169
-rw-r--r--main/src/addins/CSharpBinding/MonoDevelop.CSharp.Features/Completion/ContextHandler/RoslynRecommendationsCompletionContextHandler.cs6
-rw-r--r--main/src/addins/CSharpBinding/MonoDevelop.CSharp.Features/Completion/ContextHandler/SenderCompletionContextHandler.cs12
-rw-r--r--main/src/addins/CSharpBinding/MonoDevelop.CSharp.Features/EncapsulateField/AbstractEncapsulateFieldService.cs1
-rw-r--r--main/src/addins/CSharpBinding/MonoDevelop.CSharp.Features/ExtractMethod/CSharp/CSharpMethodExtractor.CSharpCodeGenerator.MultipleStatementsCodeGenerator.cs4
-rw-r--r--main/src/addins/CSharpBinding/MonoDevelop.CSharp.Features/ExtractMethod/CSharp/CSharpSelectionResult.StatementResult.cs2
-rw-r--r--main/src/addins/CSharpBinding/MonoDevelop.CSharp.Features/ExtractMethod/CSharp/CSharpSelectionResult.cs2
-rw-r--r--main/src/addins/CSharpBinding/MonoDevelop.CSharp.Features/Formatter/CommonFormattingHelpers.cs2
-rw-r--r--main/src/addins/CSharpBinding/MonoDevelop.CSharp.Features/Formatter/FormattingOptionsFactory.cs2
-rw-r--r--main/src/addins/CSharpBinding/MonoDevelop.CSharp.Features/GenerateFromMembers/GenerateConstructor/AbstractGenerateConstructorService.cs4
-rw-r--r--main/src/addins/CSharpBinding/MonoDevelop.CSharp.Features/GenerateMember/GenerateConstructor/AbstractGenerateConstructorService.cs5
-rw-r--r--main/src/addins/CSharpBinding/MonoDevelop.CSharp.Features/GenerateMember/GenerateDefaultConstructors/AbstractGenerateDefaultConstructorsService.cs4
-rw-r--r--main/src/addins/CSharpBinding/MonoDevelop.CSharp.Features/GenerateMember/GenerateDefaultConstructors/CSharpGenerateDefaultConstructorsService.cs1
-rw-r--r--main/src/addins/CSharpBinding/MonoDevelop.CSharp.Features/GenerateMember/GenerateEnumMember/AbstractGenerateEnumMemberService.cs4
-rw-r--r--main/src/addins/CSharpBinding/MonoDevelop.CSharp.Features/GenerateMember/GenerateParameterizedMember/AbstractGenerateParameterizedMemberService.cs6
-rw-r--r--main/src/addins/CSharpBinding/MonoDevelop.CSharp.Features/GenerateMember/GenerateParameterizedMember/CSharpGenerateParameterizedMemberService.cs2
-rw-r--r--main/src/addins/CSharpBinding/MonoDevelop.CSharp.Features/GenerateMember/GenerateVariable/AbstractGenerateVariableService.cs5
-rw-r--r--main/src/addins/CSharpBinding/MonoDevelop.CSharp.Features/GenerateType/AbstractGenerateTypeService.cs10
-rw-r--r--main/src/addins/CSharpBinding/MonoDevelop.CSharp.Features/ImplementInterface/AbstractImplementInterfaceService.CodeAction_Property.cs2
-rw-r--r--main/src/addins/CSharpBinding/MonoDevelop.CSharp.Features/IndentEngine/CSharpIndentEngine.cs3
-rw-r--r--main/src/addins/CSharpBinding/MonoDevelop.CSharp.Features/SemanticHighlighting/SemanticHighlightingVisitor.cs214
-rw-r--r--main/src/addins/CSharpBinding/MonoDevelop.CSharp.Formatting/CSharpFormattingPolicyPanel.cs4
-rw-r--r--main/src/addins/CSharpBinding/MonoDevelop.CSharp.Formatting/CSharpFormattingProfileDialog.cs2
-rw-r--r--main/src/addins/CSharpBinding/MonoDevelop.CSharp.Highlighting/CSharpSyntaxMode.cs10
-rw-r--r--main/src/addins/CSharpBinding/MonoDevelop.CSharp.Parser/TypeSystemProvider.cs1
-rw-r--r--main/src/addins/CSharpBinding/MonoDevelop.CSharp.Project/CSharpCompilerParameters.cs11
-rw-r--r--main/src/addins/CSharpBinding/MonoDevelop.CSharp.Project/CSharpProjectExtension.cs2
-rw-r--r--main/src/addins/CSharpBinding/MonoDevelop.CSharp.Project/CodeGenerationPanel.cs4
-rw-r--r--main/src/addins/CSharpBinding/MonoDevelop.CSharp.Project/CompilerOptionsPanelWidget.cs3
-rw-r--r--main/src/addins/CSharpBinding/MonoDevelop.CSharp.Refactoring/CSharpCodeGenerator.cs5
-rw-r--r--main/src/addins/CSharpBinding/MonoDevelop.CSharp.Refactoring/CodeGenerationService.cs2
-rw-r--r--main/src/addins/CSharpBinding/MonoDevelop.CSharp.Refactoring/ExtractMethodCommandHandler.cs2
-rw-r--r--main/src/addins/CSharpBinding/MonoDevelop.CSharp.Refactoring/FindDerivedSymbolsHandler.cs17
-rw-r--r--main/src/addins/CSharpBinding/MonoDevelop.CSharp.Refactoring/FindReferencesHandler.cs3
-rw-r--r--main/src/addins/CSharpBinding/MonoDevelop.CSharp.Tooltips/LanguageItemTooltipProvider.cs2
-rw-r--r--main/src/addins/CSharpBinding/MonoDevelop.CSharp/CSharpNavigationTextEditorExtension.cs107
-rw-r--r--main/src/addins/CSharpBinding/MonoDevelop.CSharp/DeclaredSymbolInfo.cs11
-rw-r--r--main/src/addins/CSharpBinding/MonoDevelop.CSharp/PathedDocumentTextEditorExtension.cs2
-rw-r--r--main/src/addins/CSharpBinding/MonoDevelop.CSharp/ProjectSearchCategory.cs41
-rw-r--r--main/src/addins/CSharpBinding/MonoDevelop.JSon/JSonIndentEngine.cs1
-rw-r--r--main/src/addins/CSharpBinding/Util/ConflictResolver.cs8
-rw-r--r--main/src/addins/CSharpBinding/Util/CrefSyntaxExtensions.cs2
-rw-r--r--main/src/addins/CSharpBinding/Util/IMethodSymbolExtensions.cs3
-rw-r--r--main/src/addins/CSharpBinding/Util/SymbolKeyExtensions.cs2
-rw-r--r--main/src/addins/CSharpBinding/Util/SyntaxNodeExtensions.cs9
-rw-r--r--main/src/addins/CSharpBinding/Util/TaskExtensions.cs2
-rw-r--r--main/src/addins/CSharpBinding/Util/TypeExtensions.cs8
-rw-r--r--main/src/addins/CSharpBinding/gtk-gui/generated.cs5
-rw-r--r--main/src/addins/ChangeLogAddIn/AddLogEntryDialog.cs2
-rw-r--r--main/src/addins/ChangeLogAddIn/ChangeLogAddIn.cs9
-rw-r--r--main/src/addins/ChangeLogAddIn/ProjectOptionPanel.cs4
-rw-r--r--main/src/addins/Deployment/MonoDevelop.Deployment.Linux/MonoDevelop.Deployment.Linux/BasicOptionPanel.cs4
-rw-r--r--main/src/addins/Deployment/MonoDevelop.Deployment.Linux/MonoDevelop.Deployment.Linux/DotDesktopDisplayBinding.cs2
-rw-r--r--main/src/addins/Deployment/MonoDevelop.Deployment.Linux/MonoDevelop.Deployment.Linux/DotDesktopView.cs12
-rw-r--r--main/src/addins/Deployment/MonoDevelop.Deployment/MonoDevelop.Deployment/PackagingProject.cs9
-rw-r--r--main/src/addins/ILAsmBinding/Gui/CompilerParametersPanelWidget.cs3
-rw-r--r--main/src/addins/MacPlatform/MacInterop/ProcessManager.cs5
-rw-r--r--main/src/addins/MacPlatform/MacPlatform.cs23
-rw-r--r--main/src/addins/MacPlatform/MacPlatform.csproj3
-rw-r--r--main/src/addins/MacPlatform/MainToolbar/AwesomeBar.cs107
-rw-r--r--main/src/addins/MacPlatform/MainToolbar/ButtonBarContainer.cs93
-rw-r--r--main/src/addins/MacPlatform/MainToolbar/CenteringSpace.cs133
-rw-r--r--main/src/addins/MacPlatform/MainToolbar/MainToolbar.cs326
-rw-r--r--main/src/addins/MacPlatform/MainToolbar/RunButton.cs7
-rw-r--r--main/src/addins/MacPlatform/MainToolbar/SearchBar.cs13
-rw-r--r--main/src/addins/MacPlatform/MainToolbar/SelectorView.cs150
-rw-r--r--main/src/addins/MacPlatform/MainToolbar/StatusBar.cs518
-rw-r--r--main/src/addins/MonoDevelop.AssemblyBrowser/MonoDevelop.AssemblyBrowser/AssemblyBrowserNavigationPoint.cs5
-rw-r--r--main/src/addins/MonoDevelop.AssemblyBrowser/MonoDevelop.AssemblyBrowser/AssemblyBrowserViewContent.cs21
-rw-r--r--main/src/addins/MonoDevelop.AssemblyBrowser/MonoDevelop.AssemblyBrowser/AssemblyBrowserWidget.cs1
-rw-r--r--main/src/addins/MonoDevelop.AssemblyBrowser/MonoDevelop.AssemblyBrowser/DisplayBinding.cs6
-rw-r--r--main/src/addins/MonoDevelop.Autotools/MakefileOptionPanel.cs4
-rw-r--r--main/src/addins/MonoDevelop.Autotools/MakefileProject.cs9
-rw-r--r--main/src/addins/MonoDevelop.Debugger.Soft/MonoDevelop.Debugger.Soft/SoftDebuggerEngine.cs2
-rw-r--r--main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.PreviewVisualizers/GenericPreviewVisualizer.cs3
-rw-r--r--main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger/BreakpointPad.cs21
-rw-r--r--main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger/BreakpointPropertiesDialog.cs43
-rw-r--r--main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger/DebuggerOptionsPanelWidget.cs3
-rw-r--r--main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger/DebuggingService.cs8
-rw-r--r--main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger/DisassemblyView.cs9
-rw-r--r--main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger/ExceptionCaughtDialog.cs6
-rw-r--r--main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger/ImmediatePad.cs13
-rw-r--r--main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger/ObjectValuePad.cs20
-rw-r--r--main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger/StackTracePad.cs47
-rw-r--r--main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger/ThreadsPad.cs40
-rw-r--r--main/src/addins/MonoDevelop.DesignerSupport/MonoDevelop.DesignerSupport.Toolbox/Toolbox.cs2
-rw-r--r--main/src/addins/MonoDevelop.DesignerSupport/MonoDevelop.DesignerSupport/DocumentOutlinePad.cs9
-rw-r--r--main/src/addins/MonoDevelop.DesignerSupport/MonoDevelop.DesignerSupport/PropertyPad.cs13
-rw-r--r--main/src/addins/MonoDevelop.DesignerSupport/MonoDevelop.DesignerSupport/ToolboxPad.cs7
-rw-r--r--main/src/addins/MonoDevelop.DesignerSupport/MonoDevelop.DesignerSupport/WrapperDesignView.cs69
-rw-r--r--main/src/addins/MonoDevelop.DocFood/MonoDevelop.DocFood.Options/AcronymsPanelWidget.cs3
-rw-r--r--main/src/addins/MonoDevelop.DocFood/MonoDevelop.DocFood.Options/ExpansionsPanelWidget.cs3
-rw-r--r--main/src/addins/MonoDevelop.DocFood/MonoDevelop.DocFood.Options/NoTheReorderingWidget.cs3
-rw-r--r--main/src/addins/MonoDevelop.DocFood/MonoDevelop.DocFood.Options/OfTheReorderingWidget.cs3
-rw-r--r--main/src/addins/MonoDevelop.DocFood/MonoDevelop.DocFood.Options/OptionsPanelWidget.cs3
-rw-r--r--main/src/addins/MonoDevelop.DocFood/MonoDevelop.DocFood.Options/RulesPanelWidget.cs3
-rw-r--r--main/src/addins/MonoDevelop.Gettext/MonoDevelop.Gettext.Editor/CatalogEditorView.cs20
-rw-r--r--main/src/addins/MonoDevelop.Gettext/MonoDevelop.Gettext.Editor/GettextEditorDisplayBinding.cs2
-rw-r--r--main/src/addins/MonoDevelop.Gettext/MonoDevelop.Gettext/TranslationProject.cs6
-rw-r--r--main/src/addins/MonoDevelop.GtkCore/MonoDevelop.GtkCore.Dialogs/GtkDesignerOptionsPanelWidget.cs4
-rw-r--r--main/src/addins/MonoDevelop.GtkCore/MonoDevelop.GtkCore.Dialogs/WidgetBuilderOptionPanel.cs5
-rw-r--r--main/src/addins/MonoDevelop.GtkCore/MonoDevelop.GtkCore.GuiBuilder/ActionGroupDisplayBinding.cs2
-rw-r--r--main/src/addins/MonoDevelop.GtkCore/MonoDevelop.GtkCore.GuiBuilder/ActionGroupView.cs14
-rw-r--r--main/src/addins/MonoDevelop.GtkCore/MonoDevelop.GtkCore.GuiBuilder/CodeBinder.cs7
-rw-r--r--main/src/addins/MonoDevelop.GtkCore/MonoDevelop.GtkCore.GuiBuilder/CombinedDesignView.cs77
-rw-r--r--main/src/addins/MonoDevelop.GtkCore/MonoDevelop.GtkCore.GuiBuilder/GuiBuilderDisplayBinding.cs2
-rw-r--r--main/src/addins/MonoDevelop.GtkCore/MonoDevelop.GtkCore.GuiBuilder/GuiBuilderService.cs4
-rw-r--r--main/src/addins/MonoDevelop.GtkCore/MonoDevelop.GtkCore.GuiBuilder/GuiBuilderView.cs31
-rw-r--r--main/src/addins/MonoDevelop.GtkCore/MonoDevelop.GtkCore.NodeBuilders/ActionGroupNodeBuilder.cs6
-rw-r--r--main/src/addins/MonoDevelop.GtkCore/MonoDevelop.GtkCore.NodeBuilders/WidgetNodeBuilder.cs4
-rw-r--r--main/src/addins/MonoDevelop.HexEditor/Mono.MHex.Data/Buffer.cs11
-rw-r--r--main/src/addins/MonoDevelop.HexEditor/MonoDevelop.HexEditor/DisplayBinding.cs2
-rw-r--r--main/src/addins/MonoDevelop.HexEditor/MonoDevelop.HexEditor/HexEditorView.cs8
-rw-r--r--main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Gui/PackageManagementOptionsPanel.cs7
-rw-r--r--main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Gui/PackageSourcesOptionsPanel.cs3
-rw-r--r--main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/SearchPackagesSearchCategory.cs2
-rw-r--r--main/src/addins/MonoDevelop.Refactoring/AddinInfo.cs1
-rw-r--r--main/src/addins/MonoDevelop.Refactoring/MonoDevelop.AnalysisCore/AnalysisCommands.cs1
-rw-r--r--main/src/addins/MonoDevelop.Refactoring/MonoDevelop.AnalysisCore/Gui/AnalysisOptionsPanel.cs3
-rw-r--r--main/src/addins/MonoDevelop.Refactoring/MonoDevelop.AnalysisCore/Gui/ResultTooltipProvider.cs3
-rw-r--r--main/src/addins/MonoDevelop.Refactoring/MonoDevelop.AnalysisCore/Gui/ResultsEditorExtension.cs3
-rw-r--r--main/src/addins/MonoDevelop.Refactoring/MonoDevelop.CodeActions/CodeActionEditorExtension.cs11
-rw-r--r--main/src/addins/MonoDevelop.Refactoring/MonoDevelop.CodeActions/CodeActionPanelWidget.cs3
-rw-r--r--main/src/addins/MonoDevelop.Refactoring/MonoDevelop.CodeActions/CodeRefactoringDescriptor.cs2
-rw-r--r--main/src/addins/MonoDevelop.Refactoring/MonoDevelop.CodeActions/ValidCodeDiagnosticAction.cs3
-rw-r--r--main/src/addins/MonoDevelop.Refactoring/MonoDevelop.CodeIssues/CodeDiagnosticFixDescriptor.cs2
-rw-r--r--main/src/addins/MonoDevelop.Refactoring/MonoDevelop.CodeIssues/CodeDiagnosticProvider.cs2
-rw-r--r--main/src/addins/MonoDevelop.Refactoring/MonoDevelop.CodeIssues/CodeIssuePanelWidget.cs2
-rw-r--r--main/src/addins/MonoDevelop.Refactoring/MonoDevelop.Refactoring/RefactoringOptions.cs4
-rw-r--r--main/src/addins/MonoDevelop.Refactoring/MonoDevelop.Refactoring/RefactoringService.cs14
-rw-r--r--main/src/addins/MonoDevelop.Refactoring/MonoDevelop.Refactoring/RefactoringSymbolInfo.cs6
-rw-r--r--main/src/addins/MonoDevelop.RegexToolkit/MonoDevelop.RegexToolkit.csproj21
-rw-r--r--main/src/addins/MonoDevelop.RegexToolkit/MonoDevelop.RegexToolkit/Commands.cs37
-rw-r--r--main/src/addins/MonoDevelop.RegexToolkit/MonoDevelop.RegexToolkit/RegexToolkitWidget.cs9
-rw-r--r--main/src/addins/MonoDevelop.RegexToolkit/MonoDevelop.RegexToolkit/ValidateActionCodeRefactoringProvider.cs117
-rw-r--r--main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor.OptionPanels/BehaviorPanel.cs3
-rw-r--r--main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor.OptionPanels/CompletionAppearancePanel.cs3
-rw-r--r--main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor.OptionPanels/CompletionCharactersPanel.cs3
-rw-r--r--main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor.OptionPanels/CompletionOptionsPanel.cs3
-rw-r--r--main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor.OptionPanels/GeneralOptionsPanel.cs3
-rw-r--r--main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor.OptionPanels/HighlightingPanel.cs2
-rw-r--r--main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor.OptionPanels/MarkerPanel.cs3
-rw-r--r--main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor.QuickTasks/QuickTaskOverviewMode.cs2
-rw-r--r--main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor.Wrappers/IndentationTrackerWrapper.cs4
-rw-r--r--main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor.Wrappers/SemanticHighlightingSyntaxMode.cs2
-rw-r--r--main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor.Wrappers/TooltipProviderWrapper.cs5
-rw-r--r--main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor.csproj5
-rw-r--r--main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor/CompileErrorTooltipProvider.cs2
-rw-r--r--main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor/DebugValueTooltipProvider.cs4
-rw-r--r--main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor/DebugValueWindow.cs9
-rw-r--r--main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor/ExtensibleTextEditor.cs7
-rw-r--r--main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor/LanguageItemWindow.cs2
-rw-r--r--main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor/MessageBubbleTextMarker.cs12
-rw-r--r--main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor/PinnedWatchWidget.cs2
-rw-r--r--main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor/SourceEditorView.cs117
-rw-r--r--main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor/SourceEditorWidget.cs8
-rw-r--r--main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor/TextMarker/LinkMarker.cs67
-rw-r--r--main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor/TextMarker/SmartTagMarker.cs17
-rw-r--r--main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor/TextMarker/WavedLineMarker.cs2
-rw-r--r--main/src/addins/MonoDevelop.SourceEditor2/gtk-gui/gui.stetic1
-rw-r--r--main/src/addins/NUnit/Gui/TestPad.cs12
-rw-r--r--main/src/addins/NUnit/Gui/TestResultsPad.cs20
-rw-r--r--main/src/addins/NUnit/Project/NUnitAssemblyGroupProject.cs16
-rw-r--r--main/src/addins/VBNetBinding/Gui/ConfigurationOptionsPanel.cs3
-rw-r--r--main/src/addins/VBNetBinding/Gui/ImportsOptionsPanel.cs3
-rw-r--r--main/src/addins/VBNetBinding/Gui/ProjectOptionsPanel.cs4
-rw-r--r--main/src/addins/VersionControl/MonoDevelop.VersionControl.Git/MonoDevelop.VersionControl.Git/Commands.cs2
-rw-r--r--main/src/addins/VersionControl/MonoDevelop.VersionControl.Git/MonoDevelop.VersionControl.Git/CredentialsDialog.cs2
-rw-r--r--main/src/addins/VersionControl/MonoDevelop.VersionControl.Git/MonoDevelop.VersionControl.Git/EditBranchDialog.cs2
-rw-r--r--main/src/addins/VersionControl/MonoDevelop.VersionControl.Git/MonoDevelop.VersionControl.Git/GitConfigurationDialog.cs2
-rw-r--r--main/src/addins/VersionControl/MonoDevelop.VersionControl.Git/MonoDevelop.VersionControl.Git/GitOptionsPanel.cs3
-rw-r--r--main/src/addins/VersionControl/MonoDevelop.VersionControl.Git/MonoDevelop.VersionControl.Git/GitOptionsPanelWidget.cs6
-rw-r--r--main/src/addins/VersionControl/MonoDevelop.VersionControl.Git/MonoDevelop.VersionControl.Git/GitService.cs20
-rw-r--r--main/src/addins/VersionControl/MonoDevelop.VersionControl.Git/MonoDevelop.VersionControl.Git/MergeDialog.cs2
-rw-r--r--main/src/addins/VersionControl/MonoDevelop.VersionControl.Git/MonoDevelop.VersionControl.Git/StashManagerDialog.cs2
-rw-r--r--main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl.Dialogs/VersionControlGeneralOptionsPanel.cs2
-rw-r--r--main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl.Dialogs/VersionControlPolicyPanel.cs4
-rw-r--r--main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl.Dialogs/VersionControlSolutionOptionsPanel.cs2
-rw-r--r--main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl.Views/BaseView.cs105
-rw-r--r--main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl.Views/BlameView.cs18
-rw-r--r--main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl.Views/ComparisonWidget.cs1
-rw-r--r--main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl.Views/DiffView.cs18
-rw-r--r--main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl.Views/DiffWidget.cs7
-rw-r--r--main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl.Views/DropDownBox.cs8
-rw-r--r--main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl.Views/LogView.cs26
-rw-r--r--main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl.Views/LogWidget.cs14
-rw-r--r--main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl.Views/MergeView.cs20
-rw-r--r--main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl.Views/StatusView.cs11
-rw-r--r--main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl.Views/SubviewAttachmentHandler.cs13
-rw-r--r--main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl/BlameCommand.cs7
-rw-r--r--main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl/Commands.cs2
-rw-r--r--main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl/DefaultBlameViewHandler.cs4
-rw-r--r--main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl/DefaultDiffViewHandler.cs4
-rw-r--r--main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl/DefaultLogViewHandler.cs4
-rw-r--r--main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl/DefaultMergeViewHandler.cs4
-rw-r--r--main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl/DiffCommand.cs7
-rw-r--r--main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl/IVersionControlViewHandler.cs25
-rw-r--r--main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl/LogCommand.cs11
-rw-r--r--main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl/MergeCommand.cs7
-rw-r--r--main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl/ResolveConflictsCommand.cs5
-rw-r--r--main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl/VersionControlNodeExtension.cs140
-rw-r--r--main/src/addins/VersionControl/MonoDevelop.VersionControl/VersionControl.addin.xml8
-rw-r--r--main/src/addins/WindowsPlatform/WindowsPlatform/GdkWin32.cs6
-rw-r--r--main/src/addins/WindowsPlatform/WindowsPlatform/JumpList.cs2
-rw-r--r--main/src/addins/WindowsPlatform/WindowsPlatform/MainToolbar/TitleMenuItem.cs3
-rw-r--r--main/src/addins/WindowsPlatform/WindowsPlatform/WindowsPlatform.cs9
-rw-r--r--main/src/addins/Xml/Editor/BaseXmlEditorExtension.cs2
-rw-r--r--main/src/addins/Xml/Editor/XmlEditorOptionsPanel.cs6
-rw-r--r--main/src/addins/Xml/Editor/XmlSchemasPanel.cs4
-rw-r--r--main/src/addins/Xml/Formatting/XmlFormattingPolicyPanel.cs4
-rw-r--r--main/src/core/Mono.Texteditor/Mono.TextEditor.Highlighting/ColorScheme.cs25
-rw-r--r--main/src/core/Mono.Texteditor/Mono.TextEditor/Gui/TextArea.cs3
-rw-r--r--main/src/core/Mono.Texteditor/Mono.TextEditor/Gui/TextViewMargin.cs40
-rw-r--r--main/src/core/Mono.Texteditor/Mono.TextEditor/TextLineMarker.cs3
-rw-r--r--main/src/core/Mono.Texteditor/Styles/DefaultStyle.json11
-rw-r--r--main/src/core/MonoDevelop.Core/CoreExtensions.cs (renamed from main/src/core/MonoDevelop.Core/MonoDevelop.Projects.MSBuild.Conditions/ConditionedPropertyCollection.cs)19
-rw-r--r--main/src/core/MonoDevelop.Core/MonoDevelop.Core.Assemblies/MonoRuntimeInfo.cs21
-rw-r--r--main/src/core/MonoDevelop.Core/MonoDevelop.Core.Assemblies/MonoTargetRuntime.cs2
-rw-r--r--main/src/core/MonoDevelop.Core/MonoDevelop.Core.Assemblies/MonoTargetRuntimeFactory.cs59
-rw-r--r--main/src/core/MonoDevelop.Core/MonoDevelop.Core.Text/TextFileUtility.cs115
-rw-r--r--main/src/core/MonoDevelop.Core/MonoDevelop.Core.csproj4
-rw-r--r--main/src/core/MonoDevelop.Core/MonoDevelop.Core/FilePath.cs12
-rw-r--r--main/src/core/MonoDevelop.Core/MonoDevelop.Projects.MD1/MD1DotNetProjectHandler.cs2
-rw-r--r--main/src/core/MonoDevelop.Core/MonoDevelop.Projects.MSBuild.Conditions/ConditionRelationalExpression.cs24
-rw-r--r--main/src/core/MonoDevelop.Core/MonoDevelop.Projects.MSBuild/DefaultMSBuildEngine.cs22
-rw-r--r--main/src/core/MonoDevelop.Core/MonoDevelop.Projects.MSBuild/IMetadataProperty.cs2
-rw-r--r--main/src/core/MonoDevelop.Core/MonoDevelop.Projects.MSBuild/MSBuildElement.cs2
-rw-r--r--main/src/core/MonoDevelop.Core/MonoDevelop.Projects.MSBuild/MSBuildEngine.cs2
-rw-r--r--main/src/core/MonoDevelop.Core/MonoDevelop.Projects.MSBuild/MSBuildEngineV12.cs5
-rw-r--r--main/src/core/MonoDevelop.Core/MonoDevelop.Projects.MSBuild/MSBuildEngineV4.cs2
-rw-r--r--main/src/core/MonoDevelop.Core/MonoDevelop.Projects.MSBuild/MSBuildImport.cs2
-rw-r--r--main/src/core/MonoDevelop.Core/MonoDevelop.Projects.MSBuild/MSBuildItemGroup.cs1
-rw-r--r--main/src/core/MonoDevelop.Core/MonoDevelop.Projects.MSBuild/MSBuildProject.cs63
-rw-r--r--main/src/core/MonoDevelop.Core/MonoDevelop.Projects.MSBuild/MSBuildProjectInstance.cs12
-rw-r--r--main/src/core/MonoDevelop.Core/MonoDevelop.Projects.MSBuild/MSBuildProjectService.cs15
-rw-r--r--main/src/core/MonoDevelop.Core/MonoDevelop.Projects.MSBuild/MSBuildProperty.cs125
-rw-r--r--main/src/core/MonoDevelop.Core/MonoDevelop.Projects.MSBuild/MSBuildPropertyEvaluated.cs69
-rw-r--r--main/src/core/MonoDevelop.Core/MonoDevelop.Projects.MSBuild/MSBuildPropertyGroup.cs55
-rw-r--r--main/src/core/MonoDevelop.Core/MonoDevelop.Projects.MSBuild/MSBuildPropertyGroupEvaluated.cs143
-rw-r--r--main/src/core/MonoDevelop.Core/MonoDevelop.Projects.MSBuild/MSBuildPropertyGroupMerged.cs206
-rw-r--r--main/src/core/MonoDevelop.Core/MonoDevelop.Projects.MSBuild/MSBuildTarget.cs40
-rw-r--r--main/src/core/MonoDevelop.Core/MonoDevelop.Projects.MSBuild/MSBuildValueType.cs15
-rw-r--r--main/src/core/MonoDevelop.Core/MonoDevelop.Projects.MSBuild/SlnFileFormat.cs6
-rw-r--r--main/src/core/MonoDevelop.Core/MonoDevelop.Projects.SharedAssetsProjects/SharedAssetsProject.cs35
-rw-r--r--main/src/core/MonoDevelop.Core/MonoDevelop.Projects.SharedAssetsProjects/SharedAssetsProjectMSBuildExtension.cs17
-rw-r--r--main/src/core/MonoDevelop.Core/MonoDevelop.Projects/ConditionedPropertyCollection.cs269
-rw-r--r--main/src/core/MonoDevelop.Core/MonoDevelop.Projects/DotNetCompilerParameters.cs4
-rw-r--r--main/src/core/MonoDevelop.Core/MonoDevelop.Projects/DotNetProject.cs36
-rw-r--r--main/src/core/MonoDevelop.Core/MonoDevelop.Projects/DotNetProjectConfiguration.cs22
-rw-r--r--main/src/core/MonoDevelop.Core/MonoDevelop.Projects/DotNetProjectExtension.cs7
-rw-r--r--main/src/core/MonoDevelop.Core/MonoDevelop.Projects/GenericProject.cs6
-rw-r--r--main/src/core/MonoDevelop.Core/MonoDevelop.Projects/IConfigurationTarget.cs12
-rw-r--r--main/src/core/MonoDevelop.Core/MonoDevelop.Projects/IPropertySet.cs3
-rw-r--r--main/src/core/MonoDevelop.Core/MonoDevelop.Projects/ItemConfiguration.cs38
-rw-r--r--main/src/core/MonoDevelop.Core/MonoDevelop.Projects/Project.cs420
-rw-r--r--main/src/core/MonoDevelop.Core/MonoDevelop.Projects/ProjectConfiguration.cs89
-rw-r--r--main/src/core/MonoDevelop.Core/MonoDevelop.Projects/ProjectExtension.cs4
-rw-r--r--main/src/core/MonoDevelop.Core/MonoDevelop.Projects/ProjectItemMetadata.cs14
-rw-r--r--main/src/core/MonoDevelop.Core/MonoDevelop.Projects/ProjectReference.cs11
-rw-r--r--main/src/core/MonoDevelop.Core/MonoDevelop.Projects/Solution.cs8
-rw-r--r--main/src/core/MonoDevelop.Core/MonoDevelop.Projects/SolutionConfiguration.cs8
-rw-r--r--main/src/core/MonoDevelop.Core/MonoDevelop.Projects/SolutionItem.cs33
-rw-r--r--main/src/core/MonoDevelop.Core/MonoDevelop.Projects/SolutionItemConfiguration.cs4
-rw-r--r--main/src/core/MonoDevelop.Core/MonoDevelop.Projects/SolutionItemExtension.cs4
-rw-r--r--main/src/core/MonoDevelop.Core/MonoDevelop.Projects/UnknownConfiguration.cs3
-rw-r--r--main/src/core/MonoDevelop.Ide/ExtensionModel/MimeTypes.addin.xml3
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Components.AutoTest.Results/GtkNotebookResult.cs2
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Components.AutoTest.Results/GtkTreeModelResult.cs4
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Components.AutoTest.Results/GtkWidgetResult.cs4
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Components.AutoTest.Results/NSObjectResult.cs2
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Components.AutoTest/AutoTestService.cs6
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Components.Chart/Axis.cs2
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Components.Chart/BasicChart.cs143
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Components.Chart/Serie.cs2
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Components.Commands/CommandEntry.cs4
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Components.Commands/CommandEntrySet.cs4
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Components.Commands/CommandFrame.cs37
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Components.Commands/CommandManager.cs136
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Components.Commands/CommandMenu.cs2
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Components.Commands/CommandMenuBar.cs2
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Components.Commands/CommandMenuItem.cs2
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Components.Commands/CommandRouterContainer.cs8
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Components.Commands/CommandToggleToolButton.cs2
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Components.Commands/CommandToolButton.cs2
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Components.Commands/CommandToolbar.cs79
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Components.Commands/KeyBindingManager.cs6
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Components.Commands/LinkCommandEntry.cs4
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Components.Commands/MenuToolButton.cs2
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Components.DockNotebook/PlaceholderWindow.cs2
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Components.DockToolbars/ArrowWindow.cs136
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Components.DockToolbars/DockGrip.cs72
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Components.DockToolbars/DockToolbar.cs410
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Components.DockToolbars/DockToolbarFrame.cs397
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Components.DockToolbars/DockToolbarFrameLayout.cs42
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Components.DockToolbars/DockToolbarFrameStatus.cs45
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Components.DockToolbars/DockToolbarPanel.cs1034
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Components.DockToolbars/DockToolbarPosition.cs52
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Components.DockToolbars/DockToolbarStatus.cs71
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Components.DockToolbars/DockedPosition.cs81
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Components.DockToolbars/FixedPanel.cs270
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Components.DockToolbars/FloatingDock.cs65
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Components.DockToolbars/FloatingPosition.cs75
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Components.DockToolbars/IDockBar.cs37
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Components.DockToolbars/PlaceholderWindow.cs55
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Components.Docking/DockBar.cs2
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Components.Docking/DockFrame.cs2
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Components.Docking/DockGroupItem.cs2
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Components.Docking/DockItem.cs66
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Components.Docking/DockItemContainer.cs24
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Components.Docking/DockItemTitleTab.cs8
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Components.Docking/DockItemToolbar.cs95
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Components.Docking/DockPositionType.cs (renamed from main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui/IAttachableViewContent.cs)33
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Components.Docking/DockVisualStyle.cs14
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Components.Docking/TabStrip.cs4
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Components.Extensions/PlatformDialog.cs4
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Components.Extensions/TextQuestionDialog.cs4
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Components.MainToolbar/CommandSearchCategory.cs2
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Components.MainToolbar/FileSearchCategory.cs2
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Components.MainToolbar/MainToolbar.cs2
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Components.MainToolbar/ResultsDataSource.cs10
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Components.MainToolbar/SearchInSolutionSearchCategory.cs2
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Components.MainToolbar/SearchPopupWindow.cs15
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Components.MainToolbar/SearchResult.cs12
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Components.PropertyGrid.Editors/CollectionEditor.cs4
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Components.PropertyGrid.Editors/ColorEditorCell.cs2
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Components.PropertyGrid/PropertyEditorCell.cs4
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Components.Theming/GtkColors.cs2
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Components.Theming/GtkTheme.cs2
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Components.Theming/Theme.cs2
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Components.Theming/ThemeContext.cs2
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Components.Theming/ThemeEngine.cs2
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Components/ButtonEvent.cs (renamed from main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui/AbstractAttachableViewContent.cs)54
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Components/CompactDialog.cs2
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Components/ContextMenu.cs2
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Components/ContextMenuItemCollection.cs2
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Components/Control.cs106
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Components/Dialog.cs (renamed from main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui/IBaseViewContent.cs)61
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Components/DropDownBox.cs4
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Components/DropDownBoxListWindow.cs2
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Components/FileChooserAction.cs1
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Components/PathBar.cs21
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Components/RoundedFrame.cs3
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Components/TooltipWindow.cs18
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Components/Window.cs67
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.CodeCompletion/CompletionListWindow.cs6
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.CodeCompletion/ParameterInformationWindowManager.cs10
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.CodeCompletion/TooltipInformationWindow.cs4
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.CodeTemplates/CodeTemplatePanel.cs4
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Codons/PadCodon.cs18
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Codons/SolutionPadCodon.cs2
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Commands/EditCommands.cs68
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Commands/FileTabCommands.cs4
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Desktop/PlatformService.cs35
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Extension/AbstractNavigationExtension.cs182
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Extension/AbstractUsagesExtension.cs3
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Extension/TextEditorExtension.cs17
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Highlighting/ColorScheme.cs25
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/DefaultSourceEditorOptions.cs2
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/ITextSegmentMarker.cs7
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/InternalExtensionAPI/ITextEditorImpl.cs9
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/InternalExtensionAPI/ITextMarkerFactory.cs2
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/Projection/ProjectedTooltipProvider.cs10
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/TextEditor.cs33
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/TextEditorDisplayBinding.cs2
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/TextEditorViewContent.cs281
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/TextMarkerFactory.cs4
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/TooltipProvider.cs6
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.ExternalTools/ExternalToolPanel.cs2
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.FindInFiles/SearchResultPad.cs13
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.FindInFiles/SearchResultWidget.cs6
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Fonts/FontChooserPanel.cs4
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Content/IPathedDocument.cs2
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Content/ISupportsProjectReload.cs62
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Dialogs/DirtyFilesDialog.cs16
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Dialogs/FeedbackDialog.cs2
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Dialogs/IOptionsPanel.cs4
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Dialogs/ItemOptionsDialog.cs3
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Dialogs/MimeTypePolicyOptionsSection.cs3
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Dialogs/MultiConfigItemOptionsDialog.cs20
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Dialogs/MultiConfigItemOptionsPanel.cs3
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Dialogs/OptionsDialog.cs6
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Dialogs/OptionsPanel.cs4
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Dialogs/PolicyOptionsPanel.cs3
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Dialogs/ProgressDialog.cs5
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Dialogs/SelectFileFormatDialog.cs2
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.OptionPanels/AddInsOptionsPanel.cs3
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.OptionPanels/AssemblyFoldersPanel.cs4
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.OptionPanels/AuthorInformationPanel.cs5
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.OptionPanels/BuildMessagePanel.cs4
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.OptionPanels/BuildPanel.cs4
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.OptionPanels/GlobalAuthorInformationPanel.cs5
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.OptionPanels/IDEStyleOptionsPanel.cs6
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.OptionPanels/KeyBindingsPanel.cs2
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.OptionPanels/LoadSavePanel.cs3
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.OptionPanels/LogAgentOptionsPanel.cs3
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.OptionPanels/MaintenanceOptionsPanel.cs4
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.OptionPanels/MonoRuntimePanel.cs37
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.OptionPanels/SdkLocationPanel.cs2
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.OptionPanels/TasksOptionsPanel.cs2
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.OptionPanels/TextStylePolicyPanel.cs3
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Pads.ClassPad/ClassBrowserPad.cs5
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Pads.ProjectPad/ProjectFileNodeBuilder.cs2
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Pads.ProjectPad/ProjectFolderNodeBuilder.cs10
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Pads.ProjectPad/SystemFileNodeBuilder.cs2
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Pads/DefaultMonitorPad.cs44
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Pads/ErrorListPad.cs28
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Pads/MonodocTreePad.cs7
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Pads/TaskListPad.cs26
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Pads/TreeViewPad.cs6
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui/AbstractBaseViewContent.cs99
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui/AbstractPadContent.cs92
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui/BaseViewContent.cs167
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui/DefaultWorkbench.cs86
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui/DisplayBindingService.cs2
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui/DockItemToolbarLoader.cs3
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui/Document.cs84
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui/DocumentToolbar.cs86
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui/DocumentView.cs10
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui/FileViewer.cs7
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui/HiddenTextEditorViewContent.cs15
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui/HiddenWorkbenchWindow.cs24
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui/IDisplayBinding.cs6
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui/IPadContainer.cs10
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui/IViewContent.cs66
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui/IWorkbenchWindow.cs20
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui/PadContent.cs49
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui/PadFontChanger.cs5
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui/ProjectLoadProgressMonitor.cs2
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui/SdiWorkspaceWindow.cs88
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui/ViewCommandHandlers.cs28
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui/ViewContent.cs (renamed from main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui/AbstractViewContent.cs)84
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui/Workbench.cs140
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui/WorkbenchMemento.cs10
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui/WorkbenchWindow.cs2
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Navigation/DocumentNavigationPoint.cs7
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Navigation/NavigationHistoryService.cs4
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Navigation/NavigationPoint.cs5
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Navigation/TextFileNavigationPoint.cs5
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Projects.OptionPanels/BaseDirectoryPanel.cs3
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Projects.OptionPanels/BaseDirectoryPanelWidget.cs2
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Projects.OptionPanels/CodeAnalysisPanel.cs5
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Projects.OptionPanels/CodeFormattingPanel.cs2
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Projects.OptionPanels/CombineBuildOptions.cs3
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Projects.OptionPanels/CombineConfigurationPanel.cs2
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Projects.OptionPanels/CombineInformationPanel.cs2
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Projects.OptionPanels/CombineMSBuildOptions.cs2
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Projects.OptionPanels/CommonAssemblySigningPreferences.cs3
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Projects.OptionPanels/CustomCommandPanel.cs3
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Projects.OptionPanels/GeneralProjectOptions.cs4
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Projects.OptionPanels/NamespaceSynchronisationPanel.cs2
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Projects.OptionPanels/OutputOptionsPanel.cs3
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Projects.OptionPanels/PortableRuntimeOptionsPanel.cs5
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Projects.OptionPanels/RunOptionsPanel.cs2
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Projects.OptionPanels/RuntimeOptionsPanel.cs2
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Projects.OptionPanels/SolutionItemConfigurationsPanel.cs9
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Projects.OptionPanels/StartupOptionsPanel.cs3
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Projects/CombineOptionsDialog.cs3
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Projects/DefaultPolicyOptionsDialog.cs7
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Projects/GtkProjectConfigurationWidget.cs2
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Projects/NewFileDialog.cs2
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Projects/ProjectOptionsDialog.cs3
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.StandardHeader/StandardHeaderPolicyPanel.cs12
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Tasks/CommentTasksView.cs9
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Tasks/ITaskListView.cs6
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Tasks/TaskStore.cs5
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Tasks/UserTasksView.cs4
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Templates/PropertyDescriptionTemplate.cs2
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.TextEditing/TopLevelWidgetExtension.cs3
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.TypeSystem/MonoDevelopSourceTextContainer.cs1
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.TypeSystem/MonoDevelopTextLoader.cs11
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.TypeSystem/MonoDevelopWorkspace.cs38
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.WelcomePage/DefaultWelcomePage.cs2
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.WelcomePage/IWelcomePageProvider.cs3
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.WelcomePage/WelcomePageOptionPanel.cs5
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.csproj33
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide/DesktopService.cs14
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide/Ide.cs1
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide/MessageService.cs25
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide/ProjectOperations.cs25
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide/RootWorkspace.cs14
-rw-r--r--main/src/core/MonoDevelop.Ide/gtk-gui/MonoDevelop.Ide.Gui.Dialogs.SelectFileFormatDialog.cs2
-rw-r--r--main/src/core/MonoDevelop.Ide/gtk-gui/MonoDevelop.Ide.Gui.OptionPanels.IDEStyleOptionsPanelWidget.cs2
-rw-r--r--main/src/core/MonoDevelop.Ide/gtk-gui/gui.stetic4
-rw-r--r--main/src/tools/mdmonitor/InstrumentationChartView.cs (renamed from main/src/tools/mdmonitor/InstrumenationChartView.cs)155
-rw-r--r--main/src/tools/mdmonitor/InstrumentationViewerDialog.cs16
-rw-r--r--main/src/tools/mdmonitor/gtk-gui/Mono.Instrumentation.Monitor.InstrumentationChartView.cs (renamed from main/src/tools/mdmonitor/gtk-gui/Mono.Instrumentation.Monitor.InstrumenationChartView.cs)2
-rw-r--r--main/src/tools/mdmonitor/gtk-gui/gui.stetic239
-rw-r--r--main/src/tools/mdmonitor/mdmonitor.csproj4
-rw-r--r--main/tests/MonoDevelop.CSharpBinding.Tests/Features/CodeCompletion/NR5/CodeCompletionBugTests.cs2
-rw-r--r--main/tests/MonoDevelop.CSharpBinding.Tests/Features/CodeCompletion/NR5/CompletionDataList.cs2
-rw-r--r--main/tests/MonoDevelop.CSharpBinding.Tests/Features/CodeCompletion/NR6/MiscTests.cs32
-rw-r--r--main/tests/MonoDevelop.CSharpBinding.Tests/Features/CodeCompletion/NR6/RegexContextHandlerTests.cs147
-rw-r--r--main/tests/MonoDevelop.CSharpBinding.Tests/Features/CodeCompletion/PortedRoslynTests/CompletionTestBase.cs6
-rw-r--r--main/tests/MonoDevelop.CSharpBinding.Tests/Features/InspectionActionTestBase.cs6
-rw-r--r--main/tests/MonoDevelop.CSharpBinding.Tests/MonoDevelop.CSharpBinding.Tests.csproj10
-rw-r--r--main/tests/UnitTests/MonoDevelop.CSharpBinding/MonodevelopWorkspaceTests.cs60
-rw-r--r--main/tests/UnitTests/MonoDevelop.CSharpBinding/TestViewContent.cs36
-rw-r--r--main/tests/UnitTests/MonoDevelop.CSharpBinding/TestWorkbenchWindow.cs18
-rw-r--r--main/tests/UnitTests/MonoDevelop.Ide.Templates/TestableWizardPage.cs2
-rw-r--r--main/tests/UnitTests/MonoDevelop.Projects/MSBuildProjectTests.cs43
-rw-r--r--main/tests/UnitTests/MonoDevelop.Projects/MSBuildTests.cs69
-rw-r--r--main/tests/UnitTests/UnitTests.csproj1
-rwxr-xr-xmain/tests/test-projects/console-project/ConsoleProject/ConsoleProject-conf-renamed.csproj48
-rwxr-xr-xmain/tests/test-projects/msbuild-tests/conditioned-properties.csproj2
-rwxr-xr-xmain/tests/test-projects/msbuild-tests/conditioned-properties1.targets2
-rwxr-xr-xmain/tests/test-projects/msbuild-tests/project-with-duplicated-conf-saved.csproj44
-rwxr-xr-xmain/tests/test-projects/msbuild-tests/project-with-duplicated-conf.csproj43
-rw-r--r--main/tests/test-projects/test-configuration-merging/TestConfigurationMerging2.csproj3
549 files changed, 6484 insertions, 7370 deletions
diff --git a/.gitignore b/.gitignore
index b51dc3a5d4..383dc80705 100644
--- a/.gitignore
+++ b/.gitignore
@@ -180,6 +180,7 @@ Thumbs.db
/main/contrib/ICSharpCode.NRefactory/Makefile
/main/src/addins/TextTemplating/Mono.TextTemplating.Tests/Makefile
/main/tests/MacPlatform.Tests/Makefile
+/main/tests/MonoDevelop.CSharpBinding.Tests/Makefile
/main/tests/MonoDevelop.MacDev.Tests/Makefile
/main/tests/UserInterfaceTests/Makefile
/main/src/addins/VersionControl/MonoDevelop.VersionControl.Git.Tests/Makefile
diff --git a/.gitmodules b/.gitmodules
index b4b4eb8ee8..9597b87b04 100644
--- a/.gitmodules
+++ b/.gitmodules
@@ -27,7 +27,7 @@
url = git://github.com/mono/guiunit.git
[submodule "main/external/fsharpbinding"]
path = main/external/fsharpbinding
- url = https://github.com/fsharp/xamarin-monodevelop-fsharp-addin.git
+ url = git://github.com/fsharp/xamarin-monodevelop-fsharp-addin.git
branch = master
[submodule "main/external/nuget-binary"]
path = main/external/nuget-binary
diff --git a/main/external/RefactoringEssentials b/main/external/RefactoringEssentials
-Subproject 6f1ffc5b25fad78fa33a6a84be808978a527be2
+Subproject 6dab9f85590417b36e81ecdf4374e743af2469b
diff --git a/main/external/debugger-libs b/main/external/debugger-libs
-Subproject 5be3f8a20c067427dfbad4ff196f40a64189191
+Subproject fc339ef4b095026ae8d05f8ac32bf2fc385dccd
diff --git a/main/external/fsharpbinding b/main/external/fsharpbinding
-Subproject f44872ceb9d4d914d0653538cae23d65daadc79
+Subproject f4577af51b9574de334357cbd4b97533f1cc1d2
diff --git a/main/src/addins/AspNet/Execution/XspOptionsPanel.cs b/main/src/addins/AspNet/Execution/XspOptionsPanel.cs
index eea37579a5..5a97bb0c15 100644
--- a/main/src/addins/AspNet/Execution/XspOptionsPanel.cs
+++ b/main/src/addins/AspNet/Execution/XspOptionsPanel.cs
@@ -29,7 +29,7 @@
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
-using Gtk;
+using MonoDevelop.Components;
using MonoDevelop.Ide.Gui.Dialogs;
using MonoDevelop.AspNet.Projects;
@@ -39,7 +39,7 @@ namespace MonoDevelop.AspNet.Execution
{
XspOptionsPanelWidget panel;
- public override Widget CreatePanelWidget ()
+ public override Control CreatePanelWidget ()
{
return panel = new XspOptionsPanelWidget (ConfiguredProject.GetService<AspNetAppProjectFlavor> ());
}
diff --git a/main/src/addins/AspNet/Projects/AspMvcProjectConfiguration.cs b/main/src/addins/AspNet/Projects/AspMvcProjectConfiguration.cs
index 743a6109fc..0043076fd7 100644
--- a/main/src/addins/AspNet/Projects/AspMvcProjectConfiguration.cs
+++ b/main/src/addins/AspNet/Projects/AspMvcProjectConfiguration.cs
@@ -36,9 +36,5 @@ namespace MonoDevelop.AspNet.Projects
public AspMvcProjectConfiguration (string name) : base (name)
{
}
-
- public AspMvcProjectConfiguration () : base ()
- {
- }
}
}
diff --git a/main/src/addins/AspNet/Projects/AspNetAppProjectConfiguration.cs b/main/src/addins/AspNet/Projects/AspNetAppProjectConfiguration.cs
index cc20b7151b..a48276e837 100644
--- a/main/src/addins/AspNet/Projects/AspNetAppProjectConfiguration.cs
+++ b/main/src/addins/AspNet/Projects/AspNetAppProjectConfiguration.cs
@@ -37,20 +37,8 @@ namespace MonoDevelop.AspNet.Projects
{
public class AspNetAppProjectConfiguration : DotNetProjectConfiguration
{
- public AspNetAppProjectConfiguration (string name) : base (name)
+ public AspNetAppProjectConfiguration (string id) : base (id)
{
}
-
- public AspNetAppProjectConfiguration ()
- {
- }
-
- public override void CopyFrom (ItemConfiguration configuration)
- {
- base.CopyFrom (configuration);
- var cfg = configuration as AspNetAppProjectConfiguration;
- if (cfg == null)
- return;
- }
}
}
diff --git a/main/src/addins/CBinding/Gui/CTextEditorExtension.cs b/main/src/addins/CBinding/Gui/CTextEditorExtension.cs
index f31b43b900..4faec18e12 100644
--- a/main/src/addins/CBinding/Gui/CTextEditorExtension.cs
+++ b/main/src/addins/CBinding/Gui/CTextEditorExtension.cs
@@ -645,7 +645,7 @@ namespace CBinding
public event EventHandler<DocumentPathChangedEventArgs> PathChanged;
- public Gtk.Widget CreatePathWidget (int index)
+ public Control CreatePathWidget (int index)
{
PathEntry[] path = CurrentPath;
if (null == path || 0 > index || path.Length <= index) {
diff --git a/main/src/addins/CBinding/Gui/CodeGenerationPanel.cs b/main/src/addins/CBinding/Gui/CodeGenerationPanel.cs
index 6740df3b2e..d67cb97309 100644
--- a/main/src/addins/CBinding/Gui/CodeGenerationPanel.cs
+++ b/main/src/addins/CBinding/Gui/CodeGenerationPanel.cs
@@ -351,7 +351,7 @@ namespace CBinding
{
private CodeGenerationPanel panel;
- public override Gtk.Widget CreatePanelWidget ()
+ public override Control CreatePanelWidget ()
{
return panel = new CodeGenerationPanel ();
}
diff --git a/main/src/addins/CBinding/Gui/CompilerPanel.cs b/main/src/addins/CBinding/Gui/CompilerPanel.cs
index 4beaa0e61a..ef7c6a283c 100644
--- a/main/src/addins/CBinding/Gui/CompilerPanel.cs
+++ b/main/src/addins/CBinding/Gui/CompilerPanel.cs
@@ -32,6 +32,7 @@
using System;
using Mono.Addins;
+using MonoDevelop.Components;
using MonoDevelop.Ide.Gui.Dialogs;
using MonoDevelop.Ide;
@@ -114,7 +115,7 @@ namespace CBinding
{
CompilerPanel panel;
- public override Gtk.Widget CreatePanelWidget ()
+ public override Control CreatePanelWidget ()
{
return panel = new CompilerPanel ((CProject)ConfiguredProject);
}
diff --git a/main/src/addins/CBinding/Gui/GeneralOptionsPanel.cs b/main/src/addins/CBinding/Gui/GeneralOptionsPanel.cs
index 5187231f59..2547577a97 100644
--- a/main/src/addins/CBinding/Gui/GeneralOptionsPanel.cs
+++ b/main/src/addins/CBinding/Gui/GeneralOptionsPanel.cs
@@ -34,6 +34,7 @@ using System.Collections.Generic;
using Mono.Addins;
+using MonoDevelop.Components;
using MonoDevelop.Core;
using MonoDevelop.Ide.Gui.Dialogs;
using MonoDevelop.Components;
@@ -184,7 +185,7 @@ namespace CBinding
{
private GeneralOptionsPanel panel;
- public override Gtk.Widget CreatePanelWidget ()
+ public override Control CreatePanelWidget ()
{
panel = new GeneralOptionsPanel ();
return panel;
diff --git a/main/src/addins/CBinding/Gui/OutputOptionsPanel.cs b/main/src/addins/CBinding/Gui/OutputOptionsPanel.cs
index cfa9fead06..f90f629a30 100644
--- a/main/src/addins/CBinding/Gui/OutputOptionsPanel.cs
+++ b/main/src/addins/CBinding/Gui/OutputOptionsPanel.cs
@@ -33,6 +33,7 @@ using System;
using Mono.Addins;
+using MonoDevelop.Components;
using MonoDevelop.Core;
using MonoDevelop.Ide.Projects;
using MonoDevelop.Ide.Gui.Dialogs;
@@ -93,7 +94,7 @@ namespace CBinding
{
private OutputOptionsPanel panel;
- public override Gtk.Widget CreatePanelWidget ()
+ public override Control CreatePanelWidget ()
{
return panel = new OutputOptionsPanel ();
}
diff --git a/main/src/addins/CBinding/Navigation/LanguageItemCommandHandler.cs b/main/src/addins/CBinding/Navigation/LanguageItemCommandHandler.cs
index 7c25253644..f2a98b2ccd 100644
--- a/main/src/addins/CBinding/Navigation/LanguageItemCommandHandler.cs
+++ b/main/src/addins/CBinding/Navigation/LanguageItemCommandHandler.cs
@@ -39,10 +39,10 @@ namespace CBinding.Navigation
{
public class LanguageItemCommandHandler : NodeCommandHandler
{
- public override void ActivateItem ()
+ public override async void ActivateItem ()
{
LanguageItem item = (LanguageItem)CurrentNode.DataItem;
- Document doc = IdeApp.Workbench.OpenDocument (item.File);
+ Document doc = await IdeApp.Workbench.OpenDocument (item.File);
//bool isMacro = item is Macro;
doc.Editor.CaretLocation = new DocumentLocation ((int)item.Line, 1); // TODO: get column?
diff --git a/main/src/addins/CBinding/Project/CProject.cs b/main/src/addins/CBinding/Project/CProject.cs
index bb475ca9bd..bc99d6d6a4 100644
--- a/main/src/addins/CBinding/Project/CProject.cs
+++ b/main/src/addins/CBinding/Project/CProject.cs
@@ -389,13 +389,9 @@ namespace CBinding
return conf.OutputDirectory.Combine (conf.CompiledOutputName);
}
- protected override SolutionItemConfiguration OnCreateConfiguration (string name, ConfigurationKind kind)
+ protected override SolutionItemConfiguration OnCreateConfiguration (string id, ConfigurationKind kind)
{
- CProjectConfiguration conf = new CProjectConfiguration ();
-
- conf.Name = name;
-
- return conf;
+ return new CProjectConfiguration (id);
}
public Language Language {
diff --git a/main/src/addins/CBinding/Project/CProjectConfiguration.cs b/main/src/addins/CBinding/Project/CProjectConfiguration.cs
index baf48b2a8a..63973e796f 100644
--- a/main/src/addins/CBinding/Project/CProjectConfiguration.cs
+++ b/main/src/addins/CBinding/Project/CProjectConfiguration.cs
@@ -101,6 +101,10 @@ namespace CBinding
[ItemProperty ("PrecompileHeaders", DefaultValue=true)]
private bool precompileHeaders = true;
+
+ public CProjectConfiguration (string id) : base (id)
+ {
+ }
public string Output {
get { return output; }
@@ -205,9 +209,9 @@ namespace CBinding
set { define_symbols = value; }
}
- public override void CopyFrom (ItemConfiguration configuration)
+ protected override void OnCopyFrom (ItemConfiguration configuration, bool isRename)
{
- base.CopyFrom (configuration);
+ base.OnCopyFrom (configuration, isRename);
CProjectConfiguration conf = (CProjectConfiguration)configuration;
output = conf.output;
diff --git a/main/src/addins/CSharpBinding/CSharpBinding.addin.xml b/main/src/addins/CSharpBinding/CSharpBinding.addin.xml
index 2aa367529d..3f584b9f69 100644
--- a/main/src/addins/CSharpBinding/CSharpBinding.addin.xml
+++ b/main/src/addins/CSharpBinding/CSharpBinding.addin.xml
@@ -129,6 +129,7 @@
<Class fileExtensions = ".cs" class = "MonoDevelop.CSharp.PathedDocumentTextEditorExtension" />
<Class fileExtensions = ".cs" class = "MonoDevelop.CSharp.UnitTestTextEditorExtension" />
<Class fileExtensions = ".cs" class = "MonoDevelop.CSharp.ClassOutline.CSharpOutlineTextEditorExtension" />
+ <Class fileExtensions = ".cs" class = "MonoDevelop.CSharp.CSharpNavigationTextEditorExtension" />
<Class fileExtensions = ".json" class = "MonoDevelop.JSon.JSonTextEditorExtension" />
<Class class = "MonoDevelop.CSharp.Refactoring.CSharpFeaturesTextEditorExtension" />
</Extension>
diff --git a/main/src/addins/CSharpBinding/CSharpBinding.csproj b/main/src/addins/CSharpBinding/CSharpBinding.csproj
index b91a8cab8d..41c4e4b5cd 100644
--- a/main/src/addins/CSharpBinding/CSharpBinding.csproj
+++ b/main/src/addins/CSharpBinding/CSharpBinding.csproj
@@ -782,6 +782,7 @@
<Compile Include="MonoDevelop.CSharp.CodeRefactorings\CSharpSyntaxContext.cs" />
<Compile Include="MonoDevelop.CSharp.CodeRefactorings\TypeGuessing.cs" />
<Compile Include="MonoDevelop.CSharp.CodeRefactorings\Resources.cs" />
+ <Compile Include="MonoDevelop.CSharp\CSharpNavigationTextEditorExtension.cs" />
<Compile Include="MonoDevelop.CSharp.Features\EncapsulateField\AbstractEncapsulateFieldRefactoringProvider.cs" />
<Compile Include="MonoDevelop.CSharp.Features\EncapsulateField\AbstractEncapsulateFieldService.cs" />
<Compile Include="MonoDevelop.CSharp.Features\EncapsulateField\EncapsulateFieldCodeAction.cs" />
@@ -792,6 +793,7 @@
<Compile Include="Util\ConflictResolver.cs" />
<Compile Include="Util\AccessibilityUtilities.cs" />
<Compile Include="Util\Glyph.cs" />
+ <Compile Include="MonoDevelop.CSharp.Features\Completion\ContextHandler\RegexContextHandler.cs" />
</ItemGroup>
<ItemGroup>
<None Include="Makefile.am" />
diff --git a/main/src/addins/CSharpBinding/MonoDevelop.CSharp.CodeFixes/AddImport/AbstractAddImportCodeFixProvider.cs b/main/src/addins/CSharpBinding/MonoDevelop.CSharp.CodeFixes/AddImport/AbstractAddImportCodeFixProvider.cs
index 1f9da9c11b..eda711eb5d 100644
--- a/main/src/addins/CSharpBinding/MonoDevelop.CSharp.CodeFixes/AddImport/AbstractAddImportCodeFixProvider.cs
+++ b/main/src/addins/CSharpBinding/MonoDevelop.CSharp.CodeFixes/AddImport/AbstractAddImportCodeFixProvider.cs
@@ -72,8 +72,8 @@ namespace MonoDevelop.CSharp.CodeFixes
if (this.CanAddImport(node, cancellationToken))
{
var semanticModel = await document.GetSemanticModelAsync(cancellationToken).ConfigureAwait(false);
- var containingType = semanticModel.GetEnclosingNamedType(node.SpanStart, cancellationToken);
- var containingTypeOrAssembly = containingType ?? (ISymbol)semanticModel.Compilation.Assembly;
+ //var containingType = semanticModel.GetEnclosingNamedType(node.SpanStart, cancellationToken);
+ //var containingTypeOrAssembly = containingType ?? (ISymbol)semanticModel.Compilation.Assembly;
var namespacesInScope = this.GetNamespacesInScope(semanticModel, node, cancellationToken);
var matchingTypesNamespaces = await this.GetNamespacesForMatchingTypesAsync(project, diagnostic, node, semanticModel, namespacesInScope, cancellationToken).ConfigureAwait(false);
diff --git a/main/src/addins/CSharpBinding/MonoDevelop.CSharp.CodeFixes/FullyQualify/CSharpFullyQualifyCodeFixProvider.cs b/main/src/addins/CSharpBinding/MonoDevelop.CSharp.CodeFixes/FullyQualify/CSharpFullyQualifyCodeFixProvider.cs
index 520e0578d7..83d779f9b3 100644
--- a/main/src/addins/CSharpBinding/MonoDevelop.CSharp.CodeFixes/FullyQualify/CSharpFullyQualifyCodeFixProvider.cs
+++ b/main/src/addins/CSharpBinding/MonoDevelop.CSharp.CodeFixes/FullyQualify/CSharpFullyQualifyCodeFixProvider.cs
@@ -296,7 +296,6 @@ namespace MonoDevelop.CSharp.CodeFixes.FullyQualify
private static readonly ConditionalWeakTable<INamespaceOrTypeSymbol, IList<string>> s_symbolToNameMap =
new ConditionalWeakTable<INamespaceOrTypeSymbol, IList<string>>();
- private static readonly ConditionalWeakTable<INamespaceOrTypeSymbol, IList<string>>.CreateValueCallback s_getNameParts = GetNameParts;
private static IList<string> GetNameParts(INamespaceOrTypeSymbol symbol)
{
diff --git a/main/src/addins/CSharpBinding/MonoDevelop.CSharp.CodeFixes/GenerateConstructor/AbstractGenerateMemberCodeFixProvider.cs b/main/src/addins/CSharpBinding/MonoDevelop.CSharp.CodeFixes/GenerateConstructor/AbstractGenerateMemberCodeFixProvider.cs
index 5de611e013..1c735ea833 100644
--- a/main/src/addins/CSharpBinding/MonoDevelop.CSharp.CodeFixes/GenerateConstructor/AbstractGenerateMemberCodeFixProvider.cs
+++ b/main/src/addins/CSharpBinding/MonoDevelop.CSharp.CodeFixes/GenerateConstructor/AbstractGenerateMemberCodeFixProvider.cs
@@ -47,7 +47,7 @@ namespace MonoDevelop.CSharp.CodeFixes.GenerateConstructor
public sealed override async Task RegisterCodeFixesAsync(CodeFixContext context)
{
// NOTE(DustinCa): Not supported in REPL for now.
- if (context.Document.SourceCodeKind == SourceCodeKind.Interactive)
+ if (context.Document.SourceCodeKind == SourceCodeKind.Script)
{
return;
}
diff --git a/main/src/addins/CSharpBinding/MonoDevelop.CSharp.CodeFixes/ImplementAbstractClass/ImplementAbstractClassCodeFixProvider.cs b/main/src/addins/CSharpBinding/MonoDevelop.CSharp.CodeFixes/ImplementAbstractClass/ImplementAbstractClassCodeFixProvider.cs
index 50f93e61f4..25c8b7f949 100644
--- a/main/src/addins/CSharpBinding/MonoDevelop.CSharp.CodeFixes/ImplementAbstractClass/ImplementAbstractClassCodeFixProvider.cs
+++ b/main/src/addins/CSharpBinding/MonoDevelop.CSharp.CodeFixes/ImplementAbstractClass/ImplementAbstractClassCodeFixProvider.cs
@@ -63,7 +63,7 @@ namespace MonoDevelop.CSharp.CodeFixes.ImplementAbstractClass
{
var title = GettextCatalog.GetString ("Implement Abstract Class");
var abstractType = model.GetTypeInfo(node, context.CancellationToken).Type;
- var id = GetCodeActionId(abstractType.ContainingAssembly.Name, abstractType.ToDisplayString(SymbolDisplayFormat.FullyQualifiedFormat));
+ //var id = GetCodeActionId(abstractType.ContainingAssembly.Name, abstractType.ToDisplayString(SymbolDisplayFormat.FullyQualifiedFormat));
context.RegisterCodeFix(
new DocumentChangeAction(node.Span, DiagnosticSeverity.Error, title,
(c) => ImplementAbstractClassAsync(context.Document, node, c)),
diff --git a/main/src/addins/CSharpBinding/MonoDevelop.CSharp.CodeGeneration/GenerateCodeWindow.cs b/main/src/addins/CSharpBinding/MonoDevelop.CSharp.CodeGeneration/GenerateCodeWindow.cs
index c6a67ccadc..600d197bab 100644
--- a/main/src/addins/CSharpBinding/MonoDevelop.CSharp.CodeGeneration/GenerateCodeWindow.cs
+++ b/main/src/addins/CSharpBinding/MonoDevelop.CSharp.CodeGeneration/GenerateCodeWindow.cs
@@ -134,10 +134,10 @@ namespace MonoDevelop.CodeGeneration
GetSize (out w, out h);
int myMonitor = Screen.GetMonitorAtPoint (x, y);
- Gdk.Rectangle geometry = DesktopService.GetUsableMonitorGeometry (Screen, myMonitor);
+ Xwt.Rectangle geometry = DesktopService.GetUsableMonitorGeometry (Screen.Number, myMonitor);
if (x + w > geometry.Right)
- x = geometry.Right - w;
+ x = (int)geometry.Right - w;
if (y + h > geometry.Bottom)
y = y - completionContext.TriggerTextHeight - h;
diff --git a/main/src/addins/CSharpBinding/MonoDevelop.CSharp.CodeRefactorings/InlineTemporary/InlineTemporaryCodeRefactoringProvider.InitializerRewriter.cs b/main/src/addins/CSharpBinding/MonoDevelop.CSharp.CodeRefactorings/InlineTemporary/InlineTemporaryCodeRefactoringProvider.InitializerRewriter.cs
index e6866a9f25..6ab7a54616 100644
--- a/main/src/addins/CSharpBinding/MonoDevelop.CSharp.CodeRefactorings/InlineTemporary/InlineTemporaryCodeRefactoringProvider.InitializerRewriter.cs
+++ b/main/src/addins/CSharpBinding/MonoDevelop.CSharp.CodeRefactorings/InlineTemporary/InlineTemporaryCodeRefactoringProvider.InitializerRewriter.cs
@@ -22,13 +22,11 @@ namespace MonoDevelop.CSharp.CodeRefactorings.InlineTemporary
{
private readonly SemanticModel _semanticModel;
private readonly ILocalSymbol _localSymbol;
- private readonly ExpressionSyntax _initializer;
private InitializerRewriter(ExpressionSyntax initializer, ILocalSymbol localSymbol, SemanticModel semanticModel)
{
_semanticModel = semanticModel;
_localSymbol = localSymbol;
- _initializer = initializer;
}
private bool IsReference(SimpleNameSyntax name)
diff --git a/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Completion/CSharpCompletionTextEditorExtension.cs b/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Completion/CSharpCompletionTextEditorExtension.cs
index ae54ad6843..dce6229d79 100644
--- a/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Completion/CSharpCompletionTextEditorExtension.cs
+++ b/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Completion/CSharpCompletionTextEditorExtension.cs
@@ -473,8 +473,7 @@ namespace MonoDevelop.CSharp.Completion
} catch (OperationCanceledException) {
return null;
} catch (AggregateException e) {
- foreach (var inner in e.Flatten ().InnerExceptions)
- LoggingService.LogError ("Error while getting C# recommendations", inner);
+ e.Flatten ().Handle (f => f is OperationCanceledException);
} catch (Exception e) {
LoggingService.LogError ("Error while getting C# recommendations", e);
}
diff --git a/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Completion/EventCreationCompletionData.cs b/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Completion/EventCreationCompletionData.cs
index e642c485ce..c70fbf608c 100644
--- a/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Completion/EventCreationCompletionData.cs
+++ b/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Completion/EventCreationCompletionData.cs
@@ -52,9 +52,7 @@ namespace MonoDevelop.CSharp.Completion
{
readonly RoslynCodeCompletionFactory factory;
readonly ITypeSymbol delegateType;
- readonly INamedTypeSymbol curType;
- readonly string varName;
-
+
public override Task<TooltipInformation> CreateTooltipInformation (bool smartWrap, CancellationToken token)
{
return Task.FromResult (new TooltipInformation ());
@@ -62,8 +60,6 @@ namespace MonoDevelop.CSharp.Completion
public EventCreationCompletionData (ICompletionDataKeyHandler keyHandler, RoslynCodeCompletionFactory factory, ITypeSymbol delegateType, string varName, INamedTypeSymbol curType) : base (keyHandler)
{
- this.curType = curType;
- this.varName = varName;
this.DisplayText = varName;
this.delegateType = delegateType;
this.factory = factory;
@@ -97,7 +93,7 @@ namespace MonoDevelop.CSharp.Completion
var options = new InsertionModeOptions (
GettextCatalog.GetString ("Create new method"),
insertionPoints,
- async point => {
+ point => {
if (!point.Success)
return;
var indent = "\t";
diff --git a/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Completion/RoslynCodeCompletionFactory.cs b/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Completion/RoslynCodeCompletionFactory.cs
index 201f1e6259..8c02c6a3ab 100644
--- a/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Completion/RoslynCodeCompletionFactory.cs
+++ b/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Completion/RoslynCodeCompletionFactory.cs
@@ -75,8 +75,7 @@ namespace MonoDevelop.CSharp.Completion
ISymbolCompletionData ICompletionDataFactory.CreateEnumMemberCompletionData (ICompletionDataKeyHandler keyHandler, ISymbol alias, IFieldSymbol field)
{
- var model = ext.ParsedDocument.GetAst<SemanticModel> ();
- return new RoslynSymbolCompletionData (keyHandler, this, field, RoslynCompletionData.SafeMinimalDisplayString (alias ?? field.Type, model, ext.Editor.CaretOffset, Ambience.NameFormat) + "." + field.Name);
+ return new RoslynSymbolCompletionData (keyHandler, this, field, RoslynCompletionData.SafeMinimalDisplayString (alias ?? field.Type, semanticModel, ext.Editor.CaretOffset, Ambience.NameFormat) + "." + field.Name);
}
class FormatItemCompletionData : RoslynCompletionData
@@ -137,7 +136,6 @@ namespace MonoDevelop.CSharp.Completion
class XmlDocCompletionData : RoslynCompletionData
{
//readonly CSharpCompletionTextEditorExtension ext;
- readonly string title;
/*
#region IListData implementation
@@ -156,7 +154,7 @@ namespace MonoDevelop.CSharp.Completion
public XmlDocCompletionData (ICompletionDataKeyHandler keyHandler, RoslynCodeCompletionFactory ext, string title, string description, string insertText) : base (keyHandler, title, "md-keyword", description, insertText ?? title)
{
// this.ext = ext;
- this.title = title;
+ //this.title = title;
}
// public override TooltipInformation CreateTooltipInformation (bool smartWrap)
// {
diff --git a/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Completion/RoslynCompletionData.cs b/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Completion/RoslynCompletionData.cs
index 0ff1c133b9..719c867cf6 100644
--- a/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Completion/RoslynCompletionData.cs
+++ b/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Completion/RoslynCompletionData.cs
@@ -77,7 +77,7 @@ namespace MonoDevelop.CSharp.Completion
return symbol.ToMinimalDisplayString (semanticModel, position, format);
} catch (ArgumentOutOfRangeException) {
try {
- return symbol.ToMinimalDisplayString (semanticModel, 0, format);
+ return symbol.ToMinimalDisplayString (semanticModel, semanticModel.SyntaxTree.Length / 2, format);
} catch (ArgumentOutOfRangeException) {
return symbol.Name;
}
diff --git a/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Diagnostics/InconsistentNaming/NameConventionPanel.cs b/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Diagnostics/InconsistentNaming/NameConventionPanel.cs
index e91a6242ba..b71b916792 100644
--- a/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Diagnostics/InconsistentNaming/NameConventionPanel.cs
+++ b/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Diagnostics/InconsistentNaming/NameConventionPanel.cs
@@ -25,7 +25,7 @@
// THE SOFTWARE.
using System;
using MonoDevelop.Ide.Gui.Dialogs;
-using Gtk;
+using MonoDevelop.Components;
using MonoDevelop.Core;
using MonoDevelop.Ide.Editor;
@@ -47,7 +47,7 @@ namespace MonoDevelop.CSharp.Diagnostics.InconsistentNaming
}
}
- public override Widget CreatePanelWidget ()
+ public override Control CreatePanelWidget ()
{
panel = new NameConventionPanelWidget ();
panel.PolicyChanged += delegate {
diff --git a/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Diagnostics/RemoveUnnecessaryImports/CSharpRemoveUnnecessaryImportsDiagnosticAnalyzer.cs b/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Diagnostics/RemoveUnnecessaryImports/CSharpRemoveUnnecessaryImportsDiagnosticAnalyzer.cs
index 4ae9b07748..30c1046d09 100644
--- a/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Diagnostics/RemoveUnnecessaryImports/CSharpRemoveUnnecessaryImportsDiagnosticAnalyzer.cs
+++ b/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Diagnostics/RemoveUnnecessaryImports/CSharpRemoveUnnecessaryImportsDiagnosticAnalyzer.cs
@@ -32,7 +32,7 @@ namespace MonoDevelop.CSharp.Diagnostics.RemoveUnnecessaryImports
protected override IEnumerable<TextSpan> GetFixableDiagnosticSpans(IEnumerable<SyntaxNode> nodes, SyntaxTree tree, CancellationToken cancellationToken = default(CancellationToken))
{
- var nodesContainingUnnecessaryUsings = new HashSet<SyntaxNode>();
+ //var nodesContainingUnnecessaryUsings = new HashSet<SyntaxNode>();
foreach (var node in nodes) {
yield return node.Span;
// var nodeContainingUnnecessaryUsings = node.GetAncestors().First(n => n is NamespaceDeclarationSyntax || n is CompilationUnitSyntax);
diff --git a/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Diagnostics/RemoveUnnecessaryImports/RemoveUnnecessaryImportsDiagnosticAnalyzerBase.cs b/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Diagnostics/RemoveUnnecessaryImports/RemoveUnnecessaryImportsDiagnosticAnalyzerBase.cs
index 95e005836b..338c130b6f 100644
--- a/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Diagnostics/RemoveUnnecessaryImports/RemoveUnnecessaryImportsDiagnosticAnalyzerBase.cs
+++ b/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Diagnostics/RemoveUnnecessaryImports/RemoveUnnecessaryImportsDiagnosticAnalyzerBase.cs
@@ -23,12 +23,12 @@ namespace MonoDevelop.CSharp.Diagnostics.RemoveUnnecessaryImports
// The NotConfigurable custom tag ensures that user can't turn this diagnostic into a warning / error via
// ruleset editor or solution explorer. Setting messageFormat to empty string ensures that we won't display
// this diagnostic in the preview pane header.
- private static readonly DiagnosticDescriptor s_fixableIdDescriptor =
- new DiagnosticDescriptor(DiagnosticFixableId,
- title: "", messageFormat: "", category: "",
- defaultSeverity: DiagnosticSeverity.Hidden,
- isEnabledByDefault: true,
- customTags: WellKnownDiagnosticTags.NotConfigurable);
+ //private static readonly DiagnosticDescriptor s_fixableIdDescriptor =
+ // new DiagnosticDescriptor(DiagnosticFixableId,
+ // title: "", messageFormat: "", category: "",
+ // defaultSeverity: DiagnosticSeverity.Hidden,
+ // isEnabledByDefault: true,
+ // customTags: WellKnownDiagnosticTags.NotConfigurable);
protected abstract LocalizableString GetTitleAndMessageFormatForClassificationIdDescriptor();
diff --git a/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Diagnostics/SimplifyTypeNames/SimplifyTypeNamesDiagnosticAnalyzerBase.cs b/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Diagnostics/SimplifyTypeNames/SimplifyTypeNamesDiagnosticAnalyzerBase.cs
index ad6108b386..6734509864 100644
--- a/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Diagnostics/SimplifyTypeNames/SimplifyTypeNamesDiagnosticAnalyzerBase.cs
+++ b/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Diagnostics/SimplifyTypeNames/SimplifyTypeNamesDiagnosticAnalyzerBase.cs
@@ -47,7 +47,6 @@ namespace MonoDevelop.CSharp.Diagnostics.SimplifyTypeNames
isEnabledByDefault: true,
customTags: DiagnosticCustomTags.Unnecessary);
- private OptionSet _lazyDefaultOptionSet;
public override ImmutableArray<DiagnosticDescriptor> SupportedDiagnostics
{
diff --git a/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Features/CodeGeneration/CSharpCodeGenerationService.cs b/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Features/CodeGeneration/CSharpCodeGenerationService.cs
index fda0ff8cd7..6f633412fe 100644
--- a/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Features/CodeGeneration/CSharpCodeGenerationService.cs
+++ b/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Features/CodeGeneration/CSharpCodeGenerationService.cs
@@ -179,7 +179,7 @@ namespace ICSharpCode.NRefactory6.CSharp.CodeGeneration
/// <summary>
/// Returns a newly created event declaration node from the provided event.
- /// </summary
+ /// </summary>
public SyntaxNode CreateEventDeclaration(IEventSymbol @event, CodeGenerationDestination destination = CodeGenerationDestination.Unspecified)
{
try {
diff --git a/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Features/Completion/CompletionEngine.cs b/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Features/Completion/CompletionEngine.cs
index dc39adc9e0..2a04fd96f8 100644
--- a/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Features/Completion/CompletionEngine.cs
+++ b/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Features/Completion/CompletionEngine.cs
@@ -59,11 +59,10 @@ namespace ICSharpCode.NRefactory6.CSharp.Completion
new ObjectCreationContextHandler(),
new SenderCompletionContextHandler(),
new CastCompletionContextHandler(),
- new PreProcessorExpressionContextHandler()
+ new PreProcessorExpressionContextHandler(),
+ new RegexContextHandler()
};
- static readonly ICompletionDataKeyHandler DefaultKeyHandler = new RoslynRecommendationsCompletionContextHandler ();
-
readonly ICompletionDataFactory factory;
readonly Workspace workspace;
diff --git a/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Features/Completion/ContextHandler/AttributeNamedParameterContextHandler.cs b/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Features/Completion/ContextHandler/AttributeNamedParameterContextHandler.cs
index 3376e1eda3..6c26f80cec 100644
--- a/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Features/Completion/ContextHandler/AttributeNamedParameterContextHandler.cs
+++ b/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Features/Completion/ContextHandler/AttributeNamedParameterContextHandler.cs
@@ -86,11 +86,11 @@ namespace ICSharpCode.NRefactory6.CSharp.Completion
return nameColonItems.Concat(nameEqualsItems);
}
- protected async Task<bool> IsExclusiveAsync(Document document, int caretPosition, CompletionTriggerInfo triggerInfo, CancellationToken cancellationToken)
+ public override async Task<bool> IsExclusiveAsync(Document document, int position, CompletionTriggerInfo triggerInfo, CancellationToken cancellationToken)
{
var syntaxTree = await document.GetCSharpSyntaxTreeAsync(cancellationToken).ConfigureAwait(false);
- var token = syntaxTree.FindTokenOnLeftOfPosition(caretPosition, cancellationToken)
- .GetPreviousTokenIfTouchingWord(caretPosition);
+ var token = syntaxTree.FindTokenOnLeftOfPosition(position, cancellationToken)
+ .GetPreviousTokenIfTouchingWord(position);
return IsAfterNameColonArgument(token) || IsAfterNameEqualsArgument(token);
}
diff --git a/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Features/Completion/ContextHandler/CastCompletionContextHandler.cs b/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Features/Completion/ContextHandler/CastCompletionContextHandler.cs
index 9332cb2ee2..ba003bdc26 100644
--- a/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Features/Completion/ContextHandler/CastCompletionContextHandler.cs
+++ b/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Features/Completion/ContextHandler/CastCompletionContextHandler.cs
@@ -40,25 +40,25 @@ namespace ICSharpCode.NRefactory6.CSharp.Completion
{
class CastCompletionContextHandler : CompletionContextHandler
{
- protected async override Task<IEnumerable<CompletionData>> GetItemsWorkerAsync (CompletionResult completionResult, CompletionEngine engine, CompletionContext completionContext, CompletionTriggerInfo info, SyntaxContext ctx, CancellationToken cancellationToken)
+ protected override Task<IEnumerable<CompletionData>> GetItemsWorkerAsync (CompletionResult completionResult, CompletionEngine engine, CompletionContext completionContext, CompletionTriggerInfo info, SyntaxContext ctx, CancellationToken cancellationToken)
{
var position = completionContext.Position;
var document = completionContext.Document;
var syntaxTree = ctx.SyntaxTree;
if (syntaxTree.IsInNonUserCode(position, cancellationToken) ||
syntaxTree.IsPreProcessorDirectiveContext(position, cancellationToken))
- return Enumerable.Empty<CompletionData> ();
+ return Task.FromResult (Enumerable.Empty<CompletionData> ());
if (!syntaxTree.IsRightOfDotOrArrowOrColonColon(position, cancellationToken))
- return Enumerable.Empty<CompletionData> ();
+ return Task.FromResult (Enumerable.Empty<CompletionData> ());
var ma = ctx.LeftToken.Parent as MemberAccessExpressionSyntax;
if (ma == null)
- return Enumerable.Empty<CompletionData> ();
+ return Task.FromResult (Enumerable.Empty<CompletionData> ());
var model = ctx.CSharpSyntaxContext.SemanticModel;
var symbolInfo = model.GetSymbolInfo (ma.Expression);
if (symbolInfo.Symbol == null)
- return Enumerable.Empty<CompletionData> ();
+ return Task.FromResult (Enumerable.Empty<CompletionData> ());
var list = new List<CompletionData> ();
var within = model.GetEnclosingNamedTypeOrAssembly(position, cancellationToken);
@@ -78,7 +78,7 @@ namespace ICSharpCode.NRefactory6.CSharp.Completion
}
}
- return list;
+ return Task.FromResult ((IEnumerable<CompletionData>)list);
}
void Analyze (CompletionEngine engine, SyntaxNode node, ITypeSymbol type, ISymbol within, List<CompletionData> list, HashSet<string> addedSymbols, CancellationToken cancellationToken)
diff --git a/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Features/Completion/ContextHandler/DelegateCreationContextHandler.cs b/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Features/Completion/ContextHandler/DelegateCreationContextHandler.cs
index f585ea1e97..80cda00dcf 100644
--- a/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Features/Completion/ContextHandler/DelegateCreationContextHandler.cs
+++ b/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Features/Completion/ContextHandler/DelegateCreationContextHandler.cs
@@ -71,7 +71,7 @@ namespace ICSharpCode.NRefactory6.CSharp.Completion
return ch == '(' || ch == '[' || ch == ',' || IsTriggerAfterSpaceOrStartOfWordCharacter (text, position);
}
- protected async override Task<IEnumerable<CompletionData>> GetItemsWorkerAsync (CompletionResult result, CompletionEngine engine, CompletionContext completionContext, CompletionTriggerInfo info, SyntaxContext ctx, CancellationToken cancellationToken)
+ protected override Task<IEnumerable<CompletionData>> GetItemsWorkerAsync (CompletionResult result, CompletionEngine engine, CompletionContext completionContext, CompletionTriggerInfo info, SyntaxContext ctx, CancellationToken cancellationToken)
{
var document = completionContext.Document;
var position = completionContext.Position;
@@ -79,10 +79,10 @@ namespace ICSharpCode.NRefactory6.CSharp.Completion
var tree = ctx.SyntaxTree;
var model = ctx.SemanticModel;
if (tree.IsInNonUserCode (position, cancellationToken))
- return Enumerable.Empty<CompletionData> ();
+ return Task.FromResult (Enumerable.Empty<CompletionData> ());
if (!ctx.CSharpSyntaxContext.IsAnyExpressionContext)
- return Enumerable.Empty<CompletionData> ();
+ return Task.FromResult (Enumerable.Empty<CompletionData> ());
var enclosingType = model.GetEnclosingNamedType (position, cancellationToken);
var memberMethods = enclosingType.GetMembers ().OfType<IMethodSymbol> ().Where (m => m.MethodKind == MethodKind.Ordinary).ToArray ();
@@ -104,7 +104,7 @@ namespace ICSharpCode.NRefactory6.CSharp.Completion
if (list.Count > 0) {
result.AutoSelect = false;
}
- return list;
+ return Task.FromResult ((IEnumerable<CompletionData>)list);
}
void AddCompatibleMethods (CompletionEngine engine, List<CompletionData> list, ITypeSymbol delegateType, IMethodSymbol [] memberMethods, CancellationToken cancellationToken)
diff --git a/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Features/Completion/ContextHandler/KeywordContextHandler.cs b/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Features/Completion/ContextHandler/KeywordContextHandler.cs
index c060cb54dc..c8287f48e7 100644
--- a/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Features/Completion/ContextHandler/KeywordContextHandler.cs
+++ b/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Features/Completion/ContextHandler/KeywordContextHandler.cs
@@ -201,19 +201,19 @@ namespace ICSharpCode.NRefactory6.CSharp.Completion
IsStartingNewWord (text, position);
}
- protected async override Task<IEnumerable<CompletionData>> GetItemsWorkerAsync (CompletionResult completionResult, CompletionEngine engine, CompletionContext completionContext, CompletionTriggerInfo info, SyntaxContext ctx, CancellationToken cancellationToken)
+ protected override Task<IEnumerable<CompletionData>> GetItemsWorkerAsync (CompletionResult completionResult, CompletionEngine engine, CompletionContext completionContext, CompletionTriggerInfo info, SyntaxContext ctx, CancellationToken cancellationToken)
{
var model = ctx.SemanticModel;
if (ctx.CSharpSyntaxContext.IsInNonUserCode) {
- return Enumerable.Empty<CompletionData> ();
+ return Task.FromResult (Enumerable.Empty<CompletionData> ());
}
if (ctx.TargetToken.IsKind (SyntaxKind.OverrideKeyword))
- return Enumerable.Empty<CompletionData> ();
+ return Task.FromResult (Enumerable.Empty<CompletionData> ());
if (info.CompletionTriggerReason == CompletionTriggerReason.CharTyped && info.TriggerCharacter == ' ') {
if (!ctx.CSharpSyntaxContext.IsEnumBaseListContext && !ctx.LeftToken.IsKind (SyntaxKind.EqualsToken) && !ctx.LeftToken.IsKind (SyntaxKind.EqualsEqualsToken))
- return Enumerable.Empty<CompletionData> ();
+ return Task.FromResult (Enumerable.Empty<CompletionData> ());
// completionResult.AutoCompleteEmptyMatch = false;
}
@@ -237,7 +237,7 @@ namespace ICSharpCode.NRefactory6.CSharp.Completion
// if (parent.IsKind(SyntaxKind.TypeParameterConstraintClause)) {
// result.Add(factory.CreateGenericData (this, "new()", GenericDataType.PreprocessorKeyword));
// }
- return result;
+ return Task.FromResult ((IEnumerable<CompletionData>)result);
}
}
diff --git a/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Features/Completion/ContextHandler/OverrideContextHandler.cs b/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Features/Completion/ContextHandler/OverrideContextHandler.cs
index f26551a91b..f54840e40d 100644
--- a/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Features/Completion/ContextHandler/OverrideContextHandler.cs
+++ b/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Features/Completion/ContextHandler/OverrideContextHandler.cs
@@ -289,26 +289,23 @@ namespace ICSharpCode.NRefactory6.CSharp.Completion
//modifiers = new DeclarationModifiers();
seenAccessibility = Accessibility.NotApplicable;
var overrideToken = default(SyntaxToken);
- bool isUnsafe = false;
- bool isSealed = false;
- bool isAbstract = false;
while (IsOnStartLine(token.SpanStart, text, startLine) && !token.IsKind(SyntaxKind.None))
{
switch (token.Kind())
{
- case SyntaxKind.UnsafeKeyword:
- isUnsafe = true;
- break;
+ //case SyntaxKind.UnsafeKeyword:
+ // isUnsafe = true;
+ //break;
case SyntaxKind.OverrideKeyword:
overrideToken = token;
break;
- case SyntaxKind.SealedKeyword:
- isSealed = true;
- break;
- case SyntaxKind.AbstractKeyword:
- isAbstract = true;
- break;
+ //case SyntaxKind.SealedKeyword:
+ // isSealed = true;
+ //break;
+ //case SyntaxKind.AbstractKeyword:
+ // isAbstract = true;
+ //break;
case SyntaxKind.ExternKeyword:
break;
diff --git a/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Features/Completion/ContextHandler/PartialContextHandler.cs b/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Features/Completion/ContextHandler/PartialContextHandler.cs
index b0224681aa..4e1b31e6e8 100644
--- a/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Features/Completion/ContextHandler/PartialContextHandler.cs
+++ b/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Features/Completion/ContextHandler/PartialContextHandler.cs
@@ -45,7 +45,7 @@ namespace ICSharpCode.NRefactory6.CSharp.Completion
return IsTriggerAfterSpaceOrStartOfWordCharacter (text, position);
}
- protected async override Task<IEnumerable<CompletionData>> GetItemsWorkerAsync (CompletionResult completionResult, CompletionEngine engine, CompletionContext completionContext, CompletionTriggerInfo info, SyntaxContext ctx, CancellationToken cancellationToken)
+ protected override Task<IEnumerable<CompletionData>> GetItemsWorkerAsync (CompletionResult completionResult, CompletionEngine engine, CompletionContext completionContext, CompletionTriggerInfo info, SyntaxContext ctx, CancellationToken cancellationToken)
{
var document = completionContext.Document;
var position = completionContext.Position;
@@ -59,17 +59,17 @@ namespace ICSharpCode.NRefactory6.CSharp.Completion
// Only inside classes and structs
if (enclosingSymbol == null || !(enclosingSymbol.TypeKind == TypeKind.Struct || enclosingSymbol.TypeKind == TypeKind.Class)) {
- return Enumerable.Empty<CompletionData> ();
+ return Task.FromResult (Enumerable.Empty<CompletionData> ());
}
if (!IsPartialCompletionContext (tree, position, cancellationToken/*, out modifiers*/, out token)) {
if (enclosingSymbol != null && (token.IsKind (SyntaxKind.OpenBraceToken) || token.IsKind (SyntaxKind.CloseBraceToken) || token.IsKind (SyntaxKind.SemicolonToken))) {
- return CreateCompletionData (engine, semanticModel, position, enclosingSymbol, token, false, cancellationToken);
+ return Task.FromResult (CreateCompletionData (engine, semanticModel, position, enclosingSymbol, token, false, cancellationToken));
}
- return Enumerable.Empty<CompletionData> ();
+ return Task.FromResult (Enumerable.Empty<CompletionData> ());
}
- return CreateCompletionData (engine, semanticModel, position, enclosingSymbol, token, true, cancellationToken);
+ return Task.FromResult (CreateCompletionData (engine, semanticModel, position, enclosingSymbol, token, true, cancellationToken));
}
protected virtual IEnumerable<CompletionData> CreateCompletionData (CompletionEngine engine, SemanticModel semanticModel, int position, INamedTypeSymbol enclosingType, SyntaxToken token, bool afterPartialKeyword, CancellationToken cancellationToken)
@@ -142,7 +142,7 @@ namespace ICSharpCode.NRefactory6.CSharp.Completion
var token = touchingToken.GetPreviousToken();
bool foundPartial = touchingToken.IsKindOrHasMatchingText(SyntaxKind.PartialKeyword);
- bool foundAsync = false;
+ //bool foundAsync = false;
while (IsOnSameLine(token, touchingToken, tree.GetText(cancellationToken)))
{
@@ -152,10 +152,10 @@ namespace ICSharpCode.NRefactory6.CSharp.Completion
return false;
}
- if (token.IsKindOrHasMatchingText(SyntaxKind.AsyncKeyword))
- {
- foundAsync = true;
- }
+ //if (token.IsKindOrHasMatchingText(SyntaxKind.AsyncKeyword))
+ //{
+ // foundAsync = true;
+ //}
foundPartial = foundPartial || token.IsKindOrHasMatchingText(SyntaxKind.PartialKeyword);
diff --git a/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Features/Completion/ContextHandler/PreProcessorExpressionContextHandler.cs b/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Features/Completion/ContextHandler/PreProcessorExpressionContextHandler.cs
index 0b6abc3f19..0a9051cec3 100644
--- a/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Features/Completion/ContextHandler/PreProcessorExpressionContextHandler.cs
+++ b/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Features/Completion/ContextHandler/PreProcessorExpressionContextHandler.cs
@@ -42,7 +42,7 @@ namespace ICSharpCode.NRefactory6.CSharp.Completion
return IsTriggerAfterSpaceOrStartOfWordCharacter (text, position);
}
- protected async override Task<IEnumerable<CompletionData>> GetItemsWorkerAsync (CompletionResult completionResult, CompletionEngine engine, CompletionContext completionContext, CompletionTriggerInfo info, SyntaxContext ctx, CancellationToken cancellationToken)
+ protected override Task<IEnumerable<CompletionData>> GetItemsWorkerAsync (CompletionResult completionResult, CompletionEngine engine, CompletionContext completionContext, CompletionTriggerInfo info, SyntaxContext ctx, CancellationToken cancellationToken)
{
var model = ctx.SemanticModel;
@@ -53,7 +53,7 @@ namespace ICSharpCode.NRefactory6.CSharp.Completion
result.Add(engine.Factory.CreateGenericData (this, define, GenericDataType.PreprocessorSymbol));
}
}
- return result;
+ return Task.FromResult ((IEnumerable<CompletionData>)result);
}
}
} \ No newline at end of file
diff --git a/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Features/Completion/ContextHandler/RegexContextHandler.cs b/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Features/Completion/ContextHandler/RegexContextHandler.cs
new file mode 100644
index 0000000000..fa6881727e
--- /dev/null
+++ b/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Features/Completion/ContextHandler/RegexContextHandler.cs
@@ -0,0 +1,169 @@
+//
+// RegexContextHandler.cs
+//
+// Author:
+// Mike Krüger <mkrueger@xamarin.com>
+//
+// Copyright (c) 2015 Xamarin Inc. (http://xamarin.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+using System;
+using System.Threading.Tasks;
+using System.Collections.Generic;
+using System.Threading;
+using Microsoft.CodeAnalysis.CSharp;
+using System.Linq;
+using Microsoft.CodeAnalysis.CSharp.Syntax;
+using Microsoft.CodeAnalysis;
+using MonoDevelop.Ide.CodeCompletion;
+using MonoDevelop.Ide.TypeSystem;
+using Microsoft.CodeAnalysis.Text;
+using ICSharpCode.NRefactory6.CSharp.Analysis;
+
+namespace ICSharpCode.NRefactory6.CSharp.Completion
+{
+ class RegexContextHandler : CompletionContextHandler
+ {
+ public override bool IsTriggerCharacter (Microsoft.CodeAnalysis.Text.SourceText text, int position)
+ {
+ var ch = text [position];
+ return ch == '\\' || base.IsTriggerCharacter (text, position);
+ }
+
+ protected async override Task<IEnumerable<CompletionData>> GetItemsWorkerAsync (CompletionResult completionResult, CompletionEngine engine, CompletionContext completionContext, CompletionTriggerInfo info, SyntaxContext ctx, CancellationToken cancellationToken)
+ {
+ var document = completionContext.Document;
+ var position = completionContext.Position;
+ var semanticModel = ctx.SemanticModel;
+ if (info.TriggerCharacter == '\\') {
+ if (ctx.TargetToken.Parent != null && ctx.TargetToken.Parent.Parent != null &&
+ ctx.TargetToken.Parent.Parent.IsKind (SyntaxKind.Argument)) {
+ var argument = ctx.TargetToken.Parent.Parent as ArgumentSyntax;
+
+ var symbolInfo = semanticModel.GetSymbolInfo (ctx.TargetToken.Parent.Parent.Parent.Parent);
+ if (symbolInfo.Symbol == null)
+ return Enumerable.Empty<CompletionData> ();
+
+ if (SemanticHighlightingVisitor<int>.IsRegexMatchMethod (symbolInfo)) {
+ if (((ArgumentListSyntax)argument.Parent).Arguments [1] != argument)
+ return Enumerable.Empty<CompletionData> ();
+ completionResult.AutoSelect = false;
+ return GetFormatCompletionData (engine, argument.Expression.ToString () [0] == '@');
+ }
+ if (SemanticHighlightingVisitor<int>.IsRegexConstructor (symbolInfo)) {
+ if (((ArgumentListSyntax)argument.Parent).Arguments [0] != argument)
+ return Enumerable.Empty<CompletionData> ();
+ completionResult.AutoSelect = false;
+ return GetFormatCompletionData (engine, argument.Expression.ToString () [0] == '@');
+ }
+ }
+ } else {
+ var ma = ctx.TargetToken.Parent as MemberAccessExpressionSyntax;
+ if (ma != null) {
+ var symbolInfo = semanticModel.GetSymbolInfo (ma.Expression);
+ var typeInfo = semanticModel.GetTypeInfo (ma.Expression);
+ var type = typeInfo.Type;
+ if (type != null && type.Name == "Match" && type.ContainingNamespace.GetFullName () == "System.Text.RegularExpressions" ) {
+ var items = new List<CompletionData>();
+ foreach (var grp in GetGroups (ctx, symbolInfo.Symbol)) {
+ items.Add (engine.Factory.CreateGenericData (this, "Groups[\"" + grp + "\"]", GenericDataType.Undefined));
+ }
+
+ return items;
+ }
+ }
+ }
+ return Enumerable.Empty<CompletionData> ();
+ }
+
+ IEnumerable<string> GetGroups (SyntaxContext ctx, ISymbol symbol)
+ {
+ var root = ctx.SyntaxTree.GetRoot ();
+ foreach (var decl in symbol.DeclaringSyntaxReferences) {
+ Optional<object> val = null;
+
+ var node = root.FindNode (decl.Span) as VariableDeclaratorSyntax;
+ if (node == null)
+ continue;
+ var invocation = node.Initializer.Value as InvocationExpressionSyntax;
+ var invocationSymbol = ctx.SemanticModel.GetSymbolInfo (invocation).Symbol;
+ if (invocationSymbol.Name == "Match" && SemanticHighlightingVisitor<int>.IsRegexType (invocationSymbol.ContainingType)) {
+ if (invocation.ArgumentList.Arguments.Count == 1) {
+ var memberAccess = invocation.Expression as MemberAccessExpressionSyntax;
+ if (memberAccess == null)
+ continue;
+ var target = ctx.SemanticModel.GetSymbolInfo (memberAccess.Expression).Symbol;
+ if (target.DeclaringSyntaxReferences.Length == 0)
+ continue;
+ var targetNode = root.FindNode (target.DeclaringSyntaxReferences.First ().Span) as VariableDeclaratorSyntax;
+ if (targetNode == null)
+ continue;
+ var objectCreation = targetNode.Initializer.Value as ObjectCreationExpressionSyntax;
+ if (objectCreation == null)
+ continue;
+ var targetNodeSymbol = ctx.SemanticModel.GetSymbolInfo (objectCreation).Symbol;
+ if (SemanticHighlightingVisitor<int>.IsRegexType (targetNodeSymbol.ContainingType)) {
+ if (objectCreation.ArgumentList.Arguments.Count < 1)
+ continue;
+ val = ctx.SemanticModel.GetConstantValue (objectCreation.ArgumentList.Arguments [0].Expression);
+ }
+ } else {
+ if (invocation.ArgumentList.Arguments.Count < 2)
+ continue;
+ val = ctx.SemanticModel.GetConstantValue (invocation.ArgumentList.Arguments [1].Expression);
+ }
+
+ if (!val.HasValue)
+ continue;
+ var str = val.Value.ToString ();
+ int idx = -1;
+ while ((idx = str.IndexOf ("(?<", idx + 1, StringComparison.Ordinal)) >= 0) {
+ var closingIndex = str.IndexOf (">", idx, StringComparison.Ordinal);
+ if (closingIndex >= idx) {
+ yield return str.Substring (idx + 3, closingIndex - idx - 3);
+ idx = closingIndex - 1;
+ }
+ }
+ }
+ }
+ }
+
+ IEnumerable<CompletionData> GetFormatCompletionData (CompletionEngine engine, bool isVerbatimString)
+ {
+ yield return engine.Factory.CreateFormatItemCompletionData(this, (isVerbatimString ? "" : "\\") +"d", "Digit character", null);
+ yield return engine.Factory.CreateFormatItemCompletionData(this, (isVerbatimString ? "" : "\\") +"D", "Non-digit character", null);
+
+ yield return engine.Factory.CreateFormatItemCompletionData(this, (isVerbatimString ? "" : "\\") +"b", "Word boundary", null);
+ yield return engine.Factory.CreateFormatItemCompletionData(this, (isVerbatimString ? "" : "\\") +"B", "Non-word boundary", null);
+
+ yield return engine.Factory.CreateFormatItemCompletionData(this, (isVerbatimString ? "" : "\\") +"w", "Word character", null);
+ yield return engine.Factory.CreateFormatItemCompletionData(this, (isVerbatimString ? "" : "\\") +"W", "Non-word character", null);
+
+ yield return engine.Factory.CreateFormatItemCompletionData(this, (isVerbatimString ? "" : "\\") +"s", "White-space character", null);
+ yield return engine.Factory.CreateFormatItemCompletionData(this, (isVerbatimString ? "" : "\\") +"S", "Non-white-space character", null);
+
+ yield return engine.Factory.CreateFormatItemCompletionData(this, (isVerbatimString ? "" : "\\") +"A", "Start boundary", null);
+ yield return engine.Factory.CreateFormatItemCompletionData(this, (isVerbatimString ? "" : "\\") +"Z", "End boundary", null);
+
+ yield return engine.Factory.CreateFormatItemCompletionData(this, (isVerbatimString ? "" : "\\") +"k<name>", "Named backreference", null);
+ yield return engine.Factory.CreateFormatItemCompletionData(this, (isVerbatimString ? "" : "\\") +"P{name}", "Negative unicode category or unicode block", null);
+ yield return engine.Factory.CreateFormatItemCompletionData(this, (isVerbatimString ? "" : "\\") +"p{name}", "Unicode category or unicode block", null);
+ }
+ }
+} \ No newline at end of file
diff --git a/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Features/Completion/ContextHandler/RoslynRecommendationsCompletionContextHandler.cs b/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Features/Completion/ContextHandler/RoslynRecommendationsCompletionContextHandler.cs
index c411bd0d8d..30e32c8607 100644
--- a/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Features/Completion/ContextHandler/RoslynRecommendationsCompletionContextHandler.cs
+++ b/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Features/Completion/ContextHandler/RoslynRecommendationsCompletionContextHandler.cs
@@ -69,14 +69,14 @@ namespace ICSharpCode.NRefactory6.CSharp.Completion
return IsException (type.BaseType);
}
- protected async override Task<IEnumerable<CompletionData>> GetItemsWorkerAsync (CompletionResult completionResult, CompletionEngine engine, CompletionContext completionContext, CompletionTriggerInfo info, SyntaxContext ctx, CancellationToken cancellationToken)
+ protected override Task<IEnumerable<CompletionData>> GetItemsWorkerAsync (CompletionResult completionResult, CompletionEngine engine, CompletionContext completionContext, CompletionTriggerInfo info, SyntaxContext ctx, CancellationToken cancellationToken)
{
var semanticModel = ctx.SemanticModel;
var result = new List<CompletionData> ();
if (info.TriggerCharacter == ' ') {
var newExpression = ObjectCreationContextHandler.GetObjectCreationNewExpression (ctx.SyntaxTree, completionContext.Position, cancellationToken);
if (newExpression == null && info.CompletionTriggerReason == CompletionTriggerReason.CharTyped && !ctx.LeftToken.IsKind (SyntaxKind.EqualsToken) && !ctx.LeftToken.IsKind (SyntaxKind.EqualsEqualsToken))
- return Enumerable.Empty<CompletionData> ();
+ return Task.FromResult (Enumerable.Empty<CompletionData> ());
completionResult.AutoCompleteEmptyMatch = false;
}
@@ -142,7 +142,7 @@ namespace ICSharpCode.NRefactory6.CSharp.Completion
}
addData (newData);
}
- return result;
+ return Task.FromResult ((IEnumerable<CompletionData>)result);
}
protected override async Task<bool> IsSemanticTriggerCharacterAsync(Document document, int characterPosition, CancellationToken cancellationToken)
diff --git a/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Features/Completion/ContextHandler/SenderCompletionContextHandler.cs b/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Features/Completion/ContextHandler/SenderCompletionContextHandler.cs
index 635fdf3f0a..8d1ff8733a 100644
--- a/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Features/Completion/ContextHandler/SenderCompletionContextHandler.cs
+++ b/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Features/Completion/ContextHandler/SenderCompletionContextHandler.cs
@@ -39,25 +39,25 @@ namespace ICSharpCode.NRefactory6.CSharp.Completion
{
class SenderCompletionContextHandler : CompletionContextHandler
{
- protected async override Task<IEnumerable<CompletionData>> GetItemsWorkerAsync (CompletionResult completionResult, CompletionEngine engine, CompletionContext completionContext, CompletionTriggerInfo info, SyntaxContext ctx, CancellationToken cancellationToken)
+ protected override Task<IEnumerable<CompletionData>> GetItemsWorkerAsync (CompletionResult completionResult, CompletionEngine engine, CompletionContext completionContext, CompletionTriggerInfo info, SyntaxContext ctx, CancellationToken cancellationToken)
{
var position = completionContext.Position;
var document = completionContext.Document;
var syntaxTree = ctx.SyntaxTree;
if (syntaxTree.IsInNonUserCode(position, cancellationToken) ||
syntaxTree.IsPreProcessorDirectiveContext(position, cancellationToken))
- return Enumerable.Empty<CompletionData> ();
+ return Task.FromResult (Enumerable.Empty<CompletionData> ());
if (!syntaxTree.IsRightOfDotOrArrowOrColonColon(position, cancellationToken))
- return Enumerable.Empty<CompletionData> ();
+ return Task.FromResult (Enumerable.Empty<CompletionData> ());
var ma = ctx.LeftToken.Parent as MemberAccessExpressionSyntax;
if (ma == null)
- return Enumerable.Empty<CompletionData> ();
+ return Task.FromResult (Enumerable.Empty<CompletionData> ());
var model = ctx.CSharpSyntaxContext.SemanticModel;
var symbolInfo = model.GetSymbolInfo (ma.Expression);
if (symbolInfo.Symbol == null || symbolInfo.Symbol.Kind != SymbolKind.Parameter)
- return Enumerable.Empty<CompletionData> ();
+ return Task.FromResult (Enumerable.Empty<CompletionData> ());
var list = new List<CompletionData> ();
var within = model.GetEnclosingNamedTypeOrAssembly(position, cancellationToken);
var addedSymbols = new HashSet<string> ();
@@ -70,7 +70,7 @@ namespace ICSharpCode.NRefactory6.CSharp.Completion
Analyze (engine, model, ma.Expression, within, list, ano.ParameterList, symbolInfo.Symbol, addedSymbols, cancellationToken);
}
- return list;
+ return Task.FromResult ((IEnumerable<CompletionData>)list);
}
void Analyze (CompletionEngine engine,SemanticModel model, SyntaxNode node, ISymbol within, List<CompletionData> list, ParameterListSyntax parameterList, ISymbol symbol, HashSet<string> addedSymbols, CancellationToken cancellationToken)
diff --git a/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Features/EncapsulateField/AbstractEncapsulateFieldService.cs b/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Features/EncapsulateField/AbstractEncapsulateFieldService.cs
index badf36e8bb..fc9a15363f 100644
--- a/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Features/EncapsulateField/AbstractEncapsulateFieldService.cs
+++ b/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Features/EncapsulateField/AbstractEncapsulateFieldService.cs
@@ -228,7 +228,6 @@ namespace ICSharpCode.NRefactory6.CSharp.CodeRefactorings.EncapsulateField
var generatedProperty = GenerateProperty(generatedPropertyName, finalFieldName, originalField.DeclaredAccessibility, originalField, field.ContainingType, new SyntaxAnnotation(), document, cancellationToken);
- var codeGenerationService = new CSharpCodeGenerationService (document.Project.Solution.Workspace);
var solutionWithProperty = await AddPropertyAsync(document, document.Project.Solution, field, generatedProperty, cancellationToken).ConfigureAwait(false);
return new Result(solutionWithProperty, originalField.ToDisplayString(), Glyph.FieldPublic);
diff --git a/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Features/ExtractMethod/CSharp/CSharpMethodExtractor.CSharpCodeGenerator.MultipleStatementsCodeGenerator.cs b/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Features/ExtractMethod/CSharp/CSharpMethodExtractor.CSharpCodeGenerator.MultipleStatementsCodeGenerator.cs
index 205d488fc5..a75b49a0ca 100644
--- a/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Features/ExtractMethod/CSharp/CSharpMethodExtractor.CSharpCodeGenerator.MultipleStatementsCodeGenerator.cs
+++ b/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Features/ExtractMethod/CSharp/CSharpMethodExtractor.CSharpCodeGenerator.MultipleStatementsCodeGenerator.cs
@@ -32,8 +32,8 @@ namespace ICSharpCode.NRefactory6.CSharp.ExtractMethod
if (first != last)
{
- var firstUnderContainer = result.GetFirstStatementUnderContainer();
- var lastUnderContainer = result.GetLastStatementUnderContainer();
+ //var firstUnderContainer = result.GetFirstStatementUnderContainer();
+ //var lastUnderContainer = result.GetLastStatementUnderContainer();
//Contract.ThrowIfFalse(firstUnderContainer.Parent == lastUnderContainer.Parent);
return true;
}
diff --git a/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Features/ExtractMethod/CSharp/CSharpSelectionResult.StatementResult.cs b/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Features/ExtractMethod/CSharp/CSharpSelectionResult.StatementResult.cs
index 5d6565e056..478cf6f7b6 100644
--- a/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Features/ExtractMethod/CSharp/CSharpSelectionResult.StatementResult.cs
+++ b/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Features/ExtractMethod/CSharp/CSharpSelectionResult.StatementResult.cs
@@ -32,7 +32,7 @@ namespace ICSharpCode.NRefactory6.CSharp.ExtractMethod
public override bool ContainingScopeHasAsyncKeyword()
{
var node = this.GetContainingScope();
- var semanticModel = this.SemanticDocument.SemanticModel;
+ //var semanticModel = this.SemanticDocument.SemanticModel;
return node.TypeSwitch(
(AccessorDeclarationSyntax access) => false,
diff --git a/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Features/ExtractMethod/CSharp/CSharpSelectionResult.cs b/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Features/ExtractMethod/CSharp/CSharpSelectionResult.cs
index 80f343c09a..462b3313a0 100644
--- a/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Features/ExtractMethod/CSharp/CSharpSelectionResult.cs
+++ b/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Features/ExtractMethod/CSharp/CSharpSelectionResult.cs
@@ -124,7 +124,7 @@ namespace ICSharpCode.NRefactory6.CSharp.ExtractMethod
var statement = lastToken.Parent.GetStatementUnderContainer();
//Contract.ThrowIfNull(statement);
- var firstStatementUnderContainer = this.GetFirstStatementUnderContainer();
+ //var firstStatementUnderContainer = this.GetFirstStatementUnderContainer();
//Contract.ThrowIfFalse(statement.Parent == firstStatementUnderContainer.Parent);
return statement;
diff --git a/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Features/Formatter/CommonFormattingHelpers.cs b/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Features/Formatter/CommonFormattingHelpers.cs
index 4c3610cfc2..84651c5a39 100644
--- a/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Features/Formatter/CommonFormattingHelpers.cs
+++ b/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Features/Formatter/CommonFormattingHelpers.cs
@@ -180,7 +180,7 @@ namespace ICSharpCode.NRefactory6.CSharp
return;
}
- var token1PartOftoken2LeadingTrivia = token1.FullSpan.Start > token2.FullSpan.Start;
+ //var token1PartOftoken2LeadingTrivia = token1.FullSpan.Start > token2.FullSpan.Start;
if (token1.FullSpan.End == token2.FullSpan.Start)
{
diff --git a/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Features/Formatter/FormattingOptionsFactory.cs b/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Features/Formatter/FormattingOptionsFactory.cs
index 950f735934..7fae1ecefa 100644
--- a/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Features/Formatter/FormattingOptionsFactory.cs
+++ b/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Features/Formatter/FormattingOptionsFactory.cs
@@ -89,7 +89,7 @@ namespace ICSharpCode.NRefactory6.CSharp
}
/// <summary>
- /// The K&R style, so named because it was used in Kernighan and Ritchie's book The C Programming Language,
+ /// The K&amp;R style, so named because it was used in Kernighan and Ritchie's book The C Programming Language,
/// is commonly used in C. It is less common for C++, C#, and others.
/// </summary>
public static OptionSet CreateKRStyle()
diff --git a/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Features/GenerateFromMembers/GenerateConstructor/AbstractGenerateConstructorService.cs b/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Features/GenerateFromMembers/GenerateConstructor/AbstractGenerateConstructorService.cs
index f8e2bcfd82..df7c269a13 100644
--- a/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Features/GenerateFromMembers/GenerateConstructor/AbstractGenerateConstructorService.cs
+++ b/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Features/GenerateFromMembers/GenerateConstructor/AbstractGenerateConstructorService.cs
@@ -54,7 +54,6 @@ namespace ICSharpCode.NRefactory6.CSharp.GenerateFromMembers.GenerateConstructor
private class ConstructorDelegatingCodeAction : CodeAction
{
- private readonly TService _service;
private readonly Document _document;
private readonly State _state;
@@ -63,7 +62,6 @@ namespace ICSharpCode.NRefactory6.CSharp.GenerateFromMembers.GenerateConstructor
Document document,
State state)
{
- _service = service;
_document = document;
_state = state;
}
@@ -132,7 +130,6 @@ namespace ICSharpCode.NRefactory6.CSharp.GenerateFromMembers.GenerateConstructor
private class FieldDelegatingCodeAction : CodeAction
{
- private readonly TService _service;
private readonly Document _document;
private readonly State _state;
@@ -141,7 +138,6 @@ namespace ICSharpCode.NRefactory6.CSharp.GenerateFromMembers.GenerateConstructor
Document document,
State state)
{
- _service = service;
_document = document;
_state = state;
}
diff --git a/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Features/GenerateMember/GenerateConstructor/AbstractGenerateConstructorService.cs b/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Features/GenerateMember/GenerateConstructor/AbstractGenerateConstructorService.cs
index 907f779be1..e35be8230c 100644
--- a/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Features/GenerateMember/GenerateConstructor/AbstractGenerateConstructorService.cs
+++ b/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Features/GenerateMember/GenerateConstructor/AbstractGenerateConstructorService.cs
@@ -180,7 +180,7 @@ namespace ICSharpCode.NRefactory6.CSharp.GenerateMember.GenerateConstructor
return null;
}
- var arguments = _state.Arguments.Take(argumentCount).ToList();
+ // var arguments = _state.Arguments.Take(argumentCount).ToList();
var remainingArguments = _state.Arguments.Skip(argumentCount).ToList();
var remainingAttributeArguments = _state.AttributeArguments != null ? _state.AttributeArguments.Skip(argumentCount).ToList() : null;
var remainingParameterTypes = _state.ParameterTypes.Skip(argumentCount).ToList();
@@ -275,7 +275,6 @@ namespace ICSharpCode.NRefactory6.CSharp.GenerateMember.GenerateConstructor
var syntaxFactory = provider.GetService<SyntaxGenerator>();
var codeGenerationService = new CSharpCodeGenerationService (_document.Project.Solution.Workspace);
- var syntaxTree = _document.SyntaxTree;
var members = syntaxFactory.CreateFieldDelegatingConstructor(
_state.TypeToGenerateIn.Name, _state.TypeToGenerateIn, parameters,
parameterToExistingFieldMap, parameterToNewFieldMap, _cancellationToken);
@@ -550,8 +549,6 @@ namespace ICSharpCode.NRefactory6.CSharp.GenerateMember.GenerateConstructor
type: t,
name: string.Empty)).ToList();
- var destinationProvider = document.Project.Solution.Workspace.Services.GetLanguageServices(this.TypeToGenerateIn.Language);
-
return this.TypeToGenerateIn.InstanceConstructors.Any(c => SignatureComparer.HaveSameSignature(parameters, c.Parameters, compareParameterName: true, isCaseSensitive: true));
}
diff --git a/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Features/GenerateMember/GenerateDefaultConstructors/AbstractGenerateDefaultConstructorsService.cs b/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Features/GenerateMember/GenerateDefaultConstructors/AbstractGenerateDefaultConstructorsService.cs
index 9e0199e2cb..0767b25436 100644
--- a/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Features/GenerateMember/GenerateDefaultConstructors/AbstractGenerateDefaultConstructorsService.cs
+++ b/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Features/GenerateMember/GenerateDefaultConstructors/AbstractGenerateDefaultConstructorsService.cs
@@ -61,7 +61,6 @@ namespace ICSharpCode.NRefactory6.CSharp.GenerateMember.GenerateDefaultConstruct
private readonly IList<IMethodSymbol> _constructors;
private readonly Document _document;
private readonly State _state;
- private readonly TService _service;
private readonly string _title;
protected AbstractCodeAction(
@@ -71,7 +70,6 @@ namespace ICSharpCode.NRefactory6.CSharp.GenerateMember.GenerateDefaultConstruct
IList<IMethodSymbol> constructors,
string title)
{
- _service = service;
_document = document;
_state = state;
_constructors = constructors;
@@ -218,8 +216,6 @@ namespace ICSharpCode.NRefactory6.CSharp.GenerateMember.GenerateDefaultConstruct
baseType.InstanceConstructors
.Where(c => c.IsAccessibleWithin(this.ClassType));
- var destinationProvider = document.Project.Solution.Workspace.Services.GetLanguageServices(this.ClassType.Language);
-
var missingConstructors =
baseTypeConstructors.Where(c1 => !classConstructors.Any(
c2 => SignatureComparer.HaveSameSignature(c1.Parameters, c2.Parameters, compareParameterName: true, isCaseSensitive: true))).ToList();
diff --git a/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Features/GenerateMember/GenerateDefaultConstructors/CSharpGenerateDefaultConstructorsService.cs b/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Features/GenerateMember/GenerateDefaultConstructors/CSharpGenerateDefaultConstructorsService.cs
index b443a65e52..598ef2b99c 100644
--- a/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Features/GenerateMember/GenerateDefaultConstructors/CSharpGenerateDefaultConstructorsService.cs
+++ b/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Features/GenerateMember/GenerateDefaultConstructors/CSharpGenerateDefaultConstructorsService.cs
@@ -21,7 +21,6 @@ namespace ICSharpCode.NRefactory6.CSharp.GenerateMember.GenerateDefaultConstruct
{
if (!cancellationToken.IsCancellationRequested)
{
- var syntaxTree = document.SyntaxTree;
var node = document.Root.FindToken(textSpan.Start).GetAncestor<TypeSyntax>();
if (node != null)
{
diff --git a/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Features/GenerateMember/GenerateEnumMember/AbstractGenerateEnumMemberService.cs b/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Features/GenerateMember/GenerateEnumMember/AbstractGenerateEnumMemberService.cs
index 9c33c0868f..c0111bcb5d 100644
--- a/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Features/GenerateMember/GenerateEnumMember/AbstractGenerateEnumMemberService.cs
+++ b/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Features/GenerateMember/GenerateEnumMember/AbstractGenerateEnumMemberService.cs
@@ -48,7 +48,6 @@ namespace ICSharpCode.NRefactory6.CSharp.GenerateMember.GenerateEnumMember
private partial class GenerateEnumMemberCodeAction : CodeAction
{
- private readonly TService _service;
private readonly Document _document;
private readonly State _state;
@@ -57,20 +56,17 @@ namespace ICSharpCode.NRefactory6.CSharp.GenerateMember.GenerateEnumMember
Document document,
State state)
{
- _service = service;
_document = document;
_state = state;
}
protected override async Task<Document> GetChangedDocumentAsync(CancellationToken cancellationToken)
{
- var languageServices = _document.Project.Solution.Workspace.Services.GetLanguageServices(_state.TypeToGenerateIn.Language);
var value = _state.TypeToGenerateIn.LastEnumValueHasInitializer()
? EnumValueUtilities.GetNextEnumValue(_state.TypeToGenerateIn, cancellationToken)
: null;
- var syntaxTree = await _document.GetSyntaxTreeAsync(cancellationToken).ConfigureAwait(false);
var result = await new CSharpCodeGenerationService (_document.Project.Solution.Workspace).AddFieldAsync(
_document.Project.Solution,
_state.TypeToGenerateIn,
diff --git a/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Features/GenerateMember/GenerateParameterizedMember/AbstractGenerateParameterizedMemberService.cs b/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Features/GenerateMember/GenerateParameterizedMember/AbstractGenerateParameterizedMemberService.cs
index 4b8853901f..19ac827f84 100644
--- a/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Features/GenerateMember/GenerateParameterizedMember/AbstractGenerateParameterizedMemberService.cs
+++ b/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Features/GenerateMember/GenerateParameterizedMember/AbstractGenerateParameterizedMemberService.cs
@@ -221,7 +221,7 @@ namespace ICSharpCode.NRefactory6.CSharp.GenerateMember.GenerateParameterizedMem
protected override async Task<Document> GetChangedDocumentAsync(CancellationToken cancellationToken)
{
- var syntaxTree = await _document.GetSyntaxTreeAsync(cancellationToken).ConfigureAwait(false);
+ //var syntaxTree = await _document.GetSyntaxTreeAsync(cancellationToken).ConfigureAwait(false);
var syntaxFactory = _document.Project.Solution.Workspace.Services.GetLanguageServices(_state.TypeToGenerateIn.Language).GetService<SyntaxGenerator>();
if (_generateProperty)
@@ -387,9 +387,9 @@ namespace ICSharpCode.NRefactory6.CSharp.GenerateMember.GenerateParameterizedMem
methodKind: State.MethodKind);
// Ensure no conflicts between type parameter names and parameter names.
- var languageServiceProvider = this.Document.Project.Solution.Workspace.Services.GetLanguageServices(this.State.TypeToGenerateIn.Language);
+ //var languageServiceProvider = this.Document.Project.Solution.Workspace.Services.GetLanguageServices(this.State.TypeToGenerateIn.Language);
- var equalityComparer = true ? StringComparer.Ordinal : StringComparer.OrdinalIgnoreCase;
+ var equalityComparer = StringComparer.Ordinal;
var reservedParameterNames = this.DetermineParameterNames(cancellationToken).ToSet(equalityComparer);
var newTypeParameterNames = NameGenerator.EnsureUniqueness(
method.TypeParameters.Select(t => t.Name).ToList(), n => !reservedParameterNames.Contains(n));
diff --git a/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Features/GenerateMember/GenerateParameterizedMember/CSharpGenerateParameterizedMemberService.cs b/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Features/GenerateMember/GenerateParameterizedMember/CSharpGenerateParameterizedMemberService.cs
index f6784ece1a..ad3462c2ce 100644
--- a/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Features/GenerateMember/GenerateParameterizedMember/CSharpGenerateParameterizedMemberService.cs
+++ b/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Features/GenerateMember/GenerateParameterizedMember/CSharpGenerateParameterizedMemberService.cs
@@ -74,7 +74,7 @@ namespace ICSharpCode.NRefactory6.CSharp.GenerateMember.GenerateParameterizedMem
// TODO(cyrusn): If we do capture method type variables, then we should probably
// capture their constraints as well.
var genericName = (GenericNameSyntax)this.State.SimpleNameOpt;
- var semanticModel = this.Document.SemanticModel;
+ //var semanticModel = this.Document.SemanticModel;
if (genericName.TypeArgumentList.Arguments.Count == 1)
{
diff --git a/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Features/GenerateMember/GenerateVariable/AbstractGenerateVariableService.cs b/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Features/GenerateMember/GenerateVariable/AbstractGenerateVariableService.cs
index 5fd6fa0c95..d9791c3f44 100644
--- a/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Features/GenerateMember/GenerateVariable/AbstractGenerateVariableService.cs
+++ b/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Features/GenerateMember/GenerateVariable/AbstractGenerateVariableService.cs
@@ -143,7 +143,7 @@ namespace Microsoft.CodeAnalysis.GenerateMember.GenerateVariable
private partial class GenerateVariableCodeAction : CodeAction
{
- private readonly TService _service;
+ //private readonly TService _service;
private readonly State _state;
private readonly bool _generateProperty;
private readonly bool _isReadonly;
@@ -159,7 +159,7 @@ namespace Microsoft.CodeAnalysis.GenerateMember.GenerateVariable
bool isReadonly,
bool isConstant)
{
- _service = service;
+ //_service = service;
_document = document;
_state = state;
_generateProperty = generateProperty;
@@ -170,7 +170,6 @@ namespace Microsoft.CodeAnalysis.GenerateMember.GenerateVariable
protected override async Task<Document> GetChangedDocumentAsync(CancellationToken cancellationToken)
{
- var syntaxTree = await _document.GetSyntaxTreeAsync(cancellationToken).ConfigureAwait(false);
var generateUnsafe = _state.TypeMemberType.IsUnsafe() &&
!_state.IsContainedInUnsafeType;
diff --git a/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Features/GenerateType/AbstractGenerateTypeService.cs b/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Features/GenerateType/AbstractGenerateTypeService.cs
index bfe8d37073..ec95fb8916 100644
--- a/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Features/GenerateType/AbstractGenerateTypeService.cs
+++ b/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Features/GenerateType/AbstractGenerateTypeService.cs
@@ -102,11 +102,11 @@ namespace ICSharpCode.NRefactory6.CSharp.GenerateType
State state,
CancellationToken cancellationToken)
{
- var generateNewTypeInDialog = false;
+ //var generateNewTypeInDialog = false;
if (state.NamespaceToGenerateInOpt != null) {
var workspace = document.Project.Solution.Workspace;
if (workspace == null || workspace.CanApplyChange (ApplyChangesKind.AddDocument)) {
- generateNewTypeInDialog = true;
+ //generateNewTypeInDialog = true;
yield return new GenerateTypeCodeAction ((TService)this, document.Document, state, intoNamespace: true, inNewFile: true);
}
@@ -308,7 +308,7 @@ namespace ICSharpCode.NRefactory6.CSharp.GenerateType
bool inNewFile,
string destination)
{
- var finalName = GetTypeName (state);
+ //var finalName = GetTypeName (state);
if (inNewFile) {
return string.Format (Resources.GenerateForInNewFile,
@@ -375,7 +375,7 @@ namespace ICSharpCode.NRefactory6.CSharp.GenerateType
public override object GetOptions (CancellationToken cancellationToken)
{
- var typeKindValue = GetTypeKindOption (_state);
+ //var typeKindValue = GetTypeKindOption (_state);
var isPublicOnlyAccessibility = IsPublicOnlyAccessibility (_state, _document.Project);
// TODO : Callback
@@ -1002,7 +1002,7 @@ namespace ICSharpCode.NRefactory6.CSharp.GenerateType
private async Task<IEnumerable<CodeActionOperation>> GetGenerateIntoTypeOperationsAsync (INamedTypeSymbol namedType)
{
- var codeGenService = GetCodeGenerationService ();
+ //var codeGenService = GetCodeGenerationService ();
var solution = _document.Project.Solution;
var codeGenResult = await CodeGenerator.AddNamedTypeDeclarationAsync (
solution,
diff --git a/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Features/ImplementInterface/AbstractImplementInterfaceService.CodeAction_Property.cs b/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Features/ImplementInterface/AbstractImplementInterfaceService.CodeAction_Property.cs
index 1cd6f18d37..9407b332d6 100644
--- a/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Features/ImplementInterface/AbstractImplementInterfaceService.CodeAction_Property.cs
+++ b/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Features/ImplementInterface/AbstractImplementInterfaceService.CodeAction_Property.cs
@@ -27,7 +27,7 @@ namespace ICSharpCode.NRefactory6.CSharp.Features.ImplementInterface
string memberName,
CancellationToken cancellationToken)
{
- var factory = this.Document.GetLanguageService<SyntaxGenerator>();
+ //var factory = this.Document.GetLanguageService<SyntaxGenerator>();
var comAliasNameAttribute = compilation.ComAliasNameAttributeType();
var getAccessor = property.GetMethod == null
diff --git a/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Features/IndentEngine/CSharpIndentEngine.cs b/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Features/IndentEngine/CSharpIndentEngine.cs
index 78f74d6483..73e34cca72 100644
--- a/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Features/IndentEngine/CSharpIndentEngine.cs
+++ b/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Features/IndentEngine/CSharpIndentEngine.cs
@@ -258,9 +258,6 @@ namespace ICSharpCode.NRefactory6.CSharp
/// <summary>
/// Creates a new CSharpIndentEngine instance.
/// </summary>
- /// <param name="document">
- /// An instance of <see cref="SourceText"/> which is being parsed.
- /// </param>
/// <param name="formattingOptions">
/// C# formatting options.
/// </param>
diff --git a/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Features/SemanticHighlighting/SemanticHighlightingVisitor.cs b/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Features/SemanticHighlighting/SemanticHighlightingVisitor.cs
index 57ca008039..a948b2495f 100644
--- a/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Features/SemanticHighlighting/SemanticHighlightingVisitor.cs
+++ b/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Features/SemanticHighlighting/SemanticHighlightingVisitor.cs
@@ -27,6 +27,7 @@ using Microsoft.CodeAnalysis.Text;
using Microsoft.CodeAnalysis.CSharp.Syntax;
using MonoDevelop.Ide.TypeSystem;
using MonoDevelop.Core.Text;
+using System.Text.RegularExpressions;
namespace ICSharpCode.NRefactory6.CSharp.Analysis
{
@@ -85,6 +86,15 @@ namespace ICSharpCode.NRefactory6.CSharp.Analysis
protected TColor stringFormatItemColor;
+ protected TColor stringRegexCharacterClass;
+ protected TColor stringRegexGroupingConstructs;
+ protected TColor stringRegexSetConstructs;
+ protected TColor stringRegexComments;
+ protected TColor stringRegexEscapeCharacter;
+ protected TColor stringRegexAltEscapeCharacter;
+
+ protected TColor stringRegexErrors;
+
protected TextSpan region;
protected SemanticModel semanticModel;
@@ -167,34 +177,218 @@ namespace ICSharpCode.NRefactory6.CSharp.Analysis
public override void VisitInvocationExpression(InvocationExpressionSyntax node)
{
- var symbolInfo = semanticModel.GetSymbolInfo(node.Expression, cancellationToken);
-
- if (IsInactiveConditional (symbolInfo.Symbol) || IsEmptyPartialMethod(symbolInfo.Symbol, cancellationToken)) {
+ var symbolInfo = semanticModel.GetSymbolInfo (node.Expression, cancellationToken);
+
+ if (IsInactiveConditional (symbolInfo.Symbol) || IsEmptyPartialMethod (symbolInfo.Symbol, cancellationToken)) {
// mark the whole invocation statement as inactive code
- Colorize(node.Span, inactiveCodeColor);
+ Colorize (node.Span, inactiveCodeColor);
return;
}
if (node.Expression.IsKind (SyntaxKind.IdentifierName) && symbolInfo.Symbol == null) {
var id = (IdentifierNameSyntax)node.Expression;
if (id.Identifier.ValueText == "nameof") {
- Colorize(id.Span, nameofKeywordColor);
+ Colorize (id.Span, nameofKeywordColor);
}
}
ExpressionSyntax fmtArgumets;
IList<ExpressionSyntax> args;
- if (node.ArgumentList.Arguments.Count > 1 && FormatStringHelper.TryGetFormattingParameters(semanticModel, node, out fmtArgumets, out args, null, cancellationToken)) {
- var expr = node.ArgumentList.Arguments.First();
+ if (node.ArgumentList.Arguments.Count > 1 && FormatStringHelper.TryGetFormattingParameters (semanticModel, node, out fmtArgumets, out args, null, cancellationToken)) {
+ var expr = node.ArgumentList.Arguments.First ();
if (expr != null) {
var literalExpressionSyntax = expr.Expression as LiteralExpressionSyntax;
if (literalExpressionSyntax != null)
- HighlightStringFormatItems(literalExpressionSyntax);
+ HighlightStringFormatItems (literalExpressionSyntax);
+ }
+ }
+
+ var containingType = symbolInfo.Symbol?.ContainingType;
+ if (IsRegexMatchMethod (symbolInfo)) {
+ if (node.ArgumentList.Arguments.Count > 1) {
+ var pattern = node.ArgumentList.Arguments [1].Expression as LiteralExpressionSyntax;
+ if (pattern != null && pattern.IsKind (SyntaxKind.StringLiteralExpression)) {
+ ColorizeRegex (pattern);
+ }
+
}
}
- base.VisitInvocationExpression(node);
+ base.VisitInvocationExpression (node);
}
-
+
+ internal static bool IsRegexMatchMethod (SymbolInfo symbolInfo)
+ {
+ var symbol = symbolInfo.Symbol;
+ if (symbol == null)
+ return false;
+ return IsRegexType (symbol.ContainingType) && symbol.IsStatic && (symbol.Name == "IsMatch" || symbol.Name == "Match" || symbol.Name == "Matches");
+ }
+
+ public override void VisitObjectCreationExpression (ObjectCreationExpressionSyntax node)
+ {
+ base.VisitObjectCreationExpression (node);
+ var symbolInfo = semanticModel.GetSymbolInfo (node, cancellationToken);
+ if (IsRegexConstructor (symbolInfo)) {
+ if (node.ArgumentList.Arguments.Count > 0) {
+ var pattern = node.ArgumentList.Arguments [0].Expression as LiteralExpressionSyntax;
+ if (pattern != null && pattern.IsKind (SyntaxKind.StringLiteralExpression)) {
+ ColorizeRegex (pattern);
+ }
+ }
+ }
+ }
+
+ internal static bool IsRegexConstructor (SymbolInfo symbolInfo)
+ {
+ return symbolInfo.Symbol?.ContainingType is INamedTypeSymbol && IsRegexType (symbolInfo.Symbol.ContainingType);
+ }
+
+ internal static bool IsRegexType (INamedTypeSymbol containingType)
+ {
+ return containingType != null && containingType.Name == "Regex" && containingType.ContainingNamespace.GetFullName () == "System.Text.RegularExpressions";
+ }
+
+ void ColorizeRegex (LiteralExpressionSyntax literal)
+ {
+ string pattern = literal.Token.ToString ();
+ if (pattern.Length == 0)
+ return;
+ bool isVerbatim = pattern [0] == '@';
+ bool inSet = false, inGroup = false;
+ int lastEscape = -1;
+ for (int i = 1; i < pattern.Length - 1; i++) {
+ char ch = pattern [i];
+ switch (ch) {
+ case '\\':
+ var start = i;
+ i++;
+ if (!isVerbatim) {
+ if (pattern [i] == '\\') {
+ i++;
+ } else {
+ break;
+ }
+ }
+
+ switch (pattern[i]) {
+ case 'w':
+ case 'W':
+ case 's':
+ case 'S':
+ case 'd':
+ case 'D':
+ Colorize (new TextSpan (literal.SpanStart + start, i - start + 1), stringRegexCharacterClass);
+ break;
+ case 'A':
+ case 'Z':
+ case 'z':
+ case 'G':
+ case 'b':
+ case 'B':
+ // Anchor
+ Colorize (new TextSpan (literal.SpanStart + start, i - start + 1), stringRegexCharacterClass);
+ break;
+ default:
+ if (lastEscape == literal.SpanStart + start) {
+ Colorize (new TextSpan (literal.SpanStart + start, i - start + 1), stringRegexAltEscapeCharacter);
+ lastEscape = -1;
+ } else {
+ Colorize (new TextSpan (literal.SpanStart + start, i - start + 1), stringRegexEscapeCharacter);
+ lastEscape = literal.SpanStart + i + 1;
+ }
+ break;
+ }
+ break;
+ case '^':
+ if (inSet) {
+ Colorize (new TextSpan (literal.SpanStart + i, 1), stringRegexSetConstructs);
+ } else {
+ Colorize (new TextSpan (literal.SpanStart + i, 1), stringRegexCharacterClass);
+ }
+ break;
+ case '$':
+ // Anchor
+ Colorize (new TextSpan (literal.SpanStart + i, 1), stringRegexCharacterClass);
+ break;
+ case '.':
+ Colorize (new TextSpan (literal.SpanStart + i, 1), stringRegexCharacterClass);
+ break;
+ case '|':
+ // Alternate
+ Colorize (new TextSpan (literal.SpanStart + i, 1), stringRegexCharacterClass);
+ break;
+ case '*':
+ case '+':
+ case '?':
+ // Quantifier
+ Colorize (new TextSpan (literal.SpanStart + i, 1), stringRegexCharacterClass);
+ break;
+ case '{': {
+ var closingIndex = pattern.IndexOf ('}', i + 1);
+ if (closingIndex >= 0) {
+ // Quantifier
+ Colorize (new TextSpan (literal.SpanStart + i, closingIndex - i + 1), stringRegexCharacterClass);
+ i = closingIndex;
+ } else {
+ Colorize (new TextSpan (literal.SpanStart + i, pattern.Length - i), stringRegexErrors);
+ i = pattern.Length;
+ }
+ break;
+ }
+ case '[': {
+ var closingIndex = pattern.IndexOf (']', i + 1);
+ if (closingIndex < 0) {
+ Colorize (new TextSpan (literal.SpanStart + i, pattern.Length - i), stringRegexErrors);
+ i = pattern.Length;
+ break;
+ }
+ inSet = true;
+ Colorize (new TextSpan (literal.SpanStart + i, 1), stringRegexSetConstructs);
+ }
+ break;
+ case ']':
+ inSet = false;
+ Colorize (new TextSpan (literal.SpanStart + i, 1), stringRegexSetConstructs);
+ break;
+ case '-':
+ if (inSet)
+ Colorize (new TextSpan (literal.SpanStart + i, 1), stringRegexSetConstructs);
+ break;
+ case '(':
+ if (i + 1 < pattern.Length && pattern[i + 1 ] == '?') {
+ if (i + 2 < pattern.Length && pattern[i + 2] == '#') {
+ var closingIndex = pattern.IndexOf (')', i + 2);
+ if (closingIndex < 0) {
+ Colorize (new TextSpan (literal.SpanStart + i, pattern.Length - i), stringRegexErrors);
+ i = pattern.Length;
+ break;
+ }
+ Colorize (new TextSpan (literal.SpanStart + i, closingIndex - i + 1), stringRegexComments);
+ i = closingIndex;
+ break;
+ }
+ Colorize (new TextSpan (literal.SpanStart + i, 2), stringRegexGroupingConstructs);
+ inGroup = true;
+ i++;
+ break;
+ }
+ Colorize (new TextSpan (literal.SpanStart + i, 1), stringRegexGroupingConstructs);
+ break;
+ case '<':
+ case '>':
+ if (inGroup) {
+ Colorize (new TextSpan (literal.SpanStart + i, 1), stringRegexGroupingConstructs);
+ }
+ break;
+ case ')':
+ inGroup = false;
+ Colorize (new TextSpan (literal.SpanStart + i, 1), stringRegexGroupingConstructs);
+ break;
+ }
+
+ }
+ }
+
bool IsInactiveConditional(ISymbol member)
{
if (member == null || member.Kind != SymbolKind.Method)
diff --git a/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Formatting/CSharpFormattingPolicyPanel.cs b/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Formatting/CSharpFormattingPolicyPanel.cs
index 194a3d9cd5..8cff36c94c 100644
--- a/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Formatting/CSharpFormattingPolicyPanel.cs
+++ b/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Formatting/CSharpFormattingPolicyPanel.cs
@@ -24,7 +24,7 @@
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
-using Gtk;
+using MonoDevelop.Components;
using MonoDevelop.Ide.Gui.Dialogs;
using MonoDevelop.Ide.Gui.Content;
using MonoDevelop.Ide.Editor;
@@ -41,7 +41,7 @@ namespace MonoDevelop.CSharp.Formatting
TextEditorDisplayBinding.InitSourceEditor ();
}
- public override Widget CreatePanelWidget ()
+ public override Control CreatePanelWidget ()
{
return panel = new CSharpFormattingPolicyPanelWidget ();
}
diff --git a/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Formatting/CSharpFormattingProfileDialog.cs b/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Formatting/CSharpFormattingProfileDialog.cs
index e23c050f4c..7aa90ca04e 100644
--- a/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Formatting/CSharpFormattingProfileDialog.cs
+++ b/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Formatting/CSharpFormattingProfileDialog.cs
@@ -37,7 +37,7 @@ using MonoDevelop.Ide.Gui.Content;
namespace MonoDevelop.CSharp.Formatting
{
- partial class CSharpFormattingProfileDialog : Dialog
+ partial class CSharpFormattingProfileDialog : Gtk.Dialog
{
readonly TextEditor texteditor = TextEditorFactory.CreateNewEditor ();
readonly CSharpFormattingPolicy profile;
diff --git a/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Highlighting/CSharpSyntaxMode.cs b/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Highlighting/CSharpSyntaxMode.cs
index 6e30529165..d1633673de 100644
--- a/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Highlighting/CSharpSyntaxMode.cs
+++ b/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Highlighting/CSharpSyntaxMode.cs
@@ -203,7 +203,15 @@ namespace MonoDevelop.CSharp.Highlighting
stringFormatItemColor = ColorScheme.StringFormatItemsKey;
nameofKeywordColor = ColorScheme.KeywordOtherKey;
- whenKeywordColor = ColorScheme.KeywordOtherKey;
+ whenKeywordColor = ColorScheme.KeywordOtherKey;
+
+ stringRegexCharacterClass = ColorScheme.RegexCharacterClassKey;
+ stringRegexGroupingConstructs = ColorScheme.RegexGroupingConstructsKey;
+ stringRegexSetConstructs = ColorScheme.RegexSetConstructsKey;
+ stringRegexErrors = ColorScheme.SyntaxErrorKey;
+ stringRegexComments = ColorScheme.CommentsSingleLineKey;
+ stringRegexEscapeCharacter = ColorScheme.RegexEscapeCharacterKey;
+ stringRegexAltEscapeCharacter = ColorScheme.RegexAltEscapeCharacterKey;
}
protected override void Colorize (TextSpan span, string color)
diff --git a/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Parser/TypeSystemProvider.cs b/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Parser/TypeSystemProvider.cs
index 86f2cfc180..8184a6a1dc 100644
--- a/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Parser/TypeSystemProvider.cs
+++ b/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Parser/TypeSystemProvider.cs
@@ -38,7 +38,6 @@ namespace MonoDevelop.CSharp.Parser
{
sealed class TypeSystemParser : MonoDevelop.Ide.TypeSystem.TypeSystemParser
{
- static readonly List<Error> emptyList = new List<Error> ();
public override async System.Threading.Tasks.Task<ParsedDocument> Parse (MonoDevelop.Ide.TypeSystem.ParseOptions options, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken))
{
var fileName = options.FileName;
diff --git a/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Project/CSharpCompilerParameters.cs b/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Project/CSharpCompilerParameters.cs
index 55da78fbe0..4c352ac059 100644
--- a/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Project/CSharpCompilerParameters.cs
+++ b/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Project/CSharpCompilerParameters.cs
@@ -92,19 +92,19 @@ namespace MonoDevelop.CSharp.Project
[ItemProperty("WarningsNotAsErrors", DefaultValue="")]
string warningsNotAsErrors = "";
- protected override void Write (IPropertySet pset, string toolsVersion)
+ protected override void Write (IPropertySet pset)
{
pset.SetPropertyOrder ("DebugSymbols", "DebugType", "Optimize", "OutputPath", "DefineConstants", "ErrorReport", "WarningLevel", "TreatWarningsAsErrors", "DocumentationFile");
- base.Write (pset, toolsVersion);
+ base.Write (pset);
if (optimize.HasValue)
pset.SetValue ("Optimize", optimize.Value);
}
- protected override void Read (IMSBuildEvaluatedPropertyCollection pset, string toolsVersion)
+ protected override void Read (IPropertySet pset)
{
- base.Read (pset, toolsVersion);
+ base.Read (pset);
var prop = pset.GetProperty ("GenerateDocumentation");
if (prop != null && documentationFile != null) {
@@ -212,7 +212,8 @@ namespace MonoDevelop.CSharp.Project
return optimize ?? false;
}
set {
- optimize = value;
+ if (value != Optimize)
+ optimize = value;
}
}
diff --git a/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Project/CSharpProjectExtension.cs b/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Project/CSharpProjectExtension.cs
index 7dd7239f66..dcae550ed4 100644
--- a/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Project/CSharpProjectExtension.cs
+++ b/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Project/CSharpProjectExtension.cs
@@ -109,7 +109,7 @@ namespace MonoDevelop.CSharp.Project
}
}
- protected override void OnReadConfiguration (ProgressMonitor monitor, ProjectConfiguration config, IMSBuildEvaluatedPropertyCollection pset)
+ protected override void OnReadConfiguration (ProgressMonitor monitor, ProjectConfiguration config, IPropertySet pset)
{
base.OnReadConfiguration (monitor, config, pset);
diff --git a/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Project/CodeGenerationPanel.cs b/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Project/CodeGenerationPanel.cs
index dfd6150b41..46f4287f6d 100644
--- a/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Project/CodeGenerationPanel.cs
+++ b/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Project/CodeGenerationPanel.cs
@@ -27,8 +27,8 @@
//
using System;
+using MonoDevelop.Components;
using MonoDevelop.Projects;
-using Gtk;
using MonoDevelop.Ide.Gui.Dialogs;
namespace MonoDevelop.CSharp.Project
@@ -118,7 +118,7 @@ namespace MonoDevelop.CSharp.Project
{
CodeGenerationPanelWidget widget;
- public override Widget CreatePanelWidget()
+ public override Control CreatePanelWidget()
{
return widget = new CodeGenerationPanelWidget ();
}
diff --git a/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Project/CompilerOptionsPanelWidget.cs b/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Project/CompilerOptionsPanelWidget.cs
index dcbddc3bf8..26ebd30cca 100644
--- a/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Project/CompilerOptionsPanelWidget.cs
+++ b/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Project/CompilerOptionsPanelWidget.cs
@@ -30,6 +30,7 @@
using System;
using Gtk;
+using MonoDevelop.Components;
using MonoDevelop.Core;
using MonoDevelop.Projects;
using MonoDevelop.Projects.Text;
@@ -230,7 +231,7 @@ namespace MonoDevelop.CSharp.Project
{
CompilerOptionsPanelWidget widget;
- public override Widget CreatePanelWidget ()
+ public override Control CreatePanelWidget ()
{
return (widget = new CompilerOptionsPanelWidget ((DotNetProject) ConfiguredProject));
}
diff --git a/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Refactoring/CSharpCodeGenerator.cs b/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Refactoring/CSharpCodeGenerator.cs
index 166a0d5466..a9bdaeea5b 100644
--- a/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Refactoring/CSharpCodeGenerator.cs
+++ b/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Refactoring/CSharpCodeGenerator.cs
@@ -775,9 +775,9 @@ namespace MonoDevelop.CSharp.Refactoring
//if (options.ExplicitDeclaration || options.ImplementingType.Kind == TypeKind.Interface)
// return;
result.Append (GetModifiers (options.ImplementingType, options.Part, member));
- bool isFromInterface = false;
+ //bool isFromInterface = false;
if (member.ContainingType != null && member.ContainingType.TypeKind == TypeKind.Interface) {
- isFromInterface = true;
+ //isFromInterface = true;
// TODO: Type system conversion.
// if (options.ImplementingType != null) {
// foreach (var type in options.ImplementingType.BaseTypes) {
@@ -791,7 +791,6 @@ namespace MonoDevelop.CSharp.Refactoring
// }
}
if (member is IMethodSymbol) {
- var method = (IMethodSymbol)member;
if (!options.CreateProtocolMember)
result.Append ("override ");
}
diff --git a/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Refactoring/CodeGenerationService.cs b/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Refactoring/CodeGenerationService.cs
index 2485deb991..b4d271ca03 100644
--- a/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Refactoring/CodeGenerationService.cs
+++ b/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Refactoring/CodeGenerationService.cs
@@ -157,7 +157,7 @@ namespace MonoDevelop.Refactoring
if (systemVoid != null) newMember = newMember.ReplaceNode (systemVoid, SyntaxFactory.ParseTypeName ("void"));
var newRoot = root.ReplaceNode (typeDecl, typeDecl.AddMembers ((MemberDeclarationSyntax)newMember.WithAdditionalAnnotations (Simplifier.Annotation, Formatter.Annotation, insertedMemberAnnotation)));
- var doc = IdeApp.Workbench.OpenDocument (part.SourceTree.FilePath, project, true);
+ var doc = await IdeApp.Workbench.OpenDocument (part.SourceTree.FilePath, project, true);
var policy = project.Policies.Get<CSharpFormattingPolicy> ("text/x-csharp");
var textPolicy = project.Policies.Get<TextStylePolicy> ("text/x-csharp");
diff --git a/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Refactoring/ExtractMethodCommandHandler.cs b/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Refactoring/ExtractMethodCommandHandler.cs
index f4cd6ae7d0..a063282156 100644
--- a/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Refactoring/ExtractMethodCommandHandler.cs
+++ b/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Refactoring/ExtractMethodCommandHandler.cs
@@ -90,7 +90,7 @@ namespace MonoDevelop.CSharp.Refactoring
doc.Editor.RemoveText (extractionResult.MethodDeclarationNode.SpanStart, "private ".Length);
}
}
- doc.UpdateParseDocument ();
+ await doc.UpdateParseDocument ();
var info = RefactoringSymbolInfo.GetSymbolInfoAsync (doc, extractionResult.InvocationNameToken.Span.Start).Result;
var sym = info.DeclaredSymbol ?? info.Symbol;
if (sym != null)
diff --git a/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Refactoring/FindDerivedSymbolsHandler.cs b/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Refactoring/FindDerivedSymbolsHandler.cs
index bfa67762ff..e63f3f1b9c 100644
--- a/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Refactoring/FindDerivedSymbolsHandler.cs
+++ b/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Refactoring/FindDerivedSymbolsHandler.cs
@@ -60,23 +60,24 @@ namespace MonoDevelop.CSharp.Refactoring
public static void FindDerivedSymbols (ISymbol symbol)
{
- Task.Run (delegate {
+ Task.Run (async delegate {
using (var monitor = IdeApp.Workbench.ProgressMonitors.GetSearchProgressMonitor (true, true)) {
- IEnumerable<ISymbol> task;
-
+ IEnumerable<ISymbol> result;
if (symbol.ContainingType != null && symbol.ContainingType.TypeKind == TypeKind.Interface) {
- task = SymbolFinder.FindImplementationsAsync (symbol, TypeSystemService.Workspace.CurrentSolution).Result;
+ result = await SymbolFinder.FindImplementationsAsync (symbol, TypeSystemService.Workspace.CurrentSolution).ConfigureAwait (false);
} else if (symbol.Kind == SymbolKind.NamedType) {
var type = (INamedTypeSymbol)symbol;
if (type.TypeKind == TypeKind.Interface) {
- task = SymbolFinder.FindImplementationsAsync (symbol, TypeSystemService.Workspace.CurrentSolution).Result;
+ result = (await type.FindDerivedInterfacesAsync (TypeSystemService.Workspace.CurrentSolution).ConfigureAwait (false)).Cast<ISymbol> ().Concat (
+ await SymbolFinder.FindImplementationsAsync (symbol, TypeSystemService.Workspace.CurrentSolution).ConfigureAwait (false)
+ );
} else {
- task = type.FindDerivedClassesAsync (TypeSystemService.Workspace.CurrentSolution).Result.Cast<ISymbol> ();
+ result = (await type.FindDerivedClassesAsync (TypeSystemService.Workspace.CurrentSolution).ConfigureAwait (false)).Cast<ISymbol> ();
}
} else {
- task = SymbolFinder.FindOverridesAsync (symbol, TypeSystemService.Workspace.CurrentSolution).Result;
+ result = await SymbolFinder.FindOverridesAsync (symbol, TypeSystemService.Workspace.CurrentSolution).ConfigureAwait (false);
}
- foreach (var foundSymbol in task) {
+ foreach (var foundSymbol in result) {
foreach (var loc in foundSymbol.Locations)
monitor.ReportResult (new MemberReference (foundSymbol, loc.SourceTree.FilePath, loc.SourceSpan.Start, loc.SourceSpan.Length));
}
diff --git a/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Refactoring/FindReferencesHandler.cs b/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Refactoring/FindReferencesHandler.cs
index b1c0e5d15b..aa0f439781 100644
--- a/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Refactoring/FindReferencesHandler.cs
+++ b/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Refactoring/FindReferencesHandler.cs
@@ -190,9 +190,8 @@ namespace MonoDevelop.CSharp.Refactoring
var info = RefactoringSymbolInfo.GetSymbolInfoAsync (doc, doc.Editor.CaretOffset).Result;
var sym = info.Symbol ?? info.DeclaredSymbol;
- var semanticModel = doc.ParsedDocument.GetAst<SemanticModel> ();
if (sym != null)
- FindRefs (sym, semanticModel.Compilation);
+ FindRefs (sym, info.Model.Compilation);
}
}
diff --git a/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Tooltips/LanguageItemTooltipProvider.cs b/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Tooltips/LanguageItemTooltipProvider.cs
index 5e79b19167..3a8919db6e 100644
--- a/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Tooltips/LanguageItemTooltipProvider.cs
+++ b/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Tooltips/LanguageItemTooltipProvider.cs
@@ -99,7 +99,7 @@ namespace MonoDevelop.SourceEditor
#endregion
- public override Control CreateTooltipWindow (TextEditor editor, DocumentContext ctx, TooltipItem item, int offset, Gdk.ModifierType modifierState)
+ public override Control CreateTooltipWindow (TextEditor editor, DocumentContext ctx, TooltipItem item, int offset, Xwt.ModifierKeys modifierState)
{
var doc = ctx;
if (doc == null)
diff --git a/main/src/addins/CSharpBinding/MonoDevelop.CSharp/CSharpNavigationTextEditorExtension.cs b/main/src/addins/CSharpBinding/MonoDevelop.CSharp/CSharpNavigationTextEditorExtension.cs
index 1b9f73f259..c555fbd408 100644
--- a/main/src/addins/CSharpBinding/MonoDevelop.CSharp/CSharpNavigationTextEditorExtension.cs
+++ b/main/src/addins/CSharpBinding/MonoDevelop.CSharp/CSharpNavigationTextEditorExtension.cs
@@ -24,12 +24,115 @@
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
using System;
+using System.Collections.Generic;
+using System.Threading.Tasks;
+using Microsoft.CodeAnalysis;
+using Microsoft.CodeAnalysis.CSharp;
+using Microsoft.CodeAnalysis.Text;
+using MonoDevelop.Ide.Editor.Extension;
+using System.Threading;
+using Microsoft.CodeAnalysis.CSharp.Syntax;
+using MonoDevelop.Ide;
+using MonoDevelop.Ide.Editor;
+using System.Linq;
+
namespace MonoDevelop.CSharp
{
- public class CSharpNavigationTextEditorExtension
+ class CSharpNavigationTextEditorExtension : AbstractNavigationExtension
{
- public CSharpNavigationTextEditorExtension ()
+ static List<NavigationSegment> emptyList = new List<NavigationSegment> ();
+
+ protected override async Task<IEnumerable<NavigationSegment>> RequestLinksAsync (int offset, int length, CancellationToken token)
{
+ var parsedDocument = DocumentContext.ParsedDocument;
+ if (parsedDocument == null)
+ return emptyList;
+ var model = parsedDocument.GetAst<SemanticModel> ();
+ if (model == null)
+ return emptyList;
+ try {
+ var visitor = new NavigationVisitor (DocumentContext, model, new TextSpan (offset, length), token);
+ visitor.Visit (await model.SyntaxTree.GetRootAsync (token).ConfigureAwait (false));
+ return visitor.result;
+ } catch (OperationCanceledException) {
+ return emptyList;
+ }
+ }
+
+ class NavigationVisitor : CSharpSyntaxWalker
+ {
+ SemanticModel model;
+ internal List<NavigationSegment> result = new List<NavigationSegment> ();
+
+ TextSpan region;
+ DocumentContext documentContext;
+ CancellationToken token;
+
+ public NavigationVisitor (DocumentContext documentContext, SemanticModel model, TextSpan region, CancellationToken token)
+ {
+ this.documentContext = documentContext;
+ this.model = model;
+ this.region = region;
+ this.token = token;
+ }
+
+ public override void VisitCompilationUnit (CompilationUnitSyntax node)
+ {
+ var startNode = node.DescendantNodesAndSelf (n => region.Start <= n.SpanStart).FirstOrDefault ();
+ if (startNode == node || startNode == null) {
+ base.VisitCompilationUnit (node);
+ } else {
+ this.Visit (startNode);
+ }
+ }
+
+ public override void Visit (SyntaxNode node)
+ {
+ if (node.Span.End < region.Start)
+ return;
+ if (node.Span.Start > region.End)
+ return;
+ base.Visit(node);
+ }
+
+ public override void VisitIdentifierName (IdentifierNameSyntax node)
+ {
+ var info = model.GetSymbolInfo (node);
+ if (IsNavigatable (info)) {
+ result.Add (new NavigationSegment (node.Span.Start, node.Span.Length, delegate {
+ GLib.Timeout.Add (50, delegate {
+ IdeApp.ProjectOperations.JumpToDeclaration (info.Symbol, documentContext.Project);
+ return false;
+ });
+ }));
+ }
+ }
+
+ static bool IsNavigatable (SymbolInfo info)
+ {
+ return info.Symbol != null && info.Symbol.Kind != SymbolKind.Namespace;
+ }
+
+ public override void VisitMemberAccessExpression (MemberAccessExpressionSyntax node)
+ {
+ var info = model.GetSymbolInfo (node);
+ if (IsNavigatable(info)) {
+ result.Add (new NavigationSegment (node.Name.Span.Start, node.Name.Span.Length, delegate {
+ GLib.Timeout.Add (50, delegate {
+ IdeApp.ProjectOperations.JumpToDeclaration (info.Symbol, documentContext.Project);
+ return false;
+ });
+ }));
+ }
+
+ base.VisitMemberAccessExpression (node);
+ }
+
+ public override void VisitBlock (BlockSyntax node)
+ {
+ token.ThrowIfCancellationRequested ();
+ base.VisitBlock (node);
+ }
}
}
}
diff --git a/main/src/addins/CSharpBinding/MonoDevelop.CSharp/DeclaredSymbolInfo.cs b/main/src/addins/CSharpBinding/MonoDevelop.CSharp/DeclaredSymbolInfo.cs
index cdad401c81..de58487e6b 100644
--- a/main/src/addins/CSharpBinding/MonoDevelop.CSharp/DeclaredSymbolInfo.cs
+++ b/main/src/addins/CSharpBinding/MonoDevelop.CSharp/DeclaredSymbolInfo.cs
@@ -32,7 +32,6 @@ using Roslyn.Utilities;
using Microsoft.CodeAnalysis;
using System;
using System.Linq;
-using Microsoft.CodeAnalysis;
using Microsoft.CodeAnalysis.CSharp;
using Microsoft.CodeAnalysis.CSharp.Syntax;
using System.Diagnostics;
@@ -402,7 +401,7 @@ namespace MonoDevelop.CSharp
struct DeclaredSymbolInfo
{
- internal Document Document;
+ internal DocumentId DocumentId;
public string FilePath { get; }
public string Name { get; }
@@ -470,14 +469,14 @@ namespace MonoDevelop.CSharp
}
Document GetDocument (CancellationToken token)
{
- var doc = type.Document;
+ var doc = type.DocumentId;
if (doc == null) {
var docId = TypeSystemService.GetDocuments (type.FilePath).FirstOrDefault ();
if (docId == null)
return null;
return TypeSystemService.GetCodeAnalysisDocument (docId, token);
}
- return doc;
+ return TypeSystemService.GetCodeAnalysisDocument (type.DocumentId, token);
}
public override async Task<TooltipInformation> GetTooltipInformation (CancellationToken token)
@@ -526,9 +525,9 @@ namespace MonoDevelop.CSharp
}
}
- public override string GetMarkupText (Widget widget)
+ public override string GetMarkupText ()
{
- return HighlightMatch (widget, useFullName ? type.FullyQualifiedContainerName : type.Name, match);
+ return HighlightMatch (useFullName ? type.FullyQualifiedContainerName : type.Name, match);
}
public DeclaredSymbolInfoResult (string match, string matchedString, int rank, DeclaredSymbolInfo type, bool useFullName) : base (match, matchedString, rank)
diff --git a/main/src/addins/CSharpBinding/MonoDevelop.CSharp/PathedDocumentTextEditorExtension.cs b/main/src/addins/CSharpBinding/MonoDevelop.CSharp/PathedDocumentTextEditorExtension.cs
index 33eda94c5a..4a13d0bebc 100644
--- a/main/src/addins/CSharpBinding/MonoDevelop.CSharp/PathedDocumentTextEditorExtension.cs
+++ b/main/src/addins/CSharpBinding/MonoDevelop.CSharp/PathedDocumentTextEditorExtension.cs
@@ -587,7 +587,7 @@ namespace MonoDevelop.CSharp
}
- public Gtk.Widget CreatePathWidget (int index)
+ public Control CreatePathWidget (int index)
{
PathEntry[] path = CurrentPath;
if (path == null || index < 0 || index >= path.Length)
diff --git a/main/src/addins/CSharpBinding/MonoDevelop.CSharp/ProjectSearchCategory.cs b/main/src/addins/CSharpBinding/MonoDevelop.CSharp/ProjectSearchCategory.cs
index 18aeb4d240..b13b9e6977 100644
--- a/main/src/addins/CSharpBinding/MonoDevelop.CSharp/ProjectSearchCategory.cs
+++ b/main/src/addins/CSharpBinding/MonoDevelop.CSharp/ProjectSearchCategory.cs
@@ -47,16 +47,14 @@ namespace MonoDevelop.CSharp
{
class ProjectSearchCategory : SearchCategory
{
- static Components.PopoverWindow widget;
-
internal static void Init ()
{
- MonoDevelopWorkspace.LoadingFinished += delegate {
- UpdateSymbolInfos ();
+ MonoDevelopWorkspace.LoadingFinished += async delegate {
+ await UpdateSymbolInfos ();
};
if (IdeApp.IsInitialized) {
- IdeApp.Workspace.LastWorkspaceItemClosed += delegate {
- DisposeSymbolInfoTask ();
+ IdeApp.Workspace.LastWorkspaceItemClosed += async delegate {
+ await DisposeSymbolInfoTask ();
};
}
}
@@ -68,31 +66,29 @@ namespace MonoDevelop.CSharp
public override void Initialize (Components.PopoverWindow popupWindow)
{
- widget = popupWindow;
- lastResult = new WorkerResult (popupWindow);
+ lastResult = new WorkerResult ();
}
internal static Task<SymbolCache> SymbolInfoTask;
- static TimerCounter getMembersTimer = InstrumentationService.CreateTimerCounter ("Time to get all members", "NavigateToDialog");
static TimerCounter getTypesTimer = InstrumentationService.CreateTimerCounter ("Time to get all types", "NavigateToDialog");
static CancellationTokenSource symbolInfoTokenSrc = new CancellationTokenSource();
- public static void UpdateSymbolInfos ()
+ public static async Task UpdateSymbolInfos ()
{
- DisposeSymbolInfoTask ();
+ await DisposeSymbolInfoTask ();
CancellationToken token = symbolInfoTokenSrc.Token;
SymbolInfoTask = Task.Run (delegate {
return GetSymbolInfos (token);
}, token);
}
- static void DisposeSymbolInfoTask ()
+ static async Task DisposeSymbolInfoTask ()
{
symbolInfoTokenSrc.Cancel ();
if (SymbolInfoTask != null) {
try {
- var old = SymbolInfoTask.Result;
+ var old = await SymbolInfoTask;
if (old != null)
old.Dispose ();
} catch (TaskCanceledException) {
@@ -102,7 +98,7 @@ namespace MonoDevelop.CSharp
}
}
symbolInfoTokenSrc = new CancellationTokenSource();
- lastResult = new WorkerResult (widget);
+ lastResult = new WorkerResult ();
SymbolInfoTask = null;
}
@@ -154,7 +150,7 @@ namespace MonoDevelop.CSharp
cancellationToken.ThrowIfCancellationRequested ();
DeclaredSymbolInfo declaredSymbolInfo;
if (current.TryGetDeclaredSymbolInfo (out declaredSymbolInfo)) {
- declaredSymbolInfo.Document = document;
+ declaredSymbolInfo.DocumentId = document.Id;
infos.Add (declaredSymbolInfo);
}
}
@@ -211,9 +207,9 @@ namespace MonoDevelop.CSharp
case WorkspaceChangeKind.DocumentChanged:
var doc = currentSolution.GetDocument (e.DocumentId);
if (doc != null) {
- Task.Run (async delegate {
+ await Task.Run (async delegate {
await UpdateDocument (documentInfos, doc, default (CancellationToken));
- });
+ }).ConfigureAwait (false);
}
break;
}
@@ -265,7 +261,7 @@ namespace MonoDevelop.CSharp
if (searchPattern.Tag != null && !(typeTags.Contains (searchPattern.Tag) || memberTags.Contains (searchPattern.Tag)) || searchPattern.HasLineNumber)
return null;
try {
- var newResult = new WorkerResult (widget);
+ var newResult = new WorkerResult ();
newResult.pattern = searchPattern.Pattern;
newResult.Tag = searchPattern.Tag;
List<DeclaredSymbolInfo> allTypes;
@@ -278,7 +274,7 @@ namespace MonoDevelop.CSharp
newResult.FullSearch = toMatch.IndexOf ('.') > 0;
var oldLastResult = lastResult;
if (newResult.FullSearch && oldLastResult != null && !oldLastResult.FullSearch)
- oldLastResult = new WorkerResult (widget);
+ oldLastResult = new WorkerResult ();
// var now = DateTime.Now;
AllResults (searchResultCallback, oldLastResult, newResult, allTypes, token);
@@ -295,8 +291,6 @@ namespace MonoDevelop.CSharp
void AllResults (ISearchResultCallback searchResultCallback, WorkerResult lastResult, WorkerResult newResult, IReadOnlyList<DeclaredSymbolInfo> completeTypeList, CancellationToken token)
{
- if (newResult.isGotoFilePattern)
- return;
uint x = 0;
// Search Types
newResult.filteredSymbols = new List<DeclaredSymbolInfo> ();
@@ -377,14 +371,13 @@ namespace MonoDevelop.CSharp
}
}
- public bool isGotoFilePattern;
public ResultsDataSource results;
public bool FullSearch;
public StringMatcher matcher;
- public WorkerResult (Widget widget)
+ public WorkerResult ()
{
- results = new ResultsDataSource (widget);
+ results = new ResultsDataSource ();
}
internal SearchResult CheckType (DeclaredSymbolInfo symbol)
diff --git a/main/src/addins/CSharpBinding/MonoDevelop.JSon/JSonIndentEngine.cs b/main/src/addins/CSharpBinding/MonoDevelop.JSon/JSonIndentEngine.cs
index 895d6ea21d..baedfa03c4 100644
--- a/main/src/addins/CSharpBinding/MonoDevelop.JSon/JSonIndentEngine.cs
+++ b/main/src/addins/CSharpBinding/MonoDevelop.JSon/JSonIndentEngine.cs
@@ -244,7 +244,6 @@ namespace MonoDevelop.JSon
}
SourceText sourceText;
- JSonIndentEngine jSonIndentEngine;
public SourceText Document {
get {
diff --git a/main/src/addins/CSharpBinding/Util/ConflictResolver.cs b/main/src/addins/CSharpBinding/Util/ConflictResolver.cs
index 03c541b703..760c1757be 100644
--- a/main/src/addins/CSharpBinding/Util/ConflictResolver.cs
+++ b/main/src/addins/CSharpBinding/Util/ConflictResolver.cs
@@ -45,12 +45,12 @@ namespace ICSharpCode.NRefactory6.CSharp
{
class ConflictResolution
{
- static Type typeInfo;
+ //static Type typeInfo;
internal object instance;
static ConflictResolution ()
{
- typeInfo = Type.GetType ("Microsoft.CodeAnalysis.Rename.ConflictEngine.ConflictResolution" + ReflectionNamespaces.WorkspacesAsmName, true);
+ //typeInfo = Type.GetType ("Microsoft.CodeAnalysis.Rename.ConflictEngine.ConflictResolution" + ReflectionNamespaces.WorkspacesAsmName, true);
}
@@ -63,12 +63,12 @@ namespace ICSharpCode.NRefactory6.CSharp
class RenameLocations
{
- static Type typeInfo;
+ //static Type typeInfo;
internal object instance;
static RenameLocations ()
{
- typeInfo = Type.GetType ("Microsoft.CodeAnalysis.Rename.RenameLocations" + ReflectionNamespaces.WorkspacesAsmName, true);
+ //typeInfo = Type.GetType ("Microsoft.CodeAnalysis.Rename.RenameLocations" + ReflectionNamespaces.WorkspacesAsmName, true);
}
diff --git a/main/src/addins/CSharpBinding/Util/CrefSyntaxExtensions.cs b/main/src/addins/CSharpBinding/Util/CrefSyntaxExtensions.cs
index 60df664057..1d80af7b2f 100644
--- a/main/src/addins/CSharpBinding/Util/CrefSyntaxExtensions.cs
+++ b/main/src/addins/CSharpBinding/Util/CrefSyntaxExtensions.cs
@@ -83,7 +83,7 @@ namespace ICSharpCode.NRefactory6.CSharp
if (symbol is INamespaceOrTypeSymbol)
{
- var namespaceOrTypeSymbol = (INamespaceOrTypeSymbol)symbol;
+ //var namespaceOrTypeSymbol = (INamespaceOrTypeSymbol)symbol;
// 1. Check for Predefined Types
if (symbol is INamedTypeSymbol)
diff --git a/main/src/addins/CSharpBinding/Util/IMethodSymbolExtensions.cs b/main/src/addins/CSharpBinding/Util/IMethodSymbolExtensions.cs
index c1e216e404..cdb3788d4f 100644
--- a/main/src/addins/CSharpBinding/Util/IMethodSymbolExtensions.cs
+++ b/main/src/addins/CSharpBinding/Util/IMethodSymbolExtensions.cs
@@ -158,8 +158,7 @@ namespace ICSharpCode.NRefactory6.CSharp
.Concat(method.Name)
.Concat(containingType.Name);
- var unusableNames = parameterNames.Concat(outerTypeParameterNames).ToSet(
- true ? StringComparer.Ordinal : StringComparer.OrdinalIgnoreCase);
+ var unusableNames = parameterNames.Concat(outerTypeParameterNames).ToSet(StringComparer.Ordinal);
var newTypeParameterNames = NameGenerator.EnsureUniqueness(
method.TypeParameters.Select(tp => tp.Name).ToList(),
diff --git a/main/src/addins/CSharpBinding/Util/SymbolKeyExtensions.cs b/main/src/addins/CSharpBinding/Util/SymbolKeyExtensions.cs
index 9b801429ca..c190298089 100644
--- a/main/src/addins/CSharpBinding/Util/SymbolKeyExtensions.cs
+++ b/main/src/addins/CSharpBinding/Util/SymbolKeyExtensions.cs
@@ -34,7 +34,7 @@ namespace ICSharpCode.NRefactory6.CSharp
/// This entry point should only be called from the actual Symbol classes. It should not be
/// used internally inside this type. Instead, any time we need to get the <see cref="SymbolKey"/> for a
/// related symbol (i.e. the containing namespace of a namespace) we should call
- /// <see cref="GetOrCreate"/>. The benefit of this is twofold. First of all, it keeps the size of the
+ /// GetOrCreate. The benefit of this is twofold. First of all, it keeps the size of the
/// <see cref="SymbolKey"/> small by allowing up to reuse parts we've already created. For example, if we
/// have the <see cref="SymbolKey"/> for <c>Foo(int, int)</c>, then we will reuse the <see cref="SymbolKey"/>s for both <c>int</c>s.
/// Second, this allows us to deal with the recursive nature of MethodSymbols and
diff --git a/main/src/addins/CSharpBinding/Util/SyntaxNodeExtensions.cs b/main/src/addins/CSharpBinding/Util/SyntaxNodeExtensions.cs
index 98db1409f0..b93ece167e 100644
--- a/main/src/addins/CSharpBinding/Util/SyntaxNodeExtensions.cs
+++ b/main/src/addins/CSharpBinding/Util/SyntaxNodeExtensions.cs
@@ -1254,15 +1254,6 @@ namespace ICSharpCode.NRefactory6.CSharp
private static readonly Func<SyntaxTriviaList, int, SyntaxToken> s_findSkippedTokenForward =
(l, p) => FindTokenHelper.FindSkippedTokenForward(GetSkippedTokens(l), p);
- /// <summary>
- /// Look inside a trivia list for a skipped token that contains the given position.
- /// </summary>
- private static readonly Func<SyntaxTriviaList, int, SyntaxToken> s_findSkippedTokenBackward =
- (l, p) => FindTokenHelper.FindSkippedTokenBackward(GetSkippedTokens(l), p);
-
- /// <summary>
- /// return only skipped tokens
- /// </summary>
private static IEnumerable<SyntaxToken> GetSkippedTokens(SyntaxTriviaList list)
{
return list.Where(trivia => trivia.RawKind == (int)SyntaxKind.SkippedTokensTrivia)
diff --git a/main/src/addins/CSharpBinding/Util/TaskExtensions.cs b/main/src/addins/CSharpBinding/Util/TaskExtensions.cs
index c7f7b6d1bc..0b0ae8f69f 100644
--- a/main/src/addins/CSharpBinding/Util/TaskExtensions.cs
+++ b/main/src/addins/CSharpBinding/Util/TaskExtensions.cs
@@ -127,7 +127,7 @@ namespace ICSharpCode.NRefactory6.CSharp
{
return continuationFunction(t);
}
- catch (Exception e) //when (FatalError.ReportUnlessCanceled(e))
+ catch (Exception) //when (FatalError.ReportUnlessCanceled(e))
{
throw new InvalidOperationException ();
}
diff --git a/main/src/addins/CSharpBinding/Util/TypeExtensions.cs b/main/src/addins/CSharpBinding/Util/TypeExtensions.cs
index 7027bd58ee..86b8b0a5a5 100644
--- a/main/src/addins/CSharpBinding/Util/TypeExtensions.cs
+++ b/main/src/addins/CSharpBinding/Util/TypeExtensions.cs
@@ -43,6 +43,7 @@ namespace ICSharpCode.NRefactory6.CSharp
{
readonly static MethodInfo generateTypeSyntaxMethod;
readonly static MethodInfo findDerivedClassesAsyncMethod;
+ readonly static MethodInfo findDerivedInterfacesAsyncMethod;
static TypeExtensions()
{
@@ -51,8 +52,10 @@ namespace ICSharpCode.NRefactory6.CSharp
typeInfo = Type.GetType("Microsoft.CodeAnalysis.FindSymbols.DependentTypeFinder" + ReflectionNamespaces.WorkspacesAsmName, true);
findDerivedClassesAsyncMethod = typeInfo.GetMethod("FindDerivedClassesAsync", new[] { typeof(INamedTypeSymbol), typeof(Solution), typeof(IImmutableSet<Project>), typeof(CancellationToken) });
+ findDerivedInterfacesAsyncMethod = typeInfo.GetMethod("FindDerivedInterfacesAsync", new[] { typeof(INamedTypeSymbol), typeof(Solution), typeof(IImmutableSet<Project>), typeof(CancellationToken) });
}
+
public static TypeSyntax GenerateTypeSyntax(this ITypeSymbol typeSymbol, SyntaxAnnotation simplifierAnnotation = null)
{
var typeSyntax = (TypeSyntax)generateTypeSyntaxMethod.Invoke(null, new object[] { typeSymbol });
@@ -83,6 +86,11 @@ namespace ICSharpCode.NRefactory6.CSharp
return (Task<IEnumerable<INamedTypeSymbol>>)findDerivedClassesAsyncMethod.Invoke(null, new object[] { type, solution, projects, cancellationToken });
}
+ public static Task<IEnumerable<INamedTypeSymbol>> FindDerivedInterfacesAsync (this INamedTypeSymbol type, Solution solution, IImmutableSet<Project> projects = null, CancellationToken cancellationToken = default(CancellationToken))
+ {
+ return (Task<IEnumerable<INamedTypeSymbol>>)findDerivedInterfacesAsyncMethod.Invoke(null, new object[] { type, solution, projects, cancellationToken });
+ }
+
public static bool IsNullableType(this ITypeSymbol type)
{
var original = type.OriginalDefinition;
diff --git a/main/src/addins/CSharpBinding/gtk-gui/generated.cs b/main/src/addins/CSharpBinding/gtk-gui/generated.cs
index 3285e87c05..aec72da2fc 100644
--- a/main/src/addins/CSharpBinding/gtk-gui/generated.cs
+++ b/main/src/addins/CSharpBinding/gtk-gui/generated.cs
@@ -6,9 +6,10 @@ namespace Stetic
{
private static bool initialized;
- internal static void Initialize (Gtk.Widget iconRenderer)
+ internal static void Initialize(Gtk.Widget iconRenderer)
{
- if ((Stetic.Gui.initialized == false)) {
+ if ((Stetic.Gui.initialized == false))
+ {
Stetic.Gui.initialized = true;
}
}
diff --git a/main/src/addins/ChangeLogAddIn/AddLogEntryDialog.cs b/main/src/addins/ChangeLogAddIn/AddLogEntryDialog.cs
index 9b96e905d6..46985bc20e 100644
--- a/main/src/addins/ChangeLogAddIn/AddLogEntryDialog.cs
+++ b/main/src/addins/ChangeLogAddIn/AddLogEntryDialog.cs
@@ -35,7 +35,7 @@ using MonoDevelop.Ide.Fonts;
namespace MonoDevelop.ChangeLogAddIn
{
- partial class AddLogEntryDialog : Dialog
+ partial class AddLogEntryDialog : Gtk.Dialog
{
readonly ListStore store;
readonly Dictionary<ChangeLogEntry, string> changes = new Dictionary<ChangeLogEntry, string> ();
diff --git a/main/src/addins/ChangeLogAddIn/ChangeLogAddIn.cs b/main/src/addins/ChangeLogAddIn/ChangeLogAddIn.cs
index 5bfcd63773..4b6aefb313 100644
--- a/main/src/addins/ChangeLogAddIn/ChangeLogAddIn.cs
+++ b/main/src/addins/ChangeLogAddIn/ChangeLogAddIn.cs
@@ -36,6 +36,7 @@ using MonoDevelop.Ide.Gui.Content;
using MonoDevelop.Ide.Gui.Pads.ProjectPad;
using MonoDevelop.Ide;
using MonoDevelop.Ide.Editor;
+using System.Threading.Tasks;
namespace MonoDevelop.ChangeLogAddIn
{
@@ -46,9 +47,9 @@ namespace MonoDevelop.ChangeLogAddIn
public class InsertEntryHandler : CommandHandler
{
- protected override void Run()
+ protected override async void Run()
{
- Document document = GetActiveChangeLogDocument();
+ Document document = await GetActiveChangeLogDocument();
if (document == null) return;
if (InsertHeader(document))
@@ -145,7 +146,7 @@ namespace MonoDevelop.ChangeLogAddIn
return text.IndexOf (eol + eol, StringComparison.Ordinal);
}
- static Document GetActiveChangeLogDocument()
+ static async Task<Document> GetActiveChangeLogDocument()
{
string file = GetSelectedFile ();
if (file == null)
@@ -160,7 +161,7 @@ namespace MonoDevelop.ChangeLogAddIn
return null;
if (File.Exists (clog))
- return IdeApp.Workbench.OpenDocument (clog, OpenDocumentOptions.Default | OpenDocumentOptions.OnlyInternalViewer);
+ return await IdeApp.Workbench.OpenDocument (clog, OpenDocumentOptions.Default | OpenDocumentOptions.OnlyInternalViewer);
Document document = IdeApp.Workbench.NewDocument (clog, "text/plain", "");
document.Save();
diff --git a/main/src/addins/ChangeLogAddIn/ProjectOptionPanel.cs b/main/src/addins/ChangeLogAddIn/ProjectOptionPanel.cs
index 12a02a3337..43acbf321f 100644
--- a/main/src/addins/ChangeLogAddIn/ProjectOptionPanel.cs
+++ b/main/src/addins/ChangeLogAddIn/ProjectOptionPanel.cs
@@ -25,7 +25,7 @@
//
//
-using Gtk;
+using MonoDevelop.Components;
using MonoDevelop.Projects;
using MonoDevelop.Core;
using MonoDevelop.Ide.Gui.Dialogs;
@@ -36,7 +36,7 @@ namespace MonoDevelop.ChangeLogAddIn
{
ProjectOptionPanelWidget widget;
- public override Widget CreatePanelWidget ()
+ public override Control CreatePanelWidget ()
{
return widget = new ProjectOptionPanelWidget (this);
}
diff --git a/main/src/addins/Deployment/MonoDevelop.Deployment.Linux/MonoDevelop.Deployment.Linux/BasicOptionPanel.cs b/main/src/addins/Deployment/MonoDevelop.Deployment.Linux/MonoDevelop.Deployment.Linux/BasicOptionPanel.cs
index 6b9f1f7555..64a564bcff 100644
--- a/main/src/addins/Deployment/MonoDevelop.Deployment.Linux/MonoDevelop.Deployment.Linux/BasicOptionPanel.cs
+++ b/main/src/addins/Deployment/MonoDevelop.Deployment.Linux/MonoDevelop.Deployment.Linux/BasicOptionPanel.cs
@@ -1,5 +1,5 @@
-
+using MonoDevelop.Components;
using MonoDevelop.Ide.Gui.Dialogs;
using MonoDevelop.Projects;
@@ -13,7 +13,7 @@ namespace MonoDevelop.Deployment.Linux
{
}
- public override Gtk.Widget CreatePanelWidget ()
+ public override Control CreatePanelWidget ()
{
return (widget = new BasicOptionPanelWidget ((Project) ConfiguredSolutionItem, false));
}
diff --git a/main/src/addins/Deployment/MonoDevelop.Deployment.Linux/MonoDevelop.Deployment.Linux/DotDesktopDisplayBinding.cs b/main/src/addins/Deployment/MonoDevelop.Deployment.Linux/MonoDevelop.Deployment.Linux/DotDesktopDisplayBinding.cs
index 1b33518c28..c965434b68 100644
--- a/main/src/addins/Deployment/MonoDevelop.Deployment.Linux/MonoDevelop.Deployment.Linux/DotDesktopDisplayBinding.cs
+++ b/main/src/addins/Deployment/MonoDevelop.Deployment.Linux/MonoDevelop.Deployment.Linux/DotDesktopDisplayBinding.cs
@@ -16,7 +16,7 @@ namespace MonoDevelop.Deployment.Linux
|| (mimeType != null && mimeType == "application/x-desktop");
}
- public IViewContent CreateContent (FilePath fileName, string mimeType, Project ownerProject)
+ public ViewContent CreateContent (FilePath fileName, string mimeType, Project ownerProject)
{
return new DotDesktopView ();
}
diff --git a/main/src/addins/Deployment/MonoDevelop.Deployment.Linux/MonoDevelop.Deployment.Linux/DotDesktopView.cs b/main/src/addins/Deployment/MonoDevelop.Deployment.Linux/MonoDevelop.Deployment.Linux/DotDesktopView.cs
index 73d0cad10f..6a3e10d45d 100644
--- a/main/src/addins/Deployment/MonoDevelop.Deployment.Linux/MonoDevelop.Deployment.Linux/DotDesktopView.cs
+++ b/main/src/addins/Deployment/MonoDevelop.Deployment.Linux/MonoDevelop.Deployment.Linux/DotDesktopView.cs
@@ -1,10 +1,12 @@
using System;
+using MonoDevelop.Components;
+using System.Threading.Tasks;
using MonoDevelop.Ide.Gui;
namespace MonoDevelop.Deployment.Linux
{
- public class DotDesktopView: AbstractViewContent
+ public class DotDesktopView: ViewContent
{
DotDesktopViewWidget widget;
DesktopEntry entry;
@@ -25,20 +27,22 @@ namespace MonoDevelop.Deployment.Linux
}
}
- public override void Load (FileOpenInformation fileOpenInformation)
+ public override Task Load (FileOpenInformation fileOpenInformation)
{
ContentName = fileOpenInformation.FileName;
entry.Load (fileOpenInformation.FileName);
widget.DesktopEntry = entry;
+ return Task.FromResult (true);
}
- public override void Save (FileSaveInformation fileSaveInformation)
+ public override Task Save (FileSaveInformation fileSaveInformation)
{
entry.Save (fileSaveInformation.FileName);
IsDirty = false;
+ return Task.FromResult (true);
}
- public override Gtk.Widget Control {
+ public override Control Control {
get { return widget; }
}
}
diff --git a/main/src/addins/Deployment/MonoDevelop.Deployment/MonoDevelop.Deployment/PackagingProject.cs b/main/src/addins/Deployment/MonoDevelop.Deployment/MonoDevelop.Deployment/PackagingProject.cs
index 6c1ccf3e44..ebb504dd5b 100644
--- a/main/src/addins/Deployment/MonoDevelop.Deployment/MonoDevelop.Deployment/PackagingProject.cs
+++ b/main/src/addins/Deployment/MonoDevelop.Deployment/MonoDevelop.Deployment/PackagingProject.cs
@@ -35,11 +35,9 @@ namespace MonoDevelop.Deployment
get { return packages; }
}
- protected override SolutionItemConfiguration OnCreateConfiguration (string name, ConfigurationKind kind)
+ protected override SolutionItemConfiguration OnCreateConfiguration (string id, ConfigurationKind kind)
{
- PackagingProjectConfiguration conf = new PackagingProjectConfiguration ();
- conf.Name = name;
- return conf;
+ return new PackagingProjectConfiguration (id);
}
protected override Task<BuildResult> OnClean (ProgressMonitor monitor, ConfigurationSelector configuration, OperationContext operationContext)
@@ -75,5 +73,8 @@ namespace MonoDevelop.Deployment
public class PackagingProjectConfiguration : SolutionItemConfiguration
{
+ public PackagingProjectConfiguration (string id) : base (id)
+ {
+ }
}
}
diff --git a/main/src/addins/ILAsmBinding/Gui/CompilerParametersPanelWidget.cs b/main/src/addins/ILAsmBinding/Gui/CompilerParametersPanelWidget.cs
index 9bf943be95..e4fa67756f 100644
--- a/main/src/addins/ILAsmBinding/Gui/CompilerParametersPanelWidget.cs
+++ b/main/src/addins/ILAsmBinding/Gui/CompilerParametersPanelWidget.cs
@@ -24,6 +24,7 @@
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
+using MonoDevelop.Components;
using MonoDevelop.Core;
using MonoDevelop.Projects;
using Gtk;
@@ -67,7 +68,7 @@ namespace ILAsmBinding
{
CompilerParametersPanelWidget widget;
- public override Widget CreatePanelWidget()
+ public override Control CreatePanelWidget()
{
return widget = new CompilerParametersPanelWidget ();
}
diff --git a/main/src/addins/MacPlatform/MacInterop/ProcessManager.cs b/main/src/addins/MacPlatform/MacInterop/ProcessManager.cs
index 2f2cb30610..1de2daa783 100644
--- a/main/src/addins/MacPlatform/MacInterop/ProcessManager.cs
+++ b/main/src/addins/MacPlatform/MacInterop/ProcessManager.cs
@@ -64,6 +64,11 @@ namespace MonoDevelop.MacInterop
return runningApp.Terminate ();
}
+ public static bool IsRunning (int pid)
+ {
+ return NSRunningApplication.GetRunningApplication (pid) != null;
+ }
+
enum OSStatus
{
Ok = 0
diff --git a/main/src/addins/MacPlatform/MacPlatform.cs b/main/src/addins/MacPlatform/MacPlatform.cs
index 1b01113527..4c5cd8c270 100644
--- a/main/src/addins/MacPlatform/MacPlatform.cs
+++ b/main/src/addins/MacPlatform/MacPlatform.cs
@@ -67,10 +67,6 @@ namespace MonoDevelop.MacIntegration
public MacPlatformService ()
{
- string safe64 = Environment.GetEnvironmentVariable ("MONODEVELOP_64BIT_SAFE");
- if (string.IsNullOrEmpty (safe64) && IntPtr.Size == 8)
- throw new Exception ("Mac integration is not yet 64-bit safe");
-
if (initedGlobal)
throw new Exception ("Only one MacPlatformService instance allowed");
initedGlobal = true;
@@ -641,11 +637,12 @@ namespace MonoDevelop.MacIntegration
}
}
- public override Gdk.Rectangle GetUsableMonitorGeometry (Gdk.Screen screen, int monitor)
+ public override Xwt.Rectangle GetUsableMonitorGeometry (int screenNumber, int monitorNumber)
{
- Gdk.Rectangle ygeometry = screen.GetMonitorGeometry (monitor);
+ var screen = Gdk.Display.Default.GetScreen (screenNumber);
+ Gdk.Rectangle ygeometry = screen.GetMonitorGeometry (monitorNumber);
Gdk.Rectangle xgeometry = screen.GetMonitorGeometry (0);
- NSScreen nss = NSScreen.Screens[monitor];
+ NSScreen nss = NSScreen.Screens[monitorNumber];
var visible = nss.VisibleFrame;
var frame = nss.Frame;
@@ -677,10 +674,10 @@ namespace MonoDevelop.MacIntegration
width = NMath.Min (visible.Width, frame.Width);
x = NMath.Max (visible.X, frame.X);
- return new Gdk.Rectangle ((int) x, (int) y, (int) width, (int) height);
+ return new Xwt.Rectangle ((int) x, (int) y, (int) width, (int) height);
}
- public override void GrabDesktopFocus (Gtk.Window window)
+ internal override void GrabDesktopFocus (Gtk.Window window)
{
window.Present ();
NSApplication.SharedApplication.ActivateIgnoringOtherApps (true);
@@ -769,7 +766,7 @@ namespace MonoDevelop.MacIntegration
return new FdoRecentFiles (UserProfile.Current.LocalConfigDir.Combine ("RecentlyUsed.xml"));
}
- public override bool GetIsFullscreen (Gtk.Window window)
+ public override bool GetIsFullscreen (Window window)
{
if (MacSystemInformation.OsVersion < MacSystemInformation.Lion) {
return base.GetIsFullscreen (window);
@@ -779,7 +776,7 @@ namespace MonoDevelop.MacIntegration
return (nswin.StyleMask & NSWindowStyle.FullScreenWindow) != 0;
}
- public override void SetIsFullscreen (Gtk.Window window, bool isFullscreen)
+ public override void SetIsFullscreen (Window window, bool isFullscreen)
{
if (MacSystemInformation.OsVersion < MacSystemInformation.Lion) {
base.SetIsFullscreen (window, isFullscreen);
@@ -799,7 +796,7 @@ namespace MonoDevelop.MacIntegration
return toplevels.Any (t => (t.Value != null && t.Value.Modal && t.Value.Visible) || (t.Key.IsVisible && (t.Key is NSPanel)));
}
- public override void AddChildWindow (Gtk.Window parent, Gtk.Window child)
+ internal override void AddChildWindow (Gtk.Window parent, Gtk.Window child)
{
NSWindow w = GtkQuartz.GetWindow (parent);
child.Realize ();
@@ -808,7 +805,7 @@ namespace MonoDevelop.MacIntegration
w.AddChildWindow (overlay, NSWindowOrderingMode.Above);
}
- public override void PlaceWindow (Gtk.Window window, int x, int y, int width, int height)
+ internal override void PlaceWindow (Gtk.Window window, int x, int y, int width, int height)
{
if (window.GdkWindow == null)
return; // Not yet realized
diff --git a/main/src/addins/MacPlatform/MacPlatform.csproj b/main/src/addins/MacPlatform/MacPlatform.csproj
index 3925e60283..f0a81fcfbd 100644
--- a/main/src/addins/MacPlatform/MacPlatform.csproj
+++ b/main/src/addins/MacPlatform/MacPlatform.csproj
@@ -135,9 +135,10 @@
<Compile Include="MainToolbar\ButtonBar.cs" />
<Compile Include="MainToolbar\SelectorView.cs" />
<Compile Include="MainToolbar\StatusBar.cs" />
- <Compile Include="MainToolbar\CenteringSpace.cs" />
<Compile Include="MainToolbar\CALayerExtensions.cs" />
<Compile Include="MainToolbar\VerticallyCenteredTextFieldCell.cs" />
+ <Compile Include="MainToolbar\AwesomeBar.cs" />
+ <Compile Include="MainToolbar\ButtonBarContainer.cs" />
</ItemGroup>
<ItemGroup>
<None Include="Makefile.am" />
diff --git a/main/src/addins/MacPlatform/MainToolbar/AwesomeBar.cs b/main/src/addins/MacPlatform/MainToolbar/AwesomeBar.cs
new file mode 100644
index 0000000000..6e1f8957b2
--- /dev/null
+++ b/main/src/addins/MacPlatform/MainToolbar/AwesomeBar.cs
@@ -0,0 +1,107 @@
+//
+// AwesomeBar.cs
+//
+// Author:
+// iain <iain@xamarin.com>
+//
+// Copyright (c) 2015 Copyright © 2015 Xamarin, Inc
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+using System;
+using AppKit;
+using Foundation;
+using CoreGraphics;
+
+namespace MonoDevelop.MacIntegration.MainToolbar
+{
+ public class AwesomeBar : NSView
+ {
+ internal RunButton RunButton { get; set; }
+ internal SelectorView SelectorView { get; set; }
+ internal StatusBar StatusBar { get; set; }
+ internal SearchBar SearchBar { get; set; }
+ internal ButtonBarContainer ButtonBarContainer { get; private set; }
+
+ public AwesomeBar ()
+ {
+ RunButton = new RunButton ();
+ AddSubview (RunButton);
+
+ SelectorView = new SelectorView ();
+ SelectorView.SizeChanged += (object sender, EventArgs e) => UpdateLayout ();
+ AddSubview (SelectorView);
+
+ ButtonBarContainer = new ButtonBarContainer ();
+ ButtonBarContainer.SizeChanged += (object sender, EventArgs e) => UpdateLayout ();
+ AddSubview (ButtonBarContainer);
+
+ StatusBar = new StatusBar ();
+ AddSubview (StatusBar);
+
+ SearchBar = new SearchBar ();
+ AddSubview (SearchBar);
+ }
+
+ const float toolbarPadding = 8.0f;
+ const float maxSearchBarWidth = 270.0f;
+ const float minSearchBarWidth = 150.0f;
+ const float maxStatusBarWidth = 700.0f;
+ const float minStatusBarWidth = 220.0f;
+ const float runButtonWidth = 38.0f;
+ public const float ToolbarWidgetHeight = 25.0f;
+
+ void UpdateLayout ()
+ {
+ RunButton.Frame = new CGRect (toolbarPadding, 0, runButtonWidth, ToolbarWidgetHeight);
+ var statusbarWidth = Math.Max (Math.Min (Frame.Width * 0.3, maxStatusBarWidth), minStatusBarWidth);
+ var searchbarWidth = maxSearchBarWidth;
+ if (statusbarWidth < searchbarWidth) {
+ searchbarWidth = minSearchBarWidth;
+ }
+
+ // We only need to work out the width on the left side of the window because the statusbar is centred
+ // Gap + RunButton.Width + Gap + ButtonBar.Width + Gap + Half of StatusBar.Width
+ var spaceLeft = (Frame.Width / 2) - (toolbarPadding + runButtonWidth + toolbarPadding + ButtonBarContainer.Frame.Width + toolbarPadding + (statusbarWidth / 2));
+ StatusBar.Frame = new CGRect ((Frame.Width - statusbarWidth) / 2, 0, statusbarWidth, ToolbarWidgetHeight);
+ SearchBar.Frame = new CGRect (Frame.Width - searchbarWidth - 10, 0, searchbarWidth, ToolbarWidgetHeight);
+
+ var selectorSize = SelectorView.SizeThatFits (new CGSize (spaceLeft, ToolbarWidgetHeight));
+
+ SelectorView.Frame = new CGRect (toolbarPadding + runButtonWidth + toolbarPadding, 0, selectorSize.Width, ToolbarWidgetHeight);
+
+ ButtonBarContainer.SetFrameOrigin (new CGPoint(SelectorView.Frame.GetMaxX () + toolbarPadding, 0));
+
+ // Finally check if the StatusBar overlaps the ButtonBarContainer (and its padding) and adjust is accordingly
+ if (StatusBar.Frame.IntersectsWith (ButtonBarContainer.Frame.Inset (-toolbarPadding, 0))) {
+ StatusBar.SetFrameOrigin (new CGPoint (ButtonBarContainer.Frame.GetMaxX () + toolbarPadding, StatusBar.Frame.Y));
+ }
+ }
+
+ public override CGRect Frame {
+ get {
+ return base.Frame;
+ }
+ set {
+ base.Frame = value;
+ UpdateLayout ();
+ }
+ }
+ }
+}
+
diff --git a/main/src/addins/MacPlatform/MainToolbar/ButtonBarContainer.cs b/main/src/addins/MacPlatform/MainToolbar/ButtonBarContainer.cs
new file mode 100644
index 0000000000..87eaabfd1b
--- /dev/null
+++ b/main/src/addins/MacPlatform/MainToolbar/ButtonBarContainer.cs
@@ -0,0 +1,93 @@
+//
+// ButtonBarContainer.cs
+//
+// Author:
+// iain holmes <iain@xamarin.com>
+//
+// Copyright (c) 2015 Xamarin, Inc
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+using System;
+using System.Collections.Generic;
+using AppKit;
+using CoreGraphics;
+
+namespace MonoDevelop.MacIntegration.MainToolbar
+{
+ public class ButtonBarContainer : NSView
+ {
+ internal event EventHandler<EventArgs> SizeChanged;
+
+ List<ButtonBar> buttonBars;
+ internal List<ButtonBar> ButtonBars {
+ get {
+ return buttonBars;
+ }
+
+ set {
+ if (buttonBars != null) {
+ foreach (var bar in buttonBars) {
+ bar.ResizeRequested -= ResizeRequested;
+ bar.RemoveFromSuperview ();
+ }
+ }
+
+ buttonBars = value;
+ foreach (var bar in buttonBars) {
+ bar.ResizeRequested += ResizeRequested;
+ AddSubview (bar);
+ }
+
+ LayoutButtonBars ();
+ }
+ }
+
+ public ButtonBarContainer ()
+ {
+ }
+
+ const float segmentWidth = 33.0f;
+ const float buttonBarSpacing = 8.0f;
+ const float extraPadding = 6.0f;
+
+ void ResizeRequested (object sender, EventArgs e)
+ {
+ LayoutButtonBars ();
+ }
+
+ void LayoutButtonBars ()
+ {
+ nfloat nextX = 0;
+
+ foreach (ButtonBar bar in buttonBars) {
+ var frame = new CGRect (nextX, 0, extraPadding + (bar.SegmentCount * segmentWidth), AwesomeBar.ToolbarWidgetHeight);
+ bar.Frame = frame;
+
+ nextX = frame.GetMaxX () + buttonBarSpacing;
+ }
+
+ SetFrameSize (new CGSize (nextX - buttonBarSpacing, AwesomeBar.ToolbarWidgetHeight));
+
+ if (SizeChanged != null) {
+ SizeChanged (this, EventArgs.Empty);
+ }
+ }
+ }
+}
+
diff --git a/main/src/addins/MacPlatform/MainToolbar/CenteringSpace.cs b/main/src/addins/MacPlatform/MainToolbar/CenteringSpace.cs
deleted file mode 100644
index 26fa1d872a..0000000000
--- a/main/src/addins/MacPlatform/MainToolbar/CenteringSpace.cs
+++ /dev/null
@@ -1,133 +0,0 @@
-//
-// CenteringSpace.cs
-//
-// Author:
-// Marius Ungureanu <marius.ungureanu@xamarin.com>
-//
-// Copyright (c) 2015 Xamarin, Inc (http://www.xamarin.com)
-//
-// Permission is hereby granted, free of charge, to any person obtaining a copy
-// of this software and associated documentation files (the "Software"), to deal
-// in the Software without restriction, including without limitation the rights
-// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the Software is
-// furnished to do so, subject to the following conditions:
-//
-// The above copyright notice and this permission notice shall be included in
-// all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-// THE SOFTWARE.
-using System;
-using AppKit;
-using CoreGraphics;
-using Foundation;
-using MonoDevelop.Core;
-using MonoDevelop.Ide;
-
-namespace MonoDevelop.MacIntegration.MainToolbar
-{
- [Register]
- class CenteringSpaceView : NSView
- {
- internal CenteringSpaceToolbarItem toolbarItem;
- public override bool AcceptsFirstMouse (NSEvent theEvent)
- {
- return false;
- }
-
- public override void ViewDidMoveToWindow ()
- {
- NSNotificationCenter.DefaultCenter.AddObserver (NSWindow.DidResizeNotification, notif =>
- Runtime.RunInMainThread (() => toolbarItem.UpdateWidth ()));
- NSNotificationCenter.DefaultCenter.AddObserver (NSWindow.WillEnterFullScreenNotification, notif =>
- CenteringSpaceToolbarItem.WindowFullscreening = true);
- NSNotificationCenter.DefaultCenter.AddObserver (NSWindow.DidEnterFullScreenNotification, notif => {
- CenteringSpaceToolbarItem.WindowFullscreening = false;
- Runtime.RunInMainThread (() => toolbarItem.UpdateWidth ());
- });
-
- base.ViewDidMoveToWindow ();
- }
- }
-
- [Register]
- class CenteringSpaceToolbarItem : NSToolbarItem
- {
- internal static bool WindowFullscreening;
- public CenteringSpaceToolbarItem ()
- {
- Initialize ();
- }
-
- public CenteringSpaceToolbarItem (IntPtr handle) : base (handle)
- {
- Initialize ();
- }
-
- public CenteringSpaceToolbarItem (string itemIdentifier) : base (itemIdentifier)
- {
- Initialize ();
- }
-
- void Initialize ()
- {
- Label = "";
- View = new CenteringSpaceView {
- toolbarItem = this,
- Frame = new CGRect (0, 0, 1, 1),
- };
- }
-
- public override CGSize MinSize {
- get {
- // Do NOT let this calculate any values while the window is fullscreening.
- // Everything changes, and the size might end up with bogus values and cause a native crash
- // that is totally unrelated. See BXC 29261.
- if (WindowFullscreening)
- return base.MinSize;
-
- NSToolbarItem[] items = Toolbar.Items;
- int index = Array.IndexOf (items, this);
-
- if (index != -1 && View.Superview != null) {
- CGRect frame = View.Superview.Frame;
- if (frame.Left > 0) {
- nfloat space = 0;
- // There is a next item.
- if (items.Length > index + 1) {
- NSView nextItem = items [index + 1].View.Superview;
- if (nextItem != null) {
- CGRect nextFrame = nextItem.Frame;
- CGRect toolbarFrame = nextItem.Superview.Frame;
-
- // nextFrame is in center of the toolbar.
- // so Left + space = toolbarFrame / 2 - nextFrame.Width / 2.
- space = (toolbarFrame.Width - nextFrame.Width) / 2 - frame.Left;
- if (space < 0)
- space = 0;
- }
- }
-
- base.MinSize = new CGSize (space, base.MinSize.Height);
- base.MaxSize = new CGSize (space, base.MaxSize.Height);
- }
- }
- return base.MinSize;
- }
- set { base.MinSize = value; }
- }
-
- internal void UpdateWidth ()
- {
- // Trigger updates.
- MinSize = MinSize;
- }
- }
-}
-
diff --git a/main/src/addins/MacPlatform/MainToolbar/MainToolbar.cs b/main/src/addins/MacPlatform/MainToolbar/MainToolbar.cs
index 0a9ff4a042..87c593a59e 100644
--- a/main/src/addins/MacPlatform/MainToolbar/MainToolbar.cs
+++ b/main/src/addins/MacPlatform/MainToolbar/MainToolbar.cs
@@ -40,191 +40,35 @@ namespace MonoDevelop.MacIntegration.MainToolbar
class MainToolbar : IMainToolbarView
{
const string MainToolbarId = "XSMainToolbar";
- const string RunButtonId = "RunToolbarItem";
- const string ButtonBarId = "ButtonBarToolbarItem";
- const string SelectorId = "SelectorToolbarItem";
- const string SearchBarId = "SearchBarToolbarItem";
- const string StatusBarId = "StatusBarToolbarItem";
- const string CenteringSpaceId = "CenteringSpaceToolbarItem";
+ const string AwesomeBarId = "AwesomeBarToolbarItem";
internal NSToolbar widget;
internal Gtk.Window gtkWindow;
- int runButtonIdx;
- RunButton runButton {
- get { return (RunButton)widget.Items[runButtonIdx].View; }
- }
+ AwesomeBar awesomeBar;
- int buttonBarStartIdx, buttonBarCount;
-
- CenteringSpaceToolbarItem centeringSpace {
- get { return (CenteringSpaceToolbarItem)widget.Items[buttonBarStartIdx + buttonBarCount]; }
+ RunButton runButton {
+ get { return awesomeBar.RunButton; }
}
- int statusBarIdx;
StatusBar statusBar {
- get { return (StatusBar)widget.Items[statusBarIdx + buttonBarCount].View; }
+ get { return awesomeBar.StatusBar; }
}
- int selectorIdx;
SelectorView selector {
- get { return (SelectorView)widget.Items[selectorIdx].View; }
+ get { return awesomeBar.SelectorView; }
}
SelectorView.PathSelectorView selectorView {
- get { return (SelectorView.PathSelectorView)widget.Items[selectorIdx].View.Subviews [0]; }
+ get { return awesomeBar.SelectorView.RealSelectorView; }
}
- int searchEntryIdx;
SearchBar searchEntry {
- get { return (SearchBar)widget.Items[searchEntryIdx + buttonBarCount].View; }
- }
-
- // TODO: Remove this when XamMac 2.2 goes stable.
- static HashSet<object> viewCache = new HashSet<object> ();
- static HashSet<ButtonBar> buttonBarCache = new HashSet<ButtonBar> ();
-
- NSToolbarItem CreateRunToolbarItem ()
- {
- var button = new RunButton ();
- viewCache.Add (button);
- button.Activated += (o, e) => {
- if (RunButtonClicked != null)
- RunButtonClicked (o, e);
- };
-
- var item = new NSToolbarItem (RunButtonId) {
- View = button,
- MinSize = new CGSize (button.FittingSize.Width + 12, button.FittingSize.Height),
- MaxSize = new CGSize (button.FittingSize.Width + 12, button.FittingSize.Height),
- };
- return item;
- }
-
- OverflowInfoEventArgs FillOverflowInfo (OverflowInfoEventArgs e)
- {
- var visibleItems = widget.VisibleItems;
- var allItems = widget.Items;
-
- e.WindowWidth = gtkWindow.Allocation.Width;
- foreach (var iter in allItems) {
- e.AllItemsWidth += iter.MinSize.Width;
- if (!visibleItems.Contains (iter))
- e.ItemsInOverflowWidth += iter.MinSize.Width;
- }
- // Add spacings.
- nfloat spacing = (allItems.Length - 1) * 16;
- e.AllItemsWidth += spacing;
-
- return e;
- }
-
- bool IsCorrectNotification (NSView view, NSObject notifObject)
- {
- var window = selector.Window;
-
- // Skip updates with a null Window. Only crashes on Mavericks.
- // The View gets updated once again when the window resize finishes.
- // We're getting notified about all windows in the application (for example, NSPopovers) that change size when really we only care about
- // the window the bar is in.
- return window != null && notifObject == window;
- }
-
- NSToolbarItem CreateSelectorToolbarItem ()
- {
- var selector = new SelectorView ();
- viewCache.Add (selector);
- var item = new NSToolbarItem (SelectorId) {
- View = selector,
- MinSize = new CGSize (150, 25),
- MaxSize = new CGSize (150, 25),
- };
- selector.ResizeRequested += (o, e) => {
- item.MinSize = item.MaxSize = e.Size;
- centeringSpace.UpdateWidth ();
- };
- selector.OverflowInfoRequested += (o, e) => {
- FillOverflowInfo (e);
- };
-
- IDisposable resizeTimer = null;
- NSNotificationCenter.DefaultCenter.AddObserver (NSWindow.WillStartLiveResizeNotification, notif => Runtime.RunInMainThread (() => {
- if (!IsCorrectNotification (selector, notif.Object))
- return;
-
- if (resizeTimer != null)
- resizeTimer.Dispose ();
-
- resizeTimer = Application.TimeoutInvoke (100, () => {
- if (widget.Items.Length != widget.VisibleItems.Length)
- selector.RequestResize ();
- return true;
- });
- }));
-
- NSNotificationCenter.DefaultCenter.AddObserver (NSWindow.DidResizeNotification, notif => Runtime.RunInMainThread (() => {
- if (!IsCorrectNotification (selector, notif.Object))
- return;
-
- // Don't check difference in overflow menus. This could cause issues since we're doing resizing of widgets and the views might go in front
- // or behind while we're doing the resize request.
- selector.RequestResize ();
- }));
-
- NSNotificationCenter.DefaultCenter.AddObserver (NSWindow.DidEndLiveResizeNotification, notif => Runtime.RunInMainThread (() => {
- if (!IsCorrectNotification (selector, notif.Object))
- return;
-
- if (resizeTimer != null)
- resizeTimer.Dispose ();
-
- resizeTimer = Application.TimeoutInvoke (300, selector.RequestResize);
- }));
-
- var pathSelector = (SelectorView.PathSelectorView)selector.Subviews [0];
- pathSelector.ConfigurationChanged += (sender, e) => {
- if (ConfigurationChanged != null)
- ConfigurationChanged (sender, e);
- };
- pathSelector.RuntimeChanged += (sender, ea) => {
- if (RuntimeChanged != null)
- RuntimeChanged (sender, ea);
- };
- return item;
- }
-
- NSToolbarItem CreateButtonBarToolbarItem ()
- {
- var bar = new ButtonBar (barItems);
- buttonBarCache.Add (bar);
-
- // Note: We're leaving a 1 dead pixel size here because Apple bug
- // on Yosemite. Segmented controls have 3px padding on left and right
- // on Mavericks.
- nfloat size = 6 + 33 * bar.SegmentCount;
-
- // By default, Cocoa doesn't want to duplicate items in the toolbar.
- // Use different Ids to prevent this and not have to subclass.
- var item = new NSToolbarItem (ButtonBarId + buttonBarCount) {
- View = bar,
- MinSize = new CGSize (size, bar.FittingSize.Height),
- MaxSize = new CGSize (size, bar.FittingSize.Height),
- };
- bar.ResizeRequested += (o, e) => {
- nfloat resize = 6 + 33 * bar.SegmentCount;
- item.MinSize = new CGSize (resize, bar.FittingSize.Height);
- item.MaxSize = new CGSize (resize, bar.FittingSize.Height);
- selector.RequestResize ();
- centeringSpace.UpdateWidth ();
- };
- return item;
+ get { return awesomeBar.SearchBar; }
}
void AttachToolbarEvents (SearchBar bar)
{
- if (bar.EventsAttached)
- return;
-
bar.Changed += (o, e) => {
bar.LogMessage("Text changed");
if (SearchEntryChanged != null)
@@ -242,105 +86,73 @@ namespace MonoDevelop.MacIntegration.MainToolbar
if (SearchEntryActivated != null)
SearchEntryActivated (o, e);
};
- bar.EventsAttached = true;
}
- NSToolbarItem CreateSearchBarToolbarItem ()
+ public MainToolbar (Gtk.Window window)
{
- var bar = new SearchBar ();
+ gtkWindow = window;
+ widget = new NSToolbar (MainToolbarId) {
+ DisplayMode = NSToolbarDisplayMode.Icon,
+ };
+
+ awesomeBar = new AwesomeBar ();
+ awesomeBar.RunButton.Activated += (o, e) => {
+ if (RunButtonClicked != null)
+ RunButtonClicked (o, e);
+ };
// Remove the focus from the Gtk system when Cocoa has focus
// Fixes BXC #29601
- bar.GainedFocus += (o, e) => IdeApp.Workbench.RootWindow.Focus = null;
+ awesomeBar.SearchBar.GainedFocus += (o, e) => IdeApp.Workbench.RootWindow.Focus = null;
+
+ AttachToolbarEvents (awesomeBar.SearchBar);
- viewCache.Add (bar);
- var item = new NSToolbarItem (SearchBarId) {
- View = bar,
- MinSize = new CGSize (150, bar.FittingSize.Height),
- MaxSize = new CGSize (270, bar.FittingSize.Height),
+ selectorView.ConfigurationChanged += (sender, e) => {
+ if (ConfigurationChanged != null)
+ ConfigurationChanged (sender, e);
};
- AttachToolbarEvents (bar);
- return item;
- }
- NSToolbarItem CreateStatusBarToolbarItem ()
- {
- var bar = new StatusBar ();
- viewCache.Add (bar);
- var item = new NSToolbarItem (StatusBarId) {
- View = bar,
- // Place some temporary values in there.
- MinSize = new CGSize (360, 22),
- MaxSize = new CGSize (360, 22),
+ selectorView.RuntimeChanged += (sender, ea) => {
+ if (RuntimeChanged != null)
+ RuntimeChanged (sender, ea);
+ };
+
+ widget.WillInsertItem = (tool, id, send) => {
+ switch (id) {
+ case AwesomeBarId:
+ return new NSToolbarItem (AwesomeBarId) {
+ View = awesomeBar,
+ MinSize = new CGSize (1024, 25),
+ MaxSize = new CGSize (1024, 25)
+ };
+
+ default:
+ throw new NotImplementedException ();
+ }
};
Action<NSNotification> resizeAction = notif => Runtime.RunInMainThread (() => {
- // Skip updates with a null Window. Only crashes on Mavericks.
- // The View gets updated once again when the window resize finishes.
- if (bar.Window == null)
+ var win = awesomeBar.Window;
+ if (win == null) {
return;
+ }
- // We're getting notified about all windows in the application (for example, NSPopovers) that change size when really we only care about
- // the window the bar is in.
- if (notif.Object != bar.Window)
- return;
+ var item = widget.Items[0];
- double maxSize = Math.Round (bar.Window.Frame.Width * 0.30f);
- double minSize = Math.Round (bar.Window.Frame.Width * 0.25f);
- item.MinSize = new CGSize ((nfloat)Math.Max (220, minSize), 22);
- item.MaxSize = new CGSize ((nfloat)Math.Min (700, maxSize), 22);
- bar.RepositionStatusLayers ();
+ var abFrameInWindow = awesomeBar.ConvertRectToView (awesomeBar.Frame, null);
+ var size = new CGSize (win.Frame.Width - abFrameInWindow.X - 4, 25);
+ item.MinSize = size;
+ item.MaxSize = size;
});
- NSNotificationCenter.DefaultCenter.AddObserver (NSWindow.DidResizeNotification, resizeAction);
- NSNotificationCenter.DefaultCenter.AddObserver (NSWindow.DidEndLiveResizeNotification, resizeAction);
- return item;
- }
-
- NSToolbarItem CreateCenteringSpaceItem ()
- {
- var item = new CenteringSpaceToolbarItem (CenteringSpaceId);
- viewCache.Add (item.View);
- return item;
- }
-
- public MainToolbar (Gtk.Window window)
- {
- gtkWindow = window;
- widget = new NSToolbar (MainToolbarId) {
- DisplayMode = NSToolbarDisplayMode.Icon,
- };
- widget.WillInsertItem = (tool, id, send) => {
- switch (id) {
- case RunButtonId:
- return CreateRunToolbarItem ();
- case ButtonBarId:
- return CreateButtonBarToolbarItem ();
- case SearchBarId:
- return CreateSearchBarToolbarItem ();
- case SelectorId:
- return CreateSelectorToolbarItem ();
- case StatusBarId:
- return CreateStatusBarToolbarItem ();
- case CenteringSpaceId:
- return CreateCenteringSpaceItem ();
- }
- throw new NotImplementedException ();
- };
+ NSWindow nswin = GtkMacInterop.GetNSWindow (window);
+ NSNotificationCenter.DefaultCenter.AddObserver (NSWindow.DidResizeNotification, resizeAction, nswin);
+ NSNotificationCenter.DefaultCenter.AddObserver (NSWindow.DidEndLiveResizeNotification, resizeAction, nswin);
}
internal void Initialize ()
{
- int total = -1;
- widget.InsertItem (RunButtonId, runButtonIdx = ++total);
- widget.InsertItem (SelectorId, selectorIdx = ++total);
- widget.InsertItem (CenteringSpaceId, buttonBarStartIdx = ++total);
- widget.InsertItem (StatusBarId, statusBarIdx = ++total);
- widget.InsertItem (NSToolbar.NSToolbarFlexibleSpaceItemIdentifier, ++total);
- widget.InsertItem (SearchBarId, searchEntryIdx = ++total);
-
- // NSButton -> NSToolbarItemViewer -> _NSToolbarClipView -> NSToolbarView -> NSToolbarClippedItemsIndicator
- viewCache.Add (runButton.Superview.Superview.Superview);
+ widget.InsertItem (AwesomeBarId, 0);
}
#region IMainToolbarView implementation
@@ -362,23 +174,23 @@ namespace MonoDevelop.MacIntegration.MainToolbar
entry.SelectText (entry);
}
- List<IButtonBarButton> barItems = new List<IButtonBarButton> ();
public void RebuildToolbar (IEnumerable<IButtonBarButton> buttons)
{
- buttonBarCache.Clear ();
- while (buttonBarCount > 0) {
- widget.RemoveItem (buttonBarStartIdx);
- --buttonBarCount;
- }
+ List<IButtonBarButton> barItems = new List<IButtonBarButton> ();
+ List<ButtonBar> buttonBars = new List<ButtonBar> ();
foreach (var item in buttons) {
if (item.IsSeparator) {
- widget.InsertItem (ButtonBarId, buttonBarStartIdx + buttonBarCount++);
+ var bar = new ButtonBar (barItems);
+ buttonBars.Add (bar);
+
barItems.Clear ();
} else {
barItems.Add (item);
}
}
+
+ awesomeBar.ButtonBarContainer.ButtonBars = buttonBars;
}
public bool RunButtonSensitivity {
@@ -431,8 +243,9 @@ namespace MonoDevelop.MacIntegration.MainToolbar
public bool ButtonBarSensitivity {
set {
- for (int start = buttonBarStartIdx; start < buttonBarStartIdx + buttonBarCount; ++start)
- ((ButtonBar)widget.Items [start].View).Enabled = value;
+ foreach (var bar in awesomeBar.ButtonBarContainer.ButtonBars) {
+ bar.Enabled = value;
+ }
}
}
@@ -473,9 +286,14 @@ namespace MonoDevelop.MacIntegration.MainToolbar
var entry = searchEntry;
var widget = entry.gtkWidget;
var window = GtkMacInterop.GetGtkWindow (entry.Window);
+
+ // window will be null if the app is fullscreen.
if (window != null) {
widget.GdkWindow = window.GdkWindow;
- widget.Allocation = new Gdk.Rectangle ((int)entry.Superview.Frame.X, (int)entry.Superview.Frame.Y, (int)entry.Superview.Frame.Width, 0);
+
+ // We need to adjust the position of the frame so the popup will line up correctly
+ var abFrameInWindow = awesomeBar.ConvertRectToView (awesomeBar.Frame, null);
+ widget.Allocation = new Gdk.Rectangle ((int)(entry.Frame.X + abFrameInWindow.X - 8), (int)entry.Frame.Y, (int)entry.Frame.Width, 0);
} else {
// Reset the Gtk Widget each time since we can't set the GdkWindow to null.
widget.Dispose ();
@@ -484,6 +302,7 @@ namespace MonoDevelop.MacIntegration.MainToolbar
var nsWindows = NSApplication.SharedApplication.Windows;
var fullscreenToolbarNsWindow = nsWindows.FirstOrDefault (nswin =>
nswin.IsVisible && nswin.Description.StartsWith ("<NSToolbarFullScreenWindow", StringComparison.Ordinal));
+
var workbenchNsWindow = nsWindows.FirstOrDefault (nswin =>
GtkMacInterop.GetGtkWindow (nswin) is MonoDevelop.Ide.Gui.DefaultWorkbench);
@@ -491,8 +310,9 @@ namespace MonoDevelop.MacIntegration.MainToolbar
// coordinate for the popup window based on Cocoa coordinates which offset left/top from current desktop.
nfloat xOffset = -NSScreen.Screens.Min (screen => screen.Frame.Left);
nfloat yOffset = NSScreen.Screens.Max (screen => screen.Frame.Bottom);
+
widget.Allocation = new Gdk.Rectangle (0, (int)(yOffset - workbenchNsWindow.Frame.Height),
- (int)(xOffset + fullscreenToolbarNsWindow.Frame.Width), 0);
+ (int)(xOffset + fullscreenToolbarNsWindow.Frame.Width - 16), 0);
}
return widget;
}
diff --git a/main/src/addins/MacPlatform/MainToolbar/RunButton.cs b/main/src/addins/MacPlatform/MainToolbar/RunButton.cs
index ee88937d86..1139a14a7b 100644
--- a/main/src/addins/MacPlatform/MainToolbar/RunButton.cs
+++ b/main/src/addins/MacPlatform/MainToolbar/RunButton.cs
@@ -26,6 +26,7 @@
using System;
using AppKit;
using Foundation;
+using CoreGraphics;
using MonoDevelop.Components.MainToolbar;
using MonoDevelop.Ide;
using MonoDevelop.Components;
@@ -87,6 +88,12 @@ namespace MonoDevelop.MacIntegration.MainToolbar
Image = GetIcon ();
}
}
+
+ public override CGSize IntrinsicContentSize {
+ get {
+ return new CGSize (38, 25);
+ }
+ }
}
}
diff --git a/main/src/addins/MacPlatform/MainToolbar/SearchBar.cs b/main/src/addins/MacPlatform/MainToolbar/SearchBar.cs
index 565fffba40..abf49972fd 100644
--- a/main/src/addins/MacPlatform/MainToolbar/SearchBar.cs
+++ b/main/src/addins/MacPlatform/MainToolbar/SearchBar.cs
@@ -44,11 +44,6 @@ namespace MonoDevelop.MacIntegration.MainToolbar
internal event EventHandler SelectionActivated;
public event EventHandler GainedFocus;
- /// <summary>
- /// This tells whether events have been attached when created from the menu.
- /// </summary>
- internal bool EventsAttached;
-
public SearchBar ()
{
Cell.Scrollable = true;
@@ -57,11 +52,6 @@ namespace MonoDevelop.MacIntegration.MainToolbar
debugSearchbar = System.IO.File.Exists (debugFilePath);
}
- public SearchBar (IntPtr ptr) : base (ptr)
- {
- Initialize ();
- }
-
internal void LogMessage (string message)
{
if (!debugSearchbar)
@@ -108,6 +98,9 @@ namespace MonoDevelop.MacIntegration.MainToolbar
return true;
var baseHandled = base.PerformKeyEquivalent (theEvent);;
LogMessage ($"Base handled {baseHandled}");
+ LogMessage ($"First Reponder {NSApplication.SharedApplication?.KeyWindow?.FirstResponder}");
+ LogMessage ($"Refuses First Responder {RefusesFirstResponder}");
+ LogMessage ($"Editor chain {CurrentEditor}");
return baseHandled;
}
diff --git a/main/src/addins/MacPlatform/MainToolbar/SelectorView.cs b/main/src/addins/MacPlatform/MainToolbar/SelectorView.cs
index e7581a9b6a..408d2fe7d3 100644
--- a/main/src/addins/MacPlatform/MainToolbar/SelectorView.cs
+++ b/main/src/addins/MacPlatform/MainToolbar/SelectorView.cs
@@ -55,47 +55,41 @@ namespace MonoDevelop.MacIntegration.MainToolbar
[Register]
class SelectorView : NSButton
{
- public event EventHandler<SizeRequestedEventArgs> ResizeRequested;
- public event EventHandler<OverflowInfoEventArgs> OverflowInfoRequested;
+ public event EventHandler<EventArgs> SizeChanged;
internal const int ConfigurationIdx = 0;
internal const int RuntimeIdx = 1;
+ internal PathSelectorView RealSelectorView { get; private set; }
+
public SelectorView ()
{
Title = "";
BezelStyle = NSBezelStyle.TexturedRounded;
- var pathSelectorView = new PathSelectorView (new CGRect (6, 0, 1, 1));
- pathSelectorView.UnregisterDraggedTypes ();
- AddSubview (pathSelectorView);
+
+ RealSelectorView = new PathSelectorView (new CGRect (6, 0, 1, 1));
+ RealSelectorView.UnregisterDraggedTypes ();
+ AddSubview (RealSelectorView);
}
- public bool RequestResize ()
+ public override CGSize SizeThatFits (CGSize size)
{
var p = (PathSelectorView)Subviews [0];
- var overflowInfo = new OverflowInfoEventArgs ();
- if (OverflowInfoRequested != null)
- OverflowInfoRequested (this, overflowInfo);
-
- var size = new CGSize (p.ResizeIfNeeded (overflowInfo), Frame.Height);
-
- if (size != Frame.Size) {
- if (ResizeRequested != null)
- ResizeRequested (this, new SizeRequestedEventArgs (size));
+ var fitSize = p.SizeThatFits (size);
- SetFrameSize (size);
- p.SetFrameSize (size);
+ return new CGSize (fitSize.Width + 12.0, size.Height);
+ }
- SetNeedsDisplay ();
- p.SetNeedsDisplay ();
- return true;
- }
- return false;
+ public override void SetFrameSize (CGSize newSize)
+ {
+ base.SetFrameSize (newSize);
+ Subviews [0].SetFrameSize (newSize);
}
- public override void ViewWillDraw ()
+ internal void OnSizeChanged ()
{
- RequestResize ();
- base.ViewWillDraw ();
+ if (SizeChanged != null) {
+ SizeChanged (this, EventArgs.Empty);
+ }
}
#region PathSelectorView
@@ -115,57 +109,60 @@ namespace MonoDevelop.MacIntegration.MainToolbar
static readonly string RuntimePlaceholder = GettextCatalog.GetString ("Default");
CellState state = CellState.AllShown;
- nfloat UpdatePathCellForSize (int idx, nfloat remaining, CellState newStateIfEnoughSize)
+ public override CGSize SizeThatFits (CGSize size)
{
- var cell = PathComponentCells [idx];
- string text;
- if (idx == ConfigurationIdx) {
- if (ActiveConfiguration != null)
- text = ActiveConfiguration.DisplayString;
- else
- text = ConfigurationPlaceholder;
- } else {
- if (ActiveRuntime != null) {
- using (var mutableModel = ActiveRuntime.GetMutableModel ())
- text = mutableModel.FullDisplayString;
- } else
- text = RuntimePlaceholder;
+ nfloat rtWidth, cWidth;
+
+ WidthsForPathCells (out cWidth, out rtWidth);
+
+ if (10 + cWidth + rtWidth < size.Width) {
+ state = CellState.AllShown;
+ UpdatePathText (ConfigurationIdx, TextForActiveConfiguration);
+ UpdatePathText (RuntimeIdx, TextForRuntimeConfiguration);
+ return new CGSize (10 + cWidth + rtWidth, size.Height);
+ }
+
+ if (10 + 28 + cWidth < size.Width) {
+ state = CellState.ConfigurationShown;
+ UpdatePathText (ConfigurationIdx, TextForActiveConfiguration);
+ UpdatePathText (RuntimeIdx, string.Empty);
+ return new CGSize (10 + 28 + cWidth, size.Height);
}
- var size = new NSAttributedString (text, new NSStringAttributes { Font = cell.Font }).Size.Width + 20;
- if (size < remaining) {
- state |= newStateIfEnoughSize;
- UpdatePathText (idx, text);
+
+ state = CellState.AllHidden;
+ UpdatePathText (ConfigurationIdx, string.Empty);
+ UpdatePathText (RuntimeIdx, string.Empty);
+ return new CGSize (10 + 52.0, size.Height);
+ }
+
+ string TextForActiveConfiguration {
+ get {
+ return ActiveConfiguration != null ? ActiveConfiguration.DisplayString : ConfigurationPlaceholder;
}
- return remaining - size;
}
- internal nfloat ResizeIfNeeded (OverflowInfoEventArgs args)
- {
- var remaining = args.WindowWidth - args.AllItemsWidth;
- if (remaining < 0 || args.ItemsInOverflowWidth > 0) {
- var cell = PathComponentCells [RuntimeIdx];
- var size = new NSAttributedString (cell.Title, new NSStringAttributes { Font = cell.Font }).Size.Width;
- remaining += size;
- args.ItemsInOverflowWidth -= size;
- if ((state & CellState.RuntimeShown) != 0) {
- state &= ~CellState.RuntimeShown;
- UpdatePathText (RuntimeIdx, string.Empty);
- }
- if ((remaining < 0 || args.ItemsInOverflowWidth > 0) && (state & CellState.ConfigurationShown) != 0) {
- state &= ~CellState.ConfigurationShown;
- UpdatePathText (ConfigurationIdx, string.Empty);
+ string TextForRuntimeConfiguration {
+ get {
+ if (ActiveRuntime != null) {
+ using (var mutableModel = ActiveRuntime.GetMutableModel ())
+ return mutableModel.FullDisplayString;
+ } else {
+ return RuntimePlaceholder;
}
- } else {
- remaining = remaining - args.ItemsInOverflowWidth;
- if ((state & CellState.ConfigurationShown) == 0)
- remaining = UpdatePathCellForSize (ConfigurationIdx, remaining, CellState.ConfigurationShown);
- if ((state & CellState.RuntimeShown) == 0)
- UpdatePathCellForSize (RuntimeIdx, remaining, CellState.RuntimeShown);
}
+ }
+ void WidthsForPathCells (out nfloat configWidth, out nfloat runtimeWidth)
+ {
+ string text;
+ NSPathComponentCell cell;
- return 10 +
- PathComponentCells [ConfigurationIdx].CellSize.Width +
- PathComponentCells [RuntimeIdx].CellSize.Width + Frame.Left;
+ text = TextForActiveConfiguration;
+ cell = PathComponentCells [ConfigurationIdx];
+ configWidth = new NSAttributedString (text, new NSStringAttributes { Font = cell.Font }).Size.Width + 28;
+
+ text = TextForRuntimeConfiguration;
+ cell = PathComponentCells [RuntimeIdx];
+ runtimeWidth = new NSAttributedString (text, new NSStringAttributes { Font = cell.Font }).Size.Width + 28;
}
NSMenu CreateSubMenuForRuntime (IRuntimeModel runtime)
@@ -344,14 +341,19 @@ namespace MonoDevelop.MacIntegration.MainToolbar
void UpdatePathText (int idx, string text)
{
- bool showText = (idx == ConfigurationIdx && (state & CellState.ConfigurationShown) != 0) || (idx == RuntimeIdx && (state & CellState.RuntimeShown) != 0);
- PathComponentCells [idx].Title = showText ? text : "\u00A0";
+ PathComponentCells [idx].Title = text;
PathComponentCells [ConfigurationIdx].Image = ImageService.GetIcon ("project").ToNSImage ();
PathComponentCells [RuntimeIdx].Image = ImageService.GetIcon ("device").ToNSImage ();
RealignTexts ();
}
+ void OnSizeChanged ()
+ {
+ var sview = (SelectorView)Superview;
+ sview.OnSizeChanged ();
+ }
+
IConfigurationModel activeConfiguration;
public IConfigurationModel ActiveConfiguration {
get { return activeConfiguration; }
@@ -359,7 +361,7 @@ namespace MonoDevelop.MacIntegration.MainToolbar
activeConfiguration = value;
state |= CellState.ConfigurationShown;
UpdatePathText (ConfigurationIdx, value.DisplayString);
- ((SelectorView)Superview).RequestResize ();
+ OnSizeChanged ();
}
}
@@ -371,7 +373,7 @@ namespace MonoDevelop.MacIntegration.MainToolbar
using (var mutableModel = value.GetMutableModel ()) {
state |= CellState.RuntimeShown;
UpdatePathText (RuntimeIdx, mutableModel.FullDisplayString);
- ((SelectorView)Superview).RequestResize ();
+ OnSizeChanged ();
}
}
}
@@ -385,9 +387,9 @@ namespace MonoDevelop.MacIntegration.MainToolbar
if (count == 0) {
state |= CellState.ConfigurationShown;
UpdatePathText (ConfigurationIdx, ConfigurationPlaceholder);
- ((SelectorView)Superview).RequestResize ();
}
PathComponentCells [ConfigurationIdx].Enabled = count > 1;
+ OnSizeChanged ();
}
}
@@ -400,9 +402,9 @@ namespace MonoDevelop.MacIntegration.MainToolbar
if (count == 0) {
state |= CellState.RuntimeShown;
UpdatePathText (RuntimeIdx, RuntimePlaceholder);
- ((SelectorView)Superview).RequestResize ();
}
PathComponentCells [RuntimeIdx].Enabled = count > 1;
+ OnSizeChanged ();
}
}
diff --git a/main/src/addins/MacPlatform/MainToolbar/StatusBar.cs b/main/src/addins/MacPlatform/MainToolbar/StatusBar.cs
index d4ab2b7524..caa7ba2208 100644
--- a/main/src/addins/MacPlatform/MainToolbar/StatusBar.cs
+++ b/main/src/addins/MacPlatform/MainToolbar/StatusBar.cs
@@ -1,4 +1,4 @@
-//
+ //
// StatusBar.cs
//
// Author:
@@ -40,16 +40,30 @@ using MonoDevelop.Ide.Tasks;
namespace MonoDevelop.MacIntegration.MainToolbar
{
- class StatusIcon : StatusBarIcon
+ class StatusIcon : NSView, StatusBarIcon
{
StatusBar bar;
- CALayer layer;
+ NSImageView imageView;
- public StatusIcon (StatusBar bar, CALayer layer, NSTrackingArea trackingArea)
+ public StatusIcon (StatusBar bar) : base (CGRect.Empty)
{
+ imageView = new NSImageView (CGRect.Empty);
+ AddSubview (imageView);
+
+ var trackingArea = new NSTrackingArea (CGRect.Empty, NSTrackingAreaOptions.ActiveInKeyWindow | NSTrackingAreaOptions.InVisibleRect | NSTrackingAreaOptions.MouseEnteredAndExited, this, null);
+ AddTrackingArea (trackingArea);
+
this.bar = bar;
- this.layer = layer;
- TrackingArea = trackingArea;
+ }
+
+ public override CGRect Frame {
+ get {
+ return base.Frame;
+ }
+ set {
+ base.Frame = value;
+ imageView.Frame = new CGRect (0, 0, value.Width, value.Height);
+ }
}
public void SetAlertMode (int seconds)
@@ -57,18 +71,14 @@ namespace MonoDevelop.MacIntegration.MainToolbar
// Create fade-out fade-in animation.
}
- public void Dispose ()
+ public new void Dispose ()
{
- layer.RemoveFromSuperLayer ();
- bar.RemoveStatusLayer (layer);
+ bar.RemoveStatusIcon (this);
+ RemoveFromSuperview ();
+ base.Dispose ();
}
- public string ToolTip {
- get;
- set;
- }
-
- internal NSTrackingArea TrackingArea {
+ public new string ToolTip {
get;
set;
}
@@ -78,10 +88,30 @@ namespace MonoDevelop.MacIntegration.MainToolbar
get { return image; }
set {
image = value;
- layer.SetImage (value, bar.Window.BackingScaleFactor);
+ imageView.Image = value.ToNSImage ();
+ SetFrameSize (new CGSize (image.Width, image.Height));
+ }
+ }
+
+ public override void MouseEntered (NSEvent theEvent)
+ {
+ if (Entered != null) {
+ Entered (this, EventArgs.Empty);
+ }
+ }
+
+ public override void MouseExited (NSEvent theEvent)
+ {
+ if (Exited != null) {
+ Exited (this, EventArgs.Empty);
}
}
+ public override void MouseUp (NSEvent theEvent)
+ {
+ NotifyClicked (StatusBar.NSEventButtonToXwt (theEvent));
+ }
+
internal void NotifyClicked (Xwt.PointerButton button)
{
if (Clicked != null)
@@ -91,17 +121,72 @@ namespace MonoDevelop.MacIntegration.MainToolbar
}
public event EventHandler<StatusBarIconClickedEventArgs> Clicked;
+ public event EventHandler<EventArgs> Entered;
+ public event EventHandler<EventArgs> Exited;
+ }
+
+ class BuildResultsView : NSView
+ {
+ NSAttributedString resultString;
+ int resultCount;
+ public int ResultCount {
+ get {
+ return resultCount;
+ }
+ set {
+ resultCount = value;
+ resultString = new NSAttributedString (value.ToString (), foregroundColor: NSColor.Text,
+ font: NSFont.SystemFontOfSize (NSFont.SmallSystemFontSize - 1));
+ ResizeToFit ();
+ }
+ }
+
+ NSImage iconImage;
+ public NSImage IconImage {
+ get {
+ return iconImage;
+ }
+ set {
+ iconImage = value;
+ ResizeToFit ();
+ }
+ }
+
+ public BuildResultsView () : base (new CGRect (0, 0, 0, 0))
+ {
+ }
+
+ public override void DrawRect (CGRect dirtyRect)
+ {
+ if (iconImage == null || resultString == null) {
+ return;
+ }
+
+ iconImage.Draw (new CGRect (0, (Frame.Size.Height - iconImage.Size.Height) / 2 + 0.5, iconImage.Size.Width, iconImage.Size.Height));
+ resultString.DrawAtPoint (new CGPoint (iconImage.Size.Width, (Frame.Size.Height - resultString.Size.Height) / 2));
+ }
+
+ void ResizeToFit ()
+ {
+ if (iconImage == null || resultString == null) {
+ return;
+ }
+
+ var stringSize = resultString.GetSize ();
+ Frame = new CGRect (Frame.X, Frame.Y, iconImage.Size.Width + stringSize.Width, Frame.Height);
+ NeedsDisplay = true;
+ }
+
+ public override void MouseDown (NSEvent theEvent)
+ {
+ IdeApp.Workbench.GetPad<MonoDevelop.Ide.Gui.Pads.ErrorListPad> ().BringToFront ();
+ }
}
[Register]
class StatusBar : NSTextField, MonoDevelop.Ide.StatusBar
{
- const string ProgressLayerId = "ProgressLayer";
const string ProgressLayerFadingId = "ProgressLayerFading";
- const string StatusIconPrefixId = "StatusLayer";
- const string BuildIconLayerId = "BuildIconLayer";
- const string BuildTextLayerId = "BuildTextLayer";
- const string SeparatorLayerId = "SeparatorLayer";
const string growthAnimationKey = "bounds";
StatusBarContextHandler ctxHandler;
Stack<double> progressMarks = new Stack<double> ();
@@ -112,6 +197,7 @@ namespace MonoDevelop.MacIntegration.MainToolbar
IconId icon;
AnimatedIcon iconAnimation;
IDisposable xwtAnimation;
+ readonly BuildResultsView buildResults;
NSAttributedString GetStatusString (string text, NSColor color)
{
@@ -138,6 +224,8 @@ namespace MonoDevelop.MacIntegration.MainToolbar
Editable = false,
Selectable = false,
};
+ NSTrackingArea textFieldArea;
+ CALayer progressLayer;
TaskEventHandler updateHandler;
public StatusBar ()
@@ -147,8 +235,17 @@ namespace MonoDevelop.MacIntegration.MainToolbar
textField.Cell = new VerticallyCenteredTextFieldCell (yOffset: -0.5f);
textField.Cell.StringValue = "";
textField.Cell.PlaceholderAttributedString = GetStatusString (BrandingService.ApplicationName, NSColor.DisabledControlText);
+
+ // The rect is empty because we use InVisibleRect to track the whole of the view.
+ textFieldArea = new NSTrackingArea (CGRect.Empty, NSTrackingAreaOptions.MouseEnteredAndExited | NSTrackingAreaOptions.ActiveInKeyWindow | NSTrackingAreaOptions.InVisibleRect, this, null);
+ textField.AddTrackingArea (textFieldArea);
+
imageView.Image = ImageService.GetIcon (Stock.StatusSteady).ToNSImage ();
+ buildResults = new BuildResultsView ();
+ buildResults.Hidden = true;
+ AddSubview (buildResults);
+
// Fixes a render glitch of a whiter bg than the others.
if (MacSystemInformation.OsVersion >= MacSystemInformation.Yosemite)
BezelStyle = NSTextFieldBezelStyle.Rounded;
@@ -158,7 +255,7 @@ namespace MonoDevelop.MacIntegration.MainToolbar
ctxHandler = new StatusBarContextHandler (this);
updateHandler = delegate {
- int ec=0, wc=0;
+ int ec = 0, wc = 0;
foreach (var t in TaskService.Errors) {
if (t.Severity == TaskSeverity.Error)
@@ -168,27 +265,13 @@ namespace MonoDevelop.MacIntegration.MainToolbar
}
Runtime.RunInMainThread (delegate {
- if (ec > 0) {
- buildResultVisible = true;
- buildResultText.AttributedString = new NSAttributedString (ec.ToString (), foregroundColor: NSColor.Text,
- font: NSFont.SystemFontOfSize (NSFont.SmallSystemFontSize - 1));
- buildResultText.ContentsScale = Window.BackingScaleFactor;
- buildResultIcon.SetImage (buildImageId = "md-status-error-count", Window.BackingScaleFactor);
- } else if (wc > 0) {
- buildResultVisible = true;
- buildResultText.AttributedString = new NSAttributedString (wc.ToString (), foregroundColor: NSColor.Text,
- font: NSFont.SystemFontOfSize (NSFont.SmallSystemFontSize - 1));
- buildResultText.ContentsScale = Window.BackingScaleFactor;
- buildResultIcon.SetImage (buildImageId = "md-status-warning-count", Window.BackingScaleFactor);
- } else
- buildResultVisible = false;
-
- CATransaction.DisableActions = true;
- nfloat buildResultPosition = DrawBuildResults ();
- CATransaction.DisableActions = false;
- if (buildResultPosition == nfloat.PositiveInfinity)
- return;
- textField.SetFrameSize (new CGSize (buildResultPosition - 6 - textField.Frame.Left, Frame.Height));
+ buildResults.Hidden = (ec == 0 && wc == 0);
+ buildResults.ResultCount = ec > 0 ? ec : wc;
+
+ buildImageId = ec > 0 ? "md-status-error-count" : "md-status-warning-count";
+ buildResults.IconImage = ImageService.GetIcon (buildImageId, Gtk.IconSize.Menu).ToNSImage ();
+
+ NeedsDisplay = true;
});
};
@@ -197,35 +280,10 @@ namespace MonoDevelop.MacIntegration.MainToolbar
TaskService.Errors.TasksAdded += updateHandler;
TaskService.Errors.TasksRemoved += updateHandler;
- NSNotificationCenter.DefaultCenter.AddObserver (NSWindow.DidChangeBackingPropertiesNotification, notif => Runtime.RunInMainThread (() => {
- if (Window == null)
- return;
-
- ReconstructString (updateTrackingAreas: true);
- foreach (var layer in Layer.Sublayers) {
- if (layer.Name != null && layer.Name.StartsWith (StatusIconPrefixId, StringComparison.Ordinal))
- layer.SetImage (layerToStatus [layer.Name].Image, Window.BackingScaleFactor);
- }
- if (buildResultVisible) {
- buildResultIcon.SetImage (buildImageId, Window.BackingScaleFactor);
- buildResultText.ContentsScale = Window.BackingScaleFactor;
- }
- }));
-
AddSubview (imageView);
AddSubview (textField);
}
- public override void DrawRect (CGRect dirtyRect)
- {
- if (imageView.Frame.Location == CGPoint.Empty)
- imageView.Frame = new CGRect (6, 0, 16, Frame.Height);
- if (textField.Frame.Location == CGPoint.Empty)
- textField.Frame = new CGRect (imageView.Frame.Right, 0, Frame.Width - 16, Frame.Height);
-
- base.DrawRect (dirtyRect);
- }
-
protected override void Dispose (bool disposing)
{
TaskService.Errors.TasksAdded -= updateHandler;
@@ -233,8 +291,24 @@ namespace MonoDevelop.MacIntegration.MainToolbar
base.Dispose (disposing);
}
- NSTrackingArea textFieldArea;
- void ReconstructString (bool updateTrackingAreas)
+ public override void DrawRect (CGRect dirtyRect)
+ {
+ base.DrawRect (dirtyRect);
+ if (statusIcons.Count == 0 || buildResults.Hidden) {
+ return;
+ }
+
+ var x = LeftMostStatusItemX ();
+ var sepRect = new CGRect (x - 9, MacSystemInformation.OsVersion >= MacSystemInformation.ElCapitan ? 5 : 4, 1, 16);
+ if (!sepRect.IntersectsWith (dirtyRect)) {
+ return;
+ }
+
+ NSColor.LightGray.SetFill ();
+ NSBezierPath.FillRect (sepRect);
+ }
+
+ void ReconstructString ()
{
if (string.IsNullOrEmpty (text)) {
textField.AttributedStringValue = new NSAttributedString ("");
@@ -244,162 +318,85 @@ namespace MonoDevelop.MacIntegration.MainToolbar
imageView.Image = image;
}
- var width = textField.AttributedStringValue.BoundingRectWithSize (new CGSize (nfloat.MaxValue, textField.Frame.Height),
- NSStringDrawingOptions.UsesFontLeading | NSStringDrawingOptions.UsesLineFragmentOrigin).Width;
-
- if (!updateTrackingAreas)
- return;
-
- if (textFieldArea != null) {
- RemoveTrackingArea (textFieldArea);
- DestroyPopover ();
- }
-
- if (width > textField.Frame.Width) {
- textFieldArea = new NSTrackingArea (textField.Frame, NSTrackingAreaOptions.MouseEnteredAndExited | NSTrackingAreaOptions.ActiveInKeyWindow, this, null);
- AddTrackingArea (textFieldArea);
- } else
- textFieldArea = null;
+ DestroyPopover (null, null);
}
- CALayer ProgressLayer {
- get { return Layer.Sublayers.FirstOrDefault (l => l.Name == ProgressLayerId); }
- }
+ readonly List<StatusIcon> statusIcons = new List<StatusIcon> ();
- readonly Dictionary<string, StatusIcon> layerToStatus = new Dictionary<string, StatusIcon> ();
- internal void RemoveStatusLayer (CALayer statusLayer)
+ internal void RemoveStatusIcon (StatusIcon icon)
{
- RemoveTrackingArea (layerToStatus [statusLayer.Name].TrackingArea);
- layerToStatus.Remove (statusLayer.Name);
- RepositionStatusLayers ();
+ statusIcons.Remove (icon);
+
+ icon.Entered -= ShowPopoverForIcon;
+ icon.Exited -= DestroyPopover;
+ icon.Clicked -= DestroyPopover;
+
+ RepositionStatusIcons ();
}
nfloat LeftMostStatusItemX ()
{
- if (Layer.Sublayers == null)
- return Layer.Frame.Width;
-
- var left = Layer.Sublayers.Min<CALayer, nfloat> (layer => {
- if (layer.Name == null)
- return nfloat.PositiveInfinity;
+ if (statusIcons.Count == 0) {
+ return Frame.Width;
+ }
- if (layer.Name.StartsWith (StatusIconPrefixId, StringComparison.Ordinal))
- return layer.Frame.Left;
- return nfloat.PositiveInfinity;
- });
- return left == nfloat.PositiveInfinity ? Layer.Frame.Width : left;
+ return statusIcons.Last ().Frame.X;
}
nfloat DrawSeparatorIfNeeded (nfloat right)
{
- CALayer layer = Layer.Sublayers.FirstOrDefault (l => l.Name == SeparatorLayerId);
- if (layerToStatus.Count == 0) {
- if (layer != null)
- layer.RemoveFromSuperLayer ();
+ NeedsDisplay = true;
+
+ if (statusIcons.Count == 0) {
return right;
}
- right -= 6;
- if (layer != null) {
- layer.Frame = new CGRect (right, MacSystemInformation.OsVersion >= MacSystemInformation.ElCapitan ? 4 : 3, 1, 16);
- layer.SetNeedsDisplay ();
- } else {
- layer = CALayer.Create ();
- layer.Name = SeparatorLayerId;
- layer.Frame = new CGRect (right, MacSystemInformation.OsVersion >= MacSystemInformation.ElCapitan ? 4 : 3, 1, 16);
- layer.BackgroundColor = NSColor.LightGray.CGColor;
- Layer.AddSublayer (layer);
- }
- return right - 3;
+ return right - 9;
}
- bool buildResultVisible;
- readonly CATextLayer buildResultText = new CATextLayer {
- Name = BuildTextLayerId,
- };
IconId buildImageId;
- readonly CALayer buildResultIcon = new CALayer {
- Name = BuildIconLayerId,
- };
- nfloat DrawBuildResults ()
- {
- if (!buildResultVisible) {
- if (Layer.Sublayers != null) {
- CALayer layer;
- layer = Layer.Sublayers.FirstOrDefault (l => l.Name != null && l.Name.StartsWith (BuildIconLayerId, StringComparison.Ordinal));
- if (layer != null)
- layer.RemoveFromSuperLayer ();
-
- layer = Layer.Sublayers.FirstOrDefault (l => l.Name != null && l.Name.StartsWith (BuildTextLayerId, StringComparison.Ordinal));
- if (layer != null)
- layer.RemoveFromSuperLayer ();
-
- layer = Layer.Sublayers.FirstOrDefault (l => l.Name != null && l.Name.StartsWith (SeparatorLayerId, StringComparison.Ordinal));
- if (layer != null)
- layer.RemoveFromSuperLayer ();
- }
- return nfloat.PositiveInfinity;
- }
- nfloat right = DrawSeparatorIfNeeded (LeftMostStatusItemX ());
- CGSize size = buildResultText.AttributedString.Size;
- right = right - 3 - size.Width;
- buildResultText.Frame = new CGRect (right, MacSystemInformation.OsVersion >= MacSystemInformation.ElCapitan ? 6 : 5, size.Width, size.Height);
- if (buildResultText.SuperLayer == null)
- Layer.AddSublayer (buildResultText);
- buildResultText.SetNeedsDisplay ();
- right -= buildResultIcon.Bounds.Width;
- buildResultIcon.Frame = new CGRect (right, MacSystemInformation.OsVersion >= MacSystemInformation.ElCapitan ? 4 : 3, buildResultIcon.Bounds.Width, buildResultIcon.Bounds.Height);
- if (buildResultIcon.SuperLayer == null)
- Layer.AddSublayer (buildResultIcon);
-
- return right;
+ void PositionBuildResults (nfloat right)
+ {
+ right = DrawSeparatorIfNeeded (right);
+ right -= (3 + buildResults.Frame.Width);
+ buildResults.SetFrameOrigin (new CGPoint (right, buildResults.Frame.Y));
}
- internal void RepositionStatusLayers ()
+ internal void RepositionStatusIcons ()
{
- nfloat right = Layer.Frame.Width - 5;
- CATransaction.DisableActions = true;
- foreach (var item in Layer.Sublayers) {
- if (item.Name != null && item.Name.StartsWith (StatusIconPrefixId, StringComparison.Ordinal)) {
- var icon = layerToStatus [item.Name];
- if (icon.TrackingArea != null)
- RemoveTrackingArea (icon.TrackingArea);
+ nfloat right = Frame.Width - 3;
- right -= item.Bounds.Width + 1;
- item.Frame = new CGRect (right, MacSystemInformation.OsVersion >= MacSystemInformation.ElCapitan ? 4 : 3, item.Bounds.Width, item.Bounds.Height);
-
- var area = new NSTrackingArea (item.Frame, NSTrackingAreaOptions.MouseEnteredAndExited | NSTrackingAreaOptions.ActiveInKeyWindow, this, null);
- AddTrackingArea (area);
-
- icon.TrackingArea = area;
- }
+ foreach (var item in statusIcons) {
+ right -= item.Bounds.Width + 1;
+ item.Frame = new CGRect (right, MacSystemInformation.OsVersion >= MacSystemInformation.ElCapitan ? 5 : 4, item.Bounds.Width, item.Bounds.Height);
}
+ PositionBuildResults (right);
+
right -= 2;
- nfloat buildResultPosition = DrawBuildResults ();
- CATransaction.DisableActions = false;
- if (buildResultPosition < right) { // We have a build result layer.
- textField.SetFrameSize (new CGSize (buildResultPosition - 3 - textField.Frame.Left, Frame.Height));
+ if (!buildResults.Hidden) { // We have a build result layer.
+ textField.SetFrameSize (new CGSize (buildResults.Frame.X - 3 - textField.Frame.Left, Frame.Height));
} else
textField.SetFrameSize (new CGSize (right - 3 - textField.Frame.Left, Frame.Height));
}
- long statusCounter;
public StatusBarIcon ShowStatusIcon (Xwt.Drawing.Image pixbuf)
{
- var layer = CALayer.Create ();
- layer.Name = StatusIconPrefixId + (++statusCounter);
- layer.Bounds = new CGRect (0, 0, (nfloat)pixbuf.Width, (nfloat)pixbuf.Height);
- var statusIcon = new StatusIcon (this, layer, null) {
+ var statusIcon = new StatusIcon (this) {
Image = pixbuf,
};
- layerToStatus [layer.Name] = statusIcon;
+ statusIcons.Add (statusIcon);
+
+ statusIcon.Entered += ShowPopoverForIcon;
+ statusIcon.Exited += DestroyPopover;
- Layer.AddSublayer (layer);
+ // We need to destroy the popover otherwise the window doesn't come up correctly
+ statusIcon.Clicked += DestroyPopover;
- RepositionStatusLayers ();
+ AddSubview (statusIcon);
+ RepositionStatusIcons ();
return statusIcon;
}
@@ -457,7 +454,7 @@ namespace MonoDevelop.MacIntegration.MainToolbar
bool changed = LoadText (message, isMarkup, color);
LoadPixbuf (image);
if (changed)
- ReconstructString (updateTrackingAreas: true);
+ ReconstructString ();
}
bool LoadText (string message, bool isMarkup, NSColor color)
@@ -501,7 +498,7 @@ namespace MonoDevelop.MacIntegration.MainToolbar
image = iconAnimation.FirstFrame.ToNSImage ();
xwtAnimation = iconAnimation.StartAnimation (p => {
image = p.ToNSImage ();
- ReconstructString (updateTrackingAreas: false);
+ ReconstructString ();
});
} else {
image = ImageService.GetIcon (iconId).ToNSImage ();
@@ -547,10 +544,12 @@ namespace MonoDevelop.MacIntegration.MainToolbar
public void EndProgress ()
{
progressMarks.Clear ();
- if (ProgressLayer != null) {
- ProgressLayer.RemoveAnimation (growthAnimationKey);
- if (inProgress == false)
- ProgressLayer.RemoveFromSuperLayer ();
+ if (progressLayer != null) {
+ progressLayer.RemoveAnimation (growthAnimationKey);
+ if (inProgress == false) {
+ progressLayer.RemoveFromSuperLayer ();
+ progressLayer = null;
+ }
}
inProgress = false;
AutoPulse = false;
@@ -573,17 +572,19 @@ namespace MonoDevelop.MacIntegration.MainToolbar
}
static CGColor xamBlue = new CGColor (52f / 255, 152f / 255, 219f / 255);
- static nfloat verticalOffset = MacSystemInformation.OsVersion >= MacSystemInformation.ElCapitan ? 2 : 0;
+ static nfloat verticalOffset = 2;
CALayer CreateProgressBarLayer (double width)
{
- CALayer progress = ProgressLayer;
+ CALayer progress = progressLayer;
if (progress == null) {
progress = CALayer.Create ();
- progress.Name = ProgressLayerId;
progress.BackgroundColor = xamBlue;
progress.BorderColor = xamBlue;
progress.FillMode = CAFillMode.Forwards;
progress.Frame = new CGRect (0, Frame.Height - barHeight - verticalOffset, (nfloat)width, barHeight);
+
+ progressLayer = progress;
+ Layer.AddSublayer (progress);
}
return progress;
}
@@ -647,11 +648,6 @@ namespace MonoDevelop.MacIntegration.MainToolbar
progress.AddAnimation (fadeout, "opacity");
};
progress.AddAnimation (animation, growthAnimationKey);
- var oldLayer = ProgressLayer;
- if (oldLayer == null)
- Layer.AddSublayer (progress);
-
- UpdateLayer ();
}
const int barHeight = 2;
@@ -717,9 +713,9 @@ namespace MonoDevelop.MacIntegration.MainToolbar
((NSTextField)popover.ContentViewController.View).AttributedStringValue = attrString;
}
- bool CreatePopoverForLayer (CALayer layer)
+ bool CreatePopoverForIcon (StatusBarIcon icon)
{
- string tooltip = layerToStatus [layer.Name].ToolTip;
+ string tooltip = icon.ToolTip;
if (tooltip == null)
return false;
@@ -732,18 +728,17 @@ namespace MonoDevelop.MacIntegration.MainToolbar
CreatePopoverCommon (Frame.Width, textField.AttributedStringValue.Value);
}
- void ShowPopoverForLayer (CALayer layer)
+ void ShowPopoverForIcon (object sender, EventArgs args)
{
if (popover != null)
return;
- if (!layerToStatus.ContainsKey (layer.Name))
- return;
+ var icon = (StatusIcon) sender;
- if (!CreatePopoverForLayer (layer))
+ if (!CreatePopoverForIcon (icon))
return;
- popover.Show (layer.Frame, this, NSRectEdge.MinYEdge);
+ popover.Show (icon.Frame, this, NSRectEdge.MinYEdge);
}
void ShowPopoverForStatusBar ()
@@ -755,59 +750,46 @@ namespace MonoDevelop.MacIntegration.MainToolbar
popover.Show (textField.Frame, this, NSRectEdge.MinYEdge);
}
- void DestroyPopover ()
+ void DestroyPopover (object sender, EventArgs args)
{
- oldLayer = null;
if (popover != null)
popover.Close ();
popover = null;
}
-
- bool InTextField (CGPoint location)
- {
- return textField.IsMouseInRect (location, textField.Frame);
- }
-
- CALayer LayerForPoint (CGPoint location)
- {
- CALayer layer = Layer.PresentationLayer.HitTest (location);
- return layer != null ? layer.ModelLayer : null;
- }
-
- string oldLayer;
+
public override void MouseEntered (NSEvent theEvent)
{
base.MouseEntered (theEvent);
- CGPoint location = ConvertPointFromView (theEvent.LocationInWindow, null);
-
- if (InTextField (location)) {
+ var width = textField.AttributedStringValue.BoundingRectWithSize (new CGSize (nfloat.MaxValue, textField.Frame.Height),
+ NSStringDrawingOptions.UsesFontLeading | NSStringDrawingOptions.UsesLineFragmentOrigin).Width;
+ if (width > textField.Frame.Width) {
ShowPopoverForStatusBar ();
- return;
- }
-
- var layer = LayerForPoint (location);
- if (layer == null)
- return;
-
- if (layer.Name == oldLayer) {
- StatusIcon icon;
- if (!layerToStatus.TryGetValue (layer.Name, out icon))
- return;
-
- if (string.IsNullOrEmpty (icon.ToolTip))
- return;
}
-
- oldLayer = layer.Name;
- ShowPopoverForLayer (layer);
}
public override void MouseExited (NSEvent theEvent)
{
base.MouseExited (theEvent);
+ DestroyPopover (null, null);
+ }
+
+ internal static Xwt.PointerButton NSEventButtonToXwt (NSEvent theEvent)
+ {
+ Xwt.PointerButton button = Xwt.PointerButton.Left;
+ switch ((NSEventType)(long)theEvent.ButtonNumber) {
+ case NSEventType.LeftMouseDown:
+ button = Xwt.PointerButton.Left;
+ break;
+ case NSEventType.RightMouseDown:
+ button = Xwt.PointerButton.Right;
+ break;
+ case NSEventType.OtherMouseDown:
+ button = Xwt.PointerButton.Middle;
+ break;
+ }
- DestroyPopover ();
+ return button;
}
public override void MouseDown (NSEvent theEvent)
@@ -815,41 +797,23 @@ namespace MonoDevelop.MacIntegration.MainToolbar
base.MouseDown (theEvent);
CGPoint location = ConvertPointFromView (theEvent.LocationInWindow, null);
- var layer = LayerForPoint (location);
- if (layer != null && layer.Name != null) {
- Xwt.PointerButton button = Xwt.PointerButton.Left;
- switch ((NSEventType)(long)theEvent.ButtonNumber) {
- case NSEventType.LeftMouseDown:
- button = Xwt.PointerButton.Left;
- break;
- case NSEventType.RightMouseDown:
- button = Xwt.PointerButton.Right;
- break;
- case NSEventType.OtherMouseDown:
- button = Xwt.PointerButton.Middle;
- break;
- }
-
- if (layerToStatus.ContainsKey (layer.Name)) {
- DestroyPopover ();
- layerToStatus [layer.Name].NotifyClicked (button);
- return;
- }
-
- if (layer.Name == BuildIconLayerId || layer.Name == BuildTextLayerId) { // We clicked error icon.
- IdeApp.Workbench.GetPad<MonoDevelop.Ide.Gui.Pads.ErrorListPad> ().BringToFront ();
- return;
- }
- }
-
- if (sourcePad != null)
+ if (textField.IsMouseInRect (location, textField.Frame) && sourcePad != null) {
sourcePad.BringToFront (true);
+ }
}
- public override void ViewDidEndLiveResize ()
- {
- base.ViewDidEndLiveResize ();
- RepositionStatusLayers ();
+ public override CGRect Frame {
+ get {
+ return base.Frame;
+ }
+ set {
+ base.Frame = value;
+ imageView.Frame = new CGRect (6, 0, 16, Frame.Height);
+ textField.Frame = new CGRect (imageView.Frame.Right, 0, Frame.Width - 16, Frame.Height);
+
+ buildResults.Frame = new CGRect (buildResults.Frame.X, buildResults.Frame.Y, buildResults.Frame.Width, Frame.Height);
+ RepositionStatusIcons ();
+ }
}
}
}
diff --git a/main/src/addins/MonoDevelop.AssemblyBrowser/MonoDevelop.AssemblyBrowser/AssemblyBrowserNavigationPoint.cs b/main/src/addins/MonoDevelop.AssemblyBrowser/MonoDevelop.AssemblyBrowser/AssemblyBrowserNavigationPoint.cs
index b11548c299..f62d47d205 100644
--- a/main/src/addins/MonoDevelop.AssemblyBrowser/MonoDevelop.AssemblyBrowser/AssemblyBrowserNavigationPoint.cs
+++ b/main/src/addins/MonoDevelop.AssemblyBrowser/MonoDevelop.AssemblyBrowser/AssemblyBrowserNavigationPoint.cs
@@ -30,6 +30,7 @@ using MonoDevelop.Ide.Gui;
using MonoDevelop.Ide.Navigation;
using ICSharpCode.NRefactory.TypeSystem;
using System.Collections.Generic;
+using System.Threading.Tasks;
namespace MonoDevelop.AssemblyBrowser
{
@@ -85,9 +86,9 @@ namespace MonoDevelop.AssemblyBrowser
#region implemented abstract members of NavigationPoint
- public override Document ShowDocument ()
+ public override Task<Document> ShowDocument ()
{
- return DoShow ();
+ return Task.FromResult (DoShow ());
}
public override string DisplayName {
diff --git a/main/src/addins/MonoDevelop.AssemblyBrowser/MonoDevelop.AssemblyBrowser/AssemblyBrowserViewContent.cs b/main/src/addins/MonoDevelop.AssemblyBrowser/MonoDevelop.AssemblyBrowser/AssemblyBrowserViewContent.cs
index 177a61db98..db1d5f40fa 100644
--- a/main/src/addins/MonoDevelop.AssemblyBrowser/MonoDevelop.AssemblyBrowser/AssemblyBrowserViewContent.cs
+++ b/main/src/addins/MonoDevelop.AssemblyBrowser/MonoDevelop.AssemblyBrowser/AssemblyBrowserViewContent.cs
@@ -30,6 +30,7 @@ using MonoDevelop.Ide.Gui;
using MonoDevelop.Refactoring;
using System;
using ICSharpCode.NRefactory.TypeSystem;
+using MonoDevelop.Components;
using MonoDevelop.Core;
using MonoDevelop.Ide.Gui.Content;
using MonoDevelop.Ide.Navigation;
@@ -37,24 +38,26 @@ using MonoDevelop.Projects;
using System.Linq;
using MonoDevelop.Ide;
using System.Collections.Generic;
-
+using System.Threading.Tasks;
+using MonoDevelop.Components;
+
namespace MonoDevelop.AssemblyBrowser
{
- class AssemblyBrowserViewContent : AbstractViewContent, IOpenNamedElementHandler, INavigable
+ class AssemblyBrowserViewContent : ViewContent, IOpenNamedElementHandler, INavigable
{
readonly static string[] defaultAssemblies = new string[] { "mscorlib", "System", "System.Core", "System.Xml" };
AssemblyBrowserWidget widget;
- protected override void OnWorkbenchWindowChanged (EventArgs e)
+ protected override void OnWorkbenchWindowChanged ()
{
- base.OnWorkbenchWindowChanged (e);
+ base.OnWorkbenchWindowChanged ();
if (WorkbenchWindow != null) {
var toolbar = WorkbenchWindow.GetToolbar (this);
widget.SetToolbar (toolbar);
}
}
- public override Gtk.Widget Control {
+ public override Control Control {
get {
return widget;
}
@@ -73,10 +76,11 @@ namespace MonoDevelop.AssemblyBrowser
IsDisposed = false;
}
- public override void Load (FileOpenInformation fileOpenInformation)
+ public override Task Load (FileOpenInformation fileOpenInformation)
{
ContentName = GettextCatalog.GetString ("Assembly Browser");
widget.AddReferenceByFileName (fileOpenInformation.FileName);
+ return Task.FromResult (true);
}
internal void EnsureDefinitionsLoaded (List<AssemblyLoader> definitions)
@@ -100,9 +104,12 @@ namespace MonoDevelop.AssemblyBrowser
IsDisposed = true;
base.Dispose ();
widget = null;
- GC.Collect ();
+ if (Disposed != null)
+ Disposed (this, EventArgs.Empty);
}
+ internal event EventHandler Disposed;
+
#region INavigable implementation
public NavigationPoint BuildNavigationPoint ()
diff --git a/main/src/addins/MonoDevelop.AssemblyBrowser/MonoDevelop.AssemblyBrowser/AssemblyBrowserWidget.cs b/main/src/addins/MonoDevelop.AssemblyBrowser/MonoDevelop.AssemblyBrowser/AssemblyBrowserWidget.cs
index 16a664662e..92a761c700 100644
--- a/main/src/addins/MonoDevelop.AssemblyBrowser/MonoDevelop.AssemblyBrowser/AssemblyBrowserWidget.cs
+++ b/main/src/addins/MonoDevelop.AssemblyBrowser/MonoDevelop.AssemblyBrowser/AssemblyBrowserWidget.cs
@@ -1266,6 +1266,7 @@ namespace MonoDevelop.AssemblyBrowser
this.Open (link, loader);
}
});
+ marker.OnlyShowLinkOnHover = true;
underlineMarkers.Add (marker);
inspectEditor.AddMarker (marker);
}
diff --git a/main/src/addins/MonoDevelop.AssemblyBrowser/MonoDevelop.AssemblyBrowser/DisplayBinding.cs b/main/src/addins/MonoDevelop.AssemblyBrowser/MonoDevelop.AssemblyBrowser/DisplayBinding.cs
index 71ded99d16..f992060d7e 100644
--- a/main/src/addins/MonoDevelop.AssemblyBrowser/MonoDevelop.AssemblyBrowser/DisplayBinding.cs
+++ b/main/src/addins/MonoDevelop.AssemblyBrowser/MonoDevelop.AssemblyBrowser/DisplayBinding.cs
@@ -53,14 +53,14 @@ namespace MonoDevelop.AssemblyBrowser
{
if (viewContent == null || viewContent.IsDisposed) {
viewContent = new AssemblyBrowserViewContent ();
- viewContent.Control.Destroyed += HandleDestroyed;
+ viewContent.Disposed += HandleDestroyed;
}
return viewContent;
}
void HandleDestroyed (object sender, EventArgs e)
{
- ((Gtk.Widget)sender).Destroyed -= HandleDestroyed;
+ ((AssemblyBrowserViewContent)sender).Disposed -= HandleDestroyed;
this.viewContent = null;
}
@@ -71,7 +71,7 @@ namespace MonoDevelop.AssemblyBrowser
|| mimeType == "application/x-msdownload";
}
- public IViewContent CreateContent (FilePath fileName, string mimeType, Project ownerProject)
+ public ViewContent CreateContent (FilePath fileName, string mimeType, Project ownerProject)
{
return GetViewContent ();
}
diff --git a/main/src/addins/MonoDevelop.Autotools/MakefileOptionPanel.cs b/main/src/addins/MonoDevelop.Autotools/MakefileOptionPanel.cs
index 4ac8a3e0b1..598bcd1d1d 100644
--- a/main/src/addins/MonoDevelop.Autotools/MakefileOptionPanel.cs
+++ b/main/src/addins/MonoDevelop.Autotools/MakefileOptionPanel.cs
@@ -1,5 +1,5 @@
-using Gtk;
+using MonoDevelop.Components;
using MonoDevelop.Ide.Gui.Dialogs;
using MonoDevelop.Projects;
@@ -13,7 +13,7 @@ namespace MonoDevelop.Autotools
{
}
- public override Widget CreatePanelWidget()
+ public override Control CreatePanelWidget()
{
Project project = ConfiguredProject;
MakefileData data = project.GetMakefileData ();
diff --git a/main/src/addins/MonoDevelop.Autotools/MakefileProject.cs b/main/src/addins/MonoDevelop.Autotools/MakefileProject.cs
index 7aecb44743..f2fb5fec65 100644
--- a/main/src/addins/MonoDevelop.Autotools/MakefileProject.cs
+++ b/main/src/addins/MonoDevelop.Autotools/MakefileProject.cs
@@ -11,11 +11,9 @@ namespace MonoDevelop.Autotools
{
}
- protected override SolutionItemConfiguration OnCreateConfiguration (string name, ConfigurationKind kind)
+ protected override SolutionItemConfiguration OnCreateConfiguration (string id, ConfigurationKind kind)
{
- MakefileProjectConfiguration conf = new MakefileProjectConfiguration ();
- conf.Name = name;
- return conf;
+ return new MakefileProjectConfiguration (id);
}
protected override void OnGetTypeTags (HashSet<string> types)
@@ -27,5 +25,8 @@ namespace MonoDevelop.Autotools
public class MakefileProjectConfiguration: ProjectConfiguration
{
+ public MakefileProjectConfiguration (string id) : base (id)
+ {
+ }
}
}
diff --git a/main/src/addins/MonoDevelop.Debugger.Soft/MonoDevelop.Debugger.Soft/SoftDebuggerEngine.cs b/main/src/addins/MonoDevelop.Debugger.Soft/MonoDevelop.Debugger.Soft/SoftDebuggerEngine.cs
index 98d5f6edab..aa0993debf 100644
--- a/main/src/addins/MonoDevelop.Debugger.Soft/MonoDevelop.Debugger.Soft/SoftDebuggerEngine.cs
+++ b/main/src/addins/MonoDevelop.Debugger.Soft/MonoDevelop.Debugger.Soft/SoftDebuggerEngine.cs
@@ -92,7 +92,7 @@ namespace MonoDevelop.Debugger.Soft
ExternalConsoleFactory.Instance.CreateConsole (dsi.CloseExternalConsoleOnExit), varsCopy);
return new ProcessAdapter (oper, Path.GetFileName (info.FileName));
};
-
+ startArgs.MonoExecutableFileName = runtime.MonoRuntimeInfo.Force64or32bit.HasValue ? runtime.MonoRuntimeInfo.Force64or32bit.Value ? "mono64" : "mono32" : "mono";
return dsi;
}
diff --git a/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.PreviewVisualizers/GenericPreviewVisualizer.cs b/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.PreviewVisualizers/GenericPreviewVisualizer.cs
index 748a080303..4bc5f46731 100644
--- a/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.PreviewVisualizers/GenericPreviewVisualizer.cs
+++ b/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.PreviewVisualizers/GenericPreviewVisualizer.cs
@@ -49,7 +49,8 @@ namespace MonoDevelop.Debugger.PreviewVisualizers
if (DebuggingService.HasInlineVisualizer (val))
value = DebuggingService.GetInlineVisualizer (val).InlineVisualize (val);
- var label = new Gtk.Label (value);
+ var label = new Gtk.Label ();
+ label.Text = value;
var font = label.Style.FontDescription.Copy ();
if (font.SizeIsAbsolute) {
diff --git a/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger/BreakpointPad.cs b/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger/BreakpointPad.cs
index 900a11fc0c..9c395b5889 100644
--- a/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger/BreakpointPad.cs
+++ b/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger/BreakpointPad.cs
@@ -40,7 +40,7 @@ using MonoDevelop.Ide;
namespace MonoDevelop.Debugger
{
- public class BreakpointPad : IPadContent
+ public class BreakpointPad : PadContent
{
BreakpointStore breakpoints;
@@ -69,8 +69,9 @@ namespace MonoDevelop.Debugger
Properties
}
- public void Initialize (IPadWindow window)
+ protected override void Initialize (IPadWindow window)
{
+ Id = "MonoDevelop.Debugger.BreakpointPad";
// Toolbar and menu definitions
ActionCommand gotoCmd = new ActionCommand (LocalCommands.GoToFile, GettextCatalog.GetString ("Go to File"));
@@ -168,12 +169,12 @@ namespace MonoDevelop.Debugger
tree.RowActivated += OnRowActivated;
- DockItemToolbar toolbar = window.GetToolbar (PositionType.Top);
+ DockItemToolbar toolbar = window.GetToolbar (DockPositionType.Top);
toolbar.Add (toolbarSet, sw);
toolbar.ShowAll ();
}
- public void Dispose ()
+ public override void Dispose ()
{
breakpoints.BreakpointAdded -= OnBreakpointAdded;
breakpoints.BreakpointRemoved -= OnBreakpointRemoved;
@@ -183,6 +184,7 @@ namespace MonoDevelop.Debugger
DebuggingService.PausedEvent -= OnDebuggerStatusCheck;
DebuggingService.ResumedEvent -= OnDebuggerStatusCheck;
DebuggingService.StoppedEvent -= OnDebuggerStatusCheck;
+ base.Dispose ();
}
void ShowPopup (Gdk.EventButton evt)
@@ -465,25 +467,16 @@ namespace MonoDevelop.Debugger
OnBpJumpTo ();
}
- public Gtk.Widget Control {
+ public override Control Control {
get {
return control;
}
}
- public string Id {
- get { return "MonoDevelop.Debugger.BreakpointPad"; }
- }
-
public string DefaultPlacement {
get { return "Bottom"; }
}
- public void RedrawContent ()
- {
- UpdateDisplay ();
- }
-
protected void OnDeleteClicked (object o, EventArgs args)
{
OnDeleted ();
diff --git a/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger/BreakpointPropertiesDialog.cs b/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger/BreakpointPropertiesDialog.cs
index 11b8ebfe09..1039e4745d 100644
--- a/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger/BreakpointPropertiesDialog.cs
+++ b/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger/BreakpointPropertiesDialog.cs
@@ -36,6 +36,7 @@ using Xwt;
using Xwt.Drawing;
using System.Linq;
using System.IO;
+using System.Threading.Tasks;
namespace MonoDevelop.Debugger
{
@@ -203,7 +204,7 @@ namespace MonoDevelop.Debugger
public BreakpointPropertiesDialog (BreakEvent be, BreakpointType breakpointType)
{
this.be = be;
- LoadExceptionList ();
+ Task.Run (LoadExceptionList);
Initialize ();
SetInitialData ();
SetLayout ();
@@ -648,7 +649,9 @@ namespace MonoDevelop.Debugger
if (!classes.Contains (entryExceptionType.Text)) {
warningException.Show ();
warningException.ToolTip = GettextCatalog.GetString ("Exception not identified");
- result = false;
+ //We might be missing some exceptions that are loaded at runtime from outside our project
+ //or we don't have project at all, hence show warning but still allow user to close window
+ result = true;
}
}
return result;
@@ -684,29 +687,35 @@ namespace MonoDevelop.Debugger
return true;
}
- void LoadExceptionList ()
+ async Task LoadExceptionList ()
{
classes.Add ("System.Exception");
- if (IdeApp.ProjectOperations.CurrentSelectedProject != null) {
- var compilation = TypeSystemService.GetCompilationAsync (IdeApp.ProjectOperations.CurrentSelectedProject).Result;
- var exceptionClass = compilation.GetTypeByMetadataName ("System.Exception");
- foreach (var t in compilation.GlobalNamespace.GetAllTypes ().Where ((arg) => arg.IsDerivedFromClass (exceptionClass))) {
- classes.Add (t.GetFullMetadataName ());
+ try {
+ Microsoft.CodeAnalysis.Compilation compilation = null;
+ Microsoft.CodeAnalysis.ProjectId dummyProjectId = null;
+ if (IdeApp.ProjectOperations.CurrentSelectedProject != null) {
+ compilation = await TypeSystemService.GetCompilationAsync (IdeApp.ProjectOperations.CurrentSelectedProject);
+ }
+ if (compilation == null) {
+ //no need to unload this assembly context, it's not cached.
+ dummyProjectId = Microsoft.CodeAnalysis.ProjectId.CreateNewId ("GetExceptionsProject");
+ compilation = Microsoft.CodeAnalysis.CSharp.CSharpCompilation.Create ("GetExceptions")
+ .AddReferences (MetadataReferenceCache.LoadReference (dummyProjectId, System.Reflection.Assembly.GetAssembly (typeof (object)).Location))//corlib
+ .AddReferences (MetadataReferenceCache.LoadReference (dummyProjectId, System.Reflection.Assembly.GetAssembly (typeof (Uri)).Location));//System.dll
}
- } else {
- //no need to unload this assembly context, it's not cached.
- var dummyProjectId = Microsoft.CodeAnalysis.ProjectId.CreateNewId ("GetExceptionsProject");
- var compilation = Microsoft.CodeAnalysis.CSharp.CSharpCompilation.Create ("GetExceptions")
- .AddReferences (MetadataReferenceCache.LoadReference (dummyProjectId, System.Reflection.Assembly.GetAssembly (typeof(object)).Location))//corlib
- .AddReferences (MetadataReferenceCache.LoadReference (dummyProjectId, System.Reflection.Assembly.GetAssembly (typeof(Uri)).Location));//System.dll
-
var exceptionClass = compilation.GetTypeByMetadataName ("System.Exception");
foreach (var t in compilation.GlobalNamespace.GetAllTypes ().Where ((arg) => arg.IsDerivedFromClass (exceptionClass))) {
classes.Add (t.GetFullMetadataName ());
}
- MetadataReferenceCache.RemoveReferences (dummyProjectId);
+ if (dummyProjectId != null) {
+ MetadataReferenceCache.RemoveReferences (dummyProjectId);
+ }
+ } catch (Exception e) {
+ LoggingService.LogError ("Failed to obtain exceptions list in breakpoint dialog.", e);
}
- entryExceptionType.SetCodeCompletionList (classes.ToList ());
+ await Runtime.RunInMainThread (() => {
+ entryExceptionType.SetCodeCompletionList (classes.ToList ());
+ });
}
public BreakEvent GetBreakEvent ()
diff --git a/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger/DebuggerOptionsPanelWidget.cs b/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger/DebuggerOptionsPanelWidget.cs
index 85c5ef476b..ec6d84fafd 100644
--- a/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger/DebuggerOptionsPanelWidget.cs
+++ b/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger/DebuggerOptionsPanelWidget.cs
@@ -26,6 +26,7 @@
using System;
using Mono.Debugging.Client;
+using MonoDevelop.Components;
using MonoDevelop.Ide.Gui.Dialogs;
using Xwt;
using MonoDevelop.Core;
@@ -36,7 +37,7 @@ namespace MonoDevelop.Debugger
{
DebuggerOptionsPanelWidget w;
- public override Gtk.Widget CreatePanelWidget ()
+ public override Control CreatePanelWidget ()
{
w = new DebuggerOptionsPanelWidget ();
diff --git a/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger/DebuggingService.cs b/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger/DebuggingService.cs
index 608391aec0..dcd54faa84 100644
--- a/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger/DebuggingService.cs
+++ b/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger/DebuggingService.cs
@@ -947,25 +947,25 @@ namespace MonoDevelop.Debugger
});
}
- public static void ShowCurrentExecutionLine ()
+ public static async void ShowCurrentExecutionLine ()
{
Runtime.AssertMainThread ();
if (currentBacktrace != null) {
var sf = GetCurrentVisibleFrame ();
if (sf != null && !string.IsNullOrEmpty (sf.SourceLocation.FileName) && System.IO.File.Exists (sf.SourceLocation.FileName) && sf.SourceLocation.Line != -1) {
- Document document = IdeApp.Workbench.OpenDocument (sf.SourceLocation.FileName, null, sf.SourceLocation.Line, 1, OpenDocumentOptions.Debugger);
+ Document document = await IdeApp.Workbench.OpenDocument (sf.SourceLocation.FileName, null, sf.SourceLocation.Line, 1, OpenDocumentOptions.Debugger);
OnDisableConditionalCompilation (new DocumentEventArgs (document));
}
}
}
- public static void ShowNextStatement ()
+ public static async void ShowNextStatement ()
{
Runtime.AssertMainThread ();
var location = NextStatementLocation;
if (location != null && System.IO.File.Exists (location.FileName)) {
- Document document = IdeApp.Workbench.OpenDocument (location.FileName, null, location.Line, 1, OpenDocumentOptions.Debugger);
+ Document document = await IdeApp.Workbench.OpenDocument (location.FileName, null, location.Line, 1, OpenDocumentOptions.Debugger);
OnDisableConditionalCompilation (new DocumentEventArgs (document));
} else {
ShowCurrentExecutionLine ();
diff --git a/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger/DisassemblyView.cs b/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger/DisassemblyView.cs
index b91b9e29b6..0f42d6b006 100644
--- a/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger/DisassemblyView.cs
+++ b/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger/DisassemblyView.cs
@@ -43,10 +43,11 @@ using MonoDevelop.Ide;
using System.Security.Cryptography;
using Gdk;
using MonoDevelop.Components;
+using System.Threading.Tasks;
namespace MonoDevelop.Debugger
{
- public class DisassemblyView: AbstractViewContent, IClipboardHandler
+ public class DisassemblyView: ViewContent, IClipboardHandler
{
Gtk.ScrolledWindow sw;
TextEditor editor;
@@ -154,15 +155,11 @@ namespace MonoDevelop.Debugger
}
}
- public override Gtk.Widget Control {
+ public override Control Control {
get {
return sw;
}
}
-
- public override void Load (FileOpenInformation fileOpenInformation)
- {
- }
public override bool IsFile {
get {
diff --git a/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger/ExceptionCaughtDialog.cs b/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger/ExceptionCaughtDialog.cs
index b8d99a58dd..4952354b9c 100644
--- a/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger/ExceptionCaughtDialog.cs
+++ b/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger/ExceptionCaughtDialog.cs
@@ -43,7 +43,7 @@ using MonoDevelop.Ide.Fonts;
namespace MonoDevelop.Debugger
{
- class ExceptionCaughtDialog : Dialog
+ class ExceptionCaughtDialog : Gtk.Dialog
{
static readonly Xwt.Drawing.Image WarningIconPixbuf = Xwt.Drawing.Image.FromResource ("exception-48.png");
protected ObjectValueTreeView ExceptionValueTreeView { get; private set; }
@@ -676,7 +676,7 @@ namespace MonoDevelop.Debugger
dlg.Line = Line;
}
- public override Widget CreateWidget ()
+ public override Control CreateWidget ()
{
var icon = Xwt.Drawing.Image.FromResource ("lightning-16.png");
var image = new Xwt.ImageView (icon).ToGtkWidget ();
@@ -764,7 +764,7 @@ namespace MonoDevelop.Debugger
dlg.Line = Line;
}
- public override Widget CreateWidget ()
+ public override Control CreateWidget ()
{
var box = new EventBox ();
box.VisibleWindow = false;
diff --git a/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger/ImmediatePad.cs b/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger/ImmediatePad.cs
index dd5ac17ce9..1b5489e8f8 100644
--- a/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger/ImmediatePad.cs
+++ b/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger/ImmediatePad.cs
@@ -37,13 +37,13 @@ using MonoDevelop.Components;
namespace MonoDevelop.Debugger
{
- public class ImmediatePad: IPadContent
+ public class ImmediatePad: PadContent
{
static readonly object mutex = new object();
DebuggerConsoleView view;
readonly List<uint> timersList = new List<uint>();
- public void Initialize (IPadWindow container)
+ protected override void Initialize (IPadWindow container)
{
view = new DebuggerConsoleView ();
view.ConsoleInput += OnViewConsoleInput;
@@ -263,21 +263,18 @@ namespace MonoDevelop.Debugger
});
}
- public void RedrawContent ()
- {
- }
-
- public Gtk.Widget Control {
+ public override Control Control {
get {
return view;
}
}
- public void Dispose ()
+ public override void Dispose ()
{
DebuggingService.PausedEvent -= DebuggerPaused;
DebuggingService.ResumedEvent -= DebuggerResumed;
DebuggingService.StoppedEvent -= DebuggerStopped;
+ base.Dispose ();
}
void DebuggerResumed (object sender, EventArgs e)
diff --git a/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger/ObjectValuePad.cs b/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger/ObjectValuePad.cs
index 1a5f3dcf5e..eb6217ecec 100644
--- a/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger/ObjectValuePad.cs
+++ b/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger/ObjectValuePad.cs
@@ -29,20 +29,20 @@ using System;
using Gtk;
using MonoDevelop.Ide.Gui;
using Mono.Debugging.Client;
+using MonoDevelop.Components;
namespace MonoDevelop.Debugger
{
- public class ObjectValuePad: IPadContent
+ public class ObjectValuePad: PadContent
{
protected ObjectValueTreeView tree;
readonly ScrolledWindow scrolled;
bool needsUpdate;
- IPadWindow container;
bool initialResume;
StackFrame lastFrame;
PadFontChanger fontChanger;
- public Gtk.Widget Control {
+ public override Control Control {
get {
return scrolled;
}
@@ -76,7 +76,7 @@ namespace MonoDevelop.Debugger
initialResume = !DebuggingService.IsDebugging;
}
- public void Dispose ()
+ public override void Dispose ()
{
if (fontChanger == null)
return;
@@ -88,21 +88,17 @@ namespace MonoDevelop.Debugger
DebuggingService.ResumedEvent -= OnDebuggerResumed;
DebuggingService.StoppedEvent -= OnDebuggerStopped;
DebuggingService.EvaluationOptionsChanged -= OnEvaluationOptionsChanged;
+ base.Dispose ();
}
- public void Initialize (IPadWindow container)
+ protected override void Initialize (IPadWindow container)
{
- this.container = container;
container.PadContentShown += delegate {
if (needsUpdate)
OnUpdateList ();
};
}
- public void RedrawContent ()
- {
- }
-
public virtual void OnUpdateList ()
{
needsUpdate = false;
@@ -113,7 +109,7 @@ namespace MonoDevelop.Debugger
protected virtual void OnFrameChanged (object s, EventArgs a)
{
- if (container != null && container.ContentVisible)
+ if (Window != null && Window.ContentVisible)
OnUpdateList ();
else
needsUpdate = true;
@@ -144,7 +140,7 @@ namespace MonoDevelop.Debugger
{
if (!DebuggingService.IsRunning) {
lastFrame = null;
- if (container != null && container.ContentVisible)
+ if (Window != null && Window.ContentVisible)
OnUpdateList ();
else
needsUpdate = true;
diff --git a/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger/StackTracePad.cs b/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger/StackTracePad.cs
index ef86548427..3e46fd0f6d 100644
--- a/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger/StackTracePad.cs
+++ b/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger/StackTracePad.cs
@@ -45,7 +45,29 @@ using System.Linq;
namespace MonoDevelop.Debugger
{
- public class StackTracePad : ScrolledWindow, IPadContent
+ public class StackTracePad : PadContent
+ {
+ StackTracePadWidget control;
+
+ public StackTracePad ()
+ {
+ Id = "MonoDevelop.Debugger.StackTracePad";
+ control = new StackTracePadWidget ();
+ }
+
+ protected override void Initialize (IPadWindow window)
+ {
+ control.Initialize (window);
+ }
+
+ public override Control Control {
+ get {
+ return control;
+ }
+ }
+ }
+
+ public class StackTracePadWidget : ScrolledWindow
{
const int IconColumn = 0;
const int MethodColumn = 1;
@@ -64,7 +86,7 @@ namespace MonoDevelop.Debugger
static Xwt.Drawing.Image pointerImage = ImageService.GetIcon ("md-stack-pointer", IconSize.Menu);
- public StackTracePad ()
+ public StackTracePadWidget ()
{
this.ShadowType = ShadowType.None;
@@ -189,7 +211,7 @@ namespace MonoDevelop.Debugger
return !value.Contains (key);
}
- void IPadContent.Initialize (IPadWindow window)
+ public void Initialize (IPadWindow window)
{
this.window = window;
window.PadContentShown += delegate {
@@ -344,25 +366,6 @@ namespace MonoDevelop.Debugger
ActivateFrame ();
}
- public Widget Control {
- get {
- return this;
- }
- }
-
- public string Id {
- get { return "MonoDevelop.Debugger.StackTracePad"; }
- }
-
- public string DefaultPlacement {
- get { return "Bottom"; }
- }
-
- public void RedrawContent ()
- {
- UpdateDisplay ();
- }
-
void ShowPopup (Gdk.EventButton evt)
{
var context_menu = new ContextMenu ();
diff --git a/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger/ThreadsPad.cs b/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger/ThreadsPad.cs
index 579dec2810..9fa65e2afc 100644
--- a/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger/ThreadsPad.cs
+++ b/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger/ThreadsPad.cs
@@ -41,7 +41,24 @@ using MonoDevelop.Ide;
namespace MonoDevelop.Debugger
{
- public class ThreadsPad : Gtk.ScrolledWindow, IPadContent
+ public class ThreadsPad: PadContent
+ {
+ ThreadsPadWidget control = new ThreadsPadWidget ();
+
+ protected override void Initialize (IPadWindow window)
+ {
+ Id = "MonoDevelop.Debugger.ThreadsPad";
+ control.Initialize (window);
+ }
+
+ public override Control Control {
+ get {
+ return control;
+ }
+ }
+ }
+
+ public class ThreadsPadWidget : Gtk.ScrolledWindow
{
TreeViewState treeViewState;
PadTreeView tree;
@@ -59,7 +76,7 @@ namespace MonoDevelop.Debugger
Location
}
- public ThreadsPad ()
+ public ThreadsPadWidget ()
{
this.ShadowType = ShadowType.None;
@@ -127,7 +144,7 @@ namespace MonoDevelop.Debugger
UpdateDisplay ();
}
- void IPadContent.Initialize (IPadWindow window)
+ public void Initialize (IPadWindow window)
{
this.window = window;
window.PadContentShown += delegate {
@@ -254,23 +271,6 @@ namespace MonoDevelop.Debugger
}
}
- public Widget Control {
- get { return this; }
- }
-
- public string Id {
- get { return "MonoDevelop.Debugger.ThreadsPad"; }
- }
-
- public string DefaultPlacement {
- get { return "Bottom"; }
- }
-
- public void RedrawContent ()
- {
- UpdateDisplay ();
- }
-
void OnDebuggerPaused (object s, EventArgs a)
{
UpdateDisplay ();
diff --git a/main/src/addins/MonoDevelop.DesignerSupport/MonoDevelop.DesignerSupport.Toolbox/Toolbox.cs b/main/src/addins/MonoDevelop.DesignerSupport/MonoDevelop.DesignerSupport.Toolbox/Toolbox.cs
index d78b1188cf..bda69169b5 100644
--- a/main/src/addins/MonoDevelop.DesignerSupport/MonoDevelop.DesignerSupport.Toolbox/Toolbox.cs
+++ b/main/src/addins/MonoDevelop.DesignerSupport/MonoDevelop.DesignerSupport.Toolbox/Toolbox.cs
@@ -66,7 +66,7 @@ namespace MonoDevelop.DesignerSupport.Toolbox
this.container = container;
#region Toolbar
- DockItemToolbar toolbar = container.GetToolbar (PositionType.Top);
+ DockItemToolbar toolbar = container.GetToolbar (DockPositionType.Top);
filterEntry = new SearchEntry();
filterEntry.Ready = true;
diff --git a/main/src/addins/MonoDevelop.DesignerSupport/MonoDevelop.DesignerSupport/DocumentOutlinePad.cs b/main/src/addins/MonoDevelop.DesignerSupport/MonoDevelop.DesignerSupport/DocumentOutlinePad.cs
index fb87b62f38..b86f6f6ac1 100644
--- a/main/src/addins/MonoDevelop.DesignerSupport/MonoDevelop.DesignerSupport/DocumentOutlinePad.cs
+++ b/main/src/addins/MonoDevelop.DesignerSupport/MonoDevelop.DesignerSupport/DocumentOutlinePad.cs
@@ -34,12 +34,13 @@ using MonoDevelop.Core;
using MonoDevelop.Ide.Gui;
using MonoDevelop.Ide;
using System.Collections.Generic;
+using MonoDevelop.Components;
namespace MonoDevelop.DesignerSupport
{
- public class DocumentOutlinePad : AbstractPadContent
+ public class DocumentOutlinePad : PadContent
{
Alignment box;
IOutlinedDocument currentOutlineDoc;
@@ -54,12 +55,12 @@ namespace MonoDevelop.DesignerSupport
box.ShowAll ();
}
- public override void Initialize (IPadWindow window)
+ protected override void Initialize (IPadWindow window)
{
base.Initialize (window);
IdeApp.Workbench.ActiveDocumentChanged += DocumentChangedHandler;
CurrentDoc = IdeApp.Workbench.ActiveDocument;
- toolbar = window.GetToolbar (PositionType.Top);
+ toolbar = window.GetToolbar (DockPositionType.Top);
toolbar.Visible = false;
Update ();
}
@@ -85,7 +86,7 @@ namespace MonoDevelop.DesignerSupport
}
}
- public override Gtk.Widget Control {
+ public override Control Control {
get { return box; }
}
diff --git a/main/src/addins/MonoDevelop.DesignerSupport/MonoDevelop.DesignerSupport/PropertyPad.cs b/main/src/addins/MonoDevelop.DesignerSupport/MonoDevelop.DesignerSupport/PropertyPad.cs
index 690aa67385..9ce9320b34 100644
--- a/main/src/addins/MonoDevelop.DesignerSupport/MonoDevelop.DesignerSupport/PropertyPad.cs
+++ b/main/src/addins/MonoDevelop.DesignerSupport/MonoDevelop.DesignerSupport/PropertyPad.cs
@@ -41,11 +41,12 @@ using System.Collections.Generic;
using MonoDevelop.Components.Commands;
using MonoDevelop.Ide;
using MonoDevelop.Ide.Commands;
+using MonoDevelop.Components;
namespace MonoDevelop.DesignerSupport
{
- public class PropertyPad : AbstractPadContent, ICommandDelegator
+ public class PropertyPad : PadContent, ICommandDelegator
{
pg.PropertyGrid grid;
InvisibleFrame frame;
@@ -64,10 +65,10 @@ namespace MonoDevelop.DesignerSupport
frame.ShowAll ();
}
- public override void Initialize (IPadWindow container)
+ protected override void Initialize (IPadWindow container)
{
base.Initialize (container);
- toolbarProvider.Attach (container.GetToolbar (Gtk.PositionType.Top));
+ toolbarProvider.Attach (container.GetToolbar (DockPositionType.Top));
grid.SetToolbarProvider (toolbarProvider);
this.container = container;
DesignerSupport.Service.SetPad (this);
@@ -79,7 +80,7 @@ namespace MonoDevelop.DesignerSupport
#region AbstractPadContent implementations
- public override Gtk.Widget Control {
+ public override Control Control {
get { return frame; }
}
@@ -118,7 +119,7 @@ namespace MonoDevelop.DesignerSupport
customWidget = false;
frame.Remove (frame.Child);
frame.Add (grid);
- toolbarProvider.Attach (container.GetToolbar (Gtk.PositionType.Top));
+ toolbarProvider.Attach (container.GetToolbar (DockPositionType.Top));
}
return grid;
@@ -138,7 +139,7 @@ namespace MonoDevelop.DesignerSupport
void ClearToolbar ()
{
if (container != null) {
- var toolbar = container.GetToolbar (Gtk.PositionType.Top);
+ var toolbar = container.GetToolbar (DockPositionType.Top);
foreach (var w in toolbar.Children)
toolbar.Remove (w);
}
diff --git a/main/src/addins/MonoDevelop.DesignerSupport/MonoDevelop.DesignerSupport/ToolboxPad.cs b/main/src/addins/MonoDevelop.DesignerSupport/MonoDevelop.DesignerSupport/ToolboxPad.cs
index e6abccb836..f27049ed61 100644
--- a/main/src/addins/MonoDevelop.DesignerSupport/MonoDevelop.DesignerSupport/ToolboxPad.cs
+++ b/main/src/addins/MonoDevelop.DesignerSupport/MonoDevelop.DesignerSupport/ToolboxPad.cs
@@ -35,11 +35,12 @@ using MonoDevelop.Ide.Gui;
using MonoDevelop.DesignerSupport;
using MonoDevelop.DesignerSupport.Toolbox;
+using MonoDevelop.Components;
namespace MonoDevelop.DesignerSupport
{
- public class ToolboxPad : AbstractPadContent
+ public class ToolboxPad : PadContent
{
Toolbox.Toolbox toolbox;
@@ -47,7 +48,7 @@ namespace MonoDevelop.DesignerSupport
{
}
- public override void Initialize (IPadWindow container)
+ protected override void Initialize (IPadWindow container)
{
base.Initialize (container);
toolbox = new Toolbox.Toolbox (DesignerSupport.Service.ToolboxService, container);
@@ -56,7 +57,7 @@ namespace MonoDevelop.DesignerSupport
#region AbstractPadContent implementations
- public override Gtk.Widget Control {
+ public override Control Control {
get { return toolbox; }
}
diff --git a/main/src/addins/MonoDevelop.DesignerSupport/MonoDevelop.DesignerSupport/WrapperDesignView.cs b/main/src/addins/MonoDevelop.DesignerSupport/MonoDevelop.DesignerSupport/WrapperDesignView.cs
index a3a743e8b0..8de2800c5f 100644
--- a/main/src/addins/MonoDevelop.DesignerSupport/MonoDevelop.DesignerSupport/WrapperDesignView.cs
+++ b/main/src/addins/MonoDevelop.DesignerSupport/MonoDevelop.DesignerSupport/WrapperDesignView.cs
@@ -1,5 +1,5 @@
//
-// WrapperDesignView.cs: base class for wrapping an IViewContent. Heavily based on
+// WrapperDesignView.cs: base class for wrapping an ViewContent. Heavily based on
// MonoDevelop.GtkCore.GuiBuilder.CombinedDesignView
//
// Author:
@@ -31,28 +31,30 @@
using System;
+using MonoDevelop.Components;
using MonoDevelop.Ide.Gui;
using MonoDevelop.Ide;
+using System.Collections.Generic;
+using System.Threading.Tasks;
namespace MonoDevelop.DesignerSupport
{
- public class WrapperDesignView : AbstractViewContent
+ public class WrapperDesignView : ViewContent
{
- IViewContent content;
+ ViewContent content;
Gtk.VBox contentBox;
Gtk.Widget topBar;
- public WrapperDesignView (IViewContent content)
+ public WrapperDesignView (ViewContent content)
{
this.content = content;
this.contentBox = new Gtk.VBox ();
this.contentBox.PackEnd (content.Control, true, true, 0);
this.contentBox.ShowAll ();
- content.ContentChanged += new EventHandler (OnTextContentChanged);
content.DirtyChanged += new EventHandler (OnTextDirtyChanged);
-
+
IdeApp.Workbench.ActiveDocumentChanged += new EventHandler (OnActiveDocumentChanged);
}
@@ -76,50 +78,53 @@ namespace MonoDevelop.DesignerSupport
}
}
- protected IViewContent Content {
+ protected ViewContent Content {
get { return content; }
}
- public override MonoDevelop.Projects.Project Project {
- get { return base.Project; }
- set {
- base.Project = value;
- content.Project = value;
+ protected override void OnSetProject (MonoDevelop.Projects.Project project)
+ {
+ base.OnSetProject (project);
+ content.Project = project;
+ }
+
+ public override ProjectReloadCapability ProjectReloadCapability {
+ get {
+ return content.ProjectReloadCapability;
}
}
- protected override void OnWorkbenchWindowChanged (EventArgs e)
+ protected override void OnWorkbenchWindowChanged ()
{
- base.OnWorkbenchWindowChanged (e);
+ base.OnWorkbenchWindowChanged ();
content.WorkbenchWindow = WorkbenchWindow;
}
public override void Dispose ()
{
- content.ContentChanged -= new EventHandler (OnTextContentChanged);
content.DirtyChanged -= new EventHandler (OnTextDirtyChanged);
IdeApp.Workbench.ActiveDocumentChanged -= new EventHandler (OnActiveDocumentChanged);
base.Dispose ();
}
- public override void Load (FileOpenInformation fileOpenInformation)
+ public override Task Load (FileOpenInformation fileOpenInformation)
{
ContentName = fileOpenInformation.FileName;
- content.Load (ContentName);
+ return content.Load (ContentName);
}
- public override void LoadNew (System.IO.Stream content, string mimeType)
+ public override Task LoadNew (System.IO.Stream content, string mimeType)
{
- this.content.LoadNew (content, mimeType);
+ return this.content.LoadNew (content, mimeType);
}
- public override Gtk.Widget Control {
+ public override Control Control {
get { return contentBox; }
}
- public override void Save (FileSaveInformation fileSaveInformation)
+ public override Task Save (FileSaveInformation fileSaveInformation)
{
- content.Save (fileSaveInformation);
+ return content.Save (fileSaveInformation);
}
public override bool IsDirty {
@@ -138,19 +143,15 @@ namespace MonoDevelop.DesignerSupport
}
}
- public override string ContentName {
- get { return content.ContentName; }
- set { content.ContentName = value; }
- }
-
- void OnTextContentChanged (object s, EventArgs args)
+ protected override void OnContentNameChanged ()
{
- OnContentChanged (args);
+ base.OnContentNameChanged ();
+ content.ContentName = ContentName;
}
-
+
void OnTextDirtyChanged (object s, EventArgs args)
{
- OnDirtyChanged (args);
+ OnDirtyChanged ();
}
void OnActiveDocumentChanged (object s, EventArgs args)
@@ -163,10 +164,10 @@ namespace MonoDevelop.DesignerSupport
protected virtual void OnDocumentActivated ()
{
}
-
- public override object GetContent (Type type)
+
+ protected override IEnumerable<object> OnGetContents (Type type)
{
- return base.GetContent (type) ?? content.GetContent (type);
+ return base.OnGetContents (type).Concat (content.GetContents (type));
}
}
}
diff --git a/main/src/addins/MonoDevelop.DocFood/MonoDevelop.DocFood.Options/AcronymsPanelWidget.cs b/main/src/addins/MonoDevelop.DocFood/MonoDevelop.DocFood.Options/AcronymsPanelWidget.cs
index 056df0d5fb..1e9ba38bae 100644
--- a/main/src/addins/MonoDevelop.DocFood/MonoDevelop.DocFood.Options/AcronymsPanelWidget.cs
+++ b/main/src/addins/MonoDevelop.DocFood/MonoDevelop.DocFood.Options/AcronymsPanelWidget.cs
@@ -24,6 +24,7 @@
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
using System;
+using MonoDevelop.Components;
using MonoDevelop.Ide.Gui.Dialogs;
namespace MonoDevelop.DocFood.Options
@@ -44,7 +45,7 @@ namespace MonoDevelop.DocFood.Options
{
AcronymsPanelWidget panel;
- public override Gtk.Widget CreatePanelWidget ()
+ public override Control CreatePanelWidget ()
{
panel = new AcronymsPanelWidget (DocConfig.Instance);
return panel;
diff --git a/main/src/addins/MonoDevelop.DocFood/MonoDevelop.DocFood.Options/ExpansionsPanelWidget.cs b/main/src/addins/MonoDevelop.DocFood/MonoDevelop.DocFood.Options/ExpansionsPanelWidget.cs
index ef67d760f9..537a6c973b 100644
--- a/main/src/addins/MonoDevelop.DocFood/MonoDevelop.DocFood.Options/ExpansionsPanelWidget.cs
+++ b/main/src/addins/MonoDevelop.DocFood/MonoDevelop.DocFood.Options/ExpansionsPanelWidget.cs
@@ -24,6 +24,7 @@
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
using System;
+using MonoDevelop.Components;
using MonoDevelop.Ide.Gui.Dialogs;
namespace MonoDevelop.DocFood.Options
@@ -54,7 +55,7 @@ namespace MonoDevelop.DocFood.Options
/// <returns>
/// The panel widget.
/// </returns>
- public override Gtk.Widget CreatePanelWidget ()
+ public override Control CreatePanelWidget ()
{
panel = new ExpansionsPanelWidget (DocConfig.Instance);
return panel;
diff --git a/main/src/addins/MonoDevelop.DocFood/MonoDevelop.DocFood.Options/NoTheReorderingWidget.cs b/main/src/addins/MonoDevelop.DocFood/MonoDevelop.DocFood.Options/NoTheReorderingWidget.cs
index d8f9bd3f9d..e6d6613f9a 100644
--- a/main/src/addins/MonoDevelop.DocFood/MonoDevelop.DocFood.Options/NoTheReorderingWidget.cs
+++ b/main/src/addins/MonoDevelop.DocFood/MonoDevelop.DocFood.Options/NoTheReorderingWidget.cs
@@ -24,6 +24,7 @@
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
using System;
+using MonoDevelop.Components;
using MonoDevelop.Ide.Gui.Dialogs;
namespace MonoDevelop.DocFood.Options
@@ -44,7 +45,7 @@ namespace MonoDevelop.DocFood.Options
{
NoTheReorderingWidget panel;
- public override Gtk.Widget CreatePanelWidget ()
+ public override Control CreatePanelWidget ()
{
panel = new NoTheReorderingWidget (DocConfig.Instance);
return panel;
diff --git a/main/src/addins/MonoDevelop.DocFood/MonoDevelop.DocFood.Options/OfTheReorderingWidget.cs b/main/src/addins/MonoDevelop.DocFood/MonoDevelop.DocFood.Options/OfTheReorderingWidget.cs
index 7a9e9f9012..a654d53e17 100644
--- a/main/src/addins/MonoDevelop.DocFood/MonoDevelop.DocFood.Options/OfTheReorderingWidget.cs
+++ b/main/src/addins/MonoDevelop.DocFood/MonoDevelop.DocFood.Options/OfTheReorderingWidget.cs
@@ -24,6 +24,7 @@
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
using System;
+using MonoDevelop.Components;
using MonoDevelop.Ide.Gui.Dialogs;
namespace MonoDevelop.DocFood.Options
@@ -44,7 +45,7 @@ namespace MonoDevelop.DocFood.Options
{
OfTheReorderingWidget panel;
- public override Gtk.Widget CreatePanelWidget ()
+ public override Control CreatePanelWidget ()
{
panel = new OfTheReorderingWidget (DocConfig.Instance);
return panel;
diff --git a/main/src/addins/MonoDevelop.DocFood/MonoDevelop.DocFood.Options/OptionsPanelWidget.cs b/main/src/addins/MonoDevelop.DocFood/MonoDevelop.DocFood.Options/OptionsPanelWidget.cs
index 8bc50381fc..4ebfbd8e80 100644
--- a/main/src/addins/MonoDevelop.DocFood/MonoDevelop.DocFood.Options/OptionsPanelWidget.cs
+++ b/main/src/addins/MonoDevelop.DocFood/MonoDevelop.DocFood.Options/OptionsPanelWidget.cs
@@ -24,6 +24,7 @@
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
using System;
+using MonoDevelop.Components;
using MonoDevelop.Ide.Gui.Dialogs;
namespace MonoDevelop.DocFood.Options
@@ -44,7 +45,7 @@ namespace MonoDevelop.DocFood.Options
{
OptionsPanelWidget panel;
- public override Gtk.Widget CreatePanelWidget ()
+ public override Control CreatePanelWidget ()
{
panel = new OptionsPanelWidget (DocConfig.Instance);
return panel;
diff --git a/main/src/addins/MonoDevelop.DocFood/MonoDevelop.DocFood.Options/RulesPanelWidget.cs b/main/src/addins/MonoDevelop.DocFood/MonoDevelop.DocFood.Options/RulesPanelWidget.cs
index 0de058c177..7bee353ab2 100644
--- a/main/src/addins/MonoDevelop.DocFood/MonoDevelop.DocFood.Options/RulesPanelWidget.cs
+++ b/main/src/addins/MonoDevelop.DocFood/MonoDevelop.DocFood.Options/RulesPanelWidget.cs
@@ -24,6 +24,7 @@
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
using System;
+using MonoDevelop.Components;
using MonoDevelop.Ide.Gui.Dialogs;
namespace MonoDevelop.DocFood.Options
@@ -44,7 +45,7 @@ namespace MonoDevelop.DocFood.Options
{
RulesPanelWidget panel;
- public override Gtk.Widget CreatePanelWidget ()
+ public override Control CreatePanelWidget ()
{
panel = new RulesPanelWidget (DocConfig.Instance);
return panel;
diff --git a/main/src/addins/MonoDevelop.Gettext/MonoDevelop.Gettext.Editor/CatalogEditorView.cs b/main/src/addins/MonoDevelop.Gettext/MonoDevelop.Gettext.Editor/CatalogEditorView.cs
index cc9aef04b0..d33b7ec7be 100644
--- a/main/src/addins/MonoDevelop.Gettext/MonoDevelop.Gettext.Editor/CatalogEditorView.cs
+++ b/main/src/addins/MonoDevelop.Gettext/MonoDevelop.Gettext.Editor/CatalogEditorView.cs
@@ -32,13 +32,15 @@ using System;
using System.Collections.Generic;
using Gtk;
using Gdk;
+using MonoDevelop.Components;
using MonoDevelop.Core;
using MonoDevelop.Ide.Gui;
using MonoDevelop.Ide.Gui.Content;
+using System.Threading.Tasks;
namespace MonoDevelop.Gettext.Editor
{
- class CatalogEditorView : AbstractViewContent, IUndoHandler
+ class CatalogEditorView : ViewContent, IUndoHandler
{
Catalog catalog;
POEditorWidget poEditorWidget;
@@ -52,7 +54,7 @@ namespace MonoDevelop.Gettext.Editor
};
}
- public override void Load (FileOpenInformation fileOpenInformation)
+ public override Task Load (FileOpenInformation fileOpenInformation)
{
var fileName = fileOpenInformation.FileName;
// using (IProgressMonitor mon = IdeApp.Workbench.ProgressMonitors.GetLoadProgressMonitor (true)) {
@@ -64,21 +66,17 @@ namespace MonoDevelop.Gettext.Editor
this.ContentName = fileName;
this.IsDirty = false;
+ return Task.FromResult (true);
}
- public override void Save (FileSaveInformation fileSaveInformation)
+ public override Task Save (FileSaveInformation fileSaveInformation)
{
- OnBeforeSave (EventArgs.Empty);
catalog.Save (fileSaveInformation.FileName);
ContentName = fileSaveInformation.FileName;
- IsDirty = false;
+ IsDirty = false;
+ return Task.FromResult (true);
}
- public override void Save ()
- {
- Save (this.ContentName);
- }
-
#region IUndoHandler implementation
void IUndoHandler.Undo ()
{
@@ -108,7 +106,7 @@ namespace MonoDevelop.Gettext.Editor
}
#endregion
- public override Widget Control
+ public override Control Control
{
get { return poEditorWidget; }
}
diff --git a/main/src/addins/MonoDevelop.Gettext/MonoDevelop.Gettext.Editor/GettextEditorDisplayBinding.cs b/main/src/addins/MonoDevelop.Gettext/MonoDevelop.Gettext.Editor/GettextEditorDisplayBinding.cs
index a572e7b707..0f9d629cfd 100644
--- a/main/src/addins/MonoDevelop.Gettext/MonoDevelop.Gettext.Editor/GettextEditorDisplayBinding.cs
+++ b/main/src/addins/MonoDevelop.Gettext/MonoDevelop.Gettext.Editor/GettextEditorDisplayBinding.cs
@@ -47,7 +47,7 @@ namespace MonoDevelop.Gettext
return filePath.IsNotNull && filePath.HasExtension (".po");
}
- public IViewContent CreateContent (FilePath filePath, string mimeType, Project project)
+ public ViewContent CreateContent (FilePath filePath, string mimeType, Project project)
{
foreach (TranslationProject tp in IdeApp.Workspace.GetAllItems<TranslationProject> ())
if (tp.BaseDirectory == Path.GetDirectoryName (filePath))
diff --git a/main/src/addins/MonoDevelop.Gettext/MonoDevelop.Gettext/TranslationProject.cs b/main/src/addins/MonoDevelop.Gettext/MonoDevelop.Gettext/TranslationProject.cs
index 2fb7956d88..14e4396528 100644
--- a/main/src/addins/MonoDevelop.Gettext/MonoDevelop.Gettext/TranslationProject.cs
+++ b/main/src/addins/MonoDevelop.Gettext/MonoDevelop.Gettext/TranslationProject.cs
@@ -440,11 +440,7 @@ namespace MonoDevelop.Gettext
class TranslationProjectConfiguration : ProjectConfiguration
{
- public TranslationProjectConfiguration ()
- {
- }
-
- public TranslationProjectConfiguration (string name): base (name)
+ public TranslationProjectConfiguration (string id): base (id)
{
}
}
diff --git a/main/src/addins/MonoDevelop.GtkCore/MonoDevelop.GtkCore.Dialogs/GtkDesignerOptionsPanelWidget.cs b/main/src/addins/MonoDevelop.GtkCore/MonoDevelop.GtkCore.Dialogs/GtkDesignerOptionsPanelWidget.cs
index cce24542b0..41f1b27042 100644
--- a/main/src/addins/MonoDevelop.GtkCore/MonoDevelop.GtkCore.Dialogs/GtkDesignerOptionsPanelWidget.cs
+++ b/main/src/addins/MonoDevelop.GtkCore/MonoDevelop.GtkCore.Dialogs/GtkDesignerOptionsPanelWidget.cs
@@ -26,7 +26,7 @@
using System;
using MonoDevelop.GtkCore.GuiBuilder;
-using Gtk;
+using MonoDevelop.Components;
using MonoDevelop.Ide.Gui.Dialogs;
namespace MonoDevelop.GtkCore.Dialogs
@@ -35,7 +35,7 @@ namespace MonoDevelop.GtkCore.Dialogs
{
GtkDesignerOptionsPanelWidget widget;
- public override Widget CreatePanelWidget ()
+ public override Control CreatePanelWidget ()
{
widget = new GtkDesignerOptionsPanelWidget ();
widget.AutoSwitchLayout = GuiBuilderService.AutoSwitchGuiLayout;
diff --git a/main/src/addins/MonoDevelop.GtkCore/MonoDevelop.GtkCore.Dialogs/WidgetBuilderOptionPanel.cs b/main/src/addins/MonoDevelop.GtkCore/MonoDevelop.GtkCore.Dialogs/WidgetBuilderOptionPanel.cs
index 4fb717ece7..794b08476b 100644
--- a/main/src/addins/MonoDevelop.GtkCore/MonoDevelop.GtkCore.Dialogs/WidgetBuilderOptionPanel.cs
+++ b/main/src/addins/MonoDevelop.GtkCore/MonoDevelop.GtkCore.Dialogs/WidgetBuilderOptionPanel.cs
@@ -29,7 +29,8 @@
using Gtk;
-
+
+using MonoDevelop.Components;
using MonoDevelop.Core;
using MonoDevelop.Projects;
using MonoDevelop.Ide.Gui.Dialogs;
@@ -121,7 +122,7 @@ namespace MonoDevelop.GtkCore.Dialogs
WidgetBuilderOptionPanelWidget widget;
- public override Widget CreatePanelWidget()
+ public override Control CreatePanelWidget()
{
return (widget = new WidgetBuilderOptionPanelWidget (ConfiguredProject));
}
diff --git a/main/src/addins/MonoDevelop.GtkCore/MonoDevelop.GtkCore.GuiBuilder/ActionGroupDisplayBinding.cs b/main/src/addins/MonoDevelop.GtkCore/MonoDevelop.GtkCore.GuiBuilder/ActionGroupDisplayBinding.cs
index b122cf3de6..5eae8f19fd 100644
--- a/main/src/addins/MonoDevelop.GtkCore/MonoDevelop.GtkCore.GuiBuilder/ActionGroupDisplayBinding.cs
+++ b/main/src/addins/MonoDevelop.GtkCore/MonoDevelop.GtkCore.GuiBuilder/ActionGroupDisplayBinding.cs
@@ -81,7 +81,7 @@ namespace MonoDevelop.GtkCore.GuiBuilder
return db != null;
}
- public IViewContent CreateContent (FilePath fileName, string mimeType, MonoDevelop.Projects.Project ownerProject)
+ public ViewContent CreateContent (FilePath fileName, string mimeType, MonoDevelop.Projects.Project ownerProject)
{
excludeThis = true;
var db = DisplayBindingService.GetDefaultViewBinding (fileName, mimeType, ownerProject);
diff --git a/main/src/addins/MonoDevelop.GtkCore/MonoDevelop.GtkCore.GuiBuilder/ActionGroupView.cs b/main/src/addins/MonoDevelop.GtkCore/MonoDevelop.GtkCore.GuiBuilder/ActionGroupView.cs
index 3e16e11f17..ba794c06f8 100644
--- a/main/src/addins/MonoDevelop.GtkCore/MonoDevelop.GtkCore.GuiBuilder/ActionGroupView.cs
+++ b/main/src/addins/MonoDevelop.GtkCore/MonoDevelop.GtkCore.GuiBuilder/ActionGroupView.cs
@@ -37,7 +37,7 @@ using MonoDevelop.Components.Commands;
using MonoDevelop.DesignerSupport;
using Microsoft.CodeAnalysis;
using MonoDevelop.Ide;
-
+using System.Threading.Tasks;
namespace MonoDevelop.GtkCore.GuiBuilder
{
@@ -50,7 +50,7 @@ namespace MonoDevelop.GtkCore.GuiBuilder
Stetic.ActionGroupInfo groupInfo;
string groupName;
- public ActionGroupView (IViewContent content, Stetic.ActionGroupInfo group, GuiBuilderProject project): base (content)
+ public ActionGroupView (ViewContent content, Stetic.ActionGroupInfo group, GuiBuilderProject project): base (content)
{
groupName = group.Name;
this.project = project;
@@ -140,11 +140,11 @@ namespace MonoDevelop.GtkCore.GuiBuilder
codeBinder.TargetObject = designer.RootComponent;
}
- public override void Save (FileSaveInformation fileSaveInformation)
+ public override async Task Save (FileSaveInformation fileSaveInformation)
{
string oldBuildFile = GuiBuilderService.GetBuildCodeFileName (project.Project, groupInfo.Name);
- base.Save (fileSaveInformation);
+ await base.Save (fileSaveInformation);
if (designer == null)
return;
@@ -189,8 +189,6 @@ namespace MonoDevelop.GtkCore.GuiBuilder
void OnGroupModified (object s, EventArgs a)
{
- if (designer.Modified)
- OnContentChanged (a);
IsDirty = designer.Modified;
}
@@ -204,10 +202,10 @@ namespace MonoDevelop.GtkCore.GuiBuilder
codeBinder.UpdateSignal (a.OldSignal, a.Signal);
}
- void OnBindField (object s, EventArgs args)
+ async void OnBindField (object s, EventArgs args)
{
if (designer.SelectedAction != null) {
- codeBinder.BindToField (designer.SelectedAction);
+ await codeBinder.BindToField (designer.SelectedAction);
}
}
}
diff --git a/main/src/addins/MonoDevelop.GtkCore/MonoDevelop.GtkCore.GuiBuilder/CodeBinder.cs b/main/src/addins/MonoDevelop.GtkCore/MonoDevelop.GtkCore.GuiBuilder/CodeBinder.cs
index 6e49af37e2..3076ef4d8d 100644
--- a/main/src/addins/MonoDevelop.GtkCore/MonoDevelop.GtkCore.GuiBuilder/CodeBinder.cs
+++ b/main/src/addins/MonoDevelop.GtkCore/MonoDevelop.GtkCore.GuiBuilder/CodeBinder.cs
@@ -47,6 +47,7 @@ using MonoDevelop.CSharp.Refactoring;
using MonoDevelop.Refactoring;
using System.Xml.XPath;
using System.IO;
+using System.Threading.Tasks;
namespace MonoDevelop.GtkCore.GuiBuilder
{
@@ -212,7 +213,7 @@ namespace MonoDevelop.GtkCore.GuiBuilder
}
/// Adds a field to the class
- public void BindToField (Stetic.Component obj)
+ public async Task BindToField (Stetic.Component obj)
{
if (targetObject == null)
return;
@@ -224,11 +225,11 @@ namespace MonoDevelop.GtkCore.GuiBuilder
return;
var location = GetSourceLocation(cls);
- var doc = IdeApp.Workbench.OpenDocument (location.SourceTree.FilePath, project, true);
+ var doc = await IdeApp.Workbench.OpenDocument (location.SourceTree.FilePath, project, true);
var editor = doc.Editor;
if (editor != null) {
- CodeGenerationService.AddNewMember (project, cls, cls.Locations.First (), GetFieldCode (cls, obj, name));
+ await CodeGenerationService.AddNewMember (project, cls, cls.Locations.First (), GetFieldCode (cls, obj, name));
}
}
diff --git a/main/src/addins/MonoDevelop.GtkCore/MonoDevelop.GtkCore.GuiBuilder/CombinedDesignView.cs b/main/src/addins/MonoDevelop.GtkCore/MonoDevelop.GtkCore.GuiBuilder/CombinedDesignView.cs
index c08d33c374..2961eb94ca 100644
--- a/main/src/addins/MonoDevelop.GtkCore/MonoDevelop.GtkCore.GuiBuilder/CombinedDesignView.cs
+++ b/main/src/addins/MonoDevelop.GtkCore/MonoDevelop.GtkCore.GuiBuilder/CombinedDesignView.cs
@@ -30,6 +30,7 @@
using System;
using System.Linq;
using Gtk;
+using MonoDevelop.Components;
using MonoDevelop.Core;
using MonoDevelop.Ide.Gui.Content;
using MonoDevelop.Ide.Gui;
@@ -37,16 +38,17 @@ using MonoDevelop.Components.Commands;
using MonoDevelop.Ide;
using System.Collections.Generic;
using MonoDevelop.Ide.Editor;
+using System.Threading.Tasks;
namespace MonoDevelop.GtkCore.GuiBuilder
{
- public class CombinedDesignView : AbstractViewContent
+ public class CombinedDesignView : ViewContent
{
- IViewContent content;
+ ViewContent content;
Gtk.Widget control;
List<TabView> tabs = new List<TabView> ();
- public CombinedDesignView (IViewContent content)
+ public CombinedDesignView (ViewContent content)
{
this.content = content;
/* This code causes that chagnes in a version control view always select the source code view.
@@ -55,7 +57,6 @@ namespace MonoDevelop.GtkCore.GuiBuilder
ShowPage (0);
};
}*/
- content.ContentChanged += new EventHandler (OnTextContentChanged);
content.DirtyChanged += new EventHandler (OnTextDirtyChanged);
CommandRouterContainer crc = new CommandRouterContainer (content.Control, content, true);
@@ -87,7 +88,7 @@ namespace MonoDevelop.GtkCore.GuiBuilder
public bool HasPage (Gtk.Widget page)
{
- return tabs.Any (p => p.Control == page);
+ return tabs.Any (p => p.Control.GetNativeWidget<Gtk.Widget> () == page);
}
public void RemoveButton (Gtk.Widget page)
@@ -108,17 +109,21 @@ namespace MonoDevelop.GtkCore.GuiBuilder
ShowPage (0);*/
}
- public override MonoDevelop.Projects.Project Project {
- get { return base.Project; }
- set {
- base.Project = value;
- content.Project = value;
+ protected override void OnSetProject (Projects.Project project)
+ {
+ base.OnSetProject (project);
+ content.Project = project;
+ }
+
+ public override ProjectReloadCapability ProjectReloadCapability {
+ get {
+ return content.ProjectReloadCapability;
}
}
- protected override void OnWorkbenchWindowChanged (EventArgs e)
+ protected override void OnWorkbenchWindowChanged ()
{
- base.OnWorkbenchWindowChanged (e);
+ base.OnWorkbenchWindowChanged ();
content.WorkbenchWindow = WorkbenchWindow;
if (WorkbenchWindow != null) {
foreach (TabView view in tabs) {
@@ -161,7 +166,6 @@ namespace MonoDevelop.GtkCore.GuiBuilder
public override void Dispose ()
{
- content.ContentChanged -= new EventHandler (OnTextContentChanged);
content.DirtyChanged -= new EventHandler (OnTextDirtyChanged);
IdeApp.Workbench.ActiveDocumentChanged -= new EventHandler (OnActiveDocumentChanged);
content.Dispose ();
@@ -172,19 +176,19 @@ namespace MonoDevelop.GtkCore.GuiBuilder
base.Dispose ();
}
- public override void Load (FileOpenInformation fileOpenInformation)
+ public override Task Load (FileOpenInformation fileOpenInformation)
{
ContentName = fileOpenInformation.FileName;
- content.Load (ContentName);
+ return content.Load (ContentName);
}
- public override Gtk.Widget Control {
+ public override Control Control {
get { return control; }
}
- public override void Save (FileSaveInformation fileSaveInformation)
+ public override Task Save (FileSaveInformation fileSaveInformation)
{
- content.Save (fileSaveInformation);
+ return content.Save (fileSaveInformation);
}
public override bool IsDirty {
@@ -211,14 +215,9 @@ namespace MonoDevelop.GtkCore.GuiBuilder
{
}
- void OnTextContentChanged (object s, EventArgs args)
- {
- OnContentChanged (args);
- }
-
void OnTextDirtyChanged (object s, EventArgs args)
{
- OnDirtyChanged (args);
+ OnDirtyChanged ();
}
void OnActiveDocumentChanged (object s, EventArgs args)
@@ -231,7 +230,7 @@ namespace MonoDevelop.GtkCore.GuiBuilder
{
}
- public override object GetContent (Type type)
+ protected override object OnGetContent (Type type)
{
// if (type == typeof(IEditableTextBuffer)) {
// // Intercept the IPositionable interface, since we need to
@@ -242,7 +241,7 @@ namespace MonoDevelop.GtkCore.GuiBuilder
// return null;
// }
//
- return base.GetContent (type) ?? (content !=null ? content.GetContent (type) : null);
+ return base.OnGetContent (type) ?? (content !=null ? content.GetContent (type) : null);
}
public void JumpTo (int line, int column)
@@ -255,7 +254,7 @@ namespace MonoDevelop.GtkCore.GuiBuilder
}
}
- class TabView: AbstractBaseViewContent, IAttachableViewContent
+ class TabView: BaseViewContent
{
string label;
Gtk.Widget content;
@@ -266,32 +265,14 @@ namespace MonoDevelop.GtkCore.GuiBuilder
this.content = content;
}
- public override object GetContent (Type type)
+ protected override object OnGetContent (Type type)
{
if (type.IsInstanceOfType (Control))
return Control;
- return base.GetContent (type);
+ return base.OnGetContent (type);
}
- #region IAttachableViewContent implementation
- public virtual void Selected ()
- {
- }
-
- public virtual void Deselected ()
- {
- }
-
- public virtual void BeforeSave ()
- {
- }
-
- public virtual void BaseContentChanged ()
- {
- }
- #endregion
-
- public override Widget Control {
+ public override Control Control {
get {
return content;
}
diff --git a/main/src/addins/MonoDevelop.GtkCore/MonoDevelop.GtkCore.GuiBuilder/GuiBuilderDisplayBinding.cs b/main/src/addins/MonoDevelop.GtkCore/MonoDevelop.GtkCore.GuiBuilder/GuiBuilderDisplayBinding.cs
index 65cde80d96..c9f93016f6 100644
--- a/main/src/addins/MonoDevelop.GtkCore/MonoDevelop.GtkCore.GuiBuilder/GuiBuilderDisplayBinding.cs
+++ b/main/src/addins/MonoDevelop.GtkCore/MonoDevelop.GtkCore.GuiBuilder/GuiBuilderDisplayBinding.cs
@@ -68,7 +68,7 @@ namespace MonoDevelop.GtkCore.GuiBuilder
return db != null;
}
- public IViewContent CreateContent (MonoDevelop.Core.FilePath fileName, string mimeType, Project ownerProject)
+ public ViewContent CreateContent (MonoDevelop.Core.FilePath fileName, string mimeType, Project ownerProject)
{
excludeThis = true;
var db = DisplayBindingService.GetDefaultViewBinding (fileName, mimeType, ownerProject);
diff --git a/main/src/addins/MonoDevelop.GtkCore/MonoDevelop.GtkCore.GuiBuilder/GuiBuilderService.cs b/main/src/addins/MonoDevelop.GtkCore/MonoDevelop.GtkCore.GuiBuilder/GuiBuilderService.cs
index b511d9fd7e..c765892291 100644
--- a/main/src/addins/MonoDevelop.GtkCore/MonoDevelop.GtkCore.GuiBuilder/GuiBuilderService.cs
+++ b/main/src/addins/MonoDevelop.GtkCore/MonoDevelop.GtkCore.GuiBuilder/GuiBuilderService.cs
@@ -168,7 +168,7 @@ namespace MonoDevelop.GtkCore.GuiBuilder
}
}
- public static ActionGroupView OpenActionGroup (Project project, Stetic.ActionGroupInfo group)
+ public static async Task<ActionGroupView> OpenActionGroup (Project project, Stetic.ActionGroupInfo group)
{
GuiBuilderProject p = GtkDesignInfo.FromProject (project).GuiBuilderProject ;
string file = p != null ? p.GetSourceCodeFile (group) : null;
@@ -176,7 +176,7 @@ namespace MonoDevelop.GtkCore.GuiBuilder
file = ActionGroupDisplayBinding.BindToClass (project, group);
}
- Document doc = IdeApp.Workbench.OpenDocument (file, true);
+ Document doc = await IdeApp.Workbench.OpenDocument (file, true);
if (doc != null) {
ActionGroupView view = doc.GetContent<ActionGroupView> ();
if (view != null) {
diff --git a/main/src/addins/MonoDevelop.GtkCore/MonoDevelop.GtkCore.GuiBuilder/GuiBuilderView.cs b/main/src/addins/MonoDevelop.GtkCore/MonoDevelop.GtkCore.GuiBuilder/GuiBuilderView.cs
index a472231a22..c0ae7f6a29 100644
--- a/main/src/addins/MonoDevelop.GtkCore/MonoDevelop.GtkCore.GuiBuilder/GuiBuilderView.cs
+++ b/main/src/addins/MonoDevelop.GtkCore/MonoDevelop.GtkCore.GuiBuilder/GuiBuilderView.cs
@@ -38,17 +38,18 @@ using MonoDevelop.Ide.Gui;
using MonoDevelop.Ide.Commands;
using MonoDevelop.Components.Commands;
using MonoDevelop.Projects;
-using MonoDevelop.DesignerSupport.Toolbox;
+using MonoDevelop.DesignerSupport.Toolbox;
using MonoDevelop.DesignerSupport;
using Gtk;
using Gdk;
using MonoDevelop.Ide;
using Microsoft.CodeAnalysis;
+using System.Threading.Tasks;
namespace MonoDevelop.GtkCore.GuiBuilder
{
- public class GuiBuilderView : CombinedDesignView, ISupportsProjectReload
+ public class GuiBuilderView : CombinedDesignView
{
Stetic.WidgetDesigner designer;
Stetic.ActionGroupDesigner actionsBox;
@@ -63,7 +64,7 @@ namespace MonoDevelop.GtkCore.GuiBuilder
string rootName;
object designerStatus;
- public GuiBuilderView (IViewContent content, GuiBuilderWindow window): base (content)
+ public GuiBuilderView (ViewContent content, GuiBuilderWindow window): base (content)
{
rootName = window.Name;
@@ -86,14 +87,16 @@ namespace MonoDevelop.GtkCore.GuiBuilder
LoadDesigner ();
}
- ProjectReloadCapability ISupportsProjectReload.ProjectReloadCapability {
+ public override ProjectReloadCapability ProjectReloadCapability {
get {
return ProjectReloadCapability.Full;
}
}
-
- void ISupportsProjectReload.Update (MonoDevelop.Projects.Project project)
+
+ protected override void OnSetProject (Projects.Project project)
{
+ base.OnSetProject (project);
+
if (gproject != null && gproject.Project == project)
return;
@@ -296,21 +299,19 @@ namespace MonoDevelop.GtkCore.GuiBuilder
void OnWindowModifiedChanged (object s, EventArgs args)
{
- if (IsDirty)
- OnContentChanged (args);
- OnDirtyChanged (args);
+ OnDirtyChanged ();
}
- void OnBindWidgetField (object o, EventArgs a)
+ async void OnBindWidgetField (object o, EventArgs a)
{
if (designer.Selection != null)
- codeBinder.BindToField (designer.Selection);
+ await codeBinder.BindToField (designer.Selection);
}
- void OnBindActionField (object o, EventArgs a)
+ async void OnBindActionField (object o, EventArgs a)
{
if (actionsBox.SelectedAction != null)
- codeBinder.BindToField (actionsBox.SelectedAction);
+ await codeBinder.BindToField (actionsBox.SelectedAction);
}
void OnSignalAdded (object sender, Stetic.ComponentSignalEventArgs args)
@@ -327,9 +328,9 @@ namespace MonoDevelop.GtkCore.GuiBuilder
codeBinder.UpdateSignal (args.OldSignal, args.Signal);
}
- public override void Save (FileSaveInformation fileSaveInformation)
+ public override async Task Save (FileSaveInformation fileSaveInformation)
{
- base.Save (fileSaveInformation);
+ await base.Save (fileSaveInformation);
if (designer == null)
return;
diff --git a/main/src/addins/MonoDevelop.GtkCore/MonoDevelop.GtkCore.NodeBuilders/ActionGroupNodeBuilder.cs b/main/src/addins/MonoDevelop.GtkCore/MonoDevelop.GtkCore.NodeBuilders/ActionGroupNodeBuilder.cs
index 5b0fd87a2f..ad6f2b722b 100644
--- a/main/src/addins/MonoDevelop.GtkCore/MonoDevelop.GtkCore.NodeBuilders/ActionGroupNodeBuilder.cs
+++ b/main/src/addins/MonoDevelop.GtkCore/MonoDevelop.GtkCore.NodeBuilders/ActionGroupNodeBuilder.cs
@@ -86,14 +86,14 @@ namespace MonoDevelop.GtkCore.NodeBuilders
class ActionGroupCommandHandler: NodeCommandHandler
{
- public override void ActivateItem ()
+ public override async void ActivateItem ()
{
GuiBuilderWindow w = (GuiBuilderWindow) CurrentNode.GetParentDataItem (typeof(GuiBuilderWindow), false);
if (w != null) {
if (w.SourceCodeFile == FilePath.Null && !w.BindToClass ())
return;
- Document doc = IdeApp.Workbench.OpenDocument (w.SourceCodeFile, true);
+ Document doc = await IdeApp.Workbench.OpenDocument (w.SourceCodeFile, true);
if (doc != null) {
GuiBuilderView view = doc.GetContent<GuiBuilderView> ();
if (view != null)
@@ -103,7 +103,7 @@ namespace MonoDevelop.GtkCore.NodeBuilders
else {
Project project = (Project) CurrentNode.GetParentDataItem (typeof(Project), false);
Stetic.ActionGroupInfo group = (Stetic.ActionGroupInfo) CurrentNode.DataItem;
- GuiBuilderService.OpenActionGroup (project, group);
+ await GuiBuilderService.OpenActionGroup (project, group);
}
}
diff --git a/main/src/addins/MonoDevelop.GtkCore/MonoDevelop.GtkCore.NodeBuilders/WidgetNodeBuilder.cs b/main/src/addins/MonoDevelop.GtkCore/MonoDevelop.GtkCore.NodeBuilders/WidgetNodeBuilder.cs
index c0d692977c..c2710e2cf2 100644
--- a/main/src/addins/MonoDevelop.GtkCore/MonoDevelop.GtkCore.NodeBuilders/WidgetNodeBuilder.cs
+++ b/main/src/addins/MonoDevelop.GtkCore/MonoDevelop.GtkCore.NodeBuilders/WidgetNodeBuilder.cs
@@ -114,13 +114,13 @@ namespace MonoDevelop.GtkCore.NodeBuilders
class GladeWindowCommandHandler: NodeCommandHandler
{
- public override void ActivateItem ()
+ public override async void ActivateItem ()
{
GuiBuilderWindow w = (GuiBuilderWindow) CurrentNode.DataItem;
if (w.SourceCodeFile == FilePath.Null && !w.BindToClass ())
return;
- Document doc = IdeApp.Workbench.OpenDocument (w.SourceCodeFile, true);
+ Document doc = await IdeApp.Workbench.OpenDocument (w.SourceCodeFile, true);
if (doc != null) {
GuiBuilderView view = doc.GetContent<GuiBuilderView> ();
if (view != null)
diff --git a/main/src/addins/MonoDevelop.HexEditor/Mono.MHex.Data/Buffer.cs b/main/src/addins/MonoDevelop.HexEditor/Mono.MHex.Data/Buffer.cs
index 4b5e64b651..31f8c29d7a 100644
--- a/main/src/addins/MonoDevelop.HexEditor/Mono.MHex.Data/Buffer.cs
+++ b/main/src/addins/MonoDevelop.HexEditor/Mono.MHex.Data/Buffer.cs
@@ -26,6 +26,7 @@
using System;
using System.IO;
+using System.Threading.Tasks;
namespace Mono.MHex.Data
{
@@ -81,6 +82,16 @@ namespace Mono.MHex.Data
return new ArrayBuffer (buf);
}
+ public static async Task<IBuffer> LoadAsync (Stream stream)
+ {
+ int count = (int) stream.Length;
+ byte[] buf = new byte[count];
+
+ await stream.ReadAsync (buf, 0, count);
+
+ return new ArrayBuffer (buf);
+ }
+
public static IBuffer Load (string fileName)
{
using (Stream stream = File.OpenRead (fileName)) {
diff --git a/main/src/addins/MonoDevelop.HexEditor/MonoDevelop.HexEditor/DisplayBinding.cs b/main/src/addins/MonoDevelop.HexEditor/MonoDevelop.HexEditor/DisplayBinding.cs
index 12a5f4c3d2..11c6c884fc 100644
--- a/main/src/addins/MonoDevelop.HexEditor/MonoDevelop.HexEditor/DisplayBinding.cs
+++ b/main/src/addins/MonoDevelop.HexEditor/MonoDevelop.HexEditor/DisplayBinding.cs
@@ -39,7 +39,7 @@ namespace MonoDevelop.HexEditor
}
}
- public IViewContent CreateContent (FilePath fileName, string mimeType, Project ownerProject)
+ public ViewContent CreateContent (FilePath fileName, string mimeType, Project ownerProject)
{
return new HexEditorView ();
diff --git a/main/src/addins/MonoDevelop.HexEditor/MonoDevelop.HexEditor/HexEditorView.cs b/main/src/addins/MonoDevelop.HexEditor/MonoDevelop.HexEditor/HexEditorView.cs
index e01cddac17..f23c5fc900 100644
--- a/main/src/addins/MonoDevelop.HexEditor/MonoDevelop.HexEditor/HexEditorView.cs
+++ b/main/src/addins/MonoDevelop.HexEditor/MonoDevelop.HexEditor/HexEditorView.cs
@@ -33,6 +33,7 @@ using MonoDevelop.Ide.Gui.Content;
using Xwt;
using MonoDevelop.Ide.Fonts;
using MonoDevelop.Ide.Editor;
+using System.Threading.Tasks;
namespace MonoDevelop.HexEditor
{
@@ -78,18 +79,19 @@ namespace MonoDevelop.HexEditor
hexEditor.Repaint ();
}
- public override void Save (FileSaveInformation fileSaveInformation)
+ public override Task Save (FileSaveInformation fileSaveInformation)
{
File.WriteAllBytes (fileSaveInformation.FileName, hexEditor.HexEditorData.Bytes);
ContentName = fileSaveInformation.FileName;
this.IsDirty = false;
+ return Task.FromResult (true);
}
- public override void Load (FileOpenInformation fileOpenInformation)
+ public override async Task Load (FileOpenInformation fileOpenInformation)
{
var fileName = fileOpenInformation.FileName;
using (Stream stream = File.OpenRead (fileName)) {
- hexEditor.HexEditorData.Buffer = ArrayBuffer.Load (stream);
+ hexEditor.HexEditorData.Buffer = await ArrayBuffer.LoadAsync (stream);
}
ContentName = fileName;
diff --git a/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Gui/PackageManagementOptionsPanel.cs b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Gui/PackageManagementOptionsPanel.cs
index f2bf9edf09..d5eca95351 100644
--- a/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Gui/PackageManagementOptionsPanel.cs
+++ b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Gui/PackageManagementOptionsPanel.cs
@@ -27,7 +27,8 @@
//
using System;
-using MonoDevelop.PackageManagement;
+using MonoDevelop.Components;
+using MonoDevelop.PackageManagement;
using MonoDevelop.Ide.Gui.Dialogs;
namespace MonoDevelop.PackageManagement.Gui
@@ -35,8 +36,8 @@ namespace MonoDevelop.PackageManagement.Gui
public class PackageManagementOptionsPanel : OptionsPanel
{
PackageManagementOptionsViewModel optionsViewModel;
-
- public override Gtk.Widget CreatePanelWidget()
+
+ public override Control CreatePanelWidget()
{
var viewModels = new PackageManagementViewModels ();
optionsViewModel = viewModels.PackageManagementOptionsViewModel;
diff --git a/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Gui/PackageSourcesOptionsPanel.cs b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Gui/PackageSourcesOptionsPanel.cs
index 48ab198d78..d40d8f0e48 100644
--- a/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Gui/PackageSourcesOptionsPanel.cs
+++ b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Gui/PackageSourcesOptionsPanel.cs
@@ -30,6 +30,7 @@ using System;
using System.Linq;
using System.IO;
using System.Security.Cryptography;
+using MonoDevelop.Components;
using MonoDevelop.PackageManagement;
using MonoDevelop.Core;
using MonoDevelop.Ide;
@@ -42,7 +43,7 @@ namespace MonoDevelop.PackageManagement.Gui
PackageManagementViewModels viewModels;
PackageSourcesWidget packageSourcesWidget;
- public override Gtk.Widget CreatePanelWidget()
+ public override Control CreatePanelWidget()
{
viewModels = new PackageManagementViewModels ();
viewModels.RegisteredPackageSourcesViewModel.Load ();
diff --git a/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/SearchPackagesSearchCategory.cs b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/SearchPackagesSearchCategory.cs
index 551205cb35..a46706c6e1 100644
--- a/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/SearchPackagesSearchCategory.cs
+++ b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/SearchPackagesSearchCategory.cs
@@ -72,7 +72,7 @@ namespace MonoDevelop.PackageManagement
runner.Run (pattern.UnparsedPattern);
}
- public override string GetMarkupText (Gtk.Widget widget)
+ public override string GetMarkupText ()
{
return GettextCatalog.GetString ("Search Packages...");
}
diff --git a/main/src/addins/MonoDevelop.Refactoring/AddinInfo.cs b/main/src/addins/MonoDevelop.Refactoring/AddinInfo.cs
index 1dd2ad8160..8411f72959 100644
--- a/main/src/addins/MonoDevelop.Refactoring/AddinInfo.cs
+++ b/main/src/addins/MonoDevelop.Refactoring/AddinInfo.cs
@@ -15,3 +15,4 @@ using Mono.Addins.Description;
[assembly:AddinDependency ("Ide", MonoDevelop.BuildInfo.Version)]
[assembly:AddinDependency ("DesignerSupport", MonoDevelop.BuildInfo.Version)]
[assembly:AddinDependency ("SourceEditor2", MonoDevelop.BuildInfo.Version)]
+[assembly:AddinDependency ("RegexToolkit", MonoDevelop.BuildInfo.Version)]
diff --git a/main/src/addins/MonoDevelop.Refactoring/MonoDevelop.AnalysisCore/AnalysisCommands.cs b/main/src/addins/MonoDevelop.Refactoring/MonoDevelop.AnalysisCore/AnalysisCommands.cs
index fdb32f6021..4bba040f78 100644
--- a/main/src/addins/MonoDevelop.Refactoring/MonoDevelop.AnalysisCore/AnalysisCommands.cs
+++ b/main/src/addins/MonoDevelop.Refactoring/MonoDevelop.AnalysisCore/AnalysisCommands.cs
@@ -31,7 +31,6 @@ using System.Linq;
using MonoDevelop.Core;
using MonoDevelop.Ide.Gui;
using System.Collections.Generic;
-using Gtk;
using MonoDevelop.AnalysisCore.Gui;
using MonoDevelop.AnalysisCore.Fixes;
using MonoDevelop.Ide;
diff --git a/main/src/addins/MonoDevelop.Refactoring/MonoDevelop.AnalysisCore/Gui/AnalysisOptionsPanel.cs b/main/src/addins/MonoDevelop.Refactoring/MonoDevelop.AnalysisCore/Gui/AnalysisOptionsPanel.cs
index b8ddfd008e..deeaf2b724 100644
--- a/main/src/addins/MonoDevelop.Refactoring/MonoDevelop.AnalysisCore/Gui/AnalysisOptionsPanel.cs
+++ b/main/src/addins/MonoDevelop.Refactoring/MonoDevelop.AnalysisCore/Gui/AnalysisOptionsPanel.cs
@@ -27,6 +27,7 @@
using System;
using MonoDevelop.Ide.Gui.Dialogs;
using Gtk;
+using MonoDevelop.Components;
using MonoDevelop.Core;
using MonoDevelop.Ide;
@@ -36,7 +37,7 @@ namespace MonoDevelop.AnalysisCore.Gui
{
AnalysisOptionsWidget widget;
- public override Widget CreatePanelWidget ()
+ public override Control CreatePanelWidget ()
{
return widget = new AnalysisOptionsWidget () {
AnalysisEnabled = AnalysisOptions.AnalysisEnabled,
diff --git a/main/src/addins/MonoDevelop.Refactoring/MonoDevelop.AnalysisCore/Gui/ResultTooltipProvider.cs b/main/src/addins/MonoDevelop.Refactoring/MonoDevelop.AnalysisCore/Gui/ResultTooltipProvider.cs
index 91326133d2..fe54647b2a 100644
--- a/main/src/addins/MonoDevelop.Refactoring/MonoDevelop.AnalysisCore/Gui/ResultTooltipProvider.cs
+++ b/main/src/addins/MonoDevelop.Refactoring/MonoDevelop.AnalysisCore/Gui/ResultTooltipProvider.cs
@@ -51,7 +51,7 @@ namespace MonoDevelop.AnalysisCore.Gui
}
- public override Control CreateTooltipWindow (TextEditor editor, DocumentContext ctx, TooltipItem item, int offset, Gdk.ModifierType modifierState)
+ public override Control CreateTooltipWindow (TextEditor editor, DocumentContext ctx, TooltipItem item, int offset, Xwt.ModifierKeys modifierState)
{
var result = item.Item as Result;
@@ -72,4 +72,3 @@ namespace MonoDevelop.AnalysisCore.Gui
}
}
-
diff --git a/main/src/addins/MonoDevelop.Refactoring/MonoDevelop.AnalysisCore/Gui/ResultsEditorExtension.cs b/main/src/addins/MonoDevelop.Refactoring/MonoDevelop.AnalysisCore/Gui/ResultsEditorExtension.cs
index 718270df5f..b327d21e98 100644
--- a/main/src/addins/MonoDevelop.Refactoring/MonoDevelop.AnalysisCore/Gui/ResultsEditorExtension.cs
+++ b/main/src/addins/MonoDevelop.Refactoring/MonoDevelop.AnalysisCore/Gui/ResultsEditorExtension.cs
@@ -129,7 +129,6 @@ namespace MonoDevelop.AnalysisCore.Gui
new ResultsUpdater (this, new Result[0], CancellationToken.None).Update ();
}
- Task oldTask;
CancellationTokenSource src = null;
object updateLock = new object();
uint updateTimeout = 0;
@@ -148,7 +147,7 @@ namespace MonoDevelop.AnalysisCore.Gui
src = new CancellationTokenSource ();
var token = src.Token;
var ad = new AnalysisDocument (Editor, DocumentContext);
- oldTask = Task.Run (() => {
+ Task.Run (() => {
try {
var result = CodeDiagnosticRunner.Check (ad, token);
if (token.IsCancellationRequested)
diff --git a/main/src/addins/MonoDevelop.Refactoring/MonoDevelop.CodeActions/CodeActionEditorExtension.cs b/main/src/addins/MonoDevelop.Refactoring/MonoDevelop.CodeActions/CodeActionEditorExtension.cs
index ccd6497ea0..98cf126a20 100644
--- a/main/src/addins/MonoDevelop.Refactoring/MonoDevelop.CodeActions/CodeActionEditorExtension.cs
+++ b/main/src/addins/MonoDevelop.Refactoring/MonoDevelop.CodeActions/CodeActionEditorExtension.cs
@@ -54,12 +54,9 @@ namespace MonoDevelop.CodeActions
{
class CodeActionEditorExtension : TextEditorExtension
{
- uint quickFixTimeout;
-
const int menuTimeout = 250;
uint smartTagPopupTimeoutId;
uint menuCloseTimeoutId;
- FixMenuDescriptor codeActionMenu;
static CodeActionEditorExtension ()
{
@@ -320,8 +317,6 @@ namespace MonoDevelop.CodeActions
}
}
- internal static Action<TextEditor, DocumentContext, FixMenuDescriptor> AddPossibleNamespace;
-
void PopupQuickFixMenu (Gdk.EventButton evt, Action<FixMenuDescriptor> menuAction)
{
FixMenuDescriptor menu = new FixMenuDescriptor ();
@@ -616,7 +611,7 @@ namespace MonoDevelop.CodeActions
if (insertionAction != null) {
var insertion = await insertionAction.CreateInsertion (token).ConfigureAwait (false);
- var document = IdeApp.Workbench.OpenDocument (insertion.Location.SourceTree.FilePath, documentContext.Project);
+ var document = await IdeApp.Workbench.OpenDocument (insertion.Location.SourceTree.FilePath, documentContext.Project);
var parsedDocument = await document.UpdateParseDocument ();
if (parsedDocument != null) {
var insertionPoints = InsertionPointService.GetInsertionPoints (
@@ -851,9 +846,7 @@ namespace MonoDevelop.CodeActions
{
CancelSmartTagPopupTimeout ();
smartTagPopupTimeoutId = GLib.Timeout.Add (menuTimeout, delegate {
- PopupQuickFixMenu (null, menu => {
- codeActionMenu = menu;
- });
+ PopupQuickFixMenu (null, menu => {});
smartTagPopupTimeoutId = 0;
return false;
});
diff --git a/main/src/addins/MonoDevelop.Refactoring/MonoDevelop.CodeActions/CodeActionPanelWidget.cs b/main/src/addins/MonoDevelop.Refactoring/MonoDevelop.CodeActions/CodeActionPanelWidget.cs
index c74d775caa..7e89e64f47 100644
--- a/main/src/addins/MonoDevelop.Refactoring/MonoDevelop.CodeActions/CodeActionPanelWidget.cs
+++ b/main/src/addins/MonoDevelop.Refactoring/MonoDevelop.CodeActions/CodeActionPanelWidget.cs
@@ -26,6 +26,7 @@
using System;
using MonoDevelop.Ide.Gui.Dialogs;
using Gtk;
+using MonoDevelop.Components;
using MonoDevelop.Core;
using System.Linq;
using System.Text;
@@ -40,7 +41,7 @@ namespace MonoDevelop.CodeActions
{
ContextActionPanelWidget widget;
- public override Widget CreatePanelWidget ()
+ public override Control CreatePanelWidget ()
{
return widget = new ContextActionPanelWidget ("text/x-csharp");
}
diff --git a/main/src/addins/MonoDevelop.Refactoring/MonoDevelop.CodeActions/CodeRefactoringDescriptor.cs b/main/src/addins/MonoDevelop.Refactoring/MonoDevelop.CodeActions/CodeRefactoringDescriptor.cs
index c845671203..aa46055a1f 100644
--- a/main/src/addins/MonoDevelop.Refactoring/MonoDevelop.CodeActions/CodeRefactoringDescriptor.cs
+++ b/main/src/addins/MonoDevelop.Refactoring/MonoDevelop.CodeActions/CodeRefactoringDescriptor.cs
@@ -32,7 +32,7 @@ using System.Linq;
namespace MonoDevelop.CodeActions
{
/// <summary>
- /// This class wraps a roslyn <see cref="ICodeRefactoringProvider"/> and adds required meta data to it.
+ /// This class wraps a roslyn ICodeRefactoringProvider and adds required meta data to it.
/// </summary>
class CodeRefactoringDescriptor
{
diff --git a/main/src/addins/MonoDevelop.Refactoring/MonoDevelop.CodeActions/ValidCodeDiagnosticAction.cs b/main/src/addins/MonoDevelop.Refactoring/MonoDevelop.CodeActions/ValidCodeDiagnosticAction.cs
index 6f5192d2d9..5c946ac714 100644
--- a/main/src/addins/MonoDevelop.Refactoring/MonoDevelop.CodeActions/ValidCodeDiagnosticAction.cs
+++ b/main/src/addins/MonoDevelop.Refactoring/MonoDevelop.CodeActions/ValidCodeDiagnosticAction.cs
@@ -40,10 +40,7 @@ namespace MonoDevelop.CodeActions
/// </summary>
class ValidCodeDiagnosticAction : ValidCodeAction
{
- CodeDiagnosticFixDescriptor cfp;
- CodeAction ca;
ImmutableArray<Diagnostic> validDiagnostics;
- TextSpan diagnosticSpan;
public CodeDiagnosticFixDescriptor Diagnostic {
get;
diff --git a/main/src/addins/MonoDevelop.Refactoring/MonoDevelop.CodeIssues/CodeDiagnosticFixDescriptor.cs b/main/src/addins/MonoDevelop.Refactoring/MonoDevelop.CodeIssues/CodeDiagnosticFixDescriptor.cs
index 7f26e14572..29c0d576c8 100644
--- a/main/src/addins/MonoDevelop.Refactoring/MonoDevelop.CodeIssues/CodeDiagnosticFixDescriptor.cs
+++ b/main/src/addins/MonoDevelop.Refactoring/MonoDevelop.CodeIssues/CodeDiagnosticFixDescriptor.cs
@@ -64,7 +64,7 @@ namespace MonoDevelop.CodeIssues
if (instance == null) {
try {
instance = (CodeFixProvider)Activator.CreateInstance (codeFixProviderType);
- } catch (InvalidCastException e) {
+ } catch (InvalidCastException) {
LoggingService.LogError (codeFixProviderType + " can't be cast to CodeFixProvider.");
throw;
}
diff --git a/main/src/addins/MonoDevelop.Refactoring/MonoDevelop.CodeIssues/CodeDiagnosticProvider.cs b/main/src/addins/MonoDevelop.Refactoring/MonoDevelop.CodeIssues/CodeDiagnosticProvider.cs
index 3cb3dd1da5..479d24dffb 100644
--- a/main/src/addins/MonoDevelop.Refactoring/MonoDevelop.CodeIssues/CodeDiagnosticProvider.cs
+++ b/main/src/addins/MonoDevelop.Refactoring/MonoDevelop.CodeIssues/CodeDiagnosticProvider.cs
@@ -34,7 +34,7 @@ using MonoDevelop.CodeActions;
namespace MonoDevelop.CodeIssues
{
/// <summary>
- /// The code diagnostic provider gives a list of code diagnostic & fix providers from an arbitrary source.
+ /// The code diagnostic provider gives a list of code diagnostic and fix providers from an arbitrary source.
/// </summary>
abstract class CodeDiagnosticProvider
{
diff --git a/main/src/addins/MonoDevelop.Refactoring/MonoDevelop.CodeIssues/CodeIssuePanelWidget.cs b/main/src/addins/MonoDevelop.Refactoring/MonoDevelop.CodeIssues/CodeIssuePanelWidget.cs
index a6c1d0ffc4..2a42b3f721 100644
--- a/main/src/addins/MonoDevelop.Refactoring/MonoDevelop.CodeIssues/CodeIssuePanelWidget.cs
+++ b/main/src/addins/MonoDevelop.Refactoring/MonoDevelop.CodeIssues/CodeIssuePanelWidget.cs
@@ -59,7 +59,7 @@ namespace MonoDevelop.CodeIssues
widget = new CodeIssuePanelWidget ("text/x-csharp");
}
- public override Widget CreatePanelWidget ()
+ public override Control CreatePanelWidget ()
{
EnsureWidget ();
return widget;
diff --git a/main/src/addins/MonoDevelop.Refactoring/MonoDevelop.Refactoring/RefactoringOptions.cs b/main/src/addins/MonoDevelop.Refactoring/MonoDevelop.Refactoring/RefactoringOptions.cs
index b1532d9e50..2684ff57f9 100644
--- a/main/src/addins/MonoDevelop.Refactoring/MonoDevelop.Refactoring/RefactoringOptions.cs
+++ b/main/src/addins/MonoDevelop.Refactoring/MonoDevelop.Refactoring/RefactoringOptions.cs
@@ -135,13 +135,13 @@ namespace MonoDevelop.Refactoring
public static async Task<ImmutableArray<string>> GetUsedNamespacesAsync (TextEditor editor, DocumentContext doc, int offset, CancellationToken cancellationToken = default (CancellationToken))
{
if (editor == null)
- throw new System.ArgumentNullException ("editor");
+ throw new System.ArgumentNullException (nameof (editor));
var parsedDocument = doc.ParsedDocument;
if (parsedDocument == null)
return ImmutableArray<string>.Empty;
var result = ImmutableArray<string>.Empty.ToBuilder ();
var sm = parsedDocument.GetAst<SemanticModel> ();
- var node = sm.SyntaxTree.GetRoot ().FindNode (TextSpan.FromBounds (offset, offset));
+ var node = (await sm.SyntaxTree.GetRootAsync (cancellationToken).ConfigureAwait (false)).FindNode (TextSpan.FromBounds (offset, offset));
while (node != null) {
var cu = node as CompilationUnitSyntax;
diff --git a/main/src/addins/MonoDevelop.Refactoring/MonoDevelop.Refactoring/RefactoringService.cs b/main/src/addins/MonoDevelop.Refactoring/MonoDevelop.Refactoring/RefactoringService.cs
index 394dbff395..e0ef78a287 100644
--- a/main/src/addins/MonoDevelop.Refactoring/MonoDevelop.Refactoring/RefactoringService.cs
+++ b/main/src/addins/MonoDevelop.Refactoring/MonoDevelop.Refactoring/RefactoringService.cs
@@ -203,13 +203,13 @@ namespace MonoDevelop.Refactoring
//static readonly CodeAnalysisBatchRunner runner = new CodeAnalysisBatchRunner();
- /// <summary>
- /// Queues a code analysis job.
- /// </summary>
- /// <param name="job">The job to queue.</param>
- /// <param name="progressMessage">
- /// The message used for a progress monitor, or null if no progress monitor should be used.
- /// </param>
+// /// <summary>
+// /// Queues a code analysis job.
+// /// </summary>
+// /// <param name="job">The job to queue.</param>
+// /// <param name="progressMessage">
+// /// The message used for a progress monitor, or null if no progress monitor should be used.
+// /// </param>
// public static IJobContext QueueCodeIssueAnalysis(IAnalysisJob job, string progressMessage = null)
// {
// if (progressMessage != null)
diff --git a/main/src/addins/MonoDevelop.Refactoring/MonoDevelop.Refactoring/RefactoringSymbolInfo.cs b/main/src/addins/MonoDevelop.Refactoring/MonoDevelop.Refactoring/RefactoringSymbolInfo.cs
index 45e3cbca62..a901409aba 100644
--- a/main/src/addins/MonoDevelop.Refactoring/MonoDevelop.Refactoring/RefactoringSymbolInfo.cs
+++ b/main/src/addins/MonoDevelop.Refactoring/MonoDevelop.Refactoring/RefactoringSymbolInfo.cs
@@ -69,6 +69,7 @@ namespace MonoDevelop.Refactoring
}
public SyntaxNode Node { get; private set; }
+ public SemanticModel Model { get; private set; }
public RefactoringSymbolInfo (SymbolInfo symbolInfo)
{
@@ -81,7 +82,7 @@ namespace MonoDevelop.Refactoring
throw new ArgumentNullException (nameof (document));
if (document.ParsedDocument == null)
return RefactoringSymbolInfo.Empty;
- var unit = document.ParsedDocument.GetAst<SemanticModel> ();
+ var unit = await document.AnalysisDocument.GetSemanticModelAsync (cancellationToken).ConfigureAwait (false);
if (unit != null) {
var root = await unit.SyntaxTree.GetRootAsync (cancellationToken).ConfigureAwait (false);
try {
@@ -91,7 +92,8 @@ namespace MonoDevelop.Refactoring
var symbol = unit.GetSymbolInfo (token.Parent);
return new RefactoringSymbolInfo (symbol) {
DeclaredSymbol = token.IsKind (SyntaxKind.IdentifierToken) ? unit.GetDeclaredSymbol (token.Parent) : null,
- Node = token.Parent
+ Node = token.Parent,
+ Model = unit
};
} catch (Exception) {
return RefactoringSymbolInfo.Empty;
diff --git a/main/src/addins/MonoDevelop.RegexToolkit/MonoDevelop.RegexToolkit.csproj b/main/src/addins/MonoDevelop.RegexToolkit/MonoDevelop.RegexToolkit.csproj
index 785be8556a..0e9417f934 100644
--- a/main/src/addins/MonoDevelop.RegexToolkit/MonoDevelop.RegexToolkit.csproj
+++ b/main/src/addins/MonoDevelop.RegexToolkit/MonoDevelop.RegexToolkit.csproj
@@ -62,6 +62,26 @@
<Reference Include="pango-sharp, Version=2.12.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f">
<SpecificVersion>False</SpecificVersion>
</Reference>
+ <Reference Include="Microsoft.CodeAnalysis.CSharp">
+ <HintPath>..\..\..\external\roslyn\Binaries\Release\Microsoft.CodeAnalysis.CSharp.dll</HintPath>
+ <Private>False</Private>
+ </Reference>
+ <Reference Include="Microsoft.CodeAnalysis.CSharp.Workspaces">
+ <HintPath>..\..\..\external\roslyn\Binaries\Release\Microsoft.CodeAnalysis.CSharp.Workspaces.dll</HintPath>
+ <Private>False</Private>
+ </Reference>
+ <Reference Include="Microsoft.CodeAnalysis">
+ <HintPath>..\..\..\build\bin\Microsoft.CodeAnalysis.dll</HintPath>
+ <Private>False</Private>
+ </Reference>
+ <Reference Include="Microsoft.CodeAnalysis.Workspaces">
+ <HintPath>..\..\..\external\roslyn\Binaries\Release\Microsoft.CodeAnalysis.Workspaces.dll</HintPath>
+ <Private>False</Private>
+ </Reference>
+ <Reference Include="System.Composition.AttributedModel">
+ <HintPath>..\..\..\external\roslyn\Binaries\Release\System.Composition.AttributedModel.dll</HintPath>
+ <Private>False</Private>
+ </Reference>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\core\MonoDevelop.Core\MonoDevelop.Core.csproj">
@@ -94,6 +114,7 @@
<Compile Include="MonoDevelop.RegexToolkit\ElementHelpWidget.cs" />
<Compile Include="gtk-gui\MonoDevelop.RegexToolkit.ElementHelpWidget.cs" />
<Compile Include="AddinInfo.cs" />
+ <Compile Include="MonoDevelop.RegexToolkit\ValidateActionCodeRefactoringProvider.cs" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="gtk-gui\gui.stetic">
diff --git a/main/src/addins/MonoDevelop.RegexToolkit/MonoDevelop.RegexToolkit/Commands.cs b/main/src/addins/MonoDevelop.RegexToolkit/MonoDevelop.RegexToolkit/Commands.cs
index 482dbcaded..5ea1ced5fb 100644
--- a/main/src/addins/MonoDevelop.RegexToolkit/MonoDevelop.RegexToolkit/Commands.cs
+++ b/main/src/addins/MonoDevelop.RegexToolkit/MonoDevelop.RegexToolkit/Commands.cs
@@ -27,11 +27,13 @@
//
using System;
+using MonoDevelop.Components;
using MonoDevelop.Components.Commands;
using MonoDevelop.Ide;
using Gtk;
using MonoDevelop.Ide.Gui;
using MonoDevelop.Core;
+using System.Threading.Tasks;
namespace MonoDevelop.RegexToolkit
{
@@ -40,11 +42,11 @@ namespace MonoDevelop.RegexToolkit
ShowRegexToolkit
}
- class ViewOnlyContent : AbstractViewContent
+ class ViewOnlyContent : ViewContent
{
Widget widget;
-
- public override Widget Control {
+
+ public override Control Control {
get {
return widget;
}
@@ -54,21 +56,20 @@ namespace MonoDevelop.RegexToolkit
{
this.widget = widget;
this.ContentName = contentName;
- IsViewOnly = true;
}
-
- public override void Load (FileOpenInformation fileOpenInformation)
- {
- throw new System.NotImplementedException ();
+
+ public override bool IsViewOnly {
+ get {
+ return true;
+ }
}
-
}
- class DefaultAttachableViewContent : AbstractAttachableViewContent
+ class DefaultAttachableViewContent : BaseViewContent
{
Widget widget;
-
- public override Widget Control {
+
+ public override Control Control {
get {
return widget;
}
@@ -91,18 +92,24 @@ namespace MonoDevelop.RegexToolkit
{
protected override void Run ()
{
+ RunRegexWindow ();
+ }
+
+ public static RegexToolkitWidget RunRegexWindow ()
+ {
foreach (var document in IdeApp.Workbench.Documents) {
if (document.Window.ViewContent.Control is RegexToolkitWidget) {
document.Window.SelectWindow ();
- return;
+ return (RegexToolkitWidget)document.Window.ViewContent.Control;
}
}
var regexToolkit = new RegexToolkitWidget ();
var newDocument = IdeApp.Workbench.OpenDocument (new ViewOnlyContent (regexToolkit, GettextCatalog.GetString ("Regex Toolkit")), true);
-
+
var elementHelp = new ElementHelpWidget (newDocument.Window, regexToolkit);
-
+
newDocument.Window.AttachViewContent (new DefaultAttachableViewContent (elementHelp, GettextCatalog.GetString ("Elements")));
+ return regexToolkit;
}
}
diff --git a/main/src/addins/MonoDevelop.RegexToolkit/MonoDevelop.RegexToolkit/RegexToolkitWidget.cs b/main/src/addins/MonoDevelop.RegexToolkit/MonoDevelop.RegexToolkit/RegexToolkitWidget.cs
index d10f8dc6ac..2cf57d534b 100644
--- a/main/src/addins/MonoDevelop.RegexToolkit/MonoDevelop.RegexToolkit/RegexToolkitWidget.cs
+++ b/main/src/addins/MonoDevelop.RegexToolkit/MonoDevelop.RegexToolkit/RegexToolkitWidget.cs
@@ -42,7 +42,14 @@ namespace MonoDevelop.RegexToolkit
TreeStore resultStore;
Thread regexThread;
-
+ public string Regex {
+ get {
+ return entryRegEx.Text;
+ }
+ set {
+ entryRegEx.Text = value;
+ }
+ }
public RegexToolkitWidget ()
{
this.Build ();
diff --git a/main/src/addins/MonoDevelop.RegexToolkit/MonoDevelop.RegexToolkit/ValidateActionCodeRefactoringProvider.cs b/main/src/addins/MonoDevelop.RegexToolkit/MonoDevelop.RegexToolkit/ValidateActionCodeRefactoringProvider.cs
new file mode 100644
index 0000000000..8b7bd5a146
--- /dev/null
+++ b/main/src/addins/MonoDevelop.RegexToolkit/MonoDevelop.RegexToolkit/ValidateActionCodeRefactoringProvider.cs
@@ -0,0 +1,117 @@
+//
+// ValidateActionCodeRefactoringProvider.cs
+//
+// Author:
+// Mike Krüger <mkrueger@xamarin.com>
+//
+// Copyright (c) 2015 Xamarin Inc. (http://xamarin.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+
+using System;
+using System.Threading;
+using System.Collections.Generic;
+using Microsoft.CodeAnalysis.CodeRefactorings;
+using Microsoft.CodeAnalysis;
+using System.Threading.Tasks;
+using Microsoft.CodeAnalysis.CodeActions;
+using Microsoft.CodeAnalysis.Text;
+using Microsoft.CodeAnalysis.CSharp.Syntax;
+using Microsoft.CodeAnalysis.CSharp;
+using Microsoft.CodeAnalysis.Formatting;
+using MonoDevelop.Core;
+using MonoDevelop.RegexToolkit;
+
+namespace RefactoringEssentials.CSharp.CodeRefactorings
+{
+ [ExportCodeRefactoringProvider(LanguageNames.CSharp, Name = "Validate regular expression")]
+ public class ValidateActionCodeRefactoringProvider : CodeRefactoringProvider
+ {
+ public sealed override async Task ComputeRefactoringsAsync(CodeRefactoringContext context)
+ {
+ var document = context.Document;
+ if (document.Project.Solution.Workspace.Kind == WorkspaceKind.MiscellaneousFiles)
+ return;
+ var span = context.Span;
+ if (!span.IsEmpty)
+ return;
+ var cancellationToken = context.CancellationToken;
+ if (cancellationToken.IsCancellationRequested)
+ return;
+
+ var model = await document.GetSemanticModelAsync(cancellationToken).ConfigureAwait(false);
+ //if (model.IsFromGeneratedCode(cancellationToken))
+ // return;
+ var root = await model.SyntaxTree.GetRootAsync(cancellationToken).ConfigureAwait(false);
+ if (!root.Span.Contains (span))
+ return;
+ var node = root.FindNode(span, false, true);
+ if (!node.IsKind(SyntaxKind.StringLiteralExpression))
+ return;
+ var argument = node.Parent as ArgumentSyntax;
+ if (argument == null)
+ return;
+ var list = argument.Parent as ArgumentListSyntax;
+
+ var invocation = argument.Parent?.Parent as InvocationExpressionSyntax;
+ if (invocation != null) {
+ var info = model.GetSymbolInfo (invocation);
+ if (!IsRegexMatchMethod (info) || list.Arguments [1] != argument)
+ return;
+ }
+
+ var oce = argument.Parent?.Parent as ObjectCreationExpressionSyntax;
+ if (oce != null) {
+ var info = model.GetSymbolInfo (oce);
+ if (info.Symbol == null || !IsRegexType (info.Symbol.ContainingType) || list.Arguments [0] != argument)
+ return;
+ }
+
+ var regex = model.GetConstantValue (node);
+ if (!regex.HasValue)
+ return;
+
+ context.RegisterRefactoring (CodeAction.Create(
+ GettextCatalog.GetString("Validate regular expression"),
+ t2 => {
+ ShowRegexToolkitHandler.RunRegexWindow ().Regex = regex.Value.ToString ();
+ return Task.FromResult(document);
+ }
+ ));
+ }
+
+ internal static bool IsRegexMatchMethod (SymbolInfo symbolInfo)
+ {
+ var symbol = symbolInfo.Symbol;
+ if (symbol == null)
+ return false;
+ return IsRegexType (symbol.ContainingType) && symbol.IsStatic && (symbol.Name == "IsMatch" || symbol.Name == "Match" || symbol.Name == "Matches");
+ }
+
+ internal static bool IsRegexConstructor (SymbolInfo symbolInfo)
+ {
+ return symbolInfo.Symbol?.ContainingType is INamedTypeSymbol && IsRegexType (symbolInfo.Symbol.ContainingType);
+ }
+
+ internal static bool IsRegexType (INamedTypeSymbol containingType)
+ {
+ return containingType != null && containingType.Name == "Regex" && containingType.ContainingNamespace.ToDisplayString () == "System.Text.RegularExpressions";
+ }
+ }
+}
diff --git a/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor.OptionPanels/BehaviorPanel.cs b/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor.OptionPanels/BehaviorPanel.cs
index 5fc5a1c2fb..5d9067d374 100644
--- a/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor.OptionPanels/BehaviorPanel.cs
+++ b/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor.OptionPanels/BehaviorPanel.cs
@@ -24,6 +24,7 @@
// THE SOFTWARE.
using System;
+using MonoDevelop.Components;
using MonoDevelop.Core;
using MonoDevelop.Ide.Gui.Dialogs;
using Mono.TextEditor;
@@ -47,7 +48,7 @@ namespace MonoDevelop.SourceEditor.OptionPanels
autoInsertBraceCheckbutton.Toggled += HandleAutoInsertBraceCheckbuttonToggled;
}
- public virtual Gtk.Widget CreatePanelWidget ()
+ public virtual Control CreatePanelWidget ()
{
// this.autoInsertTemplateCheckbutton.Active = DefaultSourceEditorOptions.Options.AutoInsertTemplates;
autoInsertBraceCheckbutton.Active = DefaultSourceEditorOptions.Instance.AutoInsertMatchingBracket;
diff --git a/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor.OptionPanels/CompletionAppearancePanel.cs b/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor.OptionPanels/CompletionAppearancePanel.cs
index 031437a5b8..46e5157abb 100644
--- a/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor.OptionPanels/CompletionAppearancePanel.cs
+++ b/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor.OptionPanels/CompletionAppearancePanel.cs
@@ -24,6 +24,7 @@
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
using System;
+using MonoDevelop.Components;
using MonoDevelop.Ide.Gui.Dialogs;
using MonoDevelop.Ide.Gui.Content;
using MonoDevelop.Ide.Editor.Extension;
@@ -52,7 +53,7 @@ namespace MonoDevelop.SourceEditor.OptionPanels
{
}
- Gtk.Widget IOptionsPanel.CreatePanelWidget ()
+ Control IOptionsPanel.CreatePanelWidget ()
{
filterByBrowsableCheckbutton.Active = IdeApp.Preferences.FilterCompletionListByEditorBrowsable;
normalOnlyRadiobutton.Active = !IdeApp.Preferences.IncludeEditorBrowsableAdvancedMembers;
diff --git a/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor.OptionPanels/CompletionCharactersPanel.cs b/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor.OptionPanels/CompletionCharactersPanel.cs
index 83f4b36617..7ee88faaa1 100644
--- a/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor.OptionPanels/CompletionCharactersPanel.cs
+++ b/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor.OptionPanels/CompletionCharactersPanel.cs
@@ -25,6 +25,7 @@
// THE SOFTWARE.
using System;
using Xwt;
+using MonoDevelop.Components;
using MonoDevelop.Core;
using MonoDevelop.Ide.Gui.Dialogs;
using MonoDevelop.Ide.CodeCompletion;
@@ -87,7 +88,7 @@ namespace MonoDevelop.SourceEditor.OptionPanels
}
}
- Gtk.Widget IOptionsPanel.CreatePanelWidget ()
+ Control IOptionsPanel.CreatePanelWidget ()
{
return (Gtk.Widget)Xwt.Toolkit.CurrentEngine.GetNativeWidget (this);
}
diff --git a/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor.OptionPanels/CompletionOptionsPanel.cs b/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor.OptionPanels/CompletionOptionsPanel.cs
index eff7432934..86d2a271bc 100644
--- a/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor.OptionPanels/CompletionOptionsPanel.cs
+++ b/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor.OptionPanels/CompletionOptionsPanel.cs
@@ -24,6 +24,7 @@
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
using System;
+using MonoDevelop.Components;
using MonoDevelop.Ide.Gui.Dialogs;
using MonoDevelop.Ide.Gui.Content;
using MonoDevelop.Ide.Editor.Extension;
@@ -56,7 +57,7 @@ namespace MonoDevelop.SourceEditor.OptionPanels
{
}
- Gtk.Widget IOptionsPanel.CreatePanelWidget ()
+ Control IOptionsPanel.CreatePanelWidget ()
{
autoCodeCompletionCheckbutton.Active = DefaultSourceEditorOptions.Instance.EnableAutoCodeCompletion;
showImportsCheckbutton.Active = IdeApp.Preferences.AddImportedItemsToCompletionList;
diff --git a/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor.OptionPanels/GeneralOptionsPanel.cs b/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor.OptionPanels/GeneralOptionsPanel.cs
index 9763ea2637..ef53e55e75 100644
--- a/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor.OptionPanels/GeneralOptionsPanel.cs
+++ b/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor.OptionPanels/GeneralOptionsPanel.cs
@@ -25,6 +25,7 @@
using System;
using MonoDevelop.Ide.Gui.Dialogs;
+using MonoDevelop.Components;
using MonoDevelop.Core;
using MonoDevelop.Ide.Gui.Content;
using MonoDevelop.Ide.Editor;
@@ -43,7 +44,7 @@ namespace MonoDevelop.SourceEditor.OptionPanels
this.comboboxLineEndings.Active = (int)DefaultSourceEditorOptions.Instance.LineEndingConversion;
}
- public virtual Gtk.Widget CreatePanelWidget ()
+ public virtual Control CreatePanelWidget ()
{
this.foldingCheckbutton.Active = DefaultSourceEditorOptions.Instance.ShowFoldMargin;
this.foldregionsCheckbutton.Active = DefaultSourceEditorOptions.Instance.DefaultRegionsFolding;
diff --git a/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor.OptionPanels/HighlightingPanel.cs b/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor.OptionPanels/HighlightingPanel.cs
index cb04048836..cf9c19719c 100644
--- a/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor.OptionPanels/HighlightingPanel.cs
+++ b/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor.OptionPanels/HighlightingPanel.cs
@@ -86,7 +86,7 @@ namespace MonoDevelop.SourceEditor.OptionPanels
return String.Format ("<b>{0}</b> - {1}", GLib.Markup.EscapeText (name), GLib.Markup.EscapeText (description));
}
- public virtual Gtk.Widget CreatePanelWidget ()
+ public virtual Control CreatePanelWidget ()
{
this.addButton.Clicked += AddColorScheme;
this.removeButton.Clicked += RemoveColorScheme;
diff --git a/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor.OptionPanels/MarkerPanel.cs b/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor.OptionPanels/MarkerPanel.cs
index ced732ecbc..38742589e5 100644
--- a/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor.OptionPanels/MarkerPanel.cs
+++ b/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor.OptionPanels/MarkerPanel.cs
@@ -25,6 +25,7 @@
using System;
using MonoDevelop.Ide.Gui.Dialogs;
+using MonoDevelop.Components;
using MonoDevelop.Core;
using MonoDevelop.Ide.Editor;
using MonoDevelop.Ide;
@@ -62,7 +63,7 @@ namespace MonoDevelop.SourceEditor.OptionPanels
this.Build();
}
- public virtual Gtk.Widget CreatePanelWidget ()
+ public virtual Control CreatePanelWidget ()
{
this.showLineNumbersCheckbutton.Active = showLineNumbers = DefaultSourceEditorOptions.Instance.ShowLineNumberMargin;
this.showLineNumbersCheckbutton.Toggled += delegate {
diff --git a/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor.QuickTasks/QuickTaskOverviewMode.cs b/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor.QuickTasks/QuickTaskOverviewMode.cs
index a77033c7dd..e51d47cc04 100644
--- a/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor.QuickTasks/QuickTaskOverviewMode.cs
+++ b/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor.QuickTasks/QuickTaskOverviewMode.cs
@@ -79,7 +79,7 @@ namespace MonoDevelop.SourceEditor.QuickTasks
static readonly Cairo.Color win81Background = new Cairo.Color (240 / 255d, 240 / 255d, 240 / 255d);
static readonly Cairo.Color win81Slider = new Cairo.Color (205 / 255d, 205 / 255d, 205 / 255d);
static readonly Cairo.Color win81SliderPrelight = new Cairo.Color (166 / 255d, 166 / 255d, 166 / 255d);
- static readonly Cairo.Color win81SliderActive = new Cairo.Color (96 / 255d, 96 / 255d, 96 / 255d);
+ //static readonly Cairo.Color win81SliderActive = new Cairo.Color (96 / 255d, 96 / 255d, 96 / 255d);
readonly int barPadding = MonoDevelop.Core.Platform.IsWindows ? 1 : 3;
diff --git a/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor.Wrappers/IndentationTrackerWrapper.cs b/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor.Wrappers/IndentationTrackerWrapper.cs
index 22abf06f3a..a88ecf421c 100644
--- a/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor.Wrappers/IndentationTrackerWrapper.cs
+++ b/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor.Wrappers/IndentationTrackerWrapper.cs
@@ -33,9 +33,6 @@ namespace MonoDevelop.SourceEditor.Wrappers
readonly IReadonlyTextDocument document;
readonly MonoDevelop.Ide.Editor.Extension.IndentationTracker indentationTracker;
- readonly Mono.TextEditor.TextEditorData textEditorData;
-
-
public IndentationTrackerWrapper (Mono.TextEditor.TextEditorData textEditorData, IReadonlyTextDocument document, MonoDevelop.Ide.Editor.Extension.IndentationTracker indentationTracker)
{
if (textEditorData == null)
@@ -44,7 +41,6 @@ namespace MonoDevelop.SourceEditor.Wrappers
throw new System.ArgumentNullException ("document");
if (indentationTracker == null)
throw new System.ArgumentNullException ("indentationTracker");
- this.textEditorData = textEditorData;
this.document = document;
this.indentationTracker = indentationTracker;
}
diff --git a/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor.Wrappers/SemanticHighlightingSyntaxMode.cs b/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor.Wrappers/SemanticHighlightingSyntaxMode.cs
index 745fda76b1..911e648cc7 100644
--- a/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor.Wrappers/SemanticHighlightingSyntaxMode.cs
+++ b/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor.Wrappers/SemanticHighlightingSyntaxMode.cs
@@ -165,10 +165,8 @@ namespace MonoDevelop.SourceEditor.Wrappers
const int MaximumCachedLineSegments = 200;
SemanticHighlightingSyntaxMode semanticMode;
- int lineNumber;
public CSharpChunkParser (SemanticHighlightingSyntaxMode semanticMode, SpanParser spanParser, Mono.TextEditor.Highlighting.ColorScheme style, DocumentLine line) : base (semanticMode, spanParser, style, line)
{
- lineNumber = line.LineNumber;
this.semanticMode = semanticMode;
}
diff --git a/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor.Wrappers/TooltipProviderWrapper.cs b/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor.Wrappers/TooltipProviderWrapper.cs
index 2678d02fe1..148b925256 100644
--- a/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor.Wrappers/TooltipProviderWrapper.cs
+++ b/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor.Wrappers/TooltipProviderWrapper.cs
@@ -28,6 +28,7 @@ using System.Threading;
using System.Threading.Tasks;
using Mono.TextEditor;
using MonoDevelop.Ide;
+using Xwt.GtkBackend;
using MonoDevelop.Core;
namespace MonoDevelop.SourceEditor.Wrappers
@@ -102,7 +103,7 @@ namespace MonoDevelop.SourceEditor.Wrappers
var wrappedEditor = WrapEditor (editor);
if (wrappedEditor == null)
return null;
- var control = provider.CreateTooltipWindow (wrappedEditor, IdeApp.Workbench.ActiveDocument, new MonoDevelop.Ide.Editor.TooltipItem (item.Item, item.ItemSegment.Offset, item.ItemSegment.Length), offset, modifierState);
+ var control = provider.CreateTooltipWindow (wrappedEditor, IdeApp.Workbench.ActiveDocument, new MonoDevelop.Ide.Editor.TooltipItem (item.Item, item.ItemSegment.Offset, item.ItemSegment.Length), offset, modifierState.ToXwtValue ());
if (control == null)
return null;
return (Gtk.Window)control;
@@ -125,7 +126,7 @@ namespace MonoDevelop.SourceEditor.Wrappers
if (wrappedEditor == null) {
return tipWindow;
}
- provider.ShowTooltipWindow (wrappedEditor, tipWindow, new MonoDevelop.Ide.Editor.TooltipItem (item.Item, item.ItemSegment.Offset, item.ItemSegment.Length), modifierState, mouseX, mouseY);
+ provider.ShowTooltipWindow (wrappedEditor, tipWindow, new MonoDevelop.Ide.Editor.TooltipItem (item.Item, item.ItemSegment.Offset, item.ItemSegment.Length), modifierState.ToXwtValue (), mouseX, mouseY);
return tipWindow;
}
diff --git a/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor.csproj b/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor.csproj
index ef7c929bfe..eea6d68a71 100644
--- a/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor.csproj
+++ b/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor.csproj
@@ -98,6 +98,11 @@
<Name>Mono.TextEditor</Name>
<Private>False</Private>
</ProjectReference>
+ <ProjectReference Include="..\..\..\external\xwt\Xwt.Gtk\Xwt.Gtk.csproj">
+ <Project>{C3887A93-B2BD-4097-8E2F-3A063EFF32FD}</Project>
+ <Name>Xwt.Gtk</Name>
+ <Private>False</Private>
+ </ProjectReference>
</ItemGroup>
<ItemGroup>
<Reference Include="System" />
diff --git a/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor/CompileErrorTooltipProvider.cs b/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor/CompileErrorTooltipProvider.cs
index 2a255a9644..92e1ca6b1c 100644
--- a/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor/CompileErrorTooltipProvider.cs
+++ b/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor/CompileErrorTooltipProvider.cs
@@ -57,7 +57,7 @@ namespace MonoDevelop.SourceEditor
return Task.FromResult (new TooltipItem (errorInformation, editor.GetLineByOffset (offset)));
}
- public override Control CreateTooltipWindow (TextEditor editor, DocumentContext ctx, TooltipItem item, int offset, Gdk.ModifierType modifierState)
+ public override Control CreateTooltipWindow (TextEditor editor, DocumentContext ctx, TooltipItem item, int offset, Xwt.ModifierKeys modifierState)
{
var result = new LanguageItemWindow (GetExtensibleTextEditor (editor), modifierState, null, (string)item.Item, null);
if (result.IsEmpty)
diff --git a/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor/DebugValueTooltipProvider.cs b/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor/DebugValueTooltipProvider.cs
index 9884a63b70..efd7a03a36 100644
--- a/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor/DebugValueTooltipProvider.cs
+++ b/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor/DebugValueTooltipProvider.cs
@@ -131,12 +131,12 @@ namespace MonoDevelop.SourceEditor
return new TooltipItem (val, startOffset, expression.Length);
}
- public override Control CreateTooltipWindow (TextEditor editor, DocumentContext ctx, TooltipItem item, int offset, Gdk.ModifierType modifierState)
+ public override Control CreateTooltipWindow (TextEditor editor, DocumentContext ctx, TooltipItem item, int offset, Xwt.ModifierKeys modifierState)
{
return new DebugValueWindow (editor, offset, DebuggingService.CurrentFrame, (ObjectValue) item.Item, null);
}
- public override void ShowTooltipWindow (TextEditor editor, Control tipWindow, TooltipItem item, Gdk.ModifierType modifierState, int mouseX, int mouseY)
+ public override void ShowTooltipWindow (TextEditor editor, Control tipWindow, TooltipItem item, Xwt.ModifierKeys modifierState, int mouseX, int mouseY)
{
var location = editor.OffsetToLocation (item.Offset);
var point = editor.LocationToPoint (location);
diff --git a/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor/DebugValueWindow.cs b/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor/DebugValueWindow.cs
index 2670b4a4e6..a66b394315 100644
--- a/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor/DebugValueWindow.cs
+++ b/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor/DebugValueWindow.cs
@@ -167,11 +167,12 @@ namespace MonoDevelop.SourceEditor
this.GetPosition (out x, out y);
oldY = y;
- Gdk.Rectangle geometry = DesktopService.GetUsableMonitorGeometry (Screen, Screen.GetMonitorAtPoint (x, y));
+ Xwt.Rectangle geometry = DesktopService.GetUsableMonitorGeometry (Screen.Number, Screen.GetMonitorAtPoint (x, y));
+ int top = (int)geometry.Top;
if (allocation.Height <= geometry.Height && y + allocation.Height >= geometry.Y + geometry.Height - edgeGap)
- y = geometry.Top + (geometry.Height - allocation.Height - edgeGap);
- if (y < geometry.Top + edgeGap)
- y = geometry.Top + edgeGap;
+ y = top + ((int)geometry.Height - allocation.Height - edgeGap);
+ if (y < top + edgeGap)
+ y = top + edgeGap;
if (y != oldY) {
Move (x, y);
diff --git a/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor/ExtensibleTextEditor.cs b/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor/ExtensibleTextEditor.cs
index dc3df7cb69..3f68195f7c 100644
--- a/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor/ExtensibleTextEditor.cs
+++ b/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor/ExtensibleTextEditor.cs
@@ -57,7 +57,6 @@ namespace MonoDevelop.SourceEditor
internal object MemoryProbe = Counters.EditorsInMemory.CreateMemoryProbe ();
SourceEditorView view;
- ExtensionContext extensionContext;
Adjustment cachedHAdjustment, cachedVAdjustment;
TextEditorExtension editorExtension;
@@ -217,7 +216,6 @@ namespace MonoDevelop.SourceEditor
{
IsDestroyed = true;
UnregisterAdjustments ();
- extensionContext = null;
view = null;
var disposableSyntaxMode = Document.SyntaxMode as IDisposable;
if (disposableSyntaxMode != null) {
@@ -515,11 +513,8 @@ namespace MonoDevelop.SourceEditor
}
}
- int oldOffset = -1;
-
public Microsoft.CodeAnalysis.ISymbol GetLanguageItem (int offset, out MonoDevelop.Ide.Editor.DocumentRegion region)
{
- oldOffset = offset;
region = MonoDevelop.Ide.Editor.DocumentRegion.Empty;
if (textEditorResolverProvider != null) {
@@ -547,8 +542,6 @@ namespace MonoDevelop.SourceEditor
public Microsoft.CodeAnalysis.ISymbol GetLanguageItem (int offset, string expression)
{
- oldOffset = offset;
-
if (textEditorResolverProvider != null) {
return textEditorResolverProvider.GetLanguageItem (view.WorkbenchWindow.Document, offset, expression);
}
diff --git a/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor/LanguageItemWindow.cs b/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor/LanguageItemWindow.cs
index 670a320d72..252786d652 100644
--- a/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor/LanguageItemWindow.cs
+++ b/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor/LanguageItemWindow.cs
@@ -43,7 +43,7 @@ namespace MonoDevelop.SourceEditor
{
public bool IsEmpty { get; set; }
- public LanguageItemWindow (ExtensibleTextEditor ed, Gdk.ModifierType modifierState, object result, string errorInformations, object unit)
+ public LanguageItemWindow (ExtensibleTextEditor ed, Xwt.ModifierKeys modifierState, object result, string errorInformations, object unit)
{
string tooltip = null;
if (result is UnknownIdentifierResolveResult) {
diff --git a/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor/MessageBubbleTextMarker.cs b/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor/MessageBubbleTextMarker.cs
index 0410d1df61..5c8909100b 100644
--- a/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor/MessageBubbleTextMarker.cs
+++ b/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor/MessageBubbleTextMarker.cs
@@ -144,7 +144,7 @@ namespace MonoDevelop.SourceEditor
public override TextLineMarkerFlags Flags {
get {
- if (LineSegment != null && LineSegment.Markers.Any (m => m is DebugTextMarker))
+ if (LineSegment != null && editor.Document.GetTextSegmentMarkersAt (LineSegment).Any (m => m is DebugTextMarker))
return TextLineMarkerFlags.None;
return TextLineMarkerFlags.DrawsSelection;
@@ -355,6 +355,11 @@ namespace MonoDevelop.SourceEditor
return false;
}
+ bool IActionTextLineMarker.MouseReleased (MonoTextEditor editor, MarginMouseEventArgs args)
+ {
+ return false;
+ }
+
public void MouseHover (MonoTextEditor editor, MarginMouseEventArgs args, TextLineMarkerHoverResult result)
{
if (!IsVisible)
@@ -572,7 +577,7 @@ namespace MonoDevelop.SourceEditor
if (!IsVisible)
return false;
bool markerShouldDrawnAsHidden = cache.CurrentSelectedTextMarker != null && cache.CurrentSelectedTextMarker != this;
- if (metrics.LineSegment.Markers.Any (m => m is DebugTextMarker))
+ if (editor.Document.GetTextSegmentMarkersAt (metrics.LineSegment).Any (m => m is DebugTextMarker))
return false;
EnsureLayoutCreated (editor);
@@ -660,7 +665,8 @@ namespace MonoDevelop.SourceEditor
while (column < line.Length && char.IsWhiteSpace (editor.GetCharAt (line.Offset + (int)column))) {
column++;
}
-
+ if (column >= line.Length)
+ continue;
int index = (int)metrics.Layout.TranslateToUTF8Index (column, ref curIndex, ref byteIndex);
var pos = metrics.Layout.Layout.IndexToPos (index);
var co = o + task.Column - 1;
diff --git a/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor/PinnedWatchWidget.cs b/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor/PinnedWatchWidget.cs
index 4e74c91ea6..1c2d9779d2 100644
--- a/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor/PinnedWatchWidget.cs
+++ b/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor/PinnedWatchWidget.cs
@@ -158,7 +158,7 @@ namespace MonoDevelop.SourceEditor
TreeViewColumn col;
int cx, cy;
valueTree.GetPathAtPos ((int)args.Event.X, (int)args.Event.Y, out path, out col, out cx, out cy);
- Gdk.Rectangle rect = valueTree.GetCellArea (path, col);
+ //Gdk.Rectangle rect = valueTree.GetCellArea (path, col);
if (!mousePressed && valueTree.Columns[0] == col) {
mousePressed = true;
Editor.TextArea.MoveToTop (this);
diff --git a/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor/SourceEditorView.cs b/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor/SourceEditorView.cs
index 294777e6f7..78854edd91 100644
--- a/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor/SourceEditorView.cs
+++ b/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor/SourceEditorView.cs
@@ -66,16 +66,15 @@ using System.Threading;
namespace MonoDevelop.SourceEditor
{
- partial class SourceEditorView : AbstractViewContent, IBookmarkBuffer, IClipboardHandler, ITextFile,
+ partial class SourceEditorView : ViewContent, IBookmarkBuffer, IClipboardHandler, ITextFile,
ICompletionWidget, ISplittable, IFoldable, IToolboxDynamicProvider,
ICustomFilteringToolboxConsumer, IZoomable, ITextEditorResolver, ITextEditorDataProvider,
- ICodeTemplateHandler, ICodeTemplateContextProvider, ISupportsProjectReload, IPrintable,
+ ICodeTemplateHandler, ICodeTemplateContextProvider, IPrintable,
ITextEditorImpl, IEditorActionHost, ITextMarkerFactory, IUndoHandler
{
readonly SourceEditorWidget widget;
bool isDisposed = false;
DateTime lastSaveTimeUtc;
- string loadedMimeType;
internal object MemoryProbe = Counters.SourceViewsInMemory.CreateMemoryProbe ();
DebugMarkerPair currentDebugLineMarker;
DebugMarkerPair debugStackLineMarker;
@@ -84,6 +83,12 @@ namespace MonoDevelop.SourceEditor
List<PinnedWatchInfo> pinnedWatches = new List<PinnedWatchInfo> ();
bool writeAllowed;
bool writeAccessChecked;
+
+ public ViewContent ViewContent {
+ get {
+ return this;
+ }
+ }
public TextDocument Document {
get {
@@ -115,7 +120,7 @@ namespace MonoDevelop.SourceEditor
}
}
- public override Widget Control {
+ public override Control Control {
get {
return widget != null ? widget.Vbox : null;
}
@@ -132,7 +137,6 @@ namespace MonoDevelop.SourceEditor
}
- bool wasEdited = false;
uint removeMarkerTimeout;
Queue<MessageBubbleTextMarker> markersToRemove = new Queue<MessageBubbleTextMarker> ();
@@ -183,7 +187,7 @@ namespace MonoDevelop.SourceEditor
widget.TextEditor.Document.TextReplacing += OnTextReplacing;
widget.TextEditor.Document.TextReplaced += OnTextReplaced;
widget.TextEditor.Document.ReadOnlyCheckDelegate = CheckReadOnly;
-
+ widget.TextEditor.TextViewMargin.LineShown += TextViewMargin_LineShown;
// widget.TextEditor.Document.DocumentUpdated += delegate {
// this.IsDirty = Document.IsDirty;
// };
@@ -191,14 +195,6 @@ namespace MonoDevelop.SourceEditor
widget.TextEditor.Caret.PositionChanged += HandlePositionChanged;
widget.TextEditor.IconMargin.ButtonPressed += OnIconButtonPress;
- WorkbenchWindowChanged += HandleWorkbenchWindowChanged;
- ContentNameChanged += delegate {
- Document.FileName = ContentName;
- if (String.IsNullOrEmpty (ContentName) || !File.Exists (ContentName))
- return;
-
- lastSaveTimeUtc = File.GetLastWriteTimeUtc (ContentName);
- };
ClipbardRingUpdated += UpdateClipboardRing;
TextEditorService.FileExtensionAdded += HandleFileExtensionAdded;
@@ -234,6 +230,14 @@ namespace MonoDevelop.SourceEditor
FileRegistry.Add (this);
}
+ protected override void OnContentNameChanged ()
+ {
+ Document.FileName = ContentName;
+ if (!String.IsNullOrEmpty (ContentName) && File.Exists (ContentName))
+ lastSaveTimeUtc = File.GetLastWriteTimeUtc (ContentName);
+ base.OnContentNameChanged ();
+ }
+
void HandleLineChanged (object sender, Mono.TextEditor.LineEventArgs e)
{
UpdateBreakpoints ();
@@ -255,11 +259,6 @@ namespace MonoDevelop.SourceEditor
{
if (Document.CurrentAtomicUndoOperationType == OperationType.Format)
return;
- if (!inLoad) {
- if (widget.TextEditor.Document.IsInAtomicUndo) {
- wasEdited = true;
- }
- }
int startIndex = args.Offset;
foreach (var marker in currentErrorMarkers) {
@@ -278,7 +277,6 @@ namespace MonoDevelop.SourceEditor
void HandleBeginUndo (object sender, EventArgs e)
{
- wasEdited = false;
OnBeginUndo (EventArgs.Empty);
}
@@ -320,7 +318,7 @@ namespace MonoDevelop.SourceEditor
{
if (extension is TopLevelWidgetExtension) {
var widgetExtension = (TopLevelWidgetExtension)extension;
- var w = widgetExtension.CreateWidget ();
+ Widget w = widgetExtension.CreateWidget ();
int x, y;
if (!CalcWidgetPosition (widgetExtension, w, out x, out y)) {
w.Destroy ();
@@ -466,12 +464,11 @@ namespace MonoDevelop.SourceEditor
return true;
}
- void HandleWorkbenchWindowChanged (object sender, EventArgs e)
+ protected override void OnWorkbenchWindowChanged ()
{
- if (WorkbenchWindow != null) {
+ base.OnWorkbenchWindowChanged ();
+ if (WorkbenchWindow != null)
WorkbenchWindow.ActiveViewContentChanged += HandleActiveViewContentChanged;
- WorkbenchWindowChanged -= HandleWorkbenchWindowChanged;
- }
}
void HandleActiveViewContentChanged (object o, ActiveViewContentEventArgs e)
@@ -616,12 +613,12 @@ namespace MonoDevelop.SourceEditor
return text;
}
- public override void Save (FileSaveInformation fileSaveInformation)
+ public override Task Save (FileSaveInformation fileSaveInformation)
{
- Save (fileSaveInformation.FileName, fileSaveInformation.Encoding ?? encoding);
+ return Save (fileSaveInformation.FileName, fileSaveInformation.Encoding ?? encoding);
}
- public void Save (string fileName, Encoding encoding)
+ public async Task Save (string fileName, Encoding encoding)
{
if (widget.HasMessageBar)
return;
@@ -657,7 +654,6 @@ namespace MonoDevelop.SourceEditor
if (formatter.SupportsOnTheFlyFormatting) {
using (var undo = TextEditor.OpenUndoGroup ()) {
formatter.OnTheFlyFormat (WorkbenchWindow.Document.Editor, WorkbenchWindow.Document);
- wasEdited = false;
}
} else {
var text = document.Editor.Text;
@@ -717,7 +713,7 @@ namespace MonoDevelop.SourceEditor
// writeBom =!Mono.TextEditor.Utils.TextFileUtility.IsASCII (writeText);
}
}
- MonoDevelop.Core.Text.TextFileUtility.WriteText (fileName, writeText, writeEncoding, writeBom);
+ await MonoDevelop.Core.Text.TextFileUtility.WriteTextAsync (fileName, writeText, writeEncoding, writeBom);
} catch (InvalidEncodingException) {
var result = MessageService.AskQuestion (GettextCatalog.GetString ("Can't save file with current codepage."),
GettextCatalog.GetString ("Some unicode characters in this file could not be saved with the current encoding.\nDo you want to resave this file as Unicode ?\nYou can choose another encoding in the 'save as' dialog."),
@@ -773,14 +769,14 @@ namespace MonoDevelop.SourceEditor
Document.InformLoadComplete ();
}
- public override void LoadNew (Stream content, string mimeType)
+ public override Task LoadNew (Stream content, string mimeType)
{
throw new NotSupportedException ("Moved to TextEditorViewContent.LoadNew.");
}
- public override void Load (FileOpenInformation fileOpenInformation)
+ public override Task Load (FileOpenInformation fileOpenInformation)
{
- Load (fileOpenInformation.FileName, fileOpenInformation.Encoding, fileOpenInformation.IsReloadOperation);
+ return Load (fileOpenInformation.FileName, fileOpenInformation.Encoding, fileOpenInformation.IsReloadOperation);
}
protected virtual string ProcessLoadText (string text)
@@ -796,7 +792,7 @@ namespace MonoDevelop.SourceEditor
}
}
- public void Load (string fileName, Encoding loadEncoding, bool reload = false)
+ public async Task Load (string fileName, Encoding loadEncoding, bool reload = false)
{
widget.TextEditor.Document.TextReplaced -= OnTextReplaced;
@@ -815,12 +811,16 @@ namespace MonoDevelop.SourceEditor
didLoadCleanly = false;
}
else {
- inLoad = true;
if (loadEncoding == null) {
- text = MonoDevelop.Core.Text.TextFileUtility.ReadAllText (fileName, out hadBom, out encoding);
+ var res = await MonoDevelop.Core.Text.TextFileUtility.ReadAllTextAsync (fileName);
+ text = res.Text;
+ hadBom = res.HasBom;
+ encoding = res.Encoding;
} else {
encoding = loadEncoding;
- text = MonoDevelop.Core.Text.TextFileUtility.ReadAllText (fileName, loadEncoding, out hadBom);
+ var res = await MonoDevelop.Core.Text.TextFileUtility.ReadAllTextAsync (fileName, loadEncoding);
+ text = res.Text;
+ hadBom = res.HasBom;
}
text = ProcessLoadText (text);
if (reload) {
@@ -830,7 +830,6 @@ namespace MonoDevelop.SourceEditor
Document.Text = text;
Document.DiffTracker.SetBaseDocument (Document.CreateDocumentSnapshot ());
}
- inLoad = false;
didLoadCleanly = true;
}
// TODO: Would be much easier if the view would be created after the containers.
@@ -891,7 +890,6 @@ namespace MonoDevelop.SourceEditor
}
bool warnOverwrite = false;
- bool inLoad = false;
Encoding encoding;
bool hadBom = false;
@@ -904,10 +902,8 @@ namespace MonoDevelop.SourceEditor
}
UpdateMimeType (fileName);
- inLoad = true;
Document.Replace (0, Document.TextLength, content);
Document.DiffTracker.Reset ();
- inLoad = false;
encoding = enc;
ContentName = fileName;
UpdateExecutionLocation ();
@@ -934,6 +930,9 @@ namespace MonoDevelop.SourceEditor
}
}
}
+ if (Document.MimeType != null) {
+ widget.TextEditor.TextEditorResolverProvider = TextEditorResolverService.GetProvider (Document.MimeType);
+ }
}
public Encoding SourceEncoding {
@@ -975,6 +974,7 @@ namespace MonoDevelop.SourceEditor
widget.TextEditor.Document.TextReplaced -= OnTextReplaced;
widget.TextEditor.Document.ReadOnlyCheckDelegate = null;
widget.TextEditor.Options.Changed -= HandleWidgetTextEditorOptionsChanged;
+ widget.TextEditor.TextViewMargin.LineShown -= TextViewMargin_LineShown;
TextEditorService.FileExtensionAdded -= HandleFileExtensionAdded;
TextEditorService.FileExtensionRemoved -= HandleFileExtensionRemoved;
@@ -2262,17 +2262,12 @@ namespace MonoDevelop.SourceEditor
#region ISupportsProjectReload implementaion
- ProjectReloadCapability ISupportsProjectReload.ProjectReloadCapability {
+ public override ProjectReloadCapability ProjectReloadCapability {
get {
return ProjectReloadCapability.Full;
}
}
-
- void ISupportsProjectReload.Update (Project project)
- {
- // The project will be assigned to the view. Nothing else to do.
- }
-
+
#endregion
#endregion
@@ -2316,14 +2311,13 @@ namespace MonoDevelop.SourceEditor
}
}
- public override object GetContent (Type type)
+ protected override object OnGetContent (Type type)
{
if (type.Equals (typeof(TextEditorData)))
return TextEditor.GetTextEditorData ();
- return base.GetContent (type);
+ return base.OnGetContent (type);
}
-
#region widget command handlers
[CommandHandler (SearchCommands.EmacsFindNext)]
public void EmacsFindNext ()
@@ -2572,7 +2566,7 @@ namespace MonoDevelop.SourceEditor
object ITextEditorImpl.CreateNativeControl ()
{
- return Control;
+ return widget != null ? widget.Vbox : null;
}
string ITextEditorImpl.FormatString (int offset, string code)
@@ -2723,7 +2717,7 @@ namespace MonoDevelop.SourceEditor
return TextEditor.Document.RemoveMarker (textSegmentMarker);
}
- IFoldSegment ITextEditorImpl.CreateFoldSegment (int offset, int length, bool isFolded = false)
+ IFoldSegment ITextEditorImpl.CreateFoldSegment (int offset, int length, bool isFolded)
{
return new FoldSegmentWrapper (TextEditor.Document, "...", offset, length, Mono.TextEditor.FoldingType.None) { IsFolded = isFolded };
}
@@ -3066,6 +3060,21 @@ namespace MonoDevelop.SourceEditor
widget.RemoveOverlay (messageOverlayContent.GetNativeWidget<Widget> ());
}
+ void TextViewMargin_LineShown (object sender, Mono.TextEditor.LineEventArgs e)
+ {
+ LineShown?.Invoke (this, new Ide.Editor.LineEventArgs (new DocumentLineWrapper (e.Line)));
+ }
+
+ public IEnumerable<IDocumentLine> VisibleLines {
+ get {
+ foreach (var v in TextEditor.TextViewMargin.CachedLine) {
+ yield return new DocumentLineWrapper (v);
+ }
+ }
+ }
+
+ public event EventHandler<Ide.Editor.LineEventArgs> LineShown;
+
#region IEditorActionHost implementation
void IEditorActionHost.MoveCaretDown ()
@@ -3335,7 +3344,7 @@ namespace MonoDevelop.SourceEditor
}
}
- public ITextSegmentMarker CreateLinkMarker (MonoDevelop.Ide.Editor.TextEditor editor, int offset, int length, Action<LinkRequest> activateLink)
+ public ILinkTextMarker CreateLinkMarker (MonoDevelop.Ide.Editor.TextEditor editor, int offset, int length, Action<LinkRequest> activateLink)
{
return new LinkMarker (offset, length, activateLink);
}
diff --git a/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor/SourceEditorWidget.cs b/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor/SourceEditorWidget.cs
index b1ff244bd1..df5664c837 100644
--- a/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor/SourceEditorWidget.cs
+++ b/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor/SourceEditorWidget.cs
@@ -928,12 +928,12 @@ namespace MonoDevelop.SourceEditor
view.WorkbenchWindow.ShowNotification = false;
RemoveMessageBar ();
};
- okButton.Clicked += delegate {
+ okButton.Clicked += async delegate {
switch (combo.Active) {
case 0:
ConvertLineEndings ();
view.WorkbenchWindow.ShowNotification = false;
- view.Save (fileName, view.SourceEncoding);
+ await view.Save (fileName, view.SourceEncoding);
break;
case 1:
FileRegistry.ConvertLineEndingsInAllFiles ();
@@ -1026,7 +1026,7 @@ namespace MonoDevelop.SourceEditor
}
}
- public void Reload ()
+ public async void Reload ()
{
try {
if (!System.IO.File.Exists (view.ContentName))
@@ -1034,7 +1034,7 @@ namespace MonoDevelop.SourceEditor
view.StoreSettings ();
reloadSettings = true;
- view.Load (view.ContentName, view.SourceEncoding, true);
+ await view.Load (view.ContentName, view.SourceEncoding, true);
view.WorkbenchWindow.ShowNotification = false;
} catch (Exception ex) {
MessageService.ShowError ("Could not reload the file.", ex);
diff --git a/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor/TextMarker/LinkMarker.cs b/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor/TextMarker/LinkMarker.cs
index bbb533000b..c884720dd2 100644
--- a/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor/TextMarker/LinkMarker.cs
+++ b/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor/TextMarker/LinkMarker.cs
@@ -30,13 +30,19 @@ using MonoDevelop.Core;
namespace MonoDevelop.SourceEditor
{
- class LinkMarker : UnderlineTextSegmentMarker, ITextSegmentMarker, IActionTextLineMarker
+ class LinkMarker : UnderlineTextSegmentMarker, ILinkTextMarker, IActionTextLineMarker
{
static readonly Gdk.Cursor textLinkCursor = new Gdk.Cursor (Gdk.CursorType.Hand1);
- static readonly Cairo.Color linkColor = new Cairo.Color (0, 0, 1.0);
+
Action<LinkRequest> activateLink;
- public LinkMarker (int offset, int length, Action<LinkRequest> activateLink) : base (linkColor, new TextSegment (offset, length))
+ public bool OnlyShowLinkOnHover {
+ get;
+ set;
+ }
+
+
+ public LinkMarker (int offset, int length, Action<LinkRequest> activateLink) : base (DefaultSourceEditorOptions.Instance.GetColorStyle ().LinkColor.Color, new TextSegment (offset, length))
{
this.activateLink = activateLink;
this.Wave = false;
@@ -53,18 +59,71 @@ namespace MonoDevelop.SourceEditor
bool IActionTextLineMarker.MousePressed (MonoTextEditor editor, MarginMouseEventArgs args)
{
MousePressed?.Invoke (this, new TextEventArgsWrapper (args));
+ return false;
+ }
+
+ bool IActionTextLineMarker.MouseReleased (MonoTextEditor editor, MarginMouseEventArgs args)
+ {
if ((Platform.IsMac && (args.ModifierState & Gdk.ModifierType.Mod2Mask) == Gdk.ModifierType.Mod2Mask) ||
- (!Platform.IsMac && (args.ModifierState & Gdk.ModifierType.ControlMask) == Gdk.ModifierType.ControlMask))
+ (!Platform.IsMac && (args.ModifierState & Gdk.ModifierType.ControlMask) == Gdk.ModifierType.ControlMask))
activateLink?.Invoke (LinkRequest.RequestNewView);
else
activateLink?.Invoke (LinkRequest.SameView);
+
return false;
}
+
void IActionTextLineMarker.MouseHover (MonoTextEditor editor, MarginMouseEventArgs args, TextLineMarkerHoverResult result)
{
MouseHover?.Invoke (this, new TextEventArgsWrapper (args));
result.Cursor = textLinkCursor;
+ if (OnlyShowLinkOnHover) {
+ editor.GetTextEditorData ().Document.CommitLineUpdate (args.LineSegment);
+ editor.TextViewMargin.HoveredLineChanged += new UpdateOldLine (editor, args.LineSegment).TextViewMargin_HoveredLineChanged;
+ }
+ }
+
+ class UpdateOldLine
+ {
+ MonoTextEditor editor;
+ DocumentLine lineSegment;
+
+ public UpdateOldLine (MonoTextEditor editor, DocumentLine lineSegment)
+ {
+ this.editor = editor;
+ this.lineSegment = lineSegment;
+ }
+
+ public void TextViewMargin_HoveredLineChanged (object sender, Mono.TextEditor.LineEventArgs e)
+ {
+ editor.GetTextEditorData ().Document.CommitLineUpdate (lineSegment);
+ editor.TextViewMargin.HoveredLineChanged -= TextViewMargin_HoveredLineChanged;
+ }
+ }
+
+ public override void Draw (MonoTextEditor editor, Cairo.Context cr, LineMetrics metrics, int startOffset, int endOffset)
+ {
+ if (OnlyShowLinkOnHover) {
+ if (editor.TextViewMargin.MarginCursor != textLinkCursor)
+ return;
+ if (editor.TextViewMargin.HoveredLine == null)
+ return;
+ var hoverOffset = editor.LocationToOffset (editor.TextViewMargin.HoveredLocation);
+ if (!Segment.Contains (hoverOffset))
+ return;
+ }
+ this.Color = editor.ColorStyle.LinkColor.Color;
+
+ if (!OnlyShowLinkOnHover) {
+ if (editor.TextViewMargin.MarginCursor == textLinkCursor && editor.TextViewMargin.HoveredLine != null) {
+ var hoverOffset = editor.LocationToOffset (editor.TextViewMargin.HoveredLocation);
+ if (Segment.Contains (hoverOffset))
+ this.Color = editor.ColorStyle.ActiveLinkColor.Color;
+ }
+ }
+
+ base.Draw (editor, cr, metrics, startOffset, endOffset);
}
}
}
diff --git a/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor/TextMarker/SmartTagMarker.cs b/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor/TextMarker/SmartTagMarker.cs
index 4a486e5a4f..50312e0f0f 100644
--- a/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor/TextMarker/SmartTagMarker.cs
+++ b/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor/TextMarker/SmartTagMarker.cs
@@ -65,6 +65,12 @@ namespace MonoDevelop.SourceEditor
return false;
}
+ bool IActionTextLineMarker.MouseReleased (MonoTextEditor editor, MarginMouseEventArgs args)
+ {
+ return false;
+ }
+
+
void IActionTextLineMarker.MouseHover (Mono.TextEditor.MonoTextEditor editor, MarginMouseEventArgs args, TextLineMarkerHoverResult result)
{
if (args.Button != 0)
@@ -73,7 +79,7 @@ namespace MonoDevelop.SourceEditor
if (line == null)
return;
var x = editor.ColumnToX (line, loc.Column) - editor.HAdjustment.Value + editor.TextViewMargin.TextStartPosition;
- var y = editor.LineToY (line.LineNumber + 1) - editor.VAdjustment.Value;
+ //var y = editor.LineToY (line.LineNumber + 1) - editor.VAdjustment.Value;
const double xAdditionalSpace = tagMarkerWidth;
if (args.X - x >= -xAdditionalSpace * editor.Options.Zoom &&
args.X - x < (tagMarkerWidth + xAdditionalSpace) * editor.Options.Zoom /*&&
@@ -100,15 +106,10 @@ namespace MonoDevelop.SourceEditor
y - y2 < (editor.LineHeight / 2) * editor.Options.Zoom;
}
- bool ISmartTagMarker.IsInsideWindow (Gtk.MotionNotifyEventArgs args)
- {
- if (editor == null)
- return false;
- return args.Event.Window == editor.TextArea.GdkWindow;
- }
-
public event EventHandler<TextMarkerMouseEventArgs> MousePressed;
+ #pragma warning disable 0067
public event EventHandler<TextMarkerMouseEventArgs> MouseHover;
+ #pragma warning restore 0067
public event EventHandler ShowPopup;
public event EventHandler CancelPopup;
diff --git a/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor/TextMarker/WavedLineMarker.cs b/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor/TextMarker/WavedLineMarker.cs
index fdd11c9729..7953dac2b5 100644
--- a/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor/TextMarker/WavedLineMarker.cs
+++ b/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor/TextMarker/WavedLineMarker.cs
@@ -112,9 +112,11 @@ namespace MonoDevelop.SourceEditor
}
}
+ #pragma warning disable 0067
public event EventHandler<MonoDevelop.Ide.Editor.TextMarkerMouseEventArgs> MousePressed;
public event EventHandler<MonoDevelop.Ide.Editor.TextMarkerMouseEventArgs> MouseHover;
+ #pragma warning restore 0067
object MonoDevelop.Ide.Editor.ITextSegmentMarker.Tag {
get;
diff --git a/main/src/addins/MonoDevelop.SourceEditor2/gtk-gui/gui.stetic b/main/src/addins/MonoDevelop.SourceEditor2/gtk-gui/gui.stetic
index 0b007407c2..9e2236c02c 100644
--- a/main/src/addins/MonoDevelop.SourceEditor2/gtk-gui/gui.stetic
+++ b/main/src/addins/MonoDevelop.SourceEditor2/gtk-gui/gui.stetic
@@ -2371,6 +2371,7 @@
<widget class="Gtk.Bin" id="MonoDevelop.SourceEditor.OptionPanels.CompletionAppearancePanel" design-size="427 423">
<property name="MemberName" />
<property name="Visible">False</property>
+ <property name="GeneratePublic">False</property>
<child>
<widget class="Gtk.VBox" id="vbox1">
<property name="MemberName" />
diff --git a/main/src/addins/NUnit/Gui/TestPad.cs b/main/src/addins/NUnit/Gui/TestPad.cs
index 7af04bb8d9..3681279f08 100644
--- a/main/src/addins/NUnit/Gui/TestPad.cs
+++ b/main/src/addins/NUnit/Gui/TestPad.cs
@@ -90,7 +90,7 @@ namespace MonoDevelop.NUnit
paned = new VPaned ();
VBox vbox = new VBox ();
- DockItemToolbar topToolbar = Window.GetToolbar (PositionType.Top);
+ DockItemToolbar topToolbar = Window.GetToolbar (DockPositionType.Top);
var hbox = new HBox { Spacing = 6 };
hbox.PackStart (new ImageView (ImageService.GetIcon ("md-execute-all", IconSize.Menu)), false, false, 0);
@@ -146,10 +146,12 @@ namespace MonoDevelop.NUnit
VBox boxPaned1 = new VBox ();
chart = new TestChart ();
- chart.ButtonPressEvent += OnChartButtonPress;
chart.SelectionChanged += new EventHandler (OnChartDateChanged);
- chart.HeightRequest = 50;
-
+
+ var chartWidget = chart.GetNativeWidget<Widget> ();
+ chartWidget.ButtonPressEvent += OnChartButtonPress;
+ chartWidget.HeightRequest = 50;
+
Toolbar toolbar = new Toolbar ();
toolbar.IconSize = IconSize.SmallToolbar;
toolbar.ToolbarStyle = ToolbarStyle.Icons;
@@ -382,7 +384,7 @@ namespace MonoDevelop.NUnit
return TreeView.GetNodeAtObject (t);
}
- public override Gtk.Widget Control {
+ public override Control Control {
get {
return paned;
}
diff --git a/main/src/addins/NUnit/Gui/TestResultsPad.cs b/main/src/addins/NUnit/Gui/TestResultsPad.cs
index 43ebfd8acf..ea2d7325d4 100644
--- a/main/src/addins/NUnit/Gui/TestResultsPad.cs
+++ b/main/src/addins/NUnit/Gui/TestResultsPad.cs
@@ -49,7 +49,7 @@ using MonoDevelop.NUnit.External;
namespace MonoDevelop.NUnit
{
- public class TestResultsPad: IPadContent, ITestProgressMonitor
+ public class TestResultsPad: PadContent, ITestProgressMonitor
{
NUnitService testService = NUnitService.Instance;
@@ -154,16 +154,16 @@ namespace MonoDevelop.NUnit
"/MonoDevelop/NUnit/ContextMenu/TestResultsPad");
};
- Control.ShowAll ();
+ panel.ShowAll ();
outputViewScrolled.Hide ();
}
- void IPadContent.Initialize (IPadWindow window)
+ protected override void Initialize (IPadWindow window)
{
this.window = window;
- DockItemToolbar toolbar = window.GetToolbar (PositionType.Top);
+ DockItemToolbar toolbar = window.GetToolbar (DockPositionType.Top);
buttonSuccess = new ToggleButton ();
buttonSuccess.Label = GettextCatalog.GetString ("Successful Tests");
@@ -228,7 +228,7 @@ namespace MonoDevelop.NUnit
// Run panel
- DockItemToolbar runPanel = window.GetToolbar (PositionType.Bottom);
+ DockItemToolbar runPanel = window.GetToolbar (DockPositionType.Bottom);
infoSep = new VSeparator ();
@@ -257,10 +257,6 @@ namespace MonoDevelop.NUnit
UpdateCounters ();
}
- public void Dispose ()
- {
- }
-
public void OnTestSuiteChanged (object sender, EventArgs e)
{
if (rootTest != null) {
@@ -306,16 +302,12 @@ namespace MonoDevelop.NUnit
}
}
- public Gtk.Widget Control {
+ public override Control Control {
get {
return panel;
}
}
- public void RedrawContent ()
- {
- }
-
string GetResultsMarkup ()
{
return string.Format (GettextCatalog.GetString ("<b>Passed</b>: {0} <b>Failed</b>: {1} <b>Errors</b>: {2} <b>Inconclusive</b>: {3} <b>Invalid</b>: {4} <b>Ignored</b>: {5} <b>Skipped</b>: {6} <b>Time</b>: {7}"),
diff --git a/main/src/addins/NUnit/Project/NUnitAssemblyGroupProject.cs b/main/src/addins/NUnit/Project/NUnitAssemblyGroupProject.cs
index 70ae454717..2da28fc8f7 100644
--- a/main/src/addins/NUnit/Project/NUnitAssemblyGroupProject.cs
+++ b/main/src/addins/NUnit/Project/NUnitAssemblyGroupProject.cs
@@ -67,11 +67,9 @@ namespace MonoDevelop.NUnit
}
}
- protected override SolutionItemConfiguration OnCreateConfiguration (string name, ConfigurationKind kind)
+ protected override SolutionItemConfiguration OnCreateConfiguration (string id, ConfigurationKind kind)
{
- NUnitAssemblyGroupProjectConfiguration conf = new NUnitAssemblyGroupProjectConfiguration ();
- conf.Name = name;
- return conf;
+ return new NUnitAssemblyGroupProjectConfiguration (id);
}
}
@@ -79,16 +77,16 @@ namespace MonoDevelop.NUnit
{
TestAssemblyCollection assemblies;
- public NUnitAssemblyGroupProjectConfiguration ()
+ public NUnitAssemblyGroupProjectConfiguration (string id): base (id)
{
assemblies = new TestAssemblyCollection (this);
}
- public override void CopyFrom (ItemConfiguration other)
+ protected override void OnCopyFrom (ItemConfiguration configuration, bool isRename)
{
- base.CopyFrom (other);
-
- NUnitAssemblyGroupProjectConfiguration conf = other as NUnitAssemblyGroupProjectConfiguration;
+ base.OnCopyFrom (configuration, isRename);
+
+ NUnitAssemblyGroupProjectConfiguration conf = configuration as NUnitAssemblyGroupProjectConfiguration;
if (conf != null) {
assemblies.Clear ();
foreach (TestAssembly ta in conf.Assemblies) {
diff --git a/main/src/addins/VBNetBinding/Gui/ConfigurationOptionsPanel.cs b/main/src/addins/VBNetBinding/Gui/ConfigurationOptionsPanel.cs
index 71148c8a1b..80c602a526 100644
--- a/main/src/addins/VBNetBinding/Gui/ConfigurationOptionsPanel.cs
+++ b/main/src/addins/VBNetBinding/Gui/ConfigurationOptionsPanel.cs
@@ -28,6 +28,7 @@
using System;
+using MonoDevelop.Components;
using MonoDevelop.Projects;
using MonoDevelop.Ide.Gui.Dialogs;
@@ -41,7 +42,7 @@ namespace MonoDevelop.VBNetBinding
{
}
- public override Gtk.Widget CreatePanelWidget ()
+ public override Control CreatePanelWidget ()
{
Console.WriteLine ("ConfigurationOptionsPanel.CreatePanelWidget");
return (widget = new ConfigurationOptionsPanelWidget (ConfiguredProject));
diff --git a/main/src/addins/VBNetBinding/Gui/ImportsOptionsPanel.cs b/main/src/addins/VBNetBinding/Gui/ImportsOptionsPanel.cs
index 76fb8745fa..ea3eb9fe18 100644
--- a/main/src/addins/VBNetBinding/Gui/ImportsOptionsPanel.cs
+++ b/main/src/addins/VBNetBinding/Gui/ImportsOptionsPanel.cs
@@ -24,6 +24,7 @@
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
+using MonoDevelop.Components;
using MonoDevelop.Ide.Gui.Dialogs;
namespace MonoDevelop.VBNetBinding
@@ -36,7 +37,7 @@ namespace MonoDevelop.VBNetBinding
{
}
- public override Gtk.Widget CreatePanelWidget ()
+ public override Control CreatePanelWidget ()
{
return (widget = new ImportsOptionsPanelWidget (ConfiguredProject));
}
diff --git a/main/src/addins/VBNetBinding/Gui/ProjectOptionsPanel.cs b/main/src/addins/VBNetBinding/Gui/ProjectOptionsPanel.cs
index a456dc913b..9217e09362 100644
--- a/main/src/addins/VBNetBinding/Gui/ProjectOptionsPanel.cs
+++ b/main/src/addins/VBNetBinding/Gui/ProjectOptionsPanel.cs
@@ -26,7 +26,7 @@
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
-
+using MonoDevelop.Components;
using MonoDevelop.Ide.Gui.Dialogs;
namespace MonoDevelop.VBNetBinding
@@ -39,7 +39,7 @@ namespace MonoDevelop.VBNetBinding
{
}
- public override Gtk.Widget CreatePanelWidget ()
+ public override Control CreatePanelWidget ()
{
return (widget = new ProjectOptionsPanelWidget (ConfiguredProject));
}
diff --git a/main/src/addins/VersionControl/MonoDevelop.VersionControl.Git/MonoDevelop.VersionControl.Git/Commands.cs b/main/src/addins/VersionControl/MonoDevelop.VersionControl.Git/MonoDevelop.VersionControl.Git/Commands.cs
index 1a2b78edab..bbf092f617 100644
--- a/main/src/addins/VersionControl/MonoDevelop.VersionControl.Git/MonoDevelop.VersionControl.Git/Commands.cs
+++ b/main/src/addins/VersionControl/MonoDevelop.VersionControl.Git/MonoDevelop.VersionControl.Git/Commands.cs
@@ -64,7 +64,7 @@ namespace MonoDevelop.VersionControl.Git
protected GitRepository UpdateVisibility (CommandInfo info)
{
var repo = Repository;
- info.Visible = Repository != null;
+ info.Visible = repo != null;
return repo;
}
diff --git a/main/src/addins/VersionControl/MonoDevelop.VersionControl.Git/MonoDevelop.VersionControl.Git/CredentialsDialog.cs b/main/src/addins/VersionControl/MonoDevelop.VersionControl.Git/MonoDevelop.VersionControl.Git/CredentialsDialog.cs
index ab4e9ff94a..f534745e88 100644
--- a/main/src/addins/VersionControl/MonoDevelop.VersionControl.Git/MonoDevelop.VersionControl.Git/CredentialsDialog.cs
+++ b/main/src/addins/VersionControl/MonoDevelop.VersionControl.Git/MonoDevelop.VersionControl.Git/CredentialsDialog.cs
@@ -31,7 +31,7 @@ using MonoDevelop.Components;
namespace MonoDevelop.VersionControl.Git
{
- partial class CredentialsDialog : Dialog
+ partial class CredentialsDialog : Gtk.Dialog
{
uint r;
public CredentialsDialog (string uri, SupportedCredentialTypes type, Credentials cred)
diff --git a/main/src/addins/VersionControl/MonoDevelop.VersionControl.Git/MonoDevelop.VersionControl.Git/EditBranchDialog.cs b/main/src/addins/VersionControl/MonoDevelop.VersionControl.Git/MonoDevelop.VersionControl.Git/EditBranchDialog.cs
index a41d5fc3e6..1929c1fbad 100644
--- a/main/src/addins/VersionControl/MonoDevelop.VersionControl.Git/MonoDevelop.VersionControl.Git/EditBranchDialog.cs
+++ b/main/src/addins/VersionControl/MonoDevelop.VersionControl.Git/MonoDevelop.VersionControl.Git/EditBranchDialog.cs
@@ -35,7 +35,7 @@ using System.ComponentModel;
namespace MonoDevelop.VersionControl.Git
{
- partial class EditBranchDialog : Dialog
+ partial class EditBranchDialog : Gtk.Dialog
{
readonly ListStore comboStore;
readonly string currentTracking;
diff --git a/main/src/addins/VersionControl/MonoDevelop.VersionControl.Git/MonoDevelop.VersionControl.Git/GitConfigurationDialog.cs b/main/src/addins/VersionControl/MonoDevelop.VersionControl.Git/MonoDevelop.VersionControl.Git/GitConfigurationDialog.cs
index 712073976e..63c4269f48 100644
--- a/main/src/addins/VersionControl/MonoDevelop.VersionControl.Git/MonoDevelop.VersionControl.Git/GitConfigurationDialog.cs
+++ b/main/src/addins/VersionControl/MonoDevelop.VersionControl.Git/MonoDevelop.VersionControl.Git/GitConfigurationDialog.cs
@@ -35,7 +35,7 @@ using System.ComponentModel;
namespace MonoDevelop.VersionControl.Git
{
- partial class GitConfigurationDialog : Dialog
+ partial class GitConfigurationDialog : Gtk.Dialog
{
readonly GitRepository repo;
readonly ListStore storeBranches;
diff --git a/main/src/addins/VersionControl/MonoDevelop.VersionControl.Git/MonoDevelop.VersionControl.Git/GitOptionsPanel.cs b/main/src/addins/VersionControl/MonoDevelop.VersionControl.Git/MonoDevelop.VersionControl.Git/GitOptionsPanel.cs
index 5a09a60d17..640a44142c 100644
--- a/main/src/addins/VersionControl/MonoDevelop.VersionControl.Git/MonoDevelop.VersionControl.Git/GitOptionsPanel.cs
+++ b/main/src/addins/VersionControl/MonoDevelop.VersionControl.Git/MonoDevelop.VersionControl.Git/GitOptionsPanel.cs
@@ -23,6 +23,7 @@
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
+using MonoDevelop.Components;
using MonoDevelop.Ide.Gui.Dialogs;
namespace MonoDevelop.VersionControl.Git
@@ -31,7 +32,7 @@ namespace MonoDevelop.VersionControl.Git
{
GitOptionsPanelWidget widget;
- public override Gtk.Widget CreatePanelWidget ()
+ public override Control CreatePanelWidget ()
{
return widget = new GitOptionsPanelWidget ();
}
diff --git a/main/src/addins/VersionControl/MonoDevelop.VersionControl.Git/MonoDevelop.VersionControl.Git/GitOptionsPanelWidget.cs b/main/src/addins/VersionControl/MonoDevelop.VersionControl.Git/MonoDevelop.VersionControl.Git/GitOptionsPanelWidget.cs
index fb2c8d024a..6dfc4554f5 100644
--- a/main/src/addins/VersionControl/MonoDevelop.VersionControl.Git/MonoDevelop.VersionControl.Git/GitOptionsPanelWidget.cs
+++ b/main/src/addins/VersionControl/MonoDevelop.VersionControl.Git/MonoDevelop.VersionControl.Git/GitOptionsPanelWidget.cs
@@ -39,9 +39,9 @@ namespace MonoDevelop.VersionControl.Git
public void ApplyChanges ()
{
- GitService.UseRebaseOptionWhenPulling = checkRebase.Active;
- GitService.StashUnstashWhenUpdating = checkStashUpdate.Active;
- GitService.StashUnstashWhenSwitchingBranches = checkStashBranch.Active;
+ GitService.UseRebaseOptionWhenPulling.Value = checkRebase.Active;
+ GitService.StashUnstashWhenUpdating.Value = checkStashUpdate.Active;
+ GitService.StashUnstashWhenSwitchingBranches.Value = checkStashBranch.Active;
}
}
}
diff --git a/main/src/addins/VersionControl/MonoDevelop.VersionControl.Git/MonoDevelop.VersionControl.Git/GitService.cs b/main/src/addins/VersionControl/MonoDevelop.VersionControl.Git/MonoDevelop.VersionControl.Git/GitService.cs
index 9e05055ccd..74c3028d13 100644
--- a/main/src/addins/VersionControl/MonoDevelop.VersionControl.Git/MonoDevelop.VersionControl.Git/GitService.cs
+++ b/main/src/addins/VersionControl/MonoDevelop.VersionControl.Git/MonoDevelop.VersionControl.Git/GitService.cs
@@ -36,23 +36,9 @@ namespace MonoDevelop.VersionControl.Git
{
public static class GitService
{
- public static bool UseRebaseOptionWhenPulling
- {
- get { return PropertyService.Get ("MonoDevelop.VersionControl.Git.UseRebaseOptionWhenPulling", true); }
- set { PropertyService.Set ("MonoDevelop.VersionControl.Git.UseRebaseOptionWhenPulling", value); }
- }
-
- public static bool StashUnstashWhenUpdating
- {
- get { return PropertyService.Get ("MonoDevelop.VersionControl.Git.StashUnstashWhenUpdating", true); }
- set { PropertyService.Set ("MonoDevelop.VersionControl.Git.StashUnstashWhenUpdating", value); }
- }
-
- public static bool StashUnstashWhenSwitchingBranches
- {
- get { return PropertyService.Get ("MonoDevelop.VersionControl.Git.StashUnstashWhenSwitchingBranches", true); }
- set { PropertyService.Set ("MonoDevelop.VersionControl.Git.StashUnstashWhenSwitchingBranches", value); }
- }
+ public static ConfigurationProperty<bool> UseRebaseOptionWhenPulling = ConfigurationProperty.Create ("MonoDevelop.VersionControl.Git.UseRebaseOptionWhenPulling", true);
+ public static ConfigurationProperty<bool> StashUnstashWhenUpdating = ConfigurationProperty.Create ("MonoDevelop.VersionControl.Git.StashUnstashWhenUpdating", true);
+ public static ConfigurationProperty<bool> StashUnstashWhenSwitchingBranches = ConfigurationProperty.Create ("MonoDevelop.VersionControl.Git.StashUnstashWhenSwitchingBranches", true);
public static void Push (GitRepository repo)
{
diff --git a/main/src/addins/VersionControl/MonoDevelop.VersionControl.Git/MonoDevelop.VersionControl.Git/MergeDialog.cs b/main/src/addins/VersionControl/MonoDevelop.VersionControl.Git/MonoDevelop.VersionControl.Git/MergeDialog.cs
index 98c2115e7a..57d82ff2d6 100644
--- a/main/src/addins/VersionControl/MonoDevelop.VersionControl.Git/MonoDevelop.VersionControl.Git/MergeDialog.cs
+++ b/main/src/addins/VersionControl/MonoDevelop.VersionControl.Git/MonoDevelop.VersionControl.Git/MergeDialog.cs
@@ -33,7 +33,7 @@ using LibGit2Sharp;
namespace MonoDevelop.VersionControl.Git
{
- partial class MergeDialog : Dialog
+ partial class MergeDialog : Gtk.Dialog
{
readonly TreeStore store;
readonly GitRepository repo;
diff --git a/main/src/addins/VersionControl/MonoDevelop.VersionControl.Git/MonoDevelop.VersionControl.Git/StashManagerDialog.cs b/main/src/addins/VersionControl/MonoDevelop.VersionControl.Git/MonoDevelop.VersionControl.Git/StashManagerDialog.cs
index 76485e358d..92c9eb3028 100644
--- a/main/src/addins/VersionControl/MonoDevelop.VersionControl.Git/MonoDevelop.VersionControl.Git/StashManagerDialog.cs
+++ b/main/src/addins/VersionControl/MonoDevelop.VersionControl.Git/MonoDevelop.VersionControl.Git/StashManagerDialog.cs
@@ -31,7 +31,7 @@ using LibGit2Sharp;
namespace MonoDevelop.VersionControl.Git
{
- partial class StashManagerDialog : Dialog
+ partial class StashManagerDialog : Gtk.Dialog
{
readonly GitRepository repository;
readonly ListStore store;
diff --git a/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl.Dialogs/VersionControlGeneralOptionsPanel.cs b/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl.Dialogs/VersionControlGeneralOptionsPanel.cs
index 7fd5e9adf6..52c06c78d8 100644
--- a/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl.Dialogs/VersionControlGeneralOptionsPanel.cs
+++ b/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl.Dialogs/VersionControlGeneralOptionsPanel.cs
@@ -34,7 +34,7 @@ namespace MonoDevelop.VersionControl
{
Xwt.CheckBox disableVersionControl;
- public override Gtk.Widget CreatePanelWidget ()
+ public override Control CreatePanelWidget ()
{
Xwt.VBox box = new Xwt.VBox ();
box.Spacing = 6;
diff --git a/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl.Dialogs/VersionControlPolicyPanel.cs b/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl.Dialogs/VersionControlPolicyPanel.cs
index aeb604d3e7..3ff75dc197 100644
--- a/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl.Dialogs/VersionControlPolicyPanel.cs
+++ b/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl.Dialogs/VersionControlPolicyPanel.cs
@@ -25,7 +25,7 @@
//
//
-using Gtk;
+using MonoDevelop.Components;
using MonoDevelop.Core;
using MonoDevelop.Ide.Gui.Dialogs;
using MonoDevelop.Projects;
@@ -37,7 +37,7 @@ namespace MonoDevelop.VersionControl
CommitMessageStylePanelWidget widget;
CommitMessageFormat format;
- public override Widget CreatePanelWidget ()
+ public override Control CreatePanelWidget ()
{
format = new CommitMessageFormat ();
widget = new CommitMessageStylePanelWidget ();
diff --git a/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl.Dialogs/VersionControlSolutionOptionsPanel.cs b/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl.Dialogs/VersionControlSolutionOptionsPanel.cs
index f97e1570c6..709c490693 100644
--- a/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl.Dialogs/VersionControlSolutionOptionsPanel.cs
+++ b/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl.Dialogs/VersionControlSolutionOptionsPanel.cs
@@ -35,7 +35,7 @@ namespace MonoDevelop.VersionControl
{
Xwt.CheckBox disableVersionControl;
- public override Gtk.Widget CreatePanelWidget ()
+ public override Control CreatePanelWidget ()
{
Xwt.VBox box = new Xwt.VBox ();
box.Spacing = 6;
diff --git a/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl.Views/BaseView.cs b/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl.Views/BaseView.cs
index f9bcd2461a..bdf5f4ebcb 100644
--- a/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl.Views/BaseView.cs
+++ b/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl.Views/BaseView.cs
@@ -1,108 +1,31 @@
using System;
-using System.IO;
+using System.IO;
using MonoDevelop.Ide.Gui;
using System.Text;
-
+using Gtk;
+using System.Threading.Tasks;
+using MonoDevelop.Components;
+
namespace MonoDevelop.VersionControl
{
- public abstract class BaseView : AbstractBaseViewContent, IViewContent
+ public abstract class BaseView : ViewContent
{
string name;
protected BaseView (string name)
{
this.name = name;
- }
-
- protected virtual void SaveAs (FileSaveInformation fileSaveInformation)
- {
- }
-
- void IViewContent.Load (FileOpenInformation fileOpenInformation)
- {
- throw new InvalidOperationException();
- }
-
- void IViewContent.Load (string fileName)
- {
- throw new InvalidOperationException();
- }
-
- void IViewContent.LoadNew (Stream stream, string mimeType)
- {
- throw new InvalidOperationException ();
- }
-
- void IViewContent.Save ()
- {
- throw new InvalidOperationException ();
- }
-
- void IViewContent.DiscardChanges ()
- {
- }
-
- void IViewContent.Save (string fileName)
- {
- SaveAs (new FileSaveInformation (fileName));
- }
-
- void IViewContent.Save (FileSaveInformation info)
- {
- SaveAs (info);
- }
-
- string IViewContent.ContentName {
- get { return name; }
- set { }
- }
-
- bool IViewContent.IsDirty {
- get { return false; }
- set { }
- }
-
- bool IViewContent.IsReadOnly {
- get { return true; }
- }
-
- bool IViewContent.IsUntitled {
- get { return false; }
- }
-
- bool IViewContent.IsViewOnly {
- get { return false; }
}
-
- bool IViewContent.IsFile {
- get { return false; }
- }
-
- string IViewContent.PathRelativeToProject {
- get { return ""; }
- }
-
- MonoDevelop.Projects.Project IViewContent.Project {
- get { return null; }
- set { }
- }
-
+
+ public override Control Control {
+ get
+ {
+ throw new NotImplementedException ();
+ }
+ }
+
public override string TabPageLabel {
get { return name; }
}
-
- public virtual string StockIconId {
- get { return null; }
- }
-
- string IViewContent.UntitledName {
- get { return ""; }
- set { }
- }
-
- event EventHandler IViewContent.BeforeSave { add { } remove { } }
- event EventHandler IViewContent.ContentChanged { add { } remove { } }
- event EventHandler IViewContent.ContentNameChanged { add { } remove { } }
- event EventHandler IViewContent.DirtyChanged { add { } remove { } }
}
} \ No newline at end of file
diff --git a/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl.Views/BlameView.cs b/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl.Views/BlameView.cs
index ee6571fb78..2faf833e3e 100644
--- a/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl.Views/BlameView.cs
+++ b/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl.Views/BlameView.cs
@@ -24,13 +24,16 @@
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
using System;
+using MonoDevelop.Components;
using MonoDevelop.Ide.Gui;
using MonoDevelop.Core;
using MonoDevelop.Ide.Gui.Content;
using Mono.TextEditor;
+using MonoDevelop.Components;
+
namespace MonoDevelop.VersionControl.Views
{
- public interface IBlameView : IAttachableViewContent
+ public interface IBlameView
{
}
@@ -39,7 +42,7 @@ namespace MonoDevelop.VersionControl.Views
BlameWidget widget;
VersionControlDocumentInfo info;
- public override Gtk.Widget Control {
+ public override Control Control {
get {
if (widget == null)
widget = new BlameWidget (info);
@@ -53,7 +56,7 @@ namespace MonoDevelop.VersionControl.Views
}
#region IAttachableViewContent implementation
- public void Selected ()
+ protected override void OnSelected ()
{
info.Start ();
var sourceEditor = info.Document.GetContent <MonoDevelop.SourceEditor.SourceEditorView> ();
@@ -63,7 +66,7 @@ namespace MonoDevelop.VersionControl.Views
}
}
- public void Deselected ()
+ protected override void OnDeselected ()
{
var sourceEditor = info.Document.GetContent <MonoDevelop.SourceEditor.SourceEditorView> ();
if (sourceEditor != null) {
@@ -72,13 +75,6 @@ namespace MonoDevelop.VersionControl.Views
}
}
- public void BeforeSave ()
- {
- }
-
- public void BaseContentChanged ()
- {
- }
#endregion
#region IUndoHandler implementation
diff --git a/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl.Views/ComparisonWidget.cs b/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl.Views/ComparisonWidget.cs
index 0be3428bcf..a338eaf966 100644
--- a/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl.Views/ComparisonWidget.cs
+++ b/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl.Views/ComparisonWidget.cs
@@ -93,6 +93,7 @@ namespace MonoDevelop.VersionControl.Views
protected override void OnSetVersionControlInfo (VersionControlDocumentInfo info)
{
info.Updated += OnInfoUpdated;
+ MainEditor.Document.ReadOnly = false;
base.OnSetVersionControlInfo (info);
}
diff --git a/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl.Views/DiffView.cs b/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl.Views/DiffView.cs
index 3162f4818c..d519772c24 100644
--- a/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl.Views/DiffView.cs
+++ b/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl.Views/DiffView.cs
@@ -26,12 +26,14 @@
using System;
using MonoDevelop.Ide.Gui;
using System.Collections.Generic;
+using MonoDevelop.Components;
using MonoDevelop.Core;
using MonoDevelop.Ide.Gui.Content;
+using MonoDevelop.Components;
namespace MonoDevelop.VersionControl.Views
{
- public interface IDiffView : IAttachableViewContent
+ public interface IDiffView
{
}
@@ -39,7 +41,7 @@ namespace MonoDevelop.VersionControl.Views
{
DiffWidget widget;
- public override Gtk.Widget Control {
+ public override Control Control {
get {
if (widget == null) {
widget = new DiffWidget (info);
@@ -89,7 +91,7 @@ namespace MonoDevelop.VersionControl.Views
return editor.YToLine (midY);
}
- public void Selected ()
+ protected override void OnSelected ()
{
info.Start ();
ComparisonWidget.UpdateLocalText ();
@@ -121,7 +123,7 @@ namespace MonoDevelop.VersionControl.Views
}
}
- public void Deselected ()
+ protected override void OnDeselected ()
{
var sourceEditor = info.Document.GetContent <MonoDevelop.SourceEditor.SourceEditorView> ();
if (sourceEditor != null) {
@@ -133,14 +135,6 @@ namespace MonoDevelop.VersionControl.Views
}
}
- public void BeforeSave ()
- {
- }
-
- public void BaseContentChanged ()
- {
- }
-
#endregion
#region IUndoHandler implementation
diff --git a/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl.Views/DiffWidget.cs b/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl.Views/DiffWidget.cs
index d98b37dab1..9535f73741 100644
--- a/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl.Views/DiffWidget.cs
+++ b/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl.Views/DiffWidget.cs
@@ -35,8 +35,8 @@ namespace MonoDevelop.VersionControl.Views
VersionControlDocumentInfo info;
Mono.TextEditor.MonoTextEditor diffTextEditor;
ComparisonWidget comparisonWidget;
- Gtk.Button buttonNext;
- Gtk.Button buttonPrev;
+ DocumentToolButton buttonNext;
+ DocumentToolButton buttonPrev;
Gtk.Button buttonDiff;
Gtk.Label labelOverview;
@@ -114,7 +114,8 @@ namespace MonoDevelop.VersionControl.Views
void SetButtonSensitivity ()
{
- this.buttonNext.Sensitive = this.buttonPrev.Sensitive = notebook1.Page == 0 && comparisonWidget.Diff != null && comparisonWidget.Diff.Count > 0;
+ this.buttonNext.GetNativeWidget<Gtk.Widget> ().Sensitive = this.buttonPrev.GetNativeWidget<Gtk.Widget> ().Sensitive =
+ notebook1.Page == 0 && comparisonWidget.Diff != null && comparisonWidget.Diff.Count > 0;
}
void HandleButtonDiffhandleClicked (object sender, EventArgs e)
diff --git a/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl.Views/DropDownBox.cs b/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl.Views/DropDownBox.cs
index 32e8313988..17cfb0693e 100644
--- a/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl.Views/DropDownBox.cs
+++ b/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl.Views/DropDownBox.cs
@@ -87,8 +87,8 @@ namespace MonoDevelop.VersionControl.Views
set;
}
- Window window = null;
- public Func<DropDownBox, Window> WindowRequestFunc = null;
+ Gtk.Window window = null;
+ public Func<DropDownBox, Gtk.Window> WindowRequestFunc = null;
public DropDownBox ()
@@ -110,12 +110,12 @@ namespace MonoDevelop.VersionControl.Views
window.WidthRequest = Allocation.Width;
int width, height;
window.GetSizeRequest (out width, out height);
- Gdk.Rectangle geometry = DesktopService.GetUsableMonitorGeometry (Screen, Screen.GetMonitorAtPoint (dx, dy));
+ Xwt.Rectangle geometry = DesktopService.GetUsableMonitorGeometry (Screen.Number, Screen.GetMonitorAtPoint (dx, dy));
if (dy + height > geometry.Bottom)
dy = oy + this.Allocation.Y - height;
if (dx + width > geometry.Right)
- dx = geometry.Right - width;
+ dx = (int)geometry.Right - width;
window.Move (dx, dy);
window.GetSizeRequest (out width, out height);
diff --git a/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl.Views/LogView.cs b/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl.Views/LogView.cs
index 85ddea19d3..4bd68c8f53 100644
--- a/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl.Views/LogView.cs
+++ b/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl.Views/LogView.cs
@@ -2,18 +2,20 @@ using System;
using System.IO;
using Gtk;
using MonoDevelop.Core;
+using MonoDevelop.Components;
using MonoDevelop.Components.Commands;
using MonoDevelop.Ide.Gui;
using MonoDevelop.Ide;
using System.Linq;
+using MonoDevelop.Components;
namespace MonoDevelop.VersionControl.Views
{
- public interface ILogView : IAttachableViewContent
+ public interface ILogView
{
}
- public class LogView : BaseView, ILogView
+ class LogView : BaseView, ILogView
{
LogWidget widget;
VersionInfo vinfo;
@@ -78,7 +80,7 @@ namespace MonoDevelop.VersionControl.Views
}
- public override Gtk.Widget Control {
+ public override Control Control {
get {
if (widget == null)
CreateControlFromInfo ();
@@ -86,9 +88,9 @@ namespace MonoDevelop.VersionControl.Views
}
}
- protected override void OnWorkbenchWindowChanged (EventArgs e)
+ protected override void OnWorkbenchWindowChanged ()
{
- base.OnWorkbenchWindowChanged (e);
+ base.OnWorkbenchWindowChanged ();
if (WorkbenchWindow != null && widget != null)
widget.SetToolbar (WorkbenchWindow.GetToolbar (this));
}
@@ -110,8 +112,7 @@ namespace MonoDevelop.VersionControl.Views
base.Dispose ();
}
- #region IAttachableViewContent implementation
- public void Selected ()
+ public void Init ()
{
if (info != null && !info.Started) {
widget.ShowLoading ();
@@ -119,17 +120,12 @@ namespace MonoDevelop.VersionControl.Views
}
}
- public void Deselected ()
- {
- }
-
- public void BeforeSave ()
+ #region IAttachableViewContent implementation
+ protected override void OnSelected ()
{
+ Init ();
}
- public void BaseContentChanged ()
- {
- }
#endregion
[CommandHandler (MonoDevelop.Ide.Commands.EditCommands.Copy)]
diff --git a/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl.Views/LogWidget.cs b/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl.Views/LogWidget.cs
index c56aba6cb6..bda3ab0a47 100644
--- a/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl.Views/LogWidget.cs
+++ b/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl.Views/LogWidget.cs
@@ -53,7 +53,7 @@ namespace MonoDevelop.VersionControl.Views
ListStore logstore = new ListStore (typeof (Revision), typeof(string));
FileTreeView treeviewFiles;
TreeStore changedpathstore;
- Gtk.Button revertButton, revertToButton, refreshButton;
+ DocumentToolButton revertButton, revertToButton, refreshButton;
SearchEntry searchEntry;
string currentFilter;
@@ -139,11 +139,11 @@ namespace MonoDevelop.VersionControl.Views
vpaned1 = vpaned1.ReplaceWithWidget (new VPanedThin () { HandleWidget = separator }, true);
revertButton = new DocumentToolButton ("vc-revert-command", GettextCatalog.GetString ("Revert changes from this revision"));
- revertButton.Sensitive = false;
+ revertButton.GetNativeWidget<Gtk.Widget> ().Sensitive = false;
revertButton.Clicked += new EventHandler (RevertRevisionClicked);
revertToButton = new DocumentToolButton ("vc-revert-command", GettextCatalog.GetString ("Revert to this revision"));
- revertToButton.Sensitive = false;
+ revertToButton.GetNativeWidget<Gtk.Widget> ().Sensitive = false;
revertToButton.Clicked += new EventHandler (RevertToRevisionClicked);
refreshButton = new DocumentToolButton (Gtk.Stock.Refresh, GettextCatalog.GetString ("Refresh"));
@@ -349,10 +349,10 @@ namespace MonoDevelop.VersionControl.Views
{
ShowLoading ();
info.Start (true);
- revertButton.Sensitive = revertToButton.Sensitive = false;
+ revertButton.GetNativeWidget<Gtk.Widget> ().Sensitive = revertToButton.GetNativeWidget<Gtk.Widget> ().Sensitive = false;
}
- void HandleTreeviewFilesDiffLineActivated (object sender, EventArgs e)
+ async void HandleTreeviewFilesDiffLineActivated (object sender, EventArgs e)
{
TreePath[] paths = treeviewFiles.Selection.GetSelectedRows ();
@@ -366,7 +366,7 @@ namespace MonoDevelop.VersionControl.Views
int line = diffRenderer.GetSelectedLine (paths[0]);
if (line == -1)
line = 1;
- var doc = IdeApp.Workbench.OpenDocument (fileName, line, 0, OpenDocumentOptions.Default | OpenDocumentOptions.OnlyInternalViewer);
+ var doc = await IdeApp.Workbench.OpenDocument (fileName, line, 0, OpenDocumentOptions.Default | OpenDocumentOptions.OnlyInternalViewer);
int i = 1;
foreach (var content in doc.Window.SubViewContents) {
DiffView diffView = content as DiffView;
@@ -664,7 +664,7 @@ namespace MonoDevelop.VersionControl.Views
if (d == null)
return;
- revertButton.Sensitive = revertToButton.Sensitive = true;
+ revertButton.GetNativeWidget<Gtk.Widget> ().Sensitive = revertToButton.GetNativeWidget<Gtk.Widget> ().Sensitive = true;
Gtk.TreeIter selectIter = Gtk.TreeIter.Zero;
bool select = false;
foreach (RevisionPath rp in info.Repository.GetRevisionChanges (d)) {
diff --git a/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl.Views/MergeView.cs b/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl.Views/MergeView.cs
index 8cb107fa2d..5408740683 100644
--- a/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl.Views/MergeView.cs
+++ b/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl.Views/MergeView.cs
@@ -24,11 +24,13 @@
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
using MonoDevelop.Ide.Gui;
+using MonoDevelop.Components;
using MonoDevelop.Core;
+using MonoDevelop.Components;
namespace MonoDevelop.VersionControl.Views
{
- public interface IMergeView : IAttachableViewContent
+ public interface IMergeView
{
}
@@ -37,7 +39,7 @@ namespace MonoDevelop.VersionControl.Views
VersionControlDocumentInfo info;
MergeWidget widget;
- public override Gtk.Widget Control {
+ public override Control Control {
get {
if (widget == null) {
widget = new MergeWidget ();
@@ -53,23 +55,11 @@ namespace MonoDevelop.VersionControl.Views
this.info = info;
}
- public void Selected ()
+ protected override void OnSelected ()
{
widget.UpdateLocalText ();
widget.info.Start ();
}
-
- public void Deselected ()
- {
- }
-
- public void BeforeSave ()
- {
- }
-
- public void BaseContentChanged ()
- {
- }
}
}
diff --git a/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl.Views/StatusView.cs b/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl.Views/StatusView.cs
index 22090f22be..9fa3c9bb52 100644
--- a/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl.Views/StatusView.cs
+++ b/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl.Views/StatusView.cs
@@ -8,6 +8,7 @@ using Mono.Addins;
using Gtk;
using MonoDevelop.Core;
+using MonoDevelop.Components;
using MonoDevelop.Components.Commands;
using MonoDevelop.Projects;
using MonoDevelop.Ide.Gui.Components;
@@ -290,9 +291,9 @@ namespace MonoDevelop.VersionControl.Views
Init ();
}
- protected override void OnWorkbenchWindowChanged (EventArgs e)
+ protected override void OnWorkbenchWindowChanged ()
{
- base.OnWorkbenchWindowChanged (e);
+ base.OnWorkbenchWindowChanged ();
if (WorkbenchWindow == null)
return;
@@ -357,10 +358,6 @@ namespace MonoDevelop.VersionControl.Views
toolbar.ShowAll ();
}
- public override string StockIconId {
- get { return "vc-status"; }
- }
-
int CompareNodes (Gtk.TreeModel model, Gtk.TreeIter a, Gtk.TreeIter b)
{
int col, val=0;
@@ -436,7 +433,7 @@ namespace MonoDevelop.VersionControl.Views
base.Dispose ();
}
- public override Gtk.Widget Control {
+ public override Control Control {
get {
return widget;
}
diff --git a/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl.Views/SubviewAttachmentHandler.cs b/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl.Views/SubviewAttachmentHandler.cs
index b95b373dea..0066ea4585 100644
--- a/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl.Views/SubviewAttachmentHandler.cs
+++ b/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl.Views/SubviewAttachmentHandler.cs
@@ -71,10 +71,10 @@ namespace MonoDevelop.VersionControl.Views
var item = new VersionControlItem (repo, project, document.FileName, false, null);
var vcInfo = new VersionControlDocumentInfo (document.PrimaryView, item, item.Repository);
- TryAttachView <IDiffView> (document, vcInfo, DiffCommand.DiffViewHandlers);
- TryAttachView <IBlameView> (document, vcInfo, BlameCommand.BlameViewHandlers);
- TryAttachView <ILogView> (document, vcInfo, LogCommand.LogViewHandlers);
- TryAttachView <IMergeView> (document, vcInfo, MergeCommand.MergeViewHandlers);
+ TryAttachView (document, vcInfo, DiffCommand.DiffViewHandlers);
+ TryAttachView (document, vcInfo, BlameCommand.BlameViewHandlers);
+ TryAttachView (document, vcInfo, LogCommand.LogViewHandlers);
+ TryAttachView (document, vcInfo, MergeCommand.MergeViewHandlers);
} catch (Exception ex) {
// If a user is hitting this, it will show a dialog box every time they
// switch to a document or open a document, so suppress the crash dialog
@@ -83,10 +83,9 @@ namespace MonoDevelop.VersionControl.Views
}
}
- static void TryAttachView <T>(Document document, VersionControlDocumentInfo info, string type)
- where T : IAttachableViewContent
+ static void TryAttachView (Document document, VersionControlDocumentInfo info, string type)
{
- var handler = AddinManager.GetExtensionObjects<IVersionControlViewHandler<T>> (type)
+ var handler = AddinManager.GetExtensionObjects<IVersionControlViewHandler> (type)
.FirstOrDefault (h => h.CanHandle (info.Item, info.Document));
if (handler != null)
document.Window.AttachViewContent (handler.CreateView (info));
diff --git a/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl/BlameCommand.cs b/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl/BlameCommand.cs
index 962f071d59..aaf261fb93 100644
--- a/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl/BlameCommand.cs
+++ b/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl/BlameCommand.cs
@@ -25,6 +25,7 @@
// THE SOFTWARE.
using System.Linq;
+using System.Threading.Tasks;
using Mono.Addins;
using MonoDevelop.Ide;
using MonoDevelop.Ide.Gui;
@@ -41,16 +42,16 @@ namespace MonoDevelop.VersionControl
return !item.IsDirectory
// FIXME: Review appending of Annotate support and use it.
&& item.VersionInfo.IsVersioned
- && AddinManager.GetExtensionObjects<IBlameViewHandler> (BlameViewHandlers).Any (h => h.CanHandle (item, null));
+ && AddinManager.GetExtensionObjects<IVersionControlViewHandler> (BlameViewHandlers).Any (h => h.CanHandle (item, null));
}
- public static bool Show (VersionControlItemList items, bool test)
+ public static async Task<bool> Show (VersionControlItemList items, bool test)
{
if (test)
return items.All (CanShow);
foreach (var item in items) {
- var document = IdeApp.Workbench.OpenDocument (item.Path, item.ContainerProject, OpenDocumentOptions.Default | OpenDocumentOptions.OnlyInternalViewer);
+ var document = await IdeApp.Workbench.OpenDocument (item.Path, item.ContainerProject, OpenDocumentOptions.Default | OpenDocumentOptions.OnlyInternalViewer);
if (document != null)
document.Window.SwitchView (document.Window.FindView<IBlameView> ());
}
diff --git a/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl/Commands.cs b/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl/Commands.cs
index af63bcf93e..be79ed4eff 100644
--- a/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl/Commands.cs
+++ b/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl/Commands.cs
@@ -243,7 +243,7 @@ namespace MonoDevelop.VersionControl
}
}
- class CurrentFileViewHandler<T> : FileVersionControlCommandHandler where T:IAttachableViewContent
+ class CurrentFileViewHandler<T> : FileVersionControlCommandHandler
{
protected override bool RunCommand (VersionControlItemList items, bool test)
{
diff --git a/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl/DefaultBlameViewHandler.cs b/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl/DefaultBlameViewHandler.cs
index 1259363f52..01d1846ea1 100644
--- a/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl/DefaultBlameViewHandler.cs
+++ b/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl/DefaultBlameViewHandler.cs
@@ -31,7 +31,7 @@ using MonoDevelop.Projects.Text;
namespace MonoDevelop.VersionControl
{
- public class DefaultBlameViewHandler : IBlameViewHandler
+ public class DefaultBlameViewHandler : IVersionControlViewHandler
{
public bool CanHandle (VersionControlItem item, DocumentView primaryView)
{
@@ -39,7 +39,7 @@ namespace MonoDevelop.VersionControl
&& item.Repository.GetFileIsText (item.Path);
}
- public IBlameView CreateView (VersionControlDocumentInfo info)
+ public BaseViewContent CreateView (VersionControlDocumentInfo info)
{
return new BlameView (info);
}
diff --git a/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl/DefaultDiffViewHandler.cs b/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl/DefaultDiffViewHandler.cs
index 4a2e775386..40ac9fa5ea 100644
--- a/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl/DefaultDiffViewHandler.cs
+++ b/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl/DefaultDiffViewHandler.cs
@@ -31,7 +31,7 @@ using MonoDevelop.Projects.Text;
namespace MonoDevelop.VersionControl
{
- public class DefaultDiffViewHandler : IDiffViewHandler
+ public class DefaultDiffViewHandler : IVersionControlViewHandler
{
public bool CanHandle (VersionControlItem item, DocumentView primaryView)
{
@@ -39,7 +39,7 @@ namespace MonoDevelop.VersionControl
&& item.Repository.GetFileIsText (item.Path);
}
- public IDiffView CreateView (VersionControlDocumentInfo info)
+ public BaseViewContent CreateView (VersionControlDocumentInfo info)
{
return new DiffView (info);
}
diff --git a/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl/DefaultLogViewHandler.cs b/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl/DefaultLogViewHandler.cs
index 9537bb7dfa..51b8c6b613 100644
--- a/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl/DefaultLogViewHandler.cs
+++ b/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl/DefaultLogViewHandler.cs
@@ -29,14 +29,14 @@ using MonoDevelop.VersionControl.Views;
namespace MonoDevelop.VersionControl
{
- public class DefaultLogViewHandler : ILogViewHandler
+ public class DefaultLogViewHandler : IVersionControlViewHandler
{
public bool CanHandle (VersionControlItem item, DocumentView primaryView)
{
return true;
}
- public ILogView CreateView (VersionControlDocumentInfo info)
+ public BaseViewContent CreateView (VersionControlDocumentInfo info)
{
return new LogView (info);
}
diff --git a/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl/DefaultMergeViewHandler.cs b/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl/DefaultMergeViewHandler.cs
index aba6756b08..ae646cd4b8 100644
--- a/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl/DefaultMergeViewHandler.cs
+++ b/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl/DefaultMergeViewHandler.cs
@@ -31,7 +31,7 @@ using MonoDevelop.Projects.Text;
namespace MonoDevelop.VersionControl
{
- public class DefaultMergeViewHandler : IMergeViewHandler
+ public class DefaultMergeViewHandler : IVersionControlViewHandler
{
public bool CanHandle (VersionControlItem item, DocumentView primaryView)
{
@@ -39,7 +39,7 @@ namespace MonoDevelop.VersionControl
&& item.Repository.GetFileIsText (item.Path);
}
- public IMergeView CreateView (VersionControlDocumentInfo info)
+ public BaseViewContent CreateView (VersionControlDocumentInfo info)
{
return new MergeView (info);
}
diff --git a/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl/DiffCommand.cs b/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl/DiffCommand.cs
index e865489318..46ee00b80d 100644
--- a/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl/DiffCommand.cs
+++ b/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl/DiffCommand.cs
@@ -25,6 +25,7 @@
// THE SOFTWARE.
using System.Linq;
+using System.Threading.Tasks;
using Mono.Addins;
using MonoDevelop.Ide;
using MonoDevelop.Ide.Gui;
@@ -40,16 +41,16 @@ namespace MonoDevelop.VersionControl
{
return !item.IsDirectory
&& item.VersionInfo.IsVersioned
- && AddinManager.GetExtensionObjects<IDiffViewHandler> (DiffViewHandlers).Any (h => h.CanHandle (item, null));
+ && AddinManager.GetExtensionObjects<IVersionControlViewHandler> (DiffViewHandlers).Any (h => h.CanHandle (item, null));
}
- public static bool Show (VersionControlItemList items, bool test)
+ public static async Task<bool> Show (VersionControlItemList items, bool test)
{
if (test)
return items.All (CanShow);
foreach (var item in items) {
- var document = IdeApp.Workbench.OpenDocument (item.Path, item.ContainerProject, OpenDocumentOptions.Default | OpenDocumentOptions.OnlyInternalViewer);
+ var document = await IdeApp.Workbench.OpenDocument (item.Path, item.ContainerProject, OpenDocumentOptions.Default | OpenDocumentOptions.OnlyInternalViewer);
if (document != null)
document.Window.SwitchView (document.Window.FindView<IDiffView> ());
}
diff --git a/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl/IVersionControlViewHandler.cs b/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl/IVersionControlViewHandler.cs
index da8611f941..2620d3c664 100644
--- a/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl/IVersionControlViewHandler.cs
+++ b/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl/IVersionControlViewHandler.cs
@@ -29,31 +29,10 @@ using MonoDevelop.Ide.Gui;
namespace MonoDevelop.VersionControl {
- public interface IVersionControlViewHandler<T>
- where T : IAttachableViewContent
+ public interface IVersionControlViewHandler
{
bool CanHandle (VersionControlItem item, DocumentView primaryView);
- T CreateView (VersionControlDocumentInfo info);
- }
-
- public interface IDiffViewHandler : IVersionControlViewHandler<IDiffView>
- {
-
- }
-
- public interface IBlameViewHandler : IVersionControlViewHandler<IBlameView>
- {
-
- }
-
- public interface ILogViewHandler : IVersionControlViewHandler<ILogView>
- {
-
- }
-
- public interface IMergeViewHandler : IVersionControlViewHandler<IMergeView>
- {
-
+ BaseViewContent CreateView (VersionControlDocumentInfo info);
}
}
diff --git a/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl/LogCommand.cs b/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl/LogCommand.cs
index 7e44c23b1d..8cce4231fd 100644
--- a/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl/LogCommand.cs
+++ b/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl/LogCommand.cs
@@ -25,6 +25,7 @@
// THE SOFTWARE.
using System.Linq;
+using System.Threading.Tasks;
using Mono.Addins;
using MonoDevelop.Ide;
using MonoDevelop.Ide.Gui;
@@ -40,11 +41,11 @@ namespace MonoDevelop.VersionControl
{
// We want directories to be able to view the log for an entire directory
// by selecting it from the solution pane
- return item.VersionInfo.IsVersioned
- && AddinManager.GetExtensionObjects<ILogViewHandler> (LogViewHandlers).Any (h => h.CanHandle (item, null));
+ return item.VersionInfo.IsVersioned &&
+ AddinManager.GetExtensionObjects<IVersionControlViewHandler> (LogViewHandlers).Any (h => h.CanHandle (item, null));
}
- public static bool Show (VersionControlItemList items, bool test)
+ public static async Task<bool> Show (VersionControlItemList items, bool test)
{
if (test)
return items.All (CanShow);
@@ -52,7 +53,7 @@ namespace MonoDevelop.VersionControl
foreach (var item in items) {
Document document = null;
if (!item.IsDirectory)
- document = IdeApp.Workbench.OpenDocument (item.Path, item.ContainerProject, OpenDocumentOptions.Default | OpenDocumentOptions.OnlyInternalViewer);
+ document = await IdeApp.Workbench.OpenDocument (item.Path, item.ContainerProject, OpenDocumentOptions.Default | OpenDocumentOptions.OnlyInternalViewer);
if (document != null) {
document.Window.SwitchView (document.Window.FindView<ILogView> ());
@@ -60,7 +61,7 @@ namespace MonoDevelop.VersionControl
VersionControlDocumentInfo info = new VersionControlDocumentInfo (null, item, item.Repository);
LogView logView = new LogView (info);
info.Document = IdeApp.Workbench.OpenDocument (logView, true).PrimaryView;
- logView.Selected ();
+ logView.Init ();
}
}
diff --git a/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl/MergeCommand.cs b/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl/MergeCommand.cs
index 840760d3f4..766a32d95a 100644
--- a/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl/MergeCommand.cs
+++ b/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl/MergeCommand.cs
@@ -25,6 +25,7 @@
// THE SOFTWARE.
using System.Linq;
+using System.Threading.Tasks;
using Mono.Addins;
using MonoDevelop.Ide;
using MonoDevelop.Ide.Gui;
@@ -40,16 +41,16 @@ namespace MonoDevelop.VersionControl
{
return !item.IsDirectory
&& item.VersionInfo.IsVersioned
- && AddinManager.GetExtensionObjects<IMergeViewHandler> (MergeViewHandlers).Any (h => h.CanHandle (item, null));
+ && AddinManager.GetExtensionObjects<IVersionControlViewHandler> (MergeViewHandlers).Any (h => h.CanHandle (item, null));
}
- public static bool Show (VersionControlItemList items, bool test)
+ public static async Task<bool> Show (VersionControlItemList items, bool test)
{
if (test)
return items.All (CanShow);
foreach (var item in items) {
- var document = IdeApp.Workbench.OpenDocument (item.Path, item.ContainerProject, OpenDocumentOptions.Default | OpenDocumentOptions.OnlyInternalViewer);
+ var document = await IdeApp.Workbench.OpenDocument (item.Path, item.ContainerProject, OpenDocumentOptions.Default | OpenDocumentOptions.OnlyInternalViewer);
if (document != null)
document.Window.SwitchView (document.Window.FindView<IMergeView> ());
}
diff --git a/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl/ResolveConflictsCommand.cs b/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl/ResolveConflictsCommand.cs
index 0691b5a7d8..dd599cfaea 100644
--- a/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl/ResolveConflictsCommand.cs
+++ b/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl/ResolveConflictsCommand.cs
@@ -29,18 +29,19 @@ using MonoDevelop.Ide;
using MonoDevelop.VersionControl.Views;
using MonoDevelop.Ide.Gui;
using MonoDevelop.Projects;
+using System.Threading.Tasks;
namespace MonoDevelop.VersionControl
{
public class ResolveConflictsCommand
{
- public static bool ResolveConflicts (VersionControlItemList list, bool test)
+ public static async Task<bool> ResolveConflicts (VersionControlItemList list, bool test)
{
if (test)
return list.All (s => (s.VersionInfo.Status & VersionStatus.Conflicted) == VersionStatus.Conflicted);
foreach (var item in list.Where (s => (s.VersionInfo.Status & VersionStatus.Conflicted) == VersionStatus.Conflicted)) {
- Document doc = IdeApp.Workbench.OpenDocument (item.Path, item.ContainerProject, true);
+ Document doc = await IdeApp.Workbench.OpenDocument (item.Path, item.ContainerProject, true);
foreach (var view in doc.Views) {
if (view.GetContent <MergeView> () != null)
view.Select ();
diff --git a/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl/VersionControlNodeExtension.cs b/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl/VersionControlNodeExtension.cs
index 6466169f67..0cb75e7881 100644
--- a/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl/VersionControlNodeExtension.cs
+++ b/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl/VersionControlNodeExtension.cs
@@ -10,7 +10,7 @@ using MonoDevelop.Components.Commands;
using MonoDevelop.Ide.Gui.Components;
using MonoDevelop.VersionControl.Views;
using MonoDevelop.Ide;
-
+using System.Threading.Tasks;
namespace MonoDevelop.VersionControl
{
@@ -222,177 +222,177 @@ namespace MonoDevelop.VersionControl
{
[AllowMultiSelection]
[CommandHandler (Commands.Update)]
- protected void OnUpdate() {
- RunCommand(Commands.Update, false);
+ protected async void OnUpdate() {
+ await RunCommand(Commands.Update, false);
}
[CommandUpdateHandler (Commands.Update)]
- protected void UpdateUpdate(CommandInfo item) {
- TestCommand(Commands.Update, item);
+ protected async void UpdateUpdate(CommandInfo item) {
+ await TestCommand(Commands.Update, item);
}
[AllowMultiSelection]
[CommandHandler (Commands.Diff)]
- protected void OnDiff() {
- RunCommand(Commands.Diff, false);
+ protected async void OnDiff() {
+ await RunCommand(Commands.Diff, false);
}
[CommandUpdateHandler (Commands.Diff)]
- protected void UpdateDiff(CommandInfo item) {
- TestCommand(Commands.Diff, item);
+ protected async void UpdateDiff(CommandInfo item) {
+ await TestCommand(Commands.Diff, item);
}
[AllowMultiSelection]
[CommandHandler (Commands.Log)]
- protected void OnLog() {
- RunCommand(Commands.Log, false);
+ protected async void OnLog() {
+ await RunCommand(Commands.Log, false);
}
[CommandUpdateHandler (Commands.Log)]
- protected void UpdateLog(CommandInfo item) {
- TestCommand(Commands.Log, item);
+ protected async void UpdateLog(CommandInfo item) {
+ await TestCommand(Commands.Log, item);
}
[AllowMultiSelection]
[CommandHandler (Commands.Status)]
- protected void OnStatus() {
- RunCommand(Commands.Status, false);
+ protected async void OnStatus() {
+ await RunCommand(Commands.Status, false);
}
[CommandUpdateHandler (Commands.Status)]
- protected void UpdateStatus(CommandInfo item) {
- TestCommand(Commands.Status, item);
+ protected async void UpdateStatus(CommandInfo item) {
+ await TestCommand(Commands.Status, item);
}
[AllowMultiSelection]
[CommandHandler (Commands.Add)]
- protected void OnAdd() {
- RunCommand(Commands.Add, false);
+ protected async void OnAdd() {
+ await RunCommand(Commands.Add, false);
}
[CommandUpdateHandler (Commands.Add)]
- protected void UpdateAdd(CommandInfo item) {
- TestCommand(Commands.Add, item);
+ protected async void UpdateAdd(CommandInfo item) {
+ await TestCommand(Commands.Add, item);
}
[AllowMultiSelection]
[CommandHandler (Commands.Remove)]
- protected void OnRemove() {
- RunCommand(Commands.Remove, false);
+ protected async void OnRemove() {
+ await RunCommand(Commands.Remove, false);
}
[CommandUpdateHandler (Commands.Remove)]
- protected void UpdateRemove(CommandInfo item) {
- TestCommand(Commands.Remove, item);
+ protected async void UpdateRemove(CommandInfo item) {
+ await TestCommand(Commands.Remove, item);
}
[CommandHandler (Commands.Publish)]
- protected void OnPublish()
+ protected async void OnPublish()
{
- RunCommand(Commands.Publish, false);
+ await RunCommand(Commands.Publish, false);
}
[CommandUpdateHandler (Commands.Publish)]
- protected void UpdatePublish(CommandInfo item) {
- TestCommand(Commands.Publish, item);
+ protected async void UpdatePublish(CommandInfo item) {
+ await TestCommand(Commands.Publish, item);
}
[AllowMultiSelection]
[CommandHandler (Commands.Revert)]
- protected void OnRevert() {
- RunCommand(Commands.Revert, false, false);
+ protected async void OnRevert() {
+ await RunCommand(Commands.Revert, false, false);
}
[CommandUpdateHandler (Commands.Revert)]
- protected void UpdateRevert(CommandInfo item) {
- TestCommand(Commands.Revert, item, false);
+ protected async void UpdateRevert(CommandInfo item) {
+ await TestCommand(Commands.Revert, item, false);
}
[AllowMultiSelection]
[CommandHandler (Commands.Lock)]
- protected void OnLock() {
- RunCommand(Commands.Lock, false);
+ protected async void OnLock() {
+ await RunCommand(Commands.Lock, false);
}
[CommandUpdateHandler (Commands.Lock)]
- protected void UpdateLock(CommandInfo item) {
- TestCommand(Commands.Lock, item);
+ protected async void UpdateLock(CommandInfo item) {
+ await TestCommand(Commands.Lock, item);
}
[AllowMultiSelection]
[CommandHandler (Commands.Unlock)]
- protected void OnUnlock() {
- RunCommand(Commands.Unlock, false);
+ protected async void OnUnlock() {
+ await RunCommand(Commands.Unlock, false);
}
[CommandUpdateHandler (Commands.Unlock)]
- protected void UpdateUnlock(CommandInfo item) {
- TestCommand(Commands.Unlock, item);
+ protected async void UpdateUnlock(CommandInfo item) {
+ await TestCommand(Commands.Unlock, item);
}
[AllowMultiSelection]
[CommandHandler (Commands.Annotate)]
- protected void OnAnnotate() {
- RunCommand(Commands.Annotate, false);
+ protected async void OnAnnotate() {
+ await RunCommand(Commands.Annotate, false);
}
[CommandUpdateHandler (Commands.Annotate)]
- protected void UpdateAnnotate(CommandInfo item) {
- TestCommand(Commands.Annotate, item);
+ protected async void UpdateAnnotate(CommandInfo item) {
+ await TestCommand(Commands.Annotate, item);
}
[AllowMultiSelection]
[CommandHandler (Commands.CreatePatch)]
- protected void OnCreatePatch() {
- RunCommand(Commands.CreatePatch, false);
+ protected async void OnCreatePatch() {
+ await RunCommand(Commands.CreatePatch, false);
}
[CommandUpdateHandler (Commands.CreatePatch)]
- protected void UpdateCreatePatch(CommandInfo item) {
- TestCommand(Commands.CreatePatch, item);
+ protected async void UpdateCreatePatch(CommandInfo item) {
+ await TestCommand(Commands.CreatePatch, item);
}
[AllowMultiSelection]
[CommandHandler (Commands.Ignore)]
- protected void OnIgnore ()
+ protected async void OnIgnore ()
{
- RunCommand(Commands.Ignore, false);
+ await RunCommand(Commands.Ignore, false);
}
[CommandUpdateHandler (Commands.Ignore)]
- protected void UpdateIgnore (CommandInfo item)
+ protected async void UpdateIgnore (CommandInfo item)
{
- TestCommand(Commands.Ignore, item);
+ await TestCommand(Commands.Ignore, item);
}
[AllowMultiSelection]
[CommandHandler (Commands.Unignore)]
- protected void OnUnignore ()
+ protected async void OnUnignore ()
{
- RunCommand(Commands.Unignore, false);
+ await RunCommand(Commands.Unignore, false);
}
[CommandUpdateHandler (Commands.Unignore)]
- protected void UpdateUnignore (CommandInfo item)
+ protected async void UpdateUnignore (CommandInfo item)
{
- TestCommand(Commands.Unignore, item);
+ await TestCommand(Commands.Unignore, item);
}
[CommandHandler (Commands.ResolveConflicts)]
- protected void OnResolveConflicts ()
+ protected async void OnResolveConflicts ()
{
- RunCommand (Commands.ResolveConflicts, false, false);
+ await RunCommand (Commands.ResolveConflicts, false, false);
}
[CommandUpdateHandler (Commands.ResolveConflicts)]
- protected void UpdateResolveConflicts (CommandInfo item)
+ protected async void UpdateResolveConflicts (CommandInfo item)
{
- TestCommand (Commands.ResolveConflicts, item, false);
+ await TestCommand (Commands.ResolveConflicts, item, false);
}
- private void TestCommand(Commands cmd, CommandInfo item, bool projRecurse = true)
+ private async Task<TestResult> TestCommand(Commands cmd, CommandInfo item, bool projRecurse = true)
{
- TestResult res = RunCommand(cmd, true, projRecurse);
+ TestResult res = await RunCommand(cmd, true, projRecurse);
if (res == TestResult.NoVersionControl && cmd == Commands.Log) {
// Use the update command to show the "not available" message
item.Icon = null;
@@ -402,10 +402,12 @@ namespace MonoDevelop.VersionControl
else
item.Text = GettextCatalog.GetString ("This project or folder is not under version control");
} else
- item.Visible = res == TestResult.Enable;
+ item.Visible = res == TestResult.Enable;
+
+ return res;
}
- private TestResult RunCommand (Commands cmd, bool test, bool projRecurse = true)
+ private async Task<TestResult> RunCommand (Commands cmd, bool test, bool projRecurse = true)
{
VersionControlItemList items = GetItems (projRecurse);
@@ -426,10 +428,10 @@ namespace MonoDevelop.VersionControl
res = UpdateCommand.Update (items, test);
break;
case Commands.Diff:
- res = DiffCommand.Show (items, test);
+ res = await DiffCommand.Show (items, test);
break;
case Commands.Log:
- res = LogCommand.Show (items, test);
+ res = await LogCommand.Show (items, test);
break;
case Commands.Status:
res = StatusView.Show (items, test, false);
@@ -455,7 +457,7 @@ namespace MonoDevelop.VersionControl
res = PublishCommand.Publish (it.WorkspaceObject, it.Path, test);
break;
case Commands.Annotate:
- res = BlameCommand.Show (items, test);
+ res = await BlameCommand.Show (items, test);
break;
case Commands.CreatePatch:
res = CreatePatchCommand.CreatePatch (items, test);
@@ -467,7 +469,7 @@ namespace MonoDevelop.VersionControl
res = UnignoreCommand.Unignore (items, test);
break;
case Commands.ResolveConflicts:
- res = ResolveConflictsCommand.ResolveConflicts (items, test);
+ res = await ResolveConflictsCommand.ResolveConflicts (items, test);
break;
}
}
diff --git a/main/src/addins/VersionControl/MonoDevelop.VersionControl/VersionControl.addin.xml b/main/src/addins/VersionControl/MonoDevelop.VersionControl/VersionControl.addin.xml
index f659d95015..bdabcfa114 100644
--- a/main/src/addins/VersionControl/MonoDevelop.VersionControl/VersionControl.addin.xml
+++ b/main/src/addins/VersionControl/MonoDevelop.VersionControl/VersionControl.addin.xml
@@ -27,7 +27,7 @@
<ExtensionPoint path = "/MonoDevelop/VersionControl/DiffViewHandler" name = "Diff view handler">
<Description>Handler used to create the a diff view which can display the current file.</Description>
- <ExtensionNode name="Handler" objectType="MonoDevelop.VersionControl.IDiffViewHandler" />
+ <ExtensionNode name="Handler" objectType="MonoDevelop.VersionControl.IVersionControlViewHandler" />
</ExtensionPoint>
<Extension path = "/MonoDevelop/VersionControl/DiffViewHandler">
@@ -36,7 +36,7 @@
<ExtensionPoint path = "/MonoDevelop/VersionControl/BlameViewHandler" name = "Blame view handler">
<Description>Handler used to create the a blame view which can display the current file.</Description>
- <ExtensionNode name="Handler" objectType="MonoDevelop.VersionControl.IBlameViewHandler" />
+ <ExtensionNode name="Handler" objectType="MonoDevelop.VersionControl.IVersionControlViewHandler" />
</ExtensionPoint>
<Extension path = "/MonoDevelop/VersionControl/BlameViewHandler">
@@ -45,7 +45,7 @@
<ExtensionPoint path = "/MonoDevelop/VersionControl/LogViewHandler" name = "Log view handler">
<Description>Handler used to create the a log view which can display the current file.</Description>
- <ExtensionNode name="Handler" objectType="MonoDevelop.VersionControl.ILogViewHandler" />
+ <ExtensionNode name="Handler" objectType="MonoDevelop.VersionControl.IVersionControlViewHandler" />
</ExtensionPoint>
<Extension path = "/MonoDevelop/VersionControl/LogViewHandler">
@@ -54,7 +54,7 @@
<ExtensionPoint path = "/MonoDevelop/VersionControl/MergeViewHandler" name = "Merge view handler">
<Description>Handler used to create the a merge view which can display the current file.</Description>
- <ExtensionNode name="Handler" objectType="MonoDevelop.VersionControl.IMergeViewHandler" />
+ <ExtensionNode name="Handler" objectType="MonoDevelop.VersionControl.IVersionControlViewHandler" />
</ExtensionPoint>
<Extension path = "/MonoDevelop/VersionControl/MergeViewHandler">
diff --git a/main/src/addins/WindowsPlatform/WindowsPlatform/GdkWin32.cs b/main/src/addins/WindowsPlatform/WindowsPlatform/GdkWin32.cs
index 6c02e62578..5b595b007b 100644
--- a/main/src/addins/WindowsPlatform/WindowsPlatform/GdkWin32.cs
+++ b/main/src/addins/WindowsPlatform/WindowsPlatform/GdkWin32.cs
@@ -58,6 +58,12 @@ namespace MonoDevelop.Platform
[DllImport (Win32.USER32, SetLastError=true, CharSet=CharSet.Auto)]
static extern uint RegisterWindowMessage (string lpString);
+ public static IntPtr HgdiobjGet (MonoDevelop.Components.Window window)
+ {
+ Gtk.Window gtkWindow = window;
+ return HgdiobjGet (gtkWindow.GdkWindow);
+ }
+
public static IntPtr HgdiobjGet (Gdk.Drawable drawable)
{
return gdk_win32_drawable_get_handle (drawable.Handle);
diff --git a/main/src/addins/WindowsPlatform/WindowsPlatform/JumpList.cs b/main/src/addins/WindowsPlatform/WindowsPlatform/JumpList.cs
index 67ec27e51e..4c907433e8 100644
--- a/main/src/addins/WindowsPlatform/WindowsPlatform/JumpList.cs
+++ b/main/src/addins/WindowsPlatform/WindowsPlatform/JumpList.cs
@@ -76,7 +76,7 @@ namespace MonoDevelop.Platform
{
Taskbar.JumpList jumplist = Taskbar.JumpList.CreateJumpListForIndividualWindow (
MonoDevelop.Core.BrandingService.ApplicationName,
- GdkWin32.HgdiobjGet (MessageService.RootWindow.GdkWindow)
+ GdkWin32.HgdiobjGet (MessageService.RootWindow)
);
jumplist.KnownCategoryToDisplay = Taskbar.JumpListKnownCategoryType.Neither;
diff --git a/main/src/addins/WindowsPlatform/WindowsPlatform/MainToolbar/TitleMenuItem.cs b/main/src/addins/WindowsPlatform/WindowsPlatform/MainToolbar/TitleMenuItem.cs
index 39484f8239..febaddd336 100644
--- a/main/src/addins/WindowsPlatform/WindowsPlatform/MainToolbar/TitleMenuItem.cs
+++ b/main/src/addins/WindowsPlatform/WindowsPlatform/MainToolbar/TitleMenuItem.cs
@@ -215,6 +215,8 @@ namespace WindowsPlatform.MainToolbar
if (!hasCommand)
return;
+ SubmenuClosing?.Invoke (this, e);
+
Xwt.Application.Invoke(() => {
if (commandArrayInfo != null) {
manager.DispatchCommand (menuEntry.CommandId, commandArrayInfo.DataItem, initialCommandTarget, commandSource);
@@ -229,6 +231,7 @@ namespace WindowsPlatform.MainToolbar
DesktopService.ShowUrl (menuLinkEntry.Url);
}
+ internal event EventHandler SubmenuClosing;
readonly MonoDevelop.Components.Commands.CommandManager manager;
readonly object initialCommandTarget;
readonly CommandSource commandSource;
diff --git a/main/src/addins/WindowsPlatform/WindowsPlatform/WindowsPlatform.cs b/main/src/addins/WindowsPlatform/WindowsPlatform/WindowsPlatform.cs
index 8e4df306a5..82c7eb6ac2 100644
--- a/main/src/addins/WindowsPlatform/WindowsPlatform/WindowsPlatform.cs
+++ b/main/src/addins/WindowsPlatform/WindowsPlatform/WindowsPlatform.cs
@@ -115,8 +115,8 @@ namespace MonoDevelop.Platform
};
foreach (CommandEntrySet ce in ces)
{
- var item = new TitleMenuItem(commandManager, ce);
- item.SubmenuClosed += (o, e) =>
+ var item = new TitleMenuItem(commandManager, ce);
+ item.SubmenuClosing += (o, e) =>
{
bool shouldFocusIde = !mainMenu.Items.OfType<MenuItem>().Any(mi => mi.IsSubmenuOpen);
if (shouldFocusIde)
@@ -289,8 +289,9 @@ namespace MonoDevelop.Platform
[DllImport (Win32.USER32)]
extern static int GetMonitorInfoA (IntPtr hmonitor, ref MonitorInfo info);
- public override Gdk.Rectangle GetUsableMonitorGeometry (Gdk.Screen screen, int monitor_id)
+ public override Xwt.Rectangle GetUsableMonitorGeometry (int screenNumber, int monitor_id)
{
+ var screen = Gdk.Display.Default.GetScreen (screenNumber);
Gdk.Rectangle geometry = screen.GetMonitorGeometry (monitor_id);
List<MonitorInfo> screens = new List<MonitorInfo> ();
@@ -321,7 +322,7 @@ namespace MonoDevelop.Platform
int y = geometry.Y + (visible.Top - frame.Top);
int height = visible.Height;
- return new Gdk.Rectangle (x, y, width, height);
+ return new Xwt.Rectangle (x, y, width, height);
}
static ProcessStartInfo CreateConsoleStartInfo (
diff --git a/main/src/addins/Xml/Editor/BaseXmlEditorExtension.cs b/main/src/addins/Xml/Editor/BaseXmlEditorExtension.cs
index 2204f06693..70bd5e151f 100644
--- a/main/src/addins/Xml/Editor/BaseXmlEditorExtension.cs
+++ b/main/src/addins/Xml/Editor/BaseXmlEditorExtension.cs
@@ -706,7 +706,7 @@ namespace MonoDevelop.Xml.Editor
public event EventHandler<DocumentPathChangedEventArgs> PathChanged;
- public Widget CreatePathWidget (int index)
+ public Control CreatePathWidget (int index)
{
if (ownerProjects.Count > 1 && index == 0) {
var window = new DropDownBoxListWindow (new DataProvider (this));
diff --git a/main/src/addins/Xml/Editor/XmlEditorOptionsPanel.cs b/main/src/addins/Xml/Editor/XmlEditorOptionsPanel.cs
index e9e6cc337a..a1106855ec 100644
--- a/main/src/addins/Xml/Editor/XmlEditorOptionsPanel.cs
+++ b/main/src/addins/Xml/Editor/XmlEditorOptionsPanel.cs
@@ -22,8 +22,8 @@
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-using System;
-using Gtk;
+using System;
+using MonoDevelop.Components;
using MonoDevelop.Ide.Gui.Dialogs;
using MonoDevelop.Core;
@@ -36,7 +36,7 @@ namespace MonoDevelop.Xml.Editor
{
XmlEditorOptionsPanelWidget widget;
- public override Widget CreatePanelWidget ()
+ public override Control CreatePanelWidget ()
{
widget = new XmlEditorOptionsPanelWidget();
widget.AutoCompleteElements = XmlEditorOptions.AutoCompleteElements;
diff --git a/main/src/addins/Xml/Editor/XmlSchemasPanel.cs b/main/src/addins/Xml/Editor/XmlSchemasPanel.cs
index bae0f24d56..cf0820b173 100644
--- a/main/src/addins/Xml/Editor/XmlSchemasPanel.cs
+++ b/main/src/addins/Xml/Editor/XmlSchemasPanel.cs
@@ -24,7 +24,7 @@
using System;
-using Gtk;
+using MonoDevelop.Components;
using MonoDevelop.Ide.Gui.Dialogs;
namespace MonoDevelop.Xml.Editor
@@ -36,7 +36,7 @@ namespace MonoDevelop.Xml.Editor
{
XmlSchemasPanelWidget widget;
- public override Widget CreatePanelWidget ()
+ public override Control CreatePanelWidget ()
{
widget = new XmlSchemasPanelWidget ();
widget.LoadUserSchemas (XmlSchemaManager.UserSchemas);
diff --git a/main/src/addins/Xml/Formatting/XmlFormattingPolicyPanel.cs b/main/src/addins/Xml/Formatting/XmlFormattingPolicyPanel.cs
index 93405e5ac1..1e3ff024e8 100644
--- a/main/src/addins/Xml/Formatting/XmlFormattingPolicyPanel.cs
+++ b/main/src/addins/Xml/Formatting/XmlFormattingPolicyPanel.cs
@@ -25,7 +25,7 @@
// THE SOFTWARE.
-using Gtk;
+using MonoDevelop.Components;
using MonoDevelop.Ide.Gui.Dialogs;
namespace MonoDevelop.Xml.Formatting
@@ -34,7 +34,7 @@ namespace MonoDevelop.Xml.Formatting
{
XmlFormattingPolicyPanelWidget panel;
- public override Widget CreatePanelWidget ()
+ public override Control CreatePanelWidget ()
{
panel = new XmlFormattingPolicyPanelWidget ();
return panel;
diff --git a/main/src/core/Mono.Texteditor/Mono.TextEditor.Highlighting/ColorScheme.cs b/main/src/core/Mono.Texteditor/Mono.TextEditor.Highlighting/ColorScheme.cs
index c06917cc8b..9e49c331ea 100644
--- a/main/src/core/Mono.Texteditor/Mono.TextEditor.Highlighting/ColorScheme.cs
+++ b/main/src/core/Mono.Texteditor/Mono.TextEditor.Highlighting/ColorScheme.cs
@@ -202,6 +202,12 @@ namespace Mono.TextEditor.Highlighting
[ColorDescription("Message Bubble Warning IconMargin")]
public AmbientColor MessageBubbleWarningIconMargin { get; private set; }
+ [ColorDescription("Link Color")]
+ public AmbientColor LinkColor { get; private set; }
+
+ [ColorDescription("Link Color(Active)")]
+ public AmbientColor ActiveLinkColor { get; private set; }
+
#endregion
#region Text Colors
@@ -627,6 +633,25 @@ namespace Mono.TextEditor.Highlighting
[ColorDescription(ScriptStringKey, VSSetting="Script String")]
public ChunkStyle ScriptString { get; private set; }
+ public const string RegexSetConstructsKey = "String(Regex Set Constructs)";
+ [ColorDescription(RegexSetConstructsKey)]
+ public ChunkStyle RegexSetConstructs { get; private set; }
+
+ public const string RegexCharacterClassKey = "String(Regex Character Class)";
+ [ColorDescription(RegexCharacterClassKey)]
+ public ChunkStyle RegexCharacterClass { get; private set; }
+
+ public const string RegexGroupingConstructsKey = "String(Regex Grouping Constructs)";
+ [ColorDescription(RegexGroupingConstructsKey)]
+ public ChunkStyle RegexGroupingConstructs { get; private set; }
+
+ public const string RegexEscapeCharacterKey = "String(Regex Escape Character)";
+ [ColorDescription(RegexEscapeCharacterKey)]
+ public ChunkStyle RegexEscapeCharacter { get; private set; }
+
+ public const string RegexAltEscapeCharacterKey = "String(Regex Alt Escape Character)";
+ [ColorDescription(RegexAltEscapeCharacterKey)]
+ public ChunkStyle RegexAltEscapeCharacter { get; private set; }
#endregion
public sealed class PropertyDescription
diff --git a/main/src/core/Mono.Texteditor/Mono.TextEditor/Gui/TextArea.cs b/main/src/core/Mono.Texteditor/Mono.TextEditor/Gui/TextArea.cs
index 5c6bf9d195..fd5a6b01d4 100644
--- a/main/src/core/Mono.Texteditor/Mono.TextEditor/Gui/TextArea.cs
+++ b/main/src/core/Mono.Texteditor/Mono.TextEditor/Gui/TextArea.cs
@@ -313,7 +313,7 @@ namespace Mono.TextEditor
nextTipOffset = tipOffset;
nextTipScheduledTime = DateTime.FromBinary (0);
tipItem = null;
- TooltipTimer ();
+ TooltipTimer ();
}
}
return 0; //FALSE
@@ -650,6 +650,7 @@ namespace Mono.TextEditor
{
var result = base.OnFocusOutEvent (evnt);
imContextNeedsReset = true;
+ mouseButtonPressed = 0;
imContext.FocusOut ();
RemoveFocusOutTimerId ();
diff --git a/main/src/core/Mono.Texteditor/Mono.TextEditor/Gui/TextViewMargin.cs b/main/src/core/Mono.Texteditor/Mono.TextEditor/Gui/TextViewMargin.cs
index 5c3207b18c..c544ae81dc 100644
--- a/main/src/core/Mono.Texteditor/Mono.TextEditor/Gui/TextViewMargin.cs
+++ b/main/src/core/Mono.Texteditor/Mono.TextEditor/Gui/TextViewMargin.cs
@@ -1024,12 +1024,26 @@ namespace Mono.TextEditor
layoutDict [line] = descriptor;
}
// textEditor.GetTextEditorData ().HeightTree.SetLineHeight (line.LineNumber, System.Math.Max (LineHeight, wrapper.Height));
+ OnLineShown (line);
return wrapper;
} finally {
sw.Stop ();
}
}
+ void OnLineShown (DocumentLine line)
+ {
+ LineShown?.Invoke (this, new LineEventArgs (line));
+ }
+
+ public event EventHandler<LineEventArgs> LineShown;
+
+ public IEnumerable<DocumentLine> CachedLine {
+ get {
+ return layoutDict.Keys;
+ }
+ }
+
public void RemoveCachedLine (DocumentLine line)
{
if (line == null)
@@ -1896,6 +1910,7 @@ namespace Mono.TextEditor
string link = GetLink != null ? GetLink (args) : null;
if (!String.IsNullOrEmpty (link)) {
+ textEditor.ClearSelection ();
textEditor.FireLinkEvent (link, args.Button, args.ModifierState);
return;
}
@@ -2039,6 +2054,28 @@ namespace Mono.TextEditor
{
if (args.Button != 2 && !InSelectionDrag)
textEditor.ClearSelection ();
+
+ DocumentLine line = Document.GetLine (clickLocation.Line);
+ bool isHandled = false;
+ if (line != null) {
+ foreach (TextLineMarker marker in line.Markers) {
+ if (marker is IActionTextLineMarker) {
+ isHandled |= ((IActionTextLineMarker)marker).MouseReleased(textEditor, args);
+ if (isHandled)
+ break;
+ }
+ }
+ var locNotSnapped = PointToLocation (args.X, args.Y, snapCharacters: false);
+ foreach (var marker in Document.GetTextSegmentMarkersAt (Document.GetOffset (locNotSnapped)).Where (m => m.IsVisible)) {
+ if (marker is IActionTextLineMarker) {
+ isHandled |= ((IActionTextLineMarker)marker).MouseReleased (textEditor, args);
+ if (isHandled)
+ break;
+ }
+ }
+ }
+
+
InSelectionDrag = false;
if (inDrag)
Caret.Location = clickLocation;
@@ -2226,6 +2263,7 @@ namespace Mono.TextEditor
var line = Document.GetLine (loc.Line);
var oldHoveredLine = HoveredLine;
HoveredLine = line;
+ HoveredLocation = loc;
OnHoveredLineChanged (new LineEventArgs (oldHoveredLine));
var hoverResult = new TextLineMarkerHoverResult ();
@@ -2537,6 +2575,8 @@ namespace Mono.TextEditor
}
}
+ public DocumentLocation HoveredLocation { get; private set; }
+
[Flags]
public enum CairoCorners
{
diff --git a/main/src/core/Mono.Texteditor/Mono.TextEditor/TextLineMarker.cs b/main/src/core/Mono.Texteditor/Mono.TextEditor/TextLineMarker.cs
index a8eb35b235..f7f15503ec 100644
--- a/main/src/core/Mono.Texteditor/Mono.TextEditor/TextLineMarker.cs
+++ b/main/src/core/Mono.Texteditor/Mono.TextEditor/TextLineMarker.cs
@@ -41,7 +41,8 @@ namespace Mono.TextEditor
/// true, if the mouse press was handled - false otherwise.
/// </returns>
bool MousePressed (MonoTextEditor editor, MarginMouseEventArgs args);
-
+ bool MouseReleased (MonoTextEditor editor, MarginMouseEventArgs args);
+
void MouseHover (MonoTextEditor editor, MarginMouseEventArgs args, TextLineMarkerHoverResult result);
}
diff --git a/main/src/core/Mono.Texteditor/Styles/DefaultStyle.json b/main/src/core/Mono.Texteditor/Styles/DefaultStyle.json
index 79d200375b..f1506de786 100644
--- a/main/src/core/Mono.Texteditor/Styles/DefaultStyle.json
+++ b/main/src/core/Mono.Texteditor/Styles/DefaultStyle.json
@@ -103,7 +103,11 @@
{ "name":"Message Bubble Warning Counter", "color":"white", "secondcolor":"#e68100" },
{ "name":"Message Bubble Warning IconMargin", "color":"#e68100", "bordercolor":"#c76f00" },
{ "name":"Message Bubble Warning Line", "color":"#fff1da" },
- { "name":"Message Bubble Warning Tooltip", "color":"#D1590B" }
+ { "name":"Message Bubble Warning Tooltip", "color":"#D1590B" },
+
+ { "name":"Link Color", "color":"#0645ad" },
+ { "name":"Link Color(Active)", "color":"#faa700" }
+
],
"text":[
@@ -128,6 +132,11 @@
{ "name":"String", "fore":"literal-orange" },
{ "name":"String(Escape)", "fore":"literal-escape" },
{ "name":"String(C# @ Verbatim)", "fore":"literal-orange" },
+ { "name":"String(Regex Set Constructs)", "fore":"#e5ae41" },
+ { "name":"String(Regex Character Class)", "fore":"#6fb3f8" },
+ { "name":"String(Regex Grouping Constructs)", "fore":"#2b922b" },
+ { "name":"String(Regex Escape Character)", "fore":"#ff0d80" },
+ { "name":"String(Regex Alt Escape Character)", "fore":"#faafba" },
{ "name":"Number", "fore":"literal-orange" },
diff --git a/main/src/core/MonoDevelop.Core/MonoDevelop.Projects.MSBuild.Conditions/ConditionedPropertyCollection.cs b/main/src/core/MonoDevelop.Core/CoreExtensions.cs
index 7ff9f3a970..68eaceeb02 100644
--- a/main/src/core/MonoDevelop.Core/MonoDevelop.Projects.MSBuild.Conditions/ConditionedPropertyCollection.cs
+++ b/main/src/core/MonoDevelop.Core/CoreExtensions.cs
@@ -1,5 +1,5 @@
-//
-// ConditionedPropertyCollection.cs
+//
+// CoreExtensions.cs
//
// Author:
// Lluis Sanchez Gual <lluis@xamarin.com>
@@ -23,20 +23,17 @@
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
-using System;
+using System.Collections;
using System.Collections.Generic;
+using System.Linq;
-namespace MonoDevelop.Projects.MSBuild.Conditions
+namespace System
{
- class ConditionedPropertyCollection : Dictionary<string, List<string>>
+ public static class CoreExtensions
{
- public void AddProperty (string name, string value)
+ public static IEnumerable<T> Concat<T> (this IEnumerable<T> e, T item)
{
- List<string> list;
- if (!TryGetValue (name, out list))
- Add (name, list = new List<string> ());
- if (!list.Contains (value))
- list.Add (value);
+ return e.Concat (Enumerable.Repeat (item, 1));
}
}
}
diff --git a/main/src/core/MonoDevelop.Core/MonoDevelop.Core.Assemblies/MonoRuntimeInfo.cs b/main/src/core/MonoDevelop.Core/MonoDevelop.Core.Assemblies/MonoRuntimeInfo.cs
index 164ed5c2e3..afb2374bed 100644
--- a/main/src/core/MonoDevelop.Core/MonoDevelop.Core.Assemblies/MonoRuntimeInfo.cs
+++ b/main/src/core/MonoDevelop.Core/MonoDevelop.Core.Assemblies/MonoRuntimeInfo.cs
@@ -39,6 +39,9 @@ namespace MonoDevelop.Core.Assemblies
{
[ItemProperty]
string prefix;
+
+ [ItemProperty]
+ bool? force64or32bit;
string monoVersion = "Unknown";
Dictionary<string,string> envVars = new Dictionary<string, string> ();
@@ -48,16 +51,21 @@ namespace MonoDevelop.Core.Assemblies
internal MonoRuntimeInfo ()
{
}
-
- public MonoRuntimeInfo (string prefix)
+
+ public MonoRuntimeInfo (string prefix, bool? force64or32bit = null)
{
+ this.force64or32bit = force64or32bit;
this.prefix = prefix;
Initialize ();
}
-
+
public string Prefix {
get { return prefix; }
}
+
+ public bool? Force64or32bit {
+ get { return force64or32bit; }
+ }
/// <summary>
/// This string is strictly for displaying to the user or logging. It should never be used for version checks.
@@ -70,7 +78,10 @@ namespace MonoDevelop.Core.Assemblies
}
public string DisplayName {
- get { return "Mono " + MonoVersion + " (" + prefix + ")"; }
+ get {
+ return "Mono " + MonoVersion + " (" + prefix + ")" +
+ (force64or32bit.HasValue ? (force64or32bit.Value ? " (64 bit)" : " (32 bit)") : "");
+ }
}
public bool IsValidRuntime {
@@ -103,7 +114,7 @@ namespace MonoDevelop.Core.Assemblies
StringWriter output = new StringWriter ();
try {
string monoPath = Path.Combine (prefix, "bin");
- monoPath = Path.Combine (monoPath, "mono");
+ monoPath = Path.Combine (monoPath, force64or32bit.HasValue ? (force64or32bit.Value ? "mono64" : "mono32") : "mono");
ProcessStartInfo pi = new ProcessStartInfo (monoPath, "--version");
pi.UseShellExecute = false;
pi.RedirectStandardOutput = true;
diff --git a/main/src/core/MonoDevelop.Core/MonoDevelop.Core.Assemblies/MonoTargetRuntime.cs b/main/src/core/MonoDevelop.Core/MonoDevelop.Core.Assemblies/MonoTargetRuntime.cs
index 84fc117ddc..a939c98153 100644
--- a/main/src/core/MonoDevelop.Core/MonoDevelop.Core.Assemblies/MonoTargetRuntime.cs
+++ b/main/src/core/MonoDevelop.Core/MonoDevelop.Core.Assemblies/MonoTargetRuntime.cs
@@ -99,7 +99,7 @@ namespace MonoDevelop.Core.Assemblies
public override string DisplayName {
get {
if (!IsRunning)
- return base.DisplayName + " (" + Prefix + ")";
+ return base.DisplayName + " (" + Prefix + ")" + (monoRuntimeInfo.Force64or32bit.HasValue ? monoRuntimeInfo.Force64or32bit.Value ? " (64bit)" : " (32bit)" : "");
else
return base.DisplayName;
}
diff --git a/main/src/core/MonoDevelop.Core/MonoDevelop.Core.Assemblies/MonoTargetRuntimeFactory.cs b/main/src/core/MonoDevelop.Core/MonoDevelop.Core.Assemblies/MonoTargetRuntimeFactory.cs
index 777f3e5399..3a8cd189d9 100644
--- a/main/src/core/MonoDevelop.Core/MonoDevelop.Core.Assemblies/MonoTargetRuntimeFactory.cs
+++ b/main/src/core/MonoDevelop.Core/MonoDevelop.Core.Assemblies/MonoTargetRuntimeFactory.cs
@@ -32,19 +32,38 @@ using MonoDevelop.Core.Serialization;
namespace MonoDevelop.Core.Assemblies
{
- class MonoTargetRuntimeFactory: ITargetRuntimeFactory
+ class MonoTargetRuntimeFactory : ITargetRuntimeFactory
{
static RuntimeCollection customRuntimes = new RuntimeCollection ();
static string configFile = UserProfile.Current.ConfigDir.Combine ("mono-runtimes.xml");
- static string[] commonLinuxPrefixes = new string[] { "/usr", "/usr/local" };
-
+ static string [] commonLinuxPrefixes = new string [] { "/usr", "/usr/local" };
+
static MonoTargetRuntimeFactory ()
{
LoadRuntimes ();
}
-
+
const string MAC_FRAMEWORK_DIR = "/Library/Frameworks/Mono.framework/Versions";
+ static IEnumerable<MonoRuntimeInfo> GetAllArchitecturesOfRuntimes (string dir)
+ {
+ var rinfo64 = new MonoRuntimeInfo (dir, true);
+ var rinfo32 = new MonoRuntimeInfo (dir, false);
+ if (rinfo64.IsValidRuntime && rinfo32.IsValidRuntime) {
+ yield return rinfo64;
+ yield return rinfo32;
+ } else if (rinfo64.IsValidRuntime) {
+ yield return rinfo64;
+ } else if (rinfo32.IsValidRuntime) {
+ yield return rinfo32;
+ } else {
+ var rinfo = new MonoRuntimeInfo (dir, null);
+ if (rinfo.IsValidRuntime) {
+ yield return rinfo;
+ }
+ }
+ }
+
public IEnumerable<TargetRuntime> CreateRuntimes ()
{
MonoRuntimeInfo currentRuntime = MonoRuntimeInfo.FromCurrentRuntime ();
@@ -54,34 +73,36 @@ namespace MonoDevelop.Core.Assemblies
if (Platform.IsWindows) {
string progs = Environment.GetFolderPath (Environment.SpecialFolder.ProgramFiles);
foreach (string dir in Directory.GetDirectories (progs, "Mono*")) {
- MonoRuntimeInfo info = new MonoRuntimeInfo (dir);
- if (info.IsValidRuntime)
+ foreach(var info in GetAllArchitecturesOfRuntimes(dir))
yield return new MonoTargetRuntime (info);
}
} else if (Platform.IsMac) {
if (!Directory.Exists (MAC_FRAMEWORK_DIR))
yield break;
foreach (string dir in Directory.GetDirectories (MAC_FRAMEWORK_DIR)) {
- if (dir.EndsWith ("/Current", StringComparison.Ordinal) || currentRuntime.Prefix == dir)
+ if (dir.EndsWith ("/Current", StringComparison.Ordinal))
continue;
- MonoRuntimeInfo info = new MonoRuntimeInfo (dir);
- if (info.IsValidRuntime)
+ foreach (var info in GetAllArchitecturesOfRuntimes (dir)) {
+ if (info.Prefix == currentRuntime.Prefix && info.Force64or32bit == currentRuntime.Force64or32bit)
+ continue;
yield return new MonoTargetRuntime (info);
+ }
}
} else {
foreach (string pref in commonLinuxPrefixes) {
- if (currentRuntime != null && currentRuntime.Prefix == pref)
- continue;
- MonoRuntimeInfo info = new MonoRuntimeInfo (pref);
- if (info.IsValidRuntime) {
- // Clean up old registered runtimes
- foreach (MonoRuntimeInfo ei in customRuntimes) {
- if (ei.Prefix == info.Prefix) {
- customRuntimes.Remove (ei);
- break;
+ foreach (var info in GetAllArchitecturesOfRuntimes (pref)) {
+ if (info.IsValidRuntime) {
+ if (currentRuntime != null && currentRuntime.Prefix == pref && currentRuntime.Force64or32bit == info.Force64or32bit)
+ continue;
+ // Clean up old registered runtimes
+ foreach (MonoRuntimeInfo ei in customRuntimes) {
+ if (ei.Prefix == info.Prefix) {
+ customRuntimes.Remove (ei);
+ break;
+ }
}
+ yield return new MonoTargetRuntime (info);
}
- yield return new MonoTargetRuntime (info);
}
}
}
diff --git a/main/src/core/MonoDevelop.Core/MonoDevelop.Core.Text/TextFileUtility.cs b/main/src/core/MonoDevelop.Core/MonoDevelop.Core.Text/TextFileUtility.cs
index b03e655350..8dec93d554 100644
--- a/main/src/core/MonoDevelop.Core/MonoDevelop.Core.Text/TextFileUtility.cs
+++ b/main/src/core/MonoDevelop.Core/MonoDevelop.Core.Text/TextFileUtility.cs
@@ -28,6 +28,7 @@ using System.Linq;
using System.Collections.Generic;
using System.IO;
using System.Text;
+using System.Threading.Tasks;
namespace MonoDevelop.Core.Text
{
@@ -215,6 +216,20 @@ namespace MonoDevelop.Core.Text
}
}
+ public static async Task<TextContent> GetTextAsync (Stream inputStream)
+ {
+ if (inputStream == null)
+ throw new ArgumentNullException ("inputStream");
+ var tc = new TextContent ();
+ bool hadBom;
+ using (var stream = OpenStream (inputStream, out hadBom)) {
+ tc.Encoding = stream.CurrentEncoding;
+ tc.Text = await stream.ReadToEndAsync ();
+ tc.HasBom = hadBom;
+ }
+ return tc;
+ }
+
public static string GetText (string fileName)
{
return GetText (File.ReadAllBytes (fileName));
@@ -230,16 +245,36 @@ namespace MonoDevelop.Core.Text
#endregion
#region file methods
- public static void WriteText (string fileName, string text, Encoding encoding, bool hadBom)
+ static string WriteTextInit (string fileName, string text, Encoding encoding)
{
if (fileName == null)
- throw new ArgumentNullException ("fileName");
+ throw new ArgumentNullException ("fileName");
if (text == null)
throw new ArgumentNullException ("text");
if (encoding == null)
throw new ArgumentNullException ("encoding");
// atomic rename only works in the same directory on linux. The tmp files may be on another partition -> breaks save.
string tmpPath = Path.Combine (Path.GetDirectoryName (fileName), ".#" + Path.GetFileName (fileName));
+ return tmpPath;
+ }
+
+ static void WriteTextFinal (string tmpPath, string fileName)
+ {
+ try {
+ SystemRename (tmpPath, fileName);
+ } catch (Exception) {
+ try {
+ File.Delete (tmpPath);
+ } catch {
+ // nothing
+ }
+ throw;
+ }
+ }
+
+ public static void WriteText (string fileName, string text, Encoding encoding, bool hadBom)
+ {
+ var tmpPath = WriteTextInit (fileName, text, encoding);
using (var stream = new FileStream (tmpPath, FileMode.OpenOrCreate, FileAccess.Write, FileShare.Write)) {
if (hadBom) {
var bom = encoding.GetPreamble ();
@@ -249,16 +284,22 @@ namespace MonoDevelop.Core.Text
byte[] bytes = encoding.GetBytes (text);
stream.Write (bytes, 0, bytes.Length);
}
- try {
- SystemRename (tmpPath, fileName);
- } catch (Exception) {
- try {
- File.Delete (tmpPath);
- } catch {
- // nothing
+ WriteTextFinal (tmpPath, fileName);
+ }
+
+ public static async Task WriteTextAsync (string fileName, string text, Encoding encoding, bool hadBom)
+ {
+ var tmpPath = WriteTextInit (fileName, text, encoding);
+ using (var stream = new FileStream (tmpPath, FileMode.OpenOrCreate, FileAccess.Write, FileShare.Write)) {
+ if (hadBom) {
+ var bom = encoding.GetPreamble ();
+ if (bom != null && bom.Length > 0)
+ await stream.WriteAsync (bom, 0, bom.Length);
}
- throw;
+ byte[] bytes = encoding.GetBytes (text);
+ await stream.WriteAsync (bytes, 0, bytes.Length);
}
+ WriteTextFinal (tmpPath, fileName);
}
/// <summary>
@@ -331,6 +372,22 @@ namespace MonoDevelop.Core.Text
return GetText (content, out encoding, out hadBom);
}
+ public static async Task<TextContent> ReadAllTextAsync (string fileName)
+ {
+ if (fileName == null)
+ throw new ArgumentNullException ("fileName");
+ byte[] content = await ReadAllBytesAsync (fileName);
+
+ bool hadBom;
+ Encoding encoding;
+ var txt = GetText (content, out encoding, out hadBom);
+ return new TextContent {
+ Text = txt,
+ HasBom = hadBom,
+ Encoding = encoding
+ };
+ }
+
public static string ReadAllText (string fileName, Encoding encoding, out bool hadBom)
{
if (fileName == null)
@@ -341,6 +398,37 @@ namespace MonoDevelop.Core.Text
byte[] content = File.ReadAllBytes (fileName);
return GetText (content, encoding, out hadBom);
}
+
+ public static async Task<TextContent> ReadAllTextAsync (string fileName, Encoding encoding)
+ {
+ if (fileName == null)
+ throw new ArgumentNullException ("fileName");
+ if (encoding == null)
+ throw new ArgumentNullException ("encoding");
+
+ byte[] content = await ReadAllBytesAsync (fileName);
+
+ bool hadBom;
+ var txt = GetText (content, encoding, out hadBom);
+ return new TextContent {
+ Text = txt,
+ HasBom = hadBom,
+ Encoding = encoding
+ };
+ }
+
+ public static async Task<byte[]> ReadAllBytesAsync (string file)
+ {
+ using (var f = File.OpenRead (file)) {
+ var res = new byte [f.Length];
+ int nr = 0;
+ int c = 0;
+ while (nr < res.Length && (c = await f.ReadAsync (res, nr, res.Length - nr)) > 0)
+ nr += c;
+ return res;
+ }
+ }
+
#endregion
#region ASCII encoding check
@@ -850,4 +938,11 @@ namespace MonoDevelop.Core.Text
}
#endregion
}
+
+ public class TextContent
+ {
+ public string Text { get; internal set; }
+ public bool HasBom { get; internal set; }
+ public Encoding Encoding { get; internal set; }
+ }
} \ No newline at end of file
diff --git a/main/src/core/MonoDevelop.Core/MonoDevelop.Core.csproj b/main/src/core/MonoDevelop.Core/MonoDevelop.Core.csproj
index b3875375ac..ae6e544b93 100644
--- a/main/src/core/MonoDevelop.Core/MonoDevelop.Core.csproj
+++ b/main/src/core/MonoDevelop.Core/MonoDevelop.Core.csproj
@@ -468,7 +468,6 @@
<Compile Include="MonoDevelop.Projects\WorkspaceObjectExtension.cs" />
<Compile Include="MonoDevelop.Core.Execution\ProcessAsyncOperation.cs" />
<Compile Include="MonoDevelop.Projects.MSBuild\MSBuildProperty.cs" />
- <Compile Include="MonoDevelop.Projects.MSBuild\MSBuildPropertyGroupMerged.cs" />
<Compile Include="MonoDevelop.Projects.MSBuild\MSBuildPropertyGroup.cs" />
<Compile Include="MonoDevelop.Projects.MSBuild\MSBuildItem.cs" />
<Compile Include="MonoDevelop.Projects.MSBuild\MSBuildItemGroup.cs" />
@@ -554,8 +553,9 @@
<Compile Include="MonoDevelop.Projects.MSBuild\IMSBuildProjectObject.cs" />
<Compile Include="MonoDevelop.Projects.MSBuild\IntrinsicFunctions.cs" />
<Compile Include="MonoDevelop.Projects.MSBuild\EscapingUtilities.cs" />
- <Compile Include="MonoDevelop.Projects.MSBuild.Conditions\ConditionedPropertyCollection.cs" />
+ <Compile Include="CoreExtensions.cs" />
<Compile Include="MonoDevelop.Core\FileWriteableState.cs" />
+ <Compile Include="MonoDevelop.Projects\ConditionedPropertyCollection.cs" />
</ItemGroup>
<ItemGroup>
<None Include="Makefile.am" />
diff --git a/main/src/core/MonoDevelop.Core/MonoDevelop.Core/FilePath.cs b/main/src/core/MonoDevelop.Core/MonoDevelop.Core/FilePath.cs
index b846fb1bec..0f8f88efd2 100644
--- a/main/src/core/MonoDevelop.Core/MonoDevelop.Core/FilePath.cs
+++ b/main/src/core/MonoDevelop.Core/MonoDevelop.Core/FilePath.cs
@@ -183,7 +183,17 @@ namespace MonoDevelop.Core
{
return Path.ChangeExtension (fileName, ext);
}
-
+
+ /// <summary>
+ /// Returns a file path with the name changed to the provided name, but keeping the extension
+ /// </summary>
+ /// <returns>The new file path</returns>
+ /// <param name="newName">New file name</param>
+ public FilePath ChangeName (string newName)
+ {
+ return ParentDirectory.Combine (newName) + Extension;
+ }
+
public FilePath Combine (params FilePath[] paths)
{
string path = fileName;
diff --git a/main/src/core/MonoDevelop.Core/MonoDevelop.Projects.MD1/MD1DotNetProjectHandler.cs b/main/src/core/MonoDevelop.Core/MonoDevelop.Projects.MD1/MD1DotNetProjectHandler.cs
index f1539f68a7..f9c1f338af 100644
--- a/main/src/core/MonoDevelop.Core/MonoDevelop.Projects.MD1/MD1DotNetProjectHandler.cs
+++ b/main/src/core/MonoDevelop.Core/MonoDevelop.Projects.MD1/MD1DotNetProjectHandler.cs
@@ -157,7 +157,7 @@ namespace MonoDevelop.Projects.MD1
if (!itemsToExclude.Contains (item) && (string.IsNullOrEmpty (item.Condition) || ConditionParser.ParseAndEvaluate (item.Condition, ctx)))
buildData.Items.Add (item);
}
- buildData.Configuration = (DotNetProjectConfiguration) conf.Clone ();
+ buildData.Configuration = (DotNetProjectConfiguration) project.CloneConfiguration (conf, conf.Id);
buildData.Configuration.SetParentItem (project);
buildData.ConfigurationSelector = configuration;
diff --git a/main/src/core/MonoDevelop.Core/MonoDevelop.Projects.MSBuild.Conditions/ConditionRelationalExpression.cs b/main/src/core/MonoDevelop.Core/MonoDevelop.Projects.MSBuild.Conditions/ConditionRelationalExpression.cs
index d6fc6fdc56..0010e3e08b 100644
--- a/main/src/core/MonoDevelop.Core/MonoDevelop.Projects.MSBuild.Conditions/ConditionRelationalExpression.cs
+++ b/main/src/core/MonoDevelop.Core/MonoDevelop.Projects.MSBuild.Conditions/ConditionRelationalExpression.cs
@@ -28,6 +28,8 @@
using System;
using System.Collections;
using System.Xml;
+using System.Text;
+using System.Collections.Generic;
namespace MonoDevelop.Projects.MSBuild.Conditions {
internal sealed class ConditionRelationalExpression : ConditionExpression {
@@ -158,22 +160,30 @@ namespace MonoDevelop.Projects.MSBuild.Conditions {
if ((op == RelationOperator.Equal || op == RelationOperator.NotEqual) && left is ConditionFactorExpression && right is ConditionFactorExpression) {
var leftString = ((ConditionFactorExpression)left).Token.Value;
var rightString = ((ConditionFactorExpression)right).Token.Value;
+ List<string> combinedProperty = null;
+ List<string> combinedValue = null;
int il = 0;
int rl = 0;
while (il < leftString.Length && rl < rightString.Length) {
if (il < leftString.Length - 2 && leftString [il] == '$' && leftString [il + 1] == '(')
- ReadPropertyCondition (properties, leftString, ref il, rightString, ref rl);
+ ReadPropertyCondition (leftString, ref combinedProperty, ref combinedValue, ref il, rightString, ref rl);
else if (rl < rightString.Length - 2 && rightString [rl] == '$' && rightString [rl + 1] == '(')
- ReadPropertyCondition (properties, rightString, ref rl, leftString, ref il);
+ ReadPropertyCondition (rightString, ref combinedProperty, ref combinedValue, ref rl, leftString, ref il);
else if (leftString [il] != rightString [rl])
return; // Condition can't be true
il++; rl++;
}
+
+ // This condition sets values for more that one property. In addition to the individual values, also register
+ // the combination of values. So for example if the condition has "$(Configuration)|$(Platform) == Foo|Bar",
+ // the conditioned property collection would contain Configuration=Foo, Platform=Bar, (Configuration|Platfrom)=Foo|Bar
+ if (combinedProperty != null)
+ properties.AddPropertyValues (combinedProperty.ToArray (), combinedValue.ToArray ());
}
}
- void ReadPropertyCondition (ConditionedPropertyCollection properties, string propString, ref int i, string valString, ref int j)
+ void ReadPropertyCondition (string propString, ref List<string> combinedProperty, ref List<string> combinedValue, ref int i, string valString, ref int j)
{
var prop = ReadPropertyTag (propString, ref i);
string val;
@@ -182,7 +192,13 @@ namespace MonoDevelop.Projects.MSBuild.Conditions {
else
val = valString.Substring (j);
- properties.AddProperty (prop, val);
+ if (combinedProperty == null) {
+ combinedProperty = new List<string> ();
+ combinedValue = new List<string> ();
+ }
+
+ combinedProperty.Add (prop);
+ combinedValue.Add (val);
}
string ReadPropertyValue (string valString, ref int j, char v)
diff --git a/main/src/core/MonoDevelop.Core/MonoDevelop.Projects.MSBuild/DefaultMSBuildEngine.cs b/main/src/core/MonoDevelop.Core/MonoDevelop.Projects.MSBuild/DefaultMSBuildEngine.cs
index 2765286835..73068cd5c3 100644
--- a/main/src/core/MonoDevelop.Core/MonoDevelop.Projects.MSBuild/DefaultMSBuildEngine.cs
+++ b/main/src/core/MonoDevelop.Core/MonoDevelop.Projects.MSBuild/DefaultMSBuildEngine.cs
@@ -378,7 +378,7 @@ namespace MonoDevelop.Projects.MSBuild
static MSBuildItemEvaluated CreateEvaluatedItem (MSBuildEvaluationContext context, MSBuildProject project, MSBuildItem sourceItem, string include)
{
var it = new MSBuildItemEvaluated (project, sourceItem.Name, sourceItem.Include, include);
- var md = new Dictionary<string,MSBuildPropertyEvaluated> ();
+ var md = new Dictionary<string,IMSBuildPropertyEvaluated> ();
foreach (var c in sourceItem.Metadata.GetProperties ()) {
md [c.Name] = new MSBuildPropertyEvaluated (project, c.Name, c.Value, context.EvaluateString (c.Value));
}
@@ -449,10 +449,7 @@ namespace MonoDevelop.Projects.MSBuild
t.IsImported = true;
project.Targets.Add (t);
}
- foreach (var cp in p.ConditionedProperties) {
- foreach (var v in cp.Value)
- project.ConditionedProperties.AddProperty (cp.Key, v);
- }
+ project.ConditionedProperties.Append (p.ConditionedProperties);
}
return;
}
@@ -530,8 +527,17 @@ namespace MonoDevelop.Projects.MSBuild
void Evaluate (ProjectInfo project, MSBuildEvaluationContext context, MSBuildTarget target)
{
- // TODO NPM
- project.Targets.Add (target);
+ if (SafeParseAndEvaluate (project, context, target.Condition)) {
+ var newTarget = new MSBuildTarget (target.Name, target.Tasks);
+ newTarget.AfterTargets = context.EvaluateString (target.AfterTargets);
+ newTarget.Inputs = context.EvaluateString (target.Inputs);
+ newTarget.Outputs = context.EvaluateString (target.Outputs);
+ newTarget.BeforeTargets = context.EvaluateString (target.BeforeTargets);
+ newTarget.DependsOnTargets = context.EvaluateString (target.DependsOnTargets);
+ newTarget.Returns = context.EvaluateString (target.Returns);
+ newTarget.KeepDuplicateOutputs = context.EvaluateString (target.KeepDuplicateOutputs);
+ project.Targets.Add (newTarget);
+ }
}
static bool SafeParseAndEvaluate (ProjectInfo project, MSBuildEvaluationContext context, string condition, bool collectConditionedProperties = false)
@@ -656,7 +662,7 @@ namespace MonoDevelop.Projects.MSBuild
pi.GlobalProperties.Remove (property);
}
- public override IDictionary<string, List<string>> GetConditionedProperties (object projectInstance)
+ public override ConditionedPropertyCollection GetConditionedProperties (object projectInstance)
{
var pi = (ProjectInfo)projectInstance;
return pi.ConditionedProperties;
diff --git a/main/src/core/MonoDevelop.Core/MonoDevelop.Projects.MSBuild/IMetadataProperty.cs b/main/src/core/MonoDevelop.Core/MonoDevelop.Projects.MSBuild/IMetadataProperty.cs
index 23bbbb74bc..8f9c627d19 100644
--- a/main/src/core/MonoDevelop.Core/MonoDevelop.Projects.MSBuild/IMetadataProperty.cs
+++ b/main/src/core/MonoDevelop.Core/MonoDevelop.Projects.MSBuild/IMetadataProperty.cs
@@ -50,7 +50,7 @@ namespace MonoDevelop.Projects.MSBuild
bool TryGetPathValue (out FilePath value, bool relativeToProject = true, FilePath relativeToPath = default(FilePath));
- void SetValue (string value, bool preserveCase = false, bool mergeToMainGroup = false);
+ void SetValue (string value, bool preserveCase = false, bool mergeToMainGroup = false, MSBuildValueType valueType = null);
void SetValue (FilePath value, bool relativeToProject = true, FilePath relativeToPath = default(FilePath), bool mergeToMainGroup = false);
diff --git a/main/src/core/MonoDevelop.Core/MonoDevelop.Projects.MSBuild/MSBuildElement.cs b/main/src/core/MonoDevelop.Core/MonoDevelop.Projects.MSBuild/MSBuildElement.cs
index dd18b5dd6a..b3e83ecec3 100644
--- a/main/src/core/MonoDevelop.Core/MonoDevelop.Projects.MSBuild/MSBuildElement.cs
+++ b/main/src/core/MonoDevelop.Core/MonoDevelop.Projects.MSBuild/MSBuildElement.cs
@@ -30,7 +30,7 @@ namespace MonoDevelop.Projects.MSBuild
{
string condition;
- static readonly string [] knownAttributes = { "Condition", "Label" };
+ static readonly string [] knownAttributes = { "Label", "Condition" };
internal override string [] GetKnownAttributes ()
{
diff --git a/main/src/core/MonoDevelop.Core/MonoDevelop.Projects.MSBuild/MSBuildEngine.cs b/main/src/core/MonoDevelop.Core/MonoDevelop.Projects.MSBuild/MSBuildEngine.cs
index a97eb2edde..3e17684abc 100644
--- a/main/src/core/MonoDevelop.Core/MonoDevelop.Projects.MSBuild/MSBuildEngine.cs
+++ b/main/src/core/MonoDevelop.Core/MonoDevelop.Projects.MSBuild/MSBuildEngine.cs
@@ -107,7 +107,7 @@ namespace MonoDevelop.Projects.MSBuild
public abstract void RemoveGlobalProperty (object projectInstance, string property);
- public abstract IDictionary<string, List<string>> GetConditionedProperties (object projectInstance);
+ public abstract ConditionedPropertyCollection GetConditionedProperties (object projectInstance);
}
}
diff --git a/main/src/core/MonoDevelop.Core/MonoDevelop.Projects.MSBuild/MSBuildEngineV12.cs b/main/src/core/MonoDevelop.Core/MonoDevelop.Projects.MSBuild/MSBuildEngineV12.cs
index 039a67ccbf..df15e56634 100644
--- a/main/src/core/MonoDevelop.Core/MonoDevelop.Projects.MSBuild/MSBuildEngineV12.cs
+++ b/main/src/core/MonoDevelop.Core/MonoDevelop.Projects.MSBuild/MSBuildEngineV12.cs
@@ -175,10 +175,9 @@ namespace MonoDevelop.Projects.MSBuild
p.RemoveGlobalProperty (property);
}
- public override IDictionary<string, List<string>> GetConditionedProperties (object project)
+ public override ConditionedPropertyCollection GetConditionedProperties (object project)
{
- var p = (MSProject)project;
- return p.ConditionedProperties;
+ throw new NotImplementedException ();
}
}
diff --git a/main/src/core/MonoDevelop.Core/MonoDevelop.Projects.MSBuild/MSBuildEngineV4.cs b/main/src/core/MonoDevelop.Core/MonoDevelop.Projects.MSBuild/MSBuildEngineV4.cs
index 472cba4d5c..b8a304bef8 100644
--- a/main/src/core/MonoDevelop.Core/MonoDevelop.Projects.MSBuild/MSBuildEngineV4.cs
+++ b/main/src/core/MonoDevelop.Core/MonoDevelop.Projects.MSBuild/MSBuildEngineV4.cs
@@ -198,7 +198,7 @@ namespace MonoDevelop.Projects.MSBuild
p.GlobalProperties.RemoveProperty (property);
}
- public override IDictionary<string, List<string>> GetConditionedProperties (object project)
+ public override ConditionedPropertyCollection GetConditionedProperties (object project)
{
throw new NotImplementedException ();
}
diff --git a/main/src/core/MonoDevelop.Core/MonoDevelop.Projects.MSBuild/MSBuildImport.cs b/main/src/core/MonoDevelop.Core/MonoDevelop.Projects.MSBuild/MSBuildImport.cs
index 4115627e2f..bc821dad2e 100644
--- a/main/src/core/MonoDevelop.Core/MonoDevelop.Projects.MSBuild/MSBuildImport.cs
+++ b/main/src/core/MonoDevelop.Core/MonoDevelop.Projects.MSBuild/MSBuildImport.cs
@@ -33,7 +33,7 @@ namespace MonoDevelop.Projects.MSBuild
{
string target;
- static readonly string [] knownAttributes = { "Project", "Condition", "Label" };
+ static readonly string [] knownAttributes = { "Project", "Label", "Condition" };
internal override string [] GetKnownAttributes ()
{
diff --git a/main/src/core/MonoDevelop.Core/MonoDevelop.Projects.MSBuild/MSBuildItemGroup.cs b/main/src/core/MonoDevelop.Core/MonoDevelop.Projects.MSBuild/MSBuildItemGroup.cs
index 1e7a745691..ecbcf2d05d 100644
--- a/main/src/core/MonoDevelop.Core/MonoDevelop.Projects.MSBuild/MSBuildItemGroup.cs
+++ b/main/src/core/MonoDevelop.Core/MonoDevelop.Projects.MSBuild/MSBuildItemGroup.cs
@@ -82,6 +82,7 @@ namespace MonoDevelop.Projects.MSBuild
if (ChildNodes.Contains (item)) {
item.RemoveIndent ();
ChildNodes = ChildNodes.Remove (item);
+ item.ParentNode = null;
NotifyChanged ();
}
}
diff --git a/main/src/core/MonoDevelop.Core/MonoDevelop.Projects.MSBuild/MSBuildProject.cs b/main/src/core/MonoDevelop.Core/MonoDevelop.Projects.MSBuild/MSBuildProject.cs
index 862c44aed4..82736754f4 100644
--- a/main/src/core/MonoDevelop.Core/MonoDevelop.Projects.MSBuild/MSBuildProject.cs
+++ b/main/src/core/MonoDevelop.Core/MonoDevelop.Projects.MSBuild/MSBuildProject.cs
@@ -47,7 +47,7 @@ namespace MonoDevelop.Projects.MSBuild
int changeStamp;
bool hadXmlDeclaration;
bool isShared;
- IDictionary<string, List<string>> conditionedProperties = new Dictionary<string, List<string>> ();
+ ConditionedPropertyCollection conditionedProperties = new ConditionedPropertyCollection ();
MSBuildEngineManager engineManager;
bool engineManagerIsLocal;
@@ -249,7 +249,7 @@ namespace MonoDevelop.Projects.MSBuild
AssertCanModify ();
DisposeMainInstance ();
ChildNodes = ChildNodes.Clear ();
- conditionedProperties.Clear ();
+ conditionedProperties = new ConditionedPropertyCollection ();
bestGroups = null;
hadXmlDeclaration = false;
initialWhitespace = null;
@@ -600,7 +600,7 @@ namespace MonoDevelop.Projects.MSBuild
((MSBuildImportGroup)import.ParentObject).RemoveImport (import);
}
- public IDictionary<string, List<string>> ConditionedProperties {
+ public ConditionedPropertyCollection ConditionedProperties {
get {
return conditionedProperties;
}
@@ -621,18 +621,14 @@ namespace MonoDevelop.Projects.MSBuild
get { return mainProjectInstance.EvaluatedItemsIgnoringCondition; }
}
- public IEnumerable<MSBuildTarget> EvaluatedTargets
+ public IEnumerable<IMSBuildTargetEvaluated> EvaluatedTargets
{
get { return mainProjectInstance.Targets; }
}
- public IMSBuildPropertySet GetGlobalPropertyGroup ()
+ public MSBuildPropertyGroup GetGlobalPropertyGroup ()
{
- foreach (MSBuildPropertyGroup grp in PropertyGroups) {
- if (grp.Condition.Length == 0)
- return grp;
- }
- return null;
+ return PropertyGroups.FirstOrDefault (g => g.Condition.Length == 0);
}
public MSBuildPropertyGroup CreatePropertyGroup ()
@@ -640,14 +636,14 @@ namespace MonoDevelop.Projects.MSBuild
return new MSBuildPropertyGroup ();
}
- public MSBuildPropertyGroup AddNewPropertyGroup (bool insertAtEnd)
+ public MSBuildPropertyGroup AddNewPropertyGroup (bool insertAtEnd = true, MSBuildObject beforeObject = null)
{
var group = new MSBuildPropertyGroup ();
AddPropertyGroup (group, insertAtEnd);
return group;
}
- public void AddPropertyGroup (MSBuildPropertyGroup group, bool insertAtEnd)
+ public void AddPropertyGroup (MSBuildPropertyGroup group, bool insertAtEnd = true, MSBuildObject beforeObject = null)
{
AssertCanModify ();
if (group.ParentProject != null)
@@ -656,26 +652,34 @@ namespace MonoDevelop.Projects.MSBuild
group.ParentNode = this;
bool added = false;
- if (insertAtEnd) {
- var last = ChildNodes.FindLastIndex (g => g is MSBuildPropertyGroup);
- if (last != -1) {
- ChildNodes = ChildNodes.Insert (last + 1, group);
- added = true;
- }
- } else {
- var first = ChildNodes.FindIndex (g => g is MSBuildPropertyGroup);
- if (first != -1) {
- ChildNodes = ChildNodes.Insert (first, group);
+ if (beforeObject != null) {
+ var index = ChildNodes.IndexOf (beforeObject);
+ if (index != -1) {
+ ChildNodes = ChildNodes.Insert (index, group);
added = true;
}
}
-
if (!added) {
- var first = ChildNodes.FindIndex (g => g is MSBuildItemGroup);
- if (first != -1)
- ChildNodes = ChildNodes.Insert (first, group);
- else
- ChildNodes = ChildNodes.Add (group);
+ if (insertAtEnd) {
+ var last = ChildNodes.FindLastIndex (g => g is MSBuildPropertyGroup);
+ if (last != -1) {
+ ChildNodes = ChildNodes.Insert (last + 1, group);
+ added = true;
+ }
+ } else {
+ var first = ChildNodes.FindIndex (g => g is MSBuildPropertyGroup);
+ if (first != -1) {
+ ChildNodes = ChildNodes.Insert (first, group);
+ added = true;
+ }
+ }
+ if (!added) {
+ var first = ChildNodes.FindIndex (g => g is MSBuildItemGroup);
+ if (first != -1)
+ ChildNodes = ChildNodes.Insert (first, group);
+ else
+ ChildNodes = ChildNodes.Add (group);
+ }
}
group.ResetIndent (true);
@@ -900,6 +904,7 @@ namespace MonoDevelop.Projects.MSBuild
if (ob.ParentObject == this) {
ob.RemoveIndent ();
ChildNodes = ChildNodes.Remove (ob);
+ ob.ParentNode = null;
}
}
@@ -910,7 +915,7 @@ namespace MonoDevelop.Projects.MSBuild
item.RemoveIndent ();
var g = item.ParentGroup;
g.RemoveItem (item);
- if (removeEmptyParentGroup && !item.ParentGroup.Items.Any ()) {
+ if (removeEmptyParentGroup && !g.Items.Any ()) {
Remove (g);
if (bestGroups != null)
bestGroups.Remove (item.Name);
diff --git a/main/src/core/MonoDevelop.Core/MonoDevelop.Projects.MSBuild/MSBuildProjectInstance.cs b/main/src/core/MonoDevelop.Core/MonoDevelop.Projects.MSBuild/MSBuildProjectInstance.cs
index e55b8a43e0..837261498f 100644
--- a/main/src/core/MonoDevelop.Core/MonoDevelop.Projects.MSBuild/MSBuildProjectInstance.cs
+++ b/main/src/core/MonoDevelop.Core/MonoDevelop.Projects.MSBuild/MSBuildProjectInstance.cs
@@ -40,7 +40,7 @@ namespace MonoDevelop.Projects.MSBuild
MSBuildEvaluatedPropertyCollection evaluatedProperties;
MSBuildTarget[] targets = new MSBuildTarget[0];
Dictionary<string,string> globalProperties = new Dictionary<string, string> ();
- IDictionary<string, List<string>> conditionedProperties;
+ ConditionedPropertyCollection conditionedProperties;
MSBuildProjectInstanceInfo info;
@@ -196,13 +196,19 @@ namespace MonoDevelop.Projects.MSBuild
get { return evaluatedItemsIgnoringCondition; }
}
- public IEnumerable<MSBuildTarget> Targets {
+ public IEnumerable<IMSBuildTargetEvaluated> Targets {
get {
return targets;
}
}
- internal IDictionary<string, List<string>> GetConditionedProperties ()
+ internal IPropertySet GetPropertiesLinkedToGroup (MSBuildPropertyGroup group)
+ {
+ evaluatedProperties.LinkToGroup (group);
+ return evaluatedProperties;
+ }
+
+ internal ConditionedPropertyCollection GetConditionedProperties ()
{
return conditionedProperties;
}
diff --git a/main/src/core/MonoDevelop.Core/MonoDevelop.Projects.MSBuild/MSBuildProjectService.cs b/main/src/core/MonoDevelop.Core/MonoDevelop.Projects.MSBuild/MSBuildProjectService.cs
index b84a554276..9d12344de8 100644
--- a/main/src/core/MonoDevelop.Core/MonoDevelop.Projects.MSBuild/MSBuildProjectService.cs
+++ b/main/src/core/MonoDevelop.Core/MonoDevelop.Projects.MSBuild/MSBuildProjectService.cs
@@ -432,7 +432,7 @@ namespace MonoDevelop.Projects.MSBuild
static async Task<bool> MigrateProject (ProgressMonitor monitor, SolutionItemExtensionNode st, MSBuildProject p, string fileName, string language)
{
- var projectLoadMonitor = monitor as ProjectLoadProgressMonitor;
+ var projectLoadMonitor = GetProjectLoadProgressMonitor (monitor);
if (projectLoadMonitor == null) {
// projectLoadMonitor will be null when running through md-tool, but
// this is not fatal if migration is not required, so just ignore it. --abock
@@ -477,6 +477,19 @@ namespace MonoDevelop.Projects.MSBuild
return true;
}
+ static ProjectLoadProgressMonitor GetProjectLoadProgressMonitor (ProgressMonitor monitor)
+ {
+ var projectLoadMonitor = monitor as ProjectLoadProgressMonitor;
+ if (projectLoadMonitor != null)
+ return projectLoadMonitor;
+
+ var aggregatedMonitor = monitor as AggregatedProgressMonitor;
+ if (aggregatedMonitor != null)
+ return aggregatedMonitor.MasterMonitor as ProjectLoadProgressMonitor;
+
+ return null;
+ }
+
internal static string GetLanguageGuid (string language)
{
foreach (var node in GetItemTypeNodes ().OfType<DotNetProjectTypeNode> ()) {
diff --git a/main/src/core/MonoDevelop.Core/MonoDevelop.Projects.MSBuild/MSBuildProperty.cs b/main/src/core/MonoDevelop.Core/MonoDevelop.Projects.MSBuild/MSBuildProperty.cs
index f3c0cc8d0a..92f758c613 100644
--- a/main/src/core/MonoDevelop.Core/MonoDevelop.Projects.MSBuild/MSBuildProperty.cs
+++ b/main/src/core/MonoDevelop.Core/MonoDevelop.Projects.MSBuild/MSBuildProperty.cs
@@ -33,17 +33,18 @@ using System.Globalization;
using System.Text;
using System.IO;
using System.Linq;
+using System.Security.Cryptography;
namespace MonoDevelop.Projects.MSBuild
{
public class MSBuildProperty: MSBuildPropertyCore, IMetadataProperty, IMSBuildPropertyEvaluated
{
- bool preserverCase;
MSBuildValueType valueType = MSBuildValueType.Default;
string value;
string rawValue, textValue;
string name;
string unevaluatedValue;
+ LinkedPropertyFlags flags;
static readonly string EmptyElementMarker = new string ('e', 1);
@@ -57,6 +58,14 @@ namespace MonoDevelop.Projects.MSBuild
this.name = name;
}
+ internal MSBuildProperty (MSBuildNode parentNode, string name, string value, string evaluatedValue): this ()
+ {
+ ParentNode = parentNode;
+ this.name = name;
+ this.unevaluatedValue = value;
+ this.value = evaluatedValue;
+ }
+
internal override void Read (MSBuildXmlReader reader)
{
name = reader.LocalName;
@@ -190,24 +199,77 @@ namespace MonoDevelop.Projects.MSBuild
return name;
}
- /// <summary>
- /// Gets or sets the value
- /// </summary>
- /// <value>The loaded value.</value>
- public string LoadedValue { get; set; }
+ internal MSBuildPropertyGroup Owner { get; set; }
public bool IsImported {
- get;
- set;
+ get { return (flags & LinkedPropertyFlags.Imported) != 0; }
+ set {
+ if (value)
+ flags |= LinkedPropertyFlags.Imported;
+ else
+ flags &= ~LinkedPropertyFlags.Imported;
+ }
}
- public bool MergeToMainGroup { get; set; }
+ public bool MergeToMainGroup {
+ get { return (flags & LinkedPropertyFlags.MergeToMainGroup) != 0; }
+ set {
+ if (value)
+ flags |= LinkedPropertyFlags.MergeToMainGroup;
+ else
+ flags &= ~LinkedPropertyFlags.MergeToMainGroup;
+ }
+ }
- internal bool Overwritten { get; set; }
+ internal bool Overwritten {
+ get { return (flags & LinkedPropertyFlags.Overwritten) != 0; }
+ set {
+ if (value)
+ flags |= LinkedPropertyFlags.Overwritten;
+ else
+ flags &= ~LinkedPropertyFlags.Overwritten;
+ }
+ }
- internal MSBuildPropertyGroup Owner { get; set; }
+ internal bool HasDefaultValue {
+ get { return (flags & LinkedPropertyFlags.HasDefaultValue) != 0; }
+ set {
+ if (value)
+ flags |= LinkedPropertyFlags.HasDefaultValue;
+ else
+ flags &= ~LinkedPropertyFlags.HasDefaultValue;
+ }
+ }
+
+ internal bool Modified {
+ get { return (flags & LinkedPropertyFlags.Modified) != 0; }
+ set {
+ if (value)
+ flags |= LinkedPropertyFlags.Modified;
+ else
+ flags &= ~LinkedPropertyFlags.Modified;
+ }
+ }
+
+ internal bool EvaluatedValueModified {
+ get { return (flags & LinkedPropertyFlags.EvaluatedValueModified) != 0; }
+ set {
+ if (value)
+ flags |= LinkedPropertyFlags.EvaluatedValueModified;
+ else
+ flags &= ~LinkedPropertyFlags.EvaluatedValueModified;
+ }
+ }
- internal bool HasDefaultValue { get; set; }
+ internal bool IsNew {
+ get { return (flags & LinkedPropertyFlags.IsNew) != 0; }
+ set {
+ if (value)
+ flags |= LinkedPropertyFlags.IsNew;
+ else
+ flags &= ~LinkedPropertyFlags.IsNew;
+ }
+ }
internal bool NotifyChanges { get; set; }
@@ -217,36 +279,30 @@ namespace MonoDevelop.Projects.MSBuild
internal MergedProperty CreateMergedProperty ()
{
- return new MergedProperty (Name, preserverCase, HasDefaultValue);
+ return new MergedProperty (Name, valueType, HasDefaultValue);
}
- public void SetValue (string value, bool preserveCase = false, bool mergeToMainGroup = false)
+ public void SetValue (string value, bool preserveCase = false, bool mergeToMainGroup = false, MSBuildValueType valueType = null)
{
AssertCanModify ();
+
+ // If no value type is specified, use the default
+ if (valueType == null)
+ valueType = preserveCase ? MSBuildValueType.DefaultPreserveCase : MSBuildValueType.Default;
+
MergeToMainGroup = mergeToMainGroup;
- this.preserverCase = preserveCase;
- valueType = preserveCase ? MSBuildValueType.Default : MSBuildValueType.DefaultPreserveCase;
+ this.valueType = valueType;
if (value == null)
value = String.Empty;
- if (preserveCase) {
- var current = GetPropertyValue ();
- if (current != null) {
- if (current.Equals (value, preserveCase ? StringComparison.InvariantCultureIgnoreCase : StringComparison.InvariantCulture))
- return;
- }
- }
SetPropertyValue (value);
- if (ParentProject != null && NotifyChanges)
- ParentProject.NotifyChanged ();
}
public void SetValue (FilePath value, bool relativeToProject = true, FilePath relativeToPath = default(FilePath), bool mergeToMainGroup = false)
{
AssertCanModify ();
MergeToMainGroup = mergeToMainGroup;
- this.preserverCase = false;
valueType = MSBuildValueType.Path;
string baseDir = null;
@@ -269,8 +325,6 @@ namespace MonoDevelop.Projects.MSBuild
return;
SetPropertyValue (MSBuildProjectService.ToMSBuildPath (baseDir, value, false));
- if (ParentProject != null && NotifyChanges)
- ParentProject.NotifyChanged ();
}
internal void ResolvePath ()
@@ -302,7 +356,12 @@ namespace MonoDevelop.Projects.MSBuild
internal virtual void SetPropertyValue (string value)
{
- if (this.value != value) {
+ if (this.value == null || !valueType.Equals (this.value, value)) {
+ // If the property has an initial evaluated value, then set the EvaluatedValueModified flag
+ if (!Modified && this.value != null)
+ EvaluatedValueModified = true;
+
+ Modified = true;
this.value = value;
this.unevaluatedValue = value;
this.rawValue = null;
@@ -413,7 +472,7 @@ namespace MonoDevelop.Projects.MSBuild
internal override void SetPropertyValue (string value)
{
- if (value != this.value)
+ if (!ValueType.Equals (value, this.value))
this.value = unevaluatedValue = value;
}
@@ -433,13 +492,13 @@ namespace MonoDevelop.Projects.MSBuild
{
public readonly string Name;
public readonly bool IsDefault;
- public readonly bool PreserveExistingCase;
+ public readonly MSBuildValueType ValueType;
- public MergedProperty (string name, bool preserveExistingCase, bool isDefault)
+ public MergedProperty (string name, MSBuildValueType valueType, bool isDefault)
{
this.Name = name;
IsDefault = isDefault;
- this.PreserveExistingCase = preserveExistingCase;
+ ValueType = valueType;
}
}
}
diff --git a/main/src/core/MonoDevelop.Core/MonoDevelop.Projects.MSBuild/MSBuildPropertyEvaluated.cs b/main/src/core/MonoDevelop.Core/MonoDevelop.Projects.MSBuild/MSBuildPropertyEvaluated.cs
index 2fa900ddd2..1c9990f496 100644
--- a/main/src/core/MonoDevelop.Core/MonoDevelop.Projects.MSBuild/MSBuildPropertyEvaluated.cs
+++ b/main/src/core/MonoDevelop.Core/MonoDevelop.Projects.MSBuild/MSBuildPropertyEvaluated.cs
@@ -34,11 +34,13 @@ using System.Globalization;
namespace MonoDevelop.Projects.MSBuild
{
- class MSBuildPropertyEvaluated: MSBuildPropertyCore, IMSBuildPropertyEvaluated
+ class MSBuildPropertyEvaluated: MSBuildPropertyCore, IMSBuildPropertyEvaluated, IMetadataProperty
{
string value;
string evaluatedValue;
string name;
+ MSBuildProperty linkedProperty;
+ LinkedPropertyFlags flags;
internal MSBuildPropertyEvaluated (MSBuildProject project, string name, string value, string evaluatedValue)
{
@@ -56,13 +58,74 @@ namespace MonoDevelop.Projects.MSBuild
public bool IsImported { get; set; }
public override string UnevaluatedValue {
- get { return value; }
+ get {
+ if (linkedProperty != null)
+ return linkedProperty.UnevaluatedValue;
+ return value;
+ }
+ }
+
+ internal bool IsNew {
+ get { return (flags & LinkedPropertyFlags.IsNew) != 0; }
+ set {
+ if (value)
+ flags |= LinkedPropertyFlags.IsNew;
+ else
+ flags &= ~LinkedPropertyFlags.IsNew;
+ }
+ }
+
+ public MSBuildProperty LinkedProperty {
+ get {
+ return linkedProperty;
+ }
}
internal override string GetPropertyValue ()
{
+ if (linkedProperty != null)
+ return linkedProperty.Value;
return evaluatedValue;
}
+
+ public void LinkToProperty (MSBuildProperty property)
+ {
+ linkedProperty = property;
+ if (linkedProperty != null && !linkedProperty.Modified && !IsNew)
+ linkedProperty.InitEvaluatedValue (evaluatedValue);
+ }
+
+ void IMetadataProperty.SetValue (string value, bool preserveCase, bool mergeToMainGroup, MSBuildValueType valueType)
+ {
+ if (linkedProperty == null)
+ throw new InvalidOperationException ("Evaluated property can't be modified");
+ linkedProperty.SetValue (value, preserveCase, mergeToMainGroup, valueType);
+ }
+
+ void IMetadataProperty.SetValue (FilePath value, bool relativeToProject, FilePath relativeToPath, bool mergeToMainGroup)
+ {
+ if (linkedProperty == null)
+ throw new InvalidOperationException ("Evaluated property can't be modified");
+ linkedProperty.SetValue (value, relativeToProject, relativeToPath, mergeToMainGroup);
+ }
+
+ void IMetadataProperty.SetValue (object value, bool mergeToMainGroup)
+ {
+ if (linkedProperty == null)
+ throw new InvalidOperationException ("Evaluated property can't be modified");
+ linkedProperty.SetValue (value, mergeToMainGroup);
+ }
+ }
+
+ [Flags]
+ public enum LinkedPropertyFlags: byte
+ {
+ Modified = 1,
+ IsNew = 2,
+ HasDefaultValue = 4,
+ Overwritten = 8,
+ MergeToMainGroup = 16,
+ Imported = 32,
+ EvaluatedValueModified = 64
}
-
}
diff --git a/main/src/core/MonoDevelop.Core/MonoDevelop.Projects.MSBuild/MSBuildPropertyGroup.cs b/main/src/core/MonoDevelop.Core/MonoDevelop.Projects.MSBuild/MSBuildPropertyGroup.cs
index 624b94a372..bd3165cb83 100644
--- a/main/src/core/MonoDevelop.Core/MonoDevelop.Projects.MSBuild/MSBuildPropertyGroup.cs
+++ b/main/src/core/MonoDevelop.Core/MonoDevelop.Projects.MSBuild/MSBuildPropertyGroup.cs
@@ -231,11 +231,12 @@ namespace MonoDevelop.Projects.MSBuild
} else {
foundProp = FindExistingProperty (i + 1, 1);
if (foundProp != null)
- insertIndex = ChildNodes.IndexOf (foundProp) - 1;
+ insertIndex = ChildNodes.IndexOf (foundProp);
}
}
var prop = new MSBuildProperty (name);
+ prop.IsNew = true;
prop.ParentNode = PropertiesParent;
prop.Owner = this;
properties [name] = prop;
@@ -250,10 +251,15 @@ namespace MonoDevelop.Projects.MSBuild
prop.ResetIndent (false);
+ if (PropertyGroupListener != null)
+ PropertyGroupListener.PropertyAdded (prop);
+
NotifyChanged ();
return prop;
}
+ internal IPropertyGroupListener PropertyGroupListener { get; set; }
+
MSBuildProperty FindExistingProperty (int index, int inc)
{
while (index >= 0 && index < propertyOrder.Count) {
@@ -278,17 +284,23 @@ namespace MonoDevelop.Projects.MSBuild
return AddProperty (name, condition);
}
- public void SetValue (string name, string value, string defaultValue = null, bool preserveExistingCase = false, bool mergeToMainGroup = false, string condition = null)
+ public void SetValue (string name, string value, string defaultValue = null, bool preserveExistingCase = false, bool mergeToMainGroup = false, string condition = null, MSBuildValueType valueType = null)
{
AssertCanModify ();
+
+ // If no value type is specified, use the default
+ if (valueType == null)
+ valueType = preserveExistingCase ? MSBuildValueType.DefaultPreserveCase : MSBuildValueType.Default;
+
if (value == null && defaultValue == "")
value = "";
+
var prop = GetProperty (name, condition);
var isDefault = value == defaultValue;
if (isDefault && !mergeToMainGroup) {
// if the value is default, only remove the property if it was not already the default
// to avoid unnecessary project file churn
- if (prop != null && string.Equals (defaultValue ?? "", prop.Value, preserveExistingCase ? StringComparison.OrdinalIgnoreCase : StringComparison.Ordinal))
+ if (prop != null && valueType.Equals (defaultValue ?? "", prop.Value))
return;
if (!IgnoreDefaultValues) {
if (prop != null)
@@ -298,7 +310,7 @@ namespace MonoDevelop.Projects.MSBuild
}
if (prop == null)
prop = AddProperty (name, condition);
- prop.SetValue (value, preserveExistingCase, mergeToMainGroup);
+ prop.SetValue (value, preserveExistingCase, mergeToMainGroup, valueType);
prop.HasDefaultValue = isDefault;
}
@@ -359,35 +371,38 @@ namespace MonoDevelop.Projects.MSBuild
public void RemoveProperty (MSBuildProperty prop)
{
AssertCanModify ();
+ if (PropertyGroupListener != null)
+ PropertyGroupListener.PropertyRemoved (prop);
prop.RemoveIndent ();
properties.Remove (prop.Name);
ChildNodes = ChildNodes.Remove (prop);
NotifyChanged ();
}
- public void RemoveAllProperties ()
+ internal void SetLoadedValues (IMSBuildPropertyGroupEvaluated loadedProps)
{
- AssertCanModify ();
- properties.Clear ();
- ChildNodes = ChildNodes.Clear ();
- NotifyChanged ();
+ foreach (var p in GetProperties ()) {
+ var ep = loadedProps.GetProperty (p.Name);
+ p.InitEvaluatedValue (ep.Value);
+ }
}
- public void UnMerge (IMSBuildPropertyGroupEvaluated baseGrp, ISet<string> propsToExclude)
+ internal void ResetIsNewFlags ()
{
- AssertCanModify ();
- HashSet<string> baseProps = new HashSet<string> ();
foreach (MSBuildProperty prop in GetProperties ()) {
- if (propsToExclude != null && propsToExclude.Contains (prop.Name))
- continue;
- baseProps.Add (prop.Name);
- var baseProp = baseGrp.GetProperty (prop.Name);
-
- // Remove properties whose value is the same as the one set in the global group
- // Remove properties which have the default value and which are not defined in the main group
+ prop.IsNew = false;
+ prop.Modified = false;
+ }
+ }
- if ((baseProp != null && prop.ValueType.Equals (prop.Value, baseProp.Value)) || (baseProp == null && prop.HasDefaultValue))
+ internal void PurgeDefaultProperties ()
+ {
+ // Remove properties that have been modified and have the default value. Usually such properties
+ // would be removed when assigning the value, but that won't happen if IgnoreDefaultValues=true
+ foreach (MSBuildProperty prop in GetProperties ()) {
+ if ((prop.Modified && prop.HasDefaultValue && !prop.EvaluatedValueModified) || (!prop.Modified && prop.IsNew))
RemoveProperty (prop.Name);
+ prop.Modified = false;
}
}
diff --git a/main/src/core/MonoDevelop.Core/MonoDevelop.Projects.MSBuild/MSBuildPropertyGroupEvaluated.cs b/main/src/core/MonoDevelop.Core/MonoDevelop.Projects.MSBuild/MSBuildPropertyGroupEvaluated.cs
index 0636e757e7..1f3f6bf88e 100644
--- a/main/src/core/MonoDevelop.Core/MonoDevelop.Projects.MSBuild/MSBuildPropertyGroupEvaluated.cs
+++ b/main/src/core/MonoDevelop.Core/MonoDevelop.Projects.MSBuild/MSBuildPropertyGroupEvaluated.cs
@@ -30,22 +30,15 @@ using MonoDevelop.Core;
namespace MonoDevelop.Projects.MSBuild
{
- class MSBuildPropertyGroupEvaluated: IMSBuildPropertyGroupEvaluated, IMSBuildProjectObject
+ class MSBuildPropertyGroupEvaluated: MSBuildNode, IMSBuildPropertyGroupEvaluated, IMSBuildProjectObject
{
- protected Dictionary<string,MSBuildPropertyEvaluated> properties = new Dictionary<string, MSBuildPropertyEvaluated> ();
- protected MSBuildProject parent;
+ protected Dictionary<string,IMSBuildPropertyEvaluated> properties = new Dictionary<string, IMSBuildPropertyEvaluated> ();
object sourceItem;
MSBuildEngine engine;
internal MSBuildPropertyGroupEvaluated (MSBuildProject parent)
{
- this.parent = parent;
- }
-
- public MSBuildProject ParentProject {
- get {
- return parent;
- }
+ ParentProject = parent;
}
internal void Sync (MSBuildEngine engine, object item)
@@ -66,11 +59,11 @@ namespace MonoDevelop.Projects.MSBuild
public IMSBuildPropertyEvaluated GetProperty (string name)
{
- MSBuildPropertyEvaluated prop;
+ IMSBuildPropertyEvaluated prop;
if (!properties.TryGetValue (name, out prop)) {
if (sourceItem != null) {
if (engine.GetItemHasMetadata (sourceItem, name)) {
- prop = new MSBuildPropertyEvaluated (parent, name, engine.GetItemMetadata (sourceItem, name), engine.GetEvaluatedItemMetadata (sourceItem, name));
+ prop = new MSBuildPropertyEvaluated (ParentProject, name, engine.GetItemMetadata (sourceItem, name), engine.GetEvaluatedItemMetadata (sourceItem, name));
properties [name] = prop;
}
}
@@ -78,15 +71,16 @@ namespace MonoDevelop.Projects.MSBuild
return prop;
}
- internal void SetProperties (Dictionary<string,MSBuildPropertyEvaluated> properties)
+ internal void SetProperties (Dictionary<string,IMSBuildPropertyEvaluated> properties)
{
this.properties = properties;
}
- internal void RemoveProperty (string name)
+ internal bool RemoveProperty (string name)
{
if (properties != null)
- properties.Remove (name);
+ return properties.Remove (name);
+ return false;
}
public string GetValue (string name, string defaultValue = null)
@@ -146,10 +140,12 @@ namespace MonoDevelop.Projects.MSBuild
}
}
- class MSBuildEvaluatedPropertyCollection: MSBuildPropertyGroupEvaluated, IMSBuildEvaluatedPropertyCollection
+ class MSBuildEvaluatedPropertyCollection: MSBuildPropertyGroupEvaluated, IMSBuildEvaluatedPropertyCollection, IPropertySet, IPropertyGroupListener
{
public readonly static MSBuildEvaluatedPropertyCollection Empty = new MSBuildEvaluatedPropertyCollection (null);
+ public MSBuildPropertyGroup LinkedGroup { get; set; }
+
public MSBuildEvaluatedPropertyCollection (MSBuildProject parent): base (parent)
{
}
@@ -160,7 +156,114 @@ namespace MonoDevelop.Projects.MSBuild
foreach (var p in e.GetEvaluatedProperties (project)) {
string name, value, finalValue;
e.GetPropertyInfo (p, out name, out value, out finalValue);
- properties [name] = new MSBuildPropertyEvaluated (parent, name, value, finalValue);
+ properties [name] = new MSBuildPropertyEvaluated (ParentProject, name, value, finalValue);
+ }
+ }
+
+ public void LinkToGroup (MSBuildPropertyGroup group)
+ {
+ LinkedGroup = group;
+ group.PropertyGroupListener = this;
+ foreach (var p in group.GetProperties ()) {
+ var ep = (MSBuildPropertyEvaluated) GetProperty (p.Name);
+ if (ep == null)
+ ep = AddProperty (p.Name);
+ ep.LinkToProperty (p);
+ }
+ }
+
+ public void RemoveRedundantProperties ()
+ {
+ // Remove properties whose value is the same as the one set in the global group
+ // Remove properties which have the default value and which are not defined in the main group
+
+ foreach (MSBuildProperty prop in LinkedGroup.GetProperties ()) {
+ if (prop.Modified && prop.HasDefaultValue)
+ RemoveProperty (prop.Name);
+ }
+ }
+
+ IMetadataProperty IPropertySet.GetProperty (string name)
+ {
+ AssertLinkedToGroup ();
+ return (IMetadataProperty) GetProperty (name);
+ }
+
+ IEnumerable<IMetadataProperty> IPropertySet.GetProperties ()
+ {
+ AssertLinkedToGroup ();
+ foreach (IMetadataProperty p in Properties)
+ yield return p;
+ }
+
+ void IPropertySet.SetValue (string name, string value, string defaultValue, bool preserveExistingCase, bool mergeToMainGroup, string condition, MSBuildValueType valueType)
+ {
+ AssertLinkedToGroup ();
+ LinkedGroup.SetValue (name, value, defaultValue, preserveExistingCase, mergeToMainGroup, condition, valueType);
+ }
+
+ void IPropertySet.SetValue (string name, FilePath value, FilePath defaultValue, bool relativeToProject, FilePath relativeToPath, bool mergeToMainGroup, string condition)
+ {
+ AssertLinkedToGroup ();
+ LinkedGroup.SetValue (name, value, defaultValue, relativeToProject, relativeToPath, mergeToMainGroup, condition);
+ }
+
+ void IPropertySet.SetValue (string name, object value, object defaultValue, bool mergeToMainGroup, string condition)
+ {
+ AssertLinkedToGroup ();
+ LinkedGroup.SetValue (name, value, defaultValue, mergeToMainGroup, condition);
+ }
+
+ void IPropertySet.SetPropertyOrder (params string [] propertyNames)
+ {
+ // When used as IPropertySet, this collection must be linked to a property group
+ AssertLinkedToGroup ();
+ LinkedGroup.SetPropertyOrder (propertyNames);
+ }
+
+ bool IPropertySet.RemoveProperty (string name)
+ {
+ AssertLinkedToGroup ();
+ return LinkedGroup.RemoveProperty (name);
+ }
+
+ MSBuildPropertyEvaluated AddProperty (string name)
+ {
+ var p = new MSBuildPropertyEvaluated (ParentProject, name, null, null);
+ p.IsNew = true;
+ properties [name] = p;
+ return p;
+ }
+
+ void AssertLinkedToGroup ()
+ {
+ if (LinkedGroup == null)
+ throw new InvalidOperationException ("MSBuildEvaluatedPropertyCollection not linked to a property group");
+ }
+
+ void IPropertyGroupListener.PropertyAdded (MSBuildProperty prop)
+ {
+ var p = (MSBuildPropertyEvaluated) GetProperty (prop.Name);
+ if (p == null || p.LinkedProperty == null) {
+ if (p == null)
+ p = AddProperty (prop.Name);
+ p.LinkToProperty (prop);
+ }
+ }
+
+ void IPropertyGroupListener.PropertyRemoved (MSBuildProperty prop)
+ {
+ var ep = (MSBuildPropertyEvaluated) GetProperty (prop.Name);
+ if (ep == null)
+ return;
+
+ if (ep.LinkedProperty != null) {
+ // Unlink the property
+ ep.LinkToProperty (null);
+ if (ep.IsNew) {
+ ep.IsNew = false;
+ properties.Remove (ep.Name);
+ }
}
}
@@ -173,5 +276,11 @@ namespace MonoDevelop.Projects.MSBuild
{
IEnumerable<IMSBuildPropertyEvaluated> Properties { get; }
}
+
+ interface IPropertyGroupListener
+ {
+ void PropertyAdded (MSBuildProperty prop);
+ void PropertyRemoved (MSBuildProperty prop);
+ }
}
diff --git a/main/src/core/MonoDevelop.Core/MonoDevelop.Projects.MSBuild/MSBuildPropertyGroupMerged.cs b/main/src/core/MonoDevelop.Core/MonoDevelop.Projects.MSBuild/MSBuildPropertyGroupMerged.cs
deleted file mode 100644
index 291f3f9a6a..0000000000
--- a/main/src/core/MonoDevelop.Core/MonoDevelop.Projects.MSBuild/MSBuildPropertyGroupMerged.cs
+++ /dev/null
@@ -1,206 +0,0 @@
-//
-// MSBuildPropertyGroupMerged.cs
-//
-// Author:
-// Lluis Sanchez Gual <lluis@xamarin.com>
-//
-// Copyright (c) 2014 Xamarin, Inc (http://www.xamarin.com)
-//
-// Permission is hereby granted, free of charge, to any person obtaining a copy
-// of this software and associated documentation files (the "Software"), to deal
-// in the Software without restriction, including without limitation the rights
-// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the Software is
-// furnished to do so, subject to the following conditions:
-//
-// The above copyright notice and this permission notice shall be included in
-// all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-// THE SOFTWARE.
-
-using System;
-using System.Linq;
-using System.Collections.Generic;
-using System.Xml;
-
-using MonoDevelop.Core;
-using System.Xml.Linq;
-
-namespace MonoDevelop.Projects.MSBuild
-{
-
- class MSBuildPropertyGroupMerged: IMSBuildPropertySet
- {
- List<IMSBuildPropertySet> groups = new List<IMSBuildPropertySet> ();
-
- public MSBuildPropertyGroupMerged (MSBuildProject project)
- {
- ParentProject = project;
- }
-
- public MSBuildProject ParentProject { get; private set; }
-
- public string Label { get; set; }
-
- public void Add (IMSBuildPropertySet g)
- {
- groups.Add (g);
- }
-
- public int GroupCount {
- get { return groups.Count; }
- }
-
- IMetadataProperty IPropertySet.GetProperty (string name)
- {
- return GetProperty (name);
- }
-
- IEnumerable<IMetadataProperty> IPropertySet.GetProperties ()
- {
- return GetProperties ().Cast<IMetadataProperty> ();
- }
-
- public MSBuildProperty GetProperty (string name)
- {
- // Find property in reverse order, since the last set
- // value is the good one
- for (int n=groups.Count - 1; n >= 0; n--) {
- var g = groups [n];
- MSBuildProperty p = g.GetProperty (name);
- if (p != null)
- return p;
- }
- return null;
- }
-
- public IMSBuildPropertySet GetGroupForProperty (string name)
- {
- // Find property in reverse order, since the last set
- // value is the good one
- for (int n=groups.Count - 1; n >= 1; n--) {
- var g = groups [n];
- MSBuildProperty p = g.GetProperty (name);
- if (p != null)
- return g;
- }
- return groups[0];
- }
-
- public void SetPropertyValue (string name, string value, bool preserveExistingCase)
- {
- MSBuildProperty p = GetProperty (name);
- if (p != null) {
- if (!preserveExistingCase || !string.Equals (value, p.Value, StringComparison.OrdinalIgnoreCase)) {
- p.SetValue (value);
- }
- return;
- }
- groups [0].SetValue (name, value, preserveExistingCase:preserveExistingCase);
- }
-
- public void SetValue (string name, string value, string defaultValue = null, bool preserveExistingCase = false, bool mergeToMainGroup = false, string condition = null)
- {
- GetGroupForProperty (name).SetValue (name, value, defaultValue, preserveExistingCase, mergeToMainGroup, condition);
- }
-
- public void SetValue (string name, FilePath value, FilePath defaultValue = default(FilePath), bool relativeToProject = true, FilePath relativeToPath = default(FilePath), bool mergeToMainGroup = false, string condition = null)
- {
- GetGroupForProperty (name).SetValue (name, value, defaultValue, relativeToProject, relativeToPath, mergeToMainGroup, condition);
- }
-
- public void SetValue (string name, object value, object defaultValue = null, bool mergeToMainGroup = false, string condition = null)
- {
- GetGroupForProperty (name).SetValue (name, value, defaultValue, mergeToMainGroup, condition);
- }
-
- public string GetValue (string name, string defaultValue = null)
- {
- return GetGroupForProperty (name).GetValue (name, defaultValue);
- }
-
- public string GetPathValue (string name, FilePath defaultValue = default(FilePath), bool relativeToFile = true)
- {
- return GetGroupForProperty (name).GetPathValue (name, defaultValue, relativeToFile);
- }
-
- public T GetValue<T> (string name)
- {
- return GetGroupForProperty (name).GetValue<T> (name);
- }
-
- public T GetValue<T> (string name, T defaultValue)
- {
- return GetGroupForProperty (name).GetValue<T> (name, defaultValue);
- }
-
- public object GetValue (string name, Type type, object defaultValue)
- {
- return GetGroupForProperty (name).GetValue (name, type, defaultValue);
- }
-
- public bool RemoveProperty (string name)
- {
- bool found = false;
- foreach (var g in groups) {
- if (g.RemoveProperty (name)) {
- Prune ((MSBuildPropertyGroup)g);
- found = true;
- }
- }
- return found;
- }
-
- public void RemoveAllProperties ()
- {
- foreach (var g in groups) {
- g.RemoveAllProperties ();
- Prune ((MSBuildPropertyGroup)g);
- }
- }
-
- public IEnumerable<MSBuildProperty> GetProperties ()
- {
- foreach (var g in groups) {
- foreach (var p in g.GetProperties ())
- yield return p;
- }
- }
-
- void Prune (MSBuildPropertyGroup g)
- {
- if (g != groups [0] && !g.GetProperties ().Any()) {
- // Remove this group since it's now empty
- g.ParentProject.Remove (g);
- }
- }
-
- public bool HasProperty (string name)
- {
- throw new NotImplementedException ();
- }
-
- public FilePath GetPathValue (string name, FilePath defaultValue = default(FilePath), bool relativeToProject = true, FilePath relativeToPath = default(FilePath))
- {
- return GetGroupForProperty (name).GetPathValue (name, defaultValue, relativeToProject, relativeToPath);
- }
-
- public bool TryGetPathValue (string name, out FilePath value, FilePath defaultValue = default(FilePath), bool relativeToProject = true, FilePath relativeToPath = default(FilePath))
- {
- return GetGroupForProperty (name).TryGetPathValue (name, out value, defaultValue, relativeToProject, relativeToPath);
- }
-
- public void SetPropertyOrder (params string[] propertyNames)
- {
- foreach (var g in groups)
- g.SetPropertyOrder (propertyNames);
- }
- }
-
-}
diff --git a/main/src/core/MonoDevelop.Core/MonoDevelop.Projects.MSBuild/MSBuildTarget.cs b/main/src/core/MonoDevelop.Core/MonoDevelop.Projects.MSBuild/MSBuildTarget.cs
index 48499bd3f1..debf9f3045 100644
--- a/main/src/core/MonoDevelop.Core/MonoDevelop.Projects.MSBuild/MSBuildTarget.cs
+++ b/main/src/core/MonoDevelop.Core/MonoDevelop.Projects.MSBuild/MSBuildTarget.cs
@@ -39,7 +39,7 @@ using System.Threading.Tasks;
namespace MonoDevelop.Projects.MSBuild
{
- public class MSBuildTarget: MSBuildElement
+ public class MSBuildTarget: MSBuildElement, IMSBuildTargetEvaluated
{
string name;
string afterTargets;
@@ -57,7 +57,7 @@ namespace MonoDevelop.Projects.MSBuild
return knownAttributes;
}
- string AfterTargets {
+ public string AfterTargets {
get {
return this.afterTargets;
}
@@ -68,7 +68,7 @@ namespace MonoDevelop.Projects.MSBuild
}
}
- string Inputs {
+ public string Inputs {
get {
return this.inputs;
}
@@ -79,7 +79,7 @@ namespace MonoDevelop.Projects.MSBuild
}
}
- string Outputs {
+ public string Outputs {
get {
return this.outputs;
}
@@ -90,7 +90,7 @@ namespace MonoDevelop.Projects.MSBuild
}
}
- string BeforeTargets {
+ public string BeforeTargets {
get {
return this.beforeTargets;
}
@@ -101,7 +101,7 @@ namespace MonoDevelop.Projects.MSBuild
}
}
- string DependsOnTargets
+ public string DependsOnTargets
{
get {
return this.dependsOnTargets;
@@ -113,7 +113,7 @@ namespace MonoDevelop.Projects.MSBuild
}
}
- string Returns {
+ public string Returns {
get {
return this.returns;
}
@@ -124,7 +124,7 @@ namespace MonoDevelop.Projects.MSBuild
}
}
- string KeepDuplicateOutputs {
+ public string KeepDuplicateOutputs {
get {
return this.keepDuplicateOutputs;
}
@@ -224,5 +224,27 @@ namespace MonoDevelop.Projects.MSBuild
ChildNodes = ChildNodes.Remove (task);
}
}
-
+
+ public interface IMSBuildTargetEvaluated
+ {
+ string AfterTargets { get; }
+
+ string Inputs { get; }
+
+ string Outputs { get; }
+
+ string BeforeTargets { get; }
+
+ string DependsOnTargets { get; }
+
+ string Returns { get; }
+
+ string KeepDuplicateOutputs { get; }
+
+ string Name { get; }
+
+ bool IsImported { get; }
+
+ IEnumerable<MSBuildTask> Tasks { get; }
+ }
}
diff --git a/main/src/core/MonoDevelop.Core/MonoDevelop.Projects.MSBuild/MSBuildValueType.cs b/main/src/core/MonoDevelop.Core/MonoDevelop.Projects.MSBuild/MSBuildValueType.cs
index d64ef6a9a4..ca56d70dcb 100644
--- a/main/src/core/MonoDevelop.Core/MonoDevelop.Projects.MSBuild/MSBuildValueType.cs
+++ b/main/src/core/MonoDevelop.Core/MonoDevelop.Projects.MSBuild/MSBuildValueType.cs
@@ -27,13 +27,14 @@ using System;
namespace MonoDevelop.Projects.MSBuild
{
- class MSBuildValueType
+ public class MSBuildValueType
{
public static readonly MSBuildValueType Default = new MSBuildValueType ();
public static readonly MSBuildValueType DefaultPreserveCase = new PreserveCaseValueType ();
public static readonly MSBuildValueType Path = new PathValueType ();
public static readonly MSBuildValueType Boolean = new PreserveCaseValueType ();
- public static readonly MSBuildValueType UnresolvedPath = new PathValueType ();
+ public static readonly MSBuildValueType Guid = new GuidValueType ();
+ internal static readonly MSBuildValueType UnresolvedPath = new PathValueType ();
public virtual bool Equals (string ob1, string ob2)
{
@@ -60,5 +61,15 @@ namespace MonoDevelop.Projects.MSBuild
return ob1.Equals (ob2, StringComparison.OrdinalIgnoreCase);
}
}
+
+ class GuidValueType: MSBuildValueType
+ {
+ public override bool Equals (string ob1, string ob2)
+ {
+ ob1 = ob1.Trim ('{', '}');
+ ob2 = ob2.Trim ('{', '}');
+ return ob1.Equals (ob2, StringComparison.OrdinalIgnoreCase);
+ }
+ }
}
diff --git a/main/src/core/MonoDevelop.Core/MonoDevelop.Projects.MSBuild/SlnFileFormat.cs b/main/src/core/MonoDevelop.Core/MonoDevelop.Projects.MSBuild/SlnFileFormat.cs
index 9bf684a17c..b2a2a0433a 100644
--- a/main/src/core/MonoDevelop.Core/MonoDevelop.Projects.MSBuild/SlnFileFormat.cs
+++ b/main/src/core/MonoDevelop.Core/MonoDevelop.Projects.MSBuild/SlnFileFormat.cs
@@ -178,7 +178,11 @@ namespace MonoDevelop.Projects.MSBuild
ICollection<SolutionFolder> folders = solution.RootFolder.GetAllItems<SolutionFolder> ().ToList ();
if (folders.Count > 1) {
// If folders ==1, that's the root folder
- var sec = sln.Sections.GetOrCreateSection ("NestedProjects", SlnSectionType.PreProcess);
+ var sec = sln.Sections.GetSection ("NestedProjects", SlnSectionType.PreProcess);
+ if (sec == null) {
+ sec = sln.Sections.GetOrCreateSection ("NestedProjects", SlnSectionType.PreProcess);
+ sec.SkipIfEmpty = true; // don't write the section if there are no nested projects after all
+ }
foreach (SolutionFolder folder in folders) {
if (folder.IsRoot)
continue;
diff --git a/main/src/core/MonoDevelop.Core/MonoDevelop.Projects.SharedAssetsProjects/SharedAssetsProject.cs b/main/src/core/MonoDevelop.Core/MonoDevelop.Projects.SharedAssetsProjects/SharedAssetsProject.cs
index ca174faa65..6c2dc55ffc 100644
--- a/main/src/core/MonoDevelop.Core/MonoDevelop.Projects.SharedAssetsProjects/SharedAssetsProject.cs
+++ b/main/src/core/MonoDevelop.Core/MonoDevelop.Projects.SharedAssetsProjects/SharedAssetsProject.cs
@@ -59,6 +59,27 @@ namespace MonoDevelop.Projects.SharedAssetsProjects
languageName = language;
}
+ protected override void OnNameChanged (SolutionItemRenamedEventArgs e)
+ {
+ if (!projItemsPath.IsNullOrEmpty && Path.GetFileNameWithoutExtension (e.OldName) == projItemsPath.FileNameWithoutExtension) {
+ // We are going to rename the projitems file, but before that, let's get all referencing projects, since they reference
+ // using the old path
+ string oldPath = ProjItemsPath;
+ var refProjects = GetReferencingProjects ().ToArray ();
+
+ // Set the new projitems file name
+ projItemsPath = projItemsPath.ParentDirectory.Combine (e.NewName) + projItemsPath.Extension;
+
+ // Update all referencing projects
+ foreach (var p in refProjects) {
+ var sr = p.References.FirstOrDefault (r => r.GetItemsProjectPath () == oldPath);
+ if (sr != null)
+ sr.SetItemsProjectPath (ProjItemsPath);
+ }
+ }
+ base.OnNameChanged (e);
+ }
+
protected override void OnInitializeFromTemplate (ProjectCreateInformation projectCreateInfo, XmlElement projectOptions)
{
base.OnInitializeFromTemplate (projectCreateInfo, projectOptions);
@@ -135,7 +156,7 @@ namespace MonoDevelop.Projects.SharedAssetsProjects
base.OnWriteProject (monitor, msproject);
- var newProject = FileName == null || !File.Exists (FileName);
+ var newProject = FileName == null || projitemsProject.IsNewProject;
if (newProject) {
var grp = msproject.GetGlobalPropertyGroup ();
if (grp == null)
@@ -145,7 +166,7 @@ namespace MonoDevelop.Projects.SharedAssetsProjects
import.Condition = @"Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')";
msproject.AddNewImport (@"$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\CodeSharing\Microsoft.CodeSharing.Common.Default.props");
msproject.AddNewImport (@"$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\CodeSharing\Microsoft.CodeSharing.Common.props");
- import = msproject.AddNewImport (Path.ChangeExtension (FileName.FileName, ".projitems"));
+ import = msproject.AddNewImport (MSBuildProjectService.ToMSBuildPath (FileName.ParentDirectory, projItemsPath));
import.Label = "Shared";
if (LanguageName.Equals("C#", StringComparison.OrdinalIgnoreCase)) {
msproject.AddNewImport (CSharptargets);
@@ -155,7 +176,13 @@ namespace MonoDevelop.Projects.SharedAssetsProjects
}
} else {
- msproject.Load (FileName);
+ var itemsImport = msproject.Imports.FirstOrDefault (i => i.Label == "Shared");
+ if (itemsImport != null)
+ itemsImport.Project = MSBuildProjectService.ToMSBuildPath (FileName.ParentDirectory, projItemsPath);
+ else {
+ var import = msproject.AddNewImport (MSBuildProjectService.ToMSBuildPath (FileName.ParentDirectory, projItemsPath));
+ import.Label = "Shared";
+ }
}
// having no ToolsVersion is equivalent to 2.0, roundtrip that correctly
@@ -412,7 +439,7 @@ namespace MonoDevelop.Projects.SharedAssetsProjects
if (ParentSolution == null)
return new DotNetProject[0];
- return ParentSolution.GetAllItems<DotNetProject> ().Where (p => p.References.Any (r => r.GetItemsProjectPath () != null));
+ return ParentSolution.GetAllItems<DotNetProject> ().Where (p => p.References.Any (r => r.GetItemsProjectPath () == ProjItemsPath));
}
}
diff --git a/main/src/core/MonoDevelop.Core/MonoDevelop.Projects.SharedAssetsProjects/SharedAssetsProjectMSBuildExtension.cs b/main/src/core/MonoDevelop.Core/MonoDevelop.Projects.SharedAssetsProjects/SharedAssetsProjectMSBuildExtension.cs
index b2c68ad756..1f5f652c87 100644
--- a/main/src/core/MonoDevelop.Core/MonoDevelop.Projects.SharedAssetsProjects/SharedAssetsProjectMSBuildExtension.cs
+++ b/main/src/core/MonoDevelop.Core/MonoDevelop.Projects.SharedAssetsProjects/SharedAssetsProjectMSBuildExtension.cs
@@ -71,13 +71,16 @@ namespace MonoDevelop.Projects.SharedAssetsProjects
ip = MSBuildProjectService.ToMSBuildPath (Project.ItemDirectory, ip);
validProjitems.Add (ip);
if (!project.Imports.Any (im => im.Project == ip)) {
- var fsharpProject = project.ProjectTypeGuids.Contains("{F2A71F9B-5D33-465A-A702-920D77279786}");
- MSBuildObject before;
- if (fsharpProject)
- //For F# use the first item group as the shared project files have to be listed first
- before = project.ItemGroups.FirstOrDefault (i => i.Label != "Shared");
- else
- before = project.Imports.FirstOrDefault (i => i.Label != "Shared");
+ // If there is already a Shared import, place the new import in the same location
+ MSBuildObject before = project.Imports.FirstOrDefault (i => i.Label == "Shared" && i.Project.EndsWith (".projitems"));
+ if (before == null) {
+ var fsharpProject = project.ProjectTypeGuids.Contains("{F2A71F9B-5D33-465A-A702-920D77279786}");
+ if (fsharpProject)
+ //For F# use the first item group as the shared project files have to be listed first
+ before = project.ItemGroups.FirstOrDefault (i => i.Label != "Shared");
+ else
+ before = project.Imports.FirstOrDefault (i => i.Label != "Shared");
+ }
var im = project.AddNewImport (ip, beforeObject: before);
im.Label = "Shared";
diff --git a/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/ConditionedPropertyCollection.cs b/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/ConditionedPropertyCollection.cs
new file mode 100644
index 0000000000..813ea2f36d
--- /dev/null
+++ b/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/ConditionedPropertyCollection.cs
@@ -0,0 +1,269 @@
+//
+// ConditionedPropertyCollection.cs
+//
+// Author:
+// Lluis Sanchez Gual <lluis@xamarin.com>
+//
+// Copyright (c) 2015 Xamarin, Inc (http://www.xamarin.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+using System;
+using System.Linq;
+using System.Collections.Generic;
+using System.Collections.Immutable;
+
+namespace MonoDevelop.Projects
+{
+ public class ConditionedPropertyCollection
+ {
+ Dictionary<string, ImmutableList<string>> props = new Dictionary<string, ImmutableList<string>> ();
+ Dictionary<KeySet, ImmutableList<ValueSet>> combinedProps = new Dictionary<KeySet, ImmutableList<ValueSet>> ();
+
+ /// <summary>
+ /// A set of strings, which can be compared to other sets ignoring the order.
+ /// </summary>
+ struct KeySet
+ {
+ string [] keys;
+
+ public KeySet (string [] keys)
+ {
+ this.keys = keys;
+ }
+
+ public override bool Equals (object obj)
+ {
+ if (!(obj is KeySet))
+ return false;
+
+ var other = (KeySet)obj;
+ if (other.keys.Length != keys.Length)
+ return false;
+
+ foreach (var k in keys) {
+ if (!other.keys.Contains (k))
+ return false;
+ }
+ return true;
+ }
+
+ public override int GetHashCode ()
+ {
+ unchecked {
+ int r = 0;
+ foreach (var k in keys)
+ r ^= k.GetHashCode ();
+ return r;
+ }
+ }
+ }
+
+ /// <summary>
+ /// A set of key/value pairs
+ /// </summary>
+ public struct ValueSet
+ {
+ internal string [] ReferenceKeys;
+ internal string [] Values;
+
+ /// <summary>
+ /// Initializes a new ValueSet
+ /// </summary>
+ /// <param name="referenceKeys">Array of keys that specifies the order in which values are stored</param>
+ /// <param name="names">Array of keys, ordered according to the values parameter</param>
+ /// <param name="values">Values of the keys.</param>
+ internal ValueSet (string [] referenceKeys, string[] names, string[] values)
+ {
+ this.ReferenceKeys = referenceKeys;
+ this.Values = new string [values.Length];
+ if (referenceKeys.Length == 1)
+ this.Values [0] = values [0];
+ else {
+ for (int n = 0; n < names.Length; n++) {
+ // Store the values using the order of the reference keys
+ int i = Array.IndexOf (referenceKeys, names [n]);
+ this.Values [i] = values [n];
+ }
+ }
+ }
+
+ public ValueSet (string [] names, string [] values): this (names, names, values)
+ {
+ }
+
+ /// <summary>
+ /// Gets the value for the given property
+ /// </summary>
+ public string GetValue (string property)
+ {
+ if (ReferenceKeys.Length == 1) {
+ // Fast path when there is only one property in the set
+ if (ReferenceKeys [0] == property)
+ return Values [0];
+ else
+ return null;
+ } else {
+ int i = Array.IndexOf (ReferenceKeys, property);
+ if (i != -1)
+ return Values [i];
+ else
+ return null;
+ }
+ }
+
+ public override bool Equals (object obj)
+ {
+ if (!(obj is ValueSet))
+ return false;
+
+ var other = (ValueSet)obj;
+
+ if (ReferenceKeys == other.ReferenceKeys) {
+ // Fast path, used when both sets are based on the same reference keys
+ for (int n = 0; n < Values.Length; n++)
+ if (Values [n] != other.Values [n])
+ return false;
+ return true;
+ }
+
+ if (other.ReferenceKeys.Length != ReferenceKeys.Length)
+ return false;
+
+ if (other.ReferenceKeys.Length == 1)
+ return ReferenceKeys[0] == other.ReferenceKeys[0] && Values [0] == other.Values [0];
+
+ for (int n = 0; n < ReferenceKeys.Length; n++) {
+ if (other.GetValue (ReferenceKeys[n]) != Values[n])
+ return false;
+ }
+ return true;
+ }
+
+ public override int GetHashCode ()
+ {
+ unchecked {
+ int r = 0;
+ foreach (var k in Values)
+ r ^= k.GetHashCode ();
+ return r;
+ }
+ }
+ }
+
+ internal void Append (ConditionedPropertyCollection other)
+ {
+ foreach (var e in other.props) {
+ var otherList = e.Value;
+ var key = e.Key;
+ ImmutableList<string> list;
+ if (props.TryGetValue (key, out list)) {
+ foreach (var c in otherList) {
+ if (!list.Contains (c))
+ list = list.Add (c);
+ }
+ props [key] = list;
+ } else
+ props [key] = otherList;
+ }
+
+ foreach (var e in other.combinedProps) {
+ var otherList = e.Value;
+ var key = e.Key;
+ ImmutableList<ValueSet> thisList;
+ if (combinedProps.TryGetValue (key, out thisList)) {
+ foreach (var c in otherList) {
+ if (!thisList.Contains (c))
+ // Create a new ValueSet so that the reference keys of this collection are reused
+ thisList = thisList.Add (new ValueSet (thisList [0].ReferenceKeys, c.ReferenceKeys, c.Values));
+ }
+ combinedProps [key] = thisList;
+ } else
+ combinedProps [key] = otherList;
+ }
+ }
+
+ internal void AddPropertyValues (string[] names, string[] values)
+ {
+ var key = new KeySet (names);
+ ImmutableList<ValueSet> list;
+ ValueSet valueSet;
+
+ // First register the combination of values
+
+ if (!combinedProps.TryGetValue (key, out list)) {
+ list = ImmutableList<ValueSet>.Empty;
+ valueSet = new ValueSet (names, names, values);
+ } else {
+ // If there is already a list, there must be at least one item.
+ // Use the reference key of that item, so they share the same reference key array
+ valueSet = new ValueSet (list [0].ReferenceKeys, names, values);
+ }
+
+ if (!list.Contains (valueSet))
+ combinedProps[key] = list.Add (valueSet);
+
+ // Now register each value individually
+
+ ImmutableList<string> valList;
+ for (int n = 0; n < names.Length; n++) {
+ var name = names [n];
+ var val = values [n];
+ if (!props.TryGetValue (name, out valList))
+ valList = ImmutableList<string>.Empty;
+ if (!valList.Contains (val))
+ props[name] = valList.Add (val);
+ }
+ }
+
+ /// <summary>
+ /// Retuns the name of all conditioned properties
+ /// </summary>
+ /// <returns>The all properties.</returns>
+ public IEnumerable<string> GetAllProperties ()
+ {
+ return props.Keys;
+ }
+
+ /// <summary>
+ /// Gets the values used in conditions for the given property
+ /// </summary>
+ public ImmutableList<string> GetAllPropertyValues (string property)
+ {
+ ImmutableList<string> list;
+ if (props.TryGetValue (property, out list))
+ return list;
+ return ImmutableList<string>.Empty;
+ }
+
+ /// <summary>
+ /// Gets the values for a combination of properties. It only returns values specified in conditions that
+ /// reference only (and only) the given properties. For example, if the properties are Configuration and
+ /// Platform, it will return values for those properties specified in conditions that reference both
+ /// Configuration and Platform.
+ /// </summary>
+ public ImmutableList<ValueSet> GetCombinedPropertyValues (params string[] properties)
+ {
+ ImmutableList<ValueSet> list;
+ if (combinedProps.TryGetValue (new KeySet (properties), out list))
+ return list;
+ return ImmutableList<ValueSet>.Empty;
+ }
+ }
+}
+
diff --git a/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/DotNetCompilerParameters.cs b/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/DotNetCompilerParameters.cs
index f6b72ebf64..699601bd54 100644
--- a/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/DotNetCompilerParameters.cs
+++ b/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/DotNetCompilerParameters.cs
@@ -38,12 +38,12 @@ namespace MonoDevelop.Projects
get { return ParentConfiguration.ParentItem; }
}
- internal protected virtual void Read (IMSBuildEvaluatedPropertyCollection pset, string toolsVersion)
+ internal protected virtual void Read (IPropertySet pset)
{
pset.ReadObjectProperties (this, GetType (), true);
}
- internal protected virtual void Write (IPropertySet pset, string toolsVersion)
+ internal protected virtual void Write (IPropertySet pset)
{
pset.WriteObjectProperties (this, GetType (), true);
}
diff --git a/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/DotNetProject.cs b/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/DotNetProject.cs
index f8bf510518..bb7f931af2 100644
--- a/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/DotNetProject.cs
+++ b/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/DotNetProject.cs
@@ -860,6 +860,16 @@ namespace MonoDevelop.Projects
});
}
+ /// <summary>
+ /// Gets the referenced assembly projects, but only projects which output are actually referenced
+ /// for example references with ReferenceOutputAssembly=false are excluded
+ /// </summary>
+ /// <param name="configuration">Configuration.</param>
+ public IEnumerable<DotNetProject> GetReferencedAssemblyProjects (ConfigurationSelector configuration)
+ {
+ return ProjectExtension.OnGetReferencedAssemblyProjects (configuration);
+ }
+
internal protected virtual async Task<List<string>> OnGetReferencedAssemblies (ConfigurationSelector configuration)
{
List<string> result = new List<string> ();
@@ -907,6 +917,23 @@ namespace MonoDevelop.Projects
return result;
}
+ internal protected virtual IEnumerable<DotNetProject> OnGetReferencedAssemblyProjects (ConfigurationSelector configuration)
+ {
+ if (ParentSolution == null) {
+ yield break;
+ }
+ foreach (ProjectReference pref in References) {
+ if (pref.ReferenceType == ReferenceType.Project &&
+ (string.IsNullOrEmpty (pref.Condition) || ConditionParser.ParseAndEvaluate (pref.Condition, new ProjectParserContext (this, (DotNetProjectConfiguration)GetConfiguration (configuration))))) {
+ if (!pref.ReferenceOutputAssembly)
+ continue;
+ var rp = pref.ResolveProject (ParentSolution) as DotNetProject;
+ if (rp != null)
+ yield return rp;
+ }
+ }
+ }
+
protected override Task<BuildResult> DoBuild (ProgressMonitor monitor, ConfigurationSelector configuration)
{
var handler = new MD1DotNetProjectHandler (this);
@@ -1544,10 +1571,10 @@ namespace MonoDevelop.Projects
}
}
- protected override void OnWriteConfiguration (ProgressMonitor monitor, ProjectConfiguration config, IMSBuildPropertySet pset)
+ protected override void OnWriteConfiguration (ProgressMonitor monitor, ProjectConfiguration config, IPropertySet pset)
{
base.OnWriteConfiguration (monitor, config, pset);
- if (pset.ParentProject.IsNewProject)
+ if (MSBuildProject.IsNewProject)
pset.SetValue ("ErrorReport", "prompt");
}
@@ -1574,6 +1601,11 @@ namespace MonoDevelop.Projects
return Project.OnGetReferencedAssemblies (configuration);
}
+ internal protected override IEnumerable<DotNetProject> OnGetReferencedAssemblyProjects (ConfigurationSelector configuration)
+ {
+ return Project.OnGetReferencedAssemblyProjects (configuration);
+ }
+
internal protected override ExecutionCommand OnCreateExecutionCommand (ConfigurationSelector configSel, DotNetProjectConfiguration configuration)
{
return Project.OnCreateExecutionCommand (configSel, configuration);
diff --git a/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/DotNetProjectConfiguration.cs b/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/DotNetProjectConfiguration.cs
index fe1968af99..411c8f7d30 100644
--- a/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/DotNetProjectConfiguration.cs
+++ b/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/DotNetProjectConfiguration.cs
@@ -52,17 +52,13 @@ namespace MonoDevelop.Projects
string sourcePath;
DotNetCompilerParameters compilationParameters;
- public DotNetProjectConfiguration ()
+ public DotNetProjectConfiguration (string id): base (id)
{
}
- public DotNetProjectConfiguration (string name): base (name)
+ internal protected override void Read (IPropertySet pset)
{
- }
-
- internal protected override void Read (IMSBuildEvaluatedPropertyCollection pset, string toolsVersion)
- {
- base.Read (pset, toolsVersion);
+ base.Read (pset);
assembly = pset.GetValue ("AssemblyName");
signAssembly = pset.GetValue<bool> ("SignAssembly");
@@ -71,18 +67,18 @@ namespace MonoDevelop.Projects
if (string.IsNullOrEmpty (assemblyKeyFile))
assemblyKeyFile = pset.GetPathValue ("AssemblyKeyFile", FilePath.Empty);
if (compilationParameters != null)
- compilationParameters.Read (pset, toolsVersion);
+ compilationParameters.Read (pset);
}
- internal protected override void Write (IPropertySet pset, string toolsVersion)
+ internal protected override void Write (IPropertySet pset)
{
- base.Write (pset, toolsVersion);
+ base.Write (pset);
pset.SetValue ("AssemblyName", assembly, mergeToMainGroup: true);
pset.SetValue ("SignAssembly", signAssembly, defaultValue:false, mergeToMainGroup: true);
pset.SetValue ("DelaySign", delaySign, defaultValue:false, mergeToMainGroup:true);
pset.SetValue ("AssemblyOriginatorKeyFile", assemblyKeyFile, defaultValue:FilePath.Empty, mergeToMainGroup:true);
if (compilationParameters != null)
- compilationParameters.Write (pset, toolsVersion);
+ compilationParameters.Write (pset);
}
private bool signAssembly = false;
@@ -182,9 +178,9 @@ namespace MonoDevelop.Projects
}
}
- public override void CopyFrom (ItemConfiguration configuration)
+ protected override void OnCopyFrom (ItemConfiguration configuration, bool isRename)
{
- base.CopyFrom (configuration);
+ base.OnCopyFrom (configuration, isRename);
DotNetProjectConfiguration conf = (DotNetProjectConfiguration) configuration;
assembly = conf.assembly;
diff --git a/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/DotNetProjectExtension.cs b/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/DotNetProjectExtension.cs
index 4281c40a73..1bf92a0cfb 100644
--- a/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/DotNetProjectExtension.cs
+++ b/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/DotNetProjectExtension.cs
@@ -33,7 +33,7 @@ using MonoDevelop.Projects.MSBuild;
namespace MonoDevelop.Projects
{
- public class DotNetProjectExtension: ProjectExtension
+ public class DotNetProjectExtension : ProjectExtension
{
#region Project properties
@@ -77,6 +77,11 @@ namespace MonoDevelop.Projects
return next.OnGetReferencedAssemblies (configuration);
}
+ internal protected virtual IEnumerable<DotNetProject> OnGetReferencedAssemblyProjects (ConfigurationSelector configuration)
+ {
+ return next.OnGetReferencedAssemblyProjects (configuration);
+ }
+
internal protected virtual ExecutionCommand OnCreateExecutionCommand (ConfigurationSelector configSel, DotNetProjectConfiguration configuration)
{
return next.OnCreateExecutionCommand (configSel, configuration);
diff --git a/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/GenericProject.cs b/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/GenericProject.cs
index 6b53f9e784..e08223f506 100644
--- a/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/GenericProject.cs
+++ b/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/GenericProject.cs
@@ -65,11 +65,7 @@ namespace MonoDevelop.Projects
[ProjectModelDataItem]
public class GenericProjectConfiguration: ProjectConfiguration
{
- public GenericProjectConfiguration ()
- {
- }
-
- public GenericProjectConfiguration (string name): base (name)
+ public GenericProjectConfiguration (string id): base (id)
{
}
}
diff --git a/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/IConfigurationTarget.cs b/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/IConfigurationTarget.cs
index da90f7e065..dc52dd5400 100644
--- a/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/IConfigurationTarget.cs
+++ b/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/IConfigurationTarget.cs
@@ -36,7 +36,17 @@ namespace MonoDevelop.Projects
ReadOnlyCollection<string> GetConfigurations ();
IItemConfigurationCollection Configurations { get; }
ItemConfiguration DefaultConfiguration { get; set; }
- ItemConfiguration CreateConfiguration (string name, ConfigurationKind kind);
+ ItemConfiguration CreateConfiguration (string id, ConfigurationKind kind);
string DefaultConfigurationId { get; set; }
}
+
+ public static class ConfigurationTargetExtensions
+ {
+ public static ItemConfiguration CloneConfiguration (this IConfigurationTarget target, ItemConfiguration configuration, string newId)
+ {
+ var clone = target.CreateConfiguration (newId, ConfigurationKind.Blank);
+ clone.CopyFrom (configuration);
+ return clone;
+ }
+ }
}
diff --git a/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/IPropertySet.cs b/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/IPropertySet.cs
index b86d8715e1..70fa3e23b3 100644
--- a/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/IPropertySet.cs
+++ b/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/IPropertySet.cs
@@ -48,12 +48,11 @@ namespace MonoDevelop.Projects
IMetadataProperty GetProperty (string name);
IEnumerable<IMetadataProperty> GetProperties ();
- void SetValue (string name, string value, string defaultValue = null, bool preserveExistingCase = false, bool mergeToMainGroup = false, string condition = null);
+ void SetValue (string name, string value, string defaultValue = null, bool preserveExistingCase = false, bool mergeToMainGroup = false, string condition = null, MSBuildValueType valueType = null);
void SetValue (string name, FilePath value, FilePath defaultValue = default(FilePath), bool relativeToProject = true, FilePath relativeToPath = default(FilePath), bool mergeToMainGroup = false, string condition = null);
void SetValue (string name, object value, object defaultValue = null, bool mergeToMainGroup = false, string condition = null);
bool RemoveProperty (string name);
- void RemoveAllProperties ();
void SetPropertyOrder (params string[] propertyNames);
}
diff --git a/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/ItemConfiguration.cs b/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/ItemConfiguration.cs
index 58165373e2..b07ba7cbc4 100644
--- a/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/ItemConfiguration.cs
+++ b/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/ItemConfiguration.cs
@@ -48,10 +48,6 @@ namespace MonoDevelop.Projects
Hashtable properties;
- public ItemConfiguration ()
- {
- }
-
public ItemConfiguration (string id)
{
ParseConfigurationId (id, out name, out platform);
@@ -84,7 +80,6 @@ namespace MonoDevelop.Projects
public string Name {
get { return name; }
- set { name = value; }
}
public string Id {
@@ -94,35 +89,34 @@ namespace MonoDevelop.Projects
else
return name + "|" + platform;
}
- set {
- ParseConfigurationId (value, out name, out platform);
- }
}
public string Platform {
get { return platform ?? string.Empty; }
- set { platform = value; }
}
public CustomCommandCollection CustomCommands {
get { return customCommands; }
}
- public object Clone()
+ /// <summary>
+ /// Copies the data of a configuration into this configuration
+ /// </summary>
+ /// <param name="configuration">Configuration from which to get the data.</param>
+ /// <param name="isRename">If true, it means that the copy is being made as a result of a rename or clone operation. In this case,
+ /// the overriden method may change the value of some properties that depend on the configuration name. For example, if the
+ /// copied configuration is Debug and the OutputPath property has "bin/Debug" as value, then that value may be changed
+ /// to match the new configuration name instead of keeping "bin/Debug"</param>
+ public void CopyFrom (ItemConfiguration configuration, bool isRename = false)
{
- ItemConfiguration conf = (ItemConfiguration) Activator.CreateInstance (GetType ());
- conf.CopyFrom (this);
- conf.name = name;
- conf.platform = platform;
- return conf;
+ OnCopyFrom (configuration, isRename);
}
-
- public virtual void CopyFrom (ItemConfiguration configuration)
+
+ protected virtual void OnCopyFrom (ItemConfiguration configuration, bool isRename)
{
- ItemConfiguration other = (ItemConfiguration) configuration;
- if (other.properties != null) {
+ if (configuration.properties != null) {
properties = new Hashtable ();
- foreach (DictionaryEntry e in other.properties) {
+ foreach (DictionaryEntry e in configuration.properties) {
if (e.Value is ICloneable)
properties [e.Key] = ((ICloneable)e.Value).Clone ();
else
@@ -131,12 +125,12 @@ namespace MonoDevelop.Projects
}
else
properties = null;
- customCommands = other.customCommands.Clone ();
+ customCommands = configuration.customCommands.Clone ();
}
public override string ToString()
{
- return name;
+ return Id;
}
public IDictionary ExtendedProperties {
diff --git a/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/Project.cs b/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/Project.cs
index c6a9586f46..d1446c5fac 100644
--- a/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/Project.cs
+++ b/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/Project.cs
@@ -175,6 +175,18 @@ namespace MonoDevelop.Projects
sourceProject = new MSBuildProject ();
sourceProject.FileName = FileName;
}
+
+ // Create a project instance to be used for comparing old and new values in the global property group
+ // We use a dummy configuration and platform to avoid loading default values from the configurations
+ // while evaluating
+ var c = Guid.NewGuid ().ToString ();
+ using (var pi = CreateProjectInstaceForConfiguration (c, c)) {
+ var globalGroup = sourceProject.GetGlobalPropertyGroup ();
+ // Avoid crash if there is not global group
+ if (globalGroup == null)
+ globalGroup = sourceProject.AddNewPropertyGroup (false);
+ mainGroupProperties = pi.GetPropertiesLinkedToGroup (globalGroup);
+ }
}
protected override void OnExtensionChainInitialized ()
@@ -200,13 +212,11 @@ namespace MonoDevelop.Projects
}
public IPropertySet ProjectProperties {
- get { return MSBuildProject.GetGlobalPropertyGroup (); }
+ get { return mainGroupProperties ?? MSBuildProject.GetGlobalPropertyGroup (); }
}
public MSBuildProject MSBuildProject {
- get {
- if (msbuildUpdatePending && !saving)
- WriteProjectAsync (new ProgressMonitor ()).Wait ();
+ get {
return sourceProject;
}
}
@@ -222,9 +232,54 @@ namespace MonoDevelop.Projects
}
}
- new public ProjectConfiguration CreateConfiguration (string name, ConfigurationKind kind = ConfigurationKind.Blank)
+ new public ProjectConfiguration CreateConfiguration (string name, string platform, ConfigurationKind kind = ConfigurationKind.Blank)
+ {
+ return (ProjectConfiguration) base.CreateConfiguration (name, platform, kind);
+ }
+
+ new public ProjectConfiguration CreateConfiguration (string id, ConfigurationKind kind = ConfigurationKind.Blank)
+ {
+ return (ProjectConfiguration) base.CreateConfiguration (id, kind);
+ }
+
+ new public ProjectConfiguration CloneConfiguration (SolutionItemConfiguration configuration, string newName, string newPlatform)
+ {
+ return (ProjectConfiguration) base.CloneConfiguration (configuration, newName, newPlatform);
+ }
+
+ new public ProjectConfiguration CloneConfiguration (SolutionItemConfiguration configuration, string newId)
+ {
+ return (ProjectConfiguration) base.CloneConfiguration (configuration, newId);
+ }
+
+ protected override void OnConfigurationAdded (ConfigurationEventArgs args)
+ {
+ var conf = (ProjectConfiguration)args.Configuration;
+
+ // Initialize the property group
+ if (!Loading)
+ InitConfiguration (conf);
+
+ base.OnConfigurationAdded (args);
+ }
+
+ void InitConfiguration (ProjectConfiguration conf)
+ {
+ var pi = CreateProjectInstaceForConfiguration (conf.Name, conf.Platform);
+ conf.Properties = pi.GetPropertiesLinkedToGroup (conf.MainPropertyGroup);
+ conf.ProjectInstance = pi;
+ }
+
+ protected override void OnConfigurationRemoved (ConfigurationEventArgs args)
{
- return (ProjectConfiguration) base.CreateConfiguration (name, kind);
+ var conf = (ProjectConfiguration) args.Configuration;
+ if (conf.ProjectInstance != null) {
+ // Dispose the project instance that was used to load the configuration
+ conf.Properties = conf.MainPropertyGroup;
+ conf.ProjectInstance.Dispose ();
+ conf.ProjectInstance = null;
+ }
+ base.OnConfigurationRemoved (args);
}
protected virtual void OnGetDefaultImports (List<string> imports)
@@ -259,9 +314,9 @@ namespace MonoDevelop.Projects
protected override Task OnLoad (ProgressMonitor monitor)
{
- return Task.Run (delegate {
+ return Task.Run (async delegate {
if (sourceProject == null || sourceProject.IsNewProject) {
- sourceProject = MSBuildProject.LoadAsync (FileName).Result;
+ sourceProject = await MSBuildProject.LoadAsync (FileName);
if (MSBuildEngineSupport == MSBuildSupport.NotSupported)
sourceProject.UseMSBuildEngine = false;
sourceProject.Evaluate ();
@@ -795,6 +850,9 @@ namespace MonoDevelop.Projects
protected override void OnDispose ()
{
+ foreach (ProjectConfiguration c in Configurations)
+ c.ProjectInstance.Dispose ();
+
foreach (var item in items) {
IDisposable disp = item as IDisposable;
if (disp != null)
@@ -960,7 +1018,9 @@ namespace MonoDevelop.Projects
builder.Unlock ();
if (builder != this.projectBuilder) {
// Dispose the builder after a while, so that it can be reused
+ #pragma warning disable 4014
Task.Delay (10000).ContinueWith (t => builder.Dispose ());
+ #pragma warning restore 4014
}
t1.End ();
if (t2 != null)
@@ -987,7 +1047,7 @@ namespace MonoDevelop.Projects
// Get the evaluated properties
- var properties = new Dictionary<string, MSBuildPropertyEvaluated> ();
+ var properties = new Dictionary<string, IMSBuildPropertyEvaluated> ();
foreach (var p in result.Properties)
properties [p.Key] = new MSBuildPropertyEvaluated (sourceProject, p.Key, p.Value, p.Value);
@@ -1001,7 +1061,7 @@ namespace MonoDevelop.Projects
var eit = new MSBuildItemEvaluated (sourceProject, it.Name, it.ItemSpec, it.ItemSpec);
if (it.Metadata.Count > 0) {
var imd = (MSBuildPropertyGroupEvaluated)eit.Metadata;
- properties = new Dictionary<string, MSBuildPropertyEvaluated> ();
+ properties = new Dictionary<string, IMSBuildPropertyEvaluated> ();
foreach (var m in it.Metadata)
properties [m.Key] = new MSBuildPropertyEvaluated (sourceProject, m.Key, m.Value, m.Value);
imd.SetProperties (properties);
@@ -1901,7 +1961,9 @@ namespace MonoDevelop.Projects
}
}
- internal void ReadProject (ProgressMonitor monitor, MSBuildProject msproject)
+ IPropertySet mainGroupProperties;
+
+ void ReadProject (ProgressMonitor monitor, MSBuildProject msproject)
{
ProjectExtension.OnReadProjectHeader (monitor, msproject);
modifiedInMemory = false;
@@ -1929,33 +1991,20 @@ namespace MonoDevelop.Projects
}
saving = true;
- MSBuildProjectInstance pi = null;
try {
msbuildUpdatePending = false;
sourceProject.FileName = FileName;
- // Create a project instance to be used for comparing old and new values in the global property group
- // We use a dummy configuration and platform to avoid loading default values from the configurations
- // while evaluating
- var c = Guid.NewGuid ().ToString ();
- pi = CreateProjectInstaceForConfiguration (c, c);
-
- IMSBuildPropertySet globalGroup = sourceProject.GetGlobalPropertyGroup ();
-
- // Store properties that already exist in the project. We'll always keep those properties, even if they have default values.
- var preexistingGlobalProps = new HashSet<string> (globalGroup != null ? globalGroup.GetProperties ().Select (p => p.Name) : Enumerable.Empty<string> ());
-
OnWriteProjectHeader (monitor, sourceProject);
ProjectExtension.OnWriteProject (monitor, sourceProject);
- // Remove properties whose value has not changed and which were not set when the project was loaded
- ((MSBuildPropertyGroup)globalGroup).UnMerge (pi.EvaluatedProperties, preexistingGlobalProps);
+ var globalGroup = sourceProject.GetGlobalPropertyGroup ();
+ globalGroup.PurgeDefaultProperties ();
+ globalGroup.ResetIsNewFlags ();
sourceProject.IsNewProject = false;
} finally {
- if (pi != null)
- pi.Dispose ();
saving = false;
}
}
@@ -1971,17 +2020,11 @@ namespace MonoDevelop.Projects
Group = grp;
}
- public bool FullySpecified {
- get { return Config != Unspecified && Platform != Unspecified; }
- }
-
public string Config;
public string Platform;
public IMSBuildPropertySet Group;
public bool Exists;
public bool IsNew; // The group did not exist in the original file
- public MSBuildProjectInstance ProjectInstance;
- public HashSet<string> PreExistingProperties;
}
const string Unspecified = null;
@@ -2051,77 +2094,10 @@ namespace MonoDevelop.Projects
timer.Trace ("Read configurations");
- List<ConfigData> configData = GetConfigData (msproject, false);
- List<ConfigData> partialConfigurations = new List<ConfigData> ();
- HashSet<string> handledConfigurations = new HashSet<string> ();
- var configurations = new HashSet<string> ();
- var platforms = new HashSet<string> ();
-
- IMSBuildPropertySet globalGroup = msproject.GetGlobalPropertyGroup ();
- configData.Insert (0, new ConfigData (Unspecified, Unspecified, globalGroup));
-
- // Load configurations, skipping the dummy config at index 0.
- for (int i = 1; i < configData.Count; i++) {
- ConfigData cgrp = configData[i];
- string platform = cgrp.Platform;
- string conf = cgrp.Config;
-
- if (platform != Unspecified)
- platforms.Add (platform);
-
- if (conf != Unspecified)
- configurations.Add (conf);
-
- if (conf == Unspecified || platform == Unspecified) {
- // skip partial configurations for now...
- partialConfigurations.Add (cgrp);
- continue;
- }
-
- string key = conf + "|" + platform;
- if (handledConfigurations.Contains (key))
- continue;
-
- LoadConfiguration (monitor, cgrp, conf, platform);
-
- handledConfigurations.Add (key);
- }
-
- // Now we can load any partial configurations by combining them with known configs or platforms.
- if (partialConfigurations.Count > 0) {
- if (platforms.Count == 0)
- platforms.Add (string.Empty); // AnyCpu
+ List<ConfigData> configData = GetConfigData (msproject, true);
- foreach (ConfigData cgrp in partialConfigurations) {
- if (cgrp.Config != Unspecified && cgrp.Platform == Unspecified) {
- string conf = cgrp.Config;
-
- foreach (var platform in platforms) {
- string key = conf + "|" + platform;
-
- if (handledConfigurations.Contains (key))
- continue;
-
- LoadConfiguration (monitor, cgrp, conf, platform);
-
- handledConfigurations.Add (key);
- }
- } else if (cgrp.Config == Unspecified && cgrp.Platform != Unspecified) {
- string platform = cgrp.Platform;
-
- foreach (var conf in configurations) {
- string key = conf + "|" + platform;
-
- if (handledConfigurations.Contains (key))
- continue;
-
- LoadConfiguration (monitor, cgrp, conf, platform);
-
- handledConfigurations.Add (key);
- }
- }
- }
- }
+ foreach (var cgrp in configData)
+ LoadConfiguration (monitor, cgrp, cgrp.Config, cgrp.Platform);
// Read extended properties
@@ -2134,14 +2110,50 @@ namespace MonoDevelop.Projects
loadedAvailableItemNames = msproject.EvaluatedItems.Where (i => i.Name == "AvailableItemName").Select (i => i.Include).ToArray ();
}
- List<ConfigData> GetConfigData (MSBuildProject msproject, bool includeGlobalGroups)
+ List<ConfigData> GetConfigData (MSBuildProject msproject, bool includeEvaluated)
{
List<ConfigData> configData = new List<ConfigData> ();
foreach (MSBuildPropertyGroup cgrp in msproject.PropertyGroups) {
string conf, platform;
- if (ParseConfigCondition (cgrp.Condition, out conf, out platform) || includeGlobalGroups)
- configData.Add (new ConfigData (conf, platform, cgrp));
+ if (ParseConfigCondition (cgrp.Condition, out conf, out platform) && conf != null && platform != null) {
+ // If a group for this configuration already was found, set the new group. If there are changes we want to modify the last group.
+ var existing = configData.FirstOrDefault (cd => cd.Config == conf && cd.Platform == platform);
+ if (existing == null)
+ configData.Add (new ConfigData (conf, platform, cgrp));
+ else
+ existing.Group = cgrp;
+ }
+ }
+ if (includeEvaluated) {
+ var confValues = msproject.ConditionedProperties.GetCombinedPropertyValues ("Configuration");
+ var platValues = msproject.ConditionedProperties.GetCombinedPropertyValues ("Platform");
+ var confPlatValues = msproject.ConditionedProperties.GetCombinedPropertyValues ("Configuration", "Platform");
+
+ // First of all, add configurations that have been specified using both the Configuration and Platform properties.
+ foreach (var co in confPlatValues) {
+ var c = co.GetValue ("Configuration");
+ var ep = co.GetValue ("Platform");
+ ep = ep == "AnyCPU" ? "" : ep;
+ if (!configData.Any (cd => cd.Config == c && cd.Platform == ep))
+ configData.Add (new ConfigData (c, ep, null));
+ }
+
+ // Now add configurations for which a platform has not been specified, but only if no other configuration
+ // exists with the same name. Combine them with individually specified platforms, if available
+ foreach (var c in confValues.Select (v => v.GetValue ("Configuration"))) {
+ if (platValues.Count > 0) {
+ foreach (var plat in platValues.Select (v => v.GetValue ("Platform"))) {
+ var ep = plat == "AnyCPU" ? "" : plat;
+ if (!configData.Any (cd => cd.Config == c && cd.Platform == ep))
+ configData.Add (new ConfigData (c, ep, null));
+ }
+ } else {
+ if (!configData.Any (cd => cd.Config == c))
+ configData.Add (new ConfigData (c, "", null));
+ }
+ }
}
+
return configData;
}
@@ -2196,27 +2208,12 @@ namespace MonoDevelop.Projects
void LoadConfiguration (ProgressMonitor monitor, ConfigData cgrp, string conf, string platform)
{
- ProjectConfiguration config = (ProjectConfiguration) CreateConfiguration (conf);
-
- // If the group is not fully specified it is not assigned to the configuration.
- // In that case, a new group will be created
- if (cgrp.FullySpecified)
- config.Properties = cgrp.Group;
-
- var pi = CreateProjectInstaceForConfiguration (conf, platform);
-
- // Set the evaluated value for each property in the property group.
- // When saving the project, if the property is assigned the same evaluated value,
- // the change won't be saved
-
- foreach (var p in cgrp.Group.GetProperties ()) {
- var ep = pi.EvaluatedProperties.GetProperty (p.Name);
- if (ep != null)
- p.InitEvaluatedValue (ep.Value);
- }
-
- config.Platform = platform;
- projectExtension.OnReadConfiguration (monitor, config, pi.EvaluatedProperties);
+ ProjectConfiguration config = (ProjectConfiguration) CreateConfiguration (conf + "|" + (platform != "AnyCPU" ? platform : ""));
+ if (cgrp.Group != null)
+ config.MainPropertyGroup = (MSBuildPropertyGroup) cgrp.Group;
+ config.MainPropertyGroup.ResetIsNewFlags ();
+ InitConfiguration (config);
+ projectExtension.OnReadConfiguration (monitor, config, config.Properties);
Configurations.Add (config);
}
@@ -2250,9 +2247,9 @@ namespace MonoDevelop.Projects
return pi;
}
- protected virtual void OnReadConfiguration (ProgressMonitor monitor, ProjectConfiguration config, IMSBuildEvaluatedPropertyCollection grp)
+ protected virtual void OnReadConfiguration (ProgressMonitor monitor, ProjectConfiguration config, IPropertySet grp)
{
- config.Read (grp, ToolsVersion);
+ config.Read (grp);
}
void RemoveDuplicateItems (MSBuildProject msproject)
@@ -2350,13 +2347,13 @@ namespace MonoDevelop.Projects
struct MergedPropertyValue
{
public readonly string XmlValue;
- public readonly bool PreserveExistingCase;
+ public readonly MSBuildValueType ValueType;
public readonly bool IsDefault;
- public MergedPropertyValue (string xmlValue, bool preserveExistingCase, bool isDefault)
+ public MergedPropertyValue (string xmlValue, MSBuildValueType valueType, bool isDefault)
{
this.XmlValue = xmlValue;
- this.PreserveExistingCase = preserveExistingCase;
+ this.ValueType = valueType;
this.IsDefault = isDefault;
}
}
@@ -2378,14 +2375,14 @@ namespace MonoDevelop.Projects
if (msproject.IsNewProject || (defaultConfProp != null && defaultPlatProp != null)) {
// If there is no config property, or if the config doesn't exist anymore, give it a new value
- if (defaultConfProp == null || !Configurations.Any<SolutionItemConfiguration> (c => c.Name == defaultConfProp.Value)) {
+ if (defaultConfProp == null || !Configurations.Any<SolutionItemConfiguration> (c => c.Name == defaultConfProp.UnevaluatedValue)) {
ItemConfiguration conf = Configurations.FirstOrDefault<ItemConfiguration> (c => c.Name == "Debug");
if (conf == null) conf = Configurations [0];
string platform = conf.Platform.Length == 0 ? "AnyCPU" : conf.Platform;
globalGroup.SetValue ("Configuration", conf.Name, condition: " '$(Configuration)' == '' ");
globalGroup.SetValue ("Platform", platform, condition: " '$(Platform)' == '' ");
- } else if (defaultPlatProp == null || !Configurations.Any<SolutionItemConfiguration> (c => c.Name == defaultConfProp.Value && c.Platform == defaultPlatProp.Value)) {
- ItemConfiguration conf = Configurations.FirstOrDefault<ItemConfiguration> (c => c.Name == defaultConfProp.Value);
+ } else if (defaultPlatProp == null || !Configurations.Any<SolutionItemConfiguration> (c => c.Name == defaultConfProp.UnevaluatedValue && c.Platform == defaultPlatProp.UnevaluatedValue)) {
+ ItemConfiguration conf = Configurations.FirstOrDefault<ItemConfiguration> (c => c.Name == defaultConfProp.UnevaluatedValue);
string platform = conf.Platform.Length == 0 ? "AnyCPU" : conf.Platform;
globalGroup.SetValue ("Platform", platform, condition: " '$(Platform)' == '' ");
}
@@ -2400,7 +2397,7 @@ namespace MonoDevelop.Projects
globalGroup.SetValue ("ProductVersion", productVersion);
globalGroup.SetValue ("SchemaVersion", schemaVersion);
- globalGroup.SetValue ("ProjectGuid", ItemId);
+ globalGroup.SetValue ("ProjectGuid", ItemId, valueType:MSBuildValueType.Guid);
if (flavorGuids.Length > 0) {
string gg = string.Join (";", flavorGuids);
@@ -2434,87 +2431,84 @@ namespace MonoDevelop.Projects
if (Configurations.Count > 0) {
- List<ConfigData> configData = GetConfigData (msproject, true);
+ List<ConfigData> configData = GetConfigData (msproject, false);
- try {
- // Write configuration data, creating new property groups if necessary
-
- foreach (ProjectConfiguration conf in Configurations) {
-
- MSBuildPropertyGroup pg = (MSBuildPropertyGroup)conf.Properties;
- ConfigData cdata = configData.FirstOrDefault (cd => cd.Group == pg);
-
- var pi = CreateProjectInstaceForConfiguration (conf.Name, conf.Platform);
-
- if (cdata == null) {
- msproject.AddPropertyGroup (pg, true);
- pg.IgnoreDefaultValues = true;
- pg.Condition = BuildConfigCondition (conf.Name, conf.Platform);
- cdata = new ConfigData (conf.Name, conf.Platform, pg);
- cdata.IsNew = true;
- configData.Add (cdata);
- } else {
- // The configuration name may have changed
- if (cdata.Config != conf.Name || cdata.Platform != conf.Platform) {
- ((MSBuildPropertyGroup)cdata.Group).Condition = BuildConfigCondition (conf.Name, conf.Platform);
- cdata.Config = conf.Name;
- cdata.Platform = conf.Platform;
- }
- }
- cdata.ProjectInstance = pi;
+ // Write configuration data, creating new property groups if necessary
- ((MSBuildPropertyGroup)cdata.Group).IgnoreDefaultValues = true;
- cdata.Exists = true;
- cdata.PreExistingProperties = new HashSet<string> (cdata.Group.GetProperties ().Select (p => p.Name));
- ProjectExtension.OnWriteConfiguration (monitor, conf, cdata.Group);
- }
+ foreach (ProjectConfiguration conf in Configurations) {
- // Find the properties in all configurations that have the MergeToProject flag set
- var mergeToProjectProperties = new HashSet<MergedProperty> (GetMergeToProjectProperties (configData));
- var mergeToProjectPropertyValues = new Dictionary<string, MergedPropertyValue> ();
+ MSBuildPropertyGroup pg = conf.MainPropertyGroup;
+ ConfigData cdata = configData.FirstOrDefault (cd => cd.Group == pg);
- foreach (ProjectConfiguration conf in Configurations) {
- ConfigData cdata = FindPropertyGroup (configData, conf);
- var propGroup = (MSBuildPropertyGroup)cdata.Group;
- CollectMergetoprojectProperties (propGroup, mergeToProjectProperties, mergeToProjectPropertyValues);
+ if (cdata == null) {
+ // Try to keep the groups in the same order as the config list
+ MSBuildObject nextConf = null;
+ int i = Configurations.IndexOf (conf);
+ if (i != -1 && i + 1 < Configurations.Count)
+ nextConf = ((ProjectConfiguration)Configurations [i + 1]).MainPropertyGroup;
+
+ msproject.AddPropertyGroup (pg, true, nextConf);
+ pg.Condition = BuildConfigCondition (conf.Name, conf.Platform);
+ cdata = new ConfigData (conf.Name, conf.Platform, pg);
+ cdata.IsNew = true;
+ configData.Add (cdata);
+ } else {
+ // The configuration name may have changed
+ if (cdata.Config != conf.Name || cdata.Platform != conf.Platform) {
+ ((MSBuildPropertyGroup)cdata.Group).Condition = BuildConfigCondition (conf.Name, conf.Platform);
+ cdata.Config = conf.Name;
+ cdata.Platform = conf.Platform;
+ }
}
- foreach (ProjectConfiguration conf in Configurations) {
- ConfigData cdata = FindPropertyGroup (configData, conf);
- var propGroup = (MSBuildPropertyGroup)cdata.Group;
+ cdata.Exists = true;
+ ProjectExtension.OnWriteConfiguration (monitor, conf, conf.Properties);
+ }
- cdata.PreExistingProperties.UnionWith (mergeToProjectPropertyValues.Select (p => p.Key));
- propGroup.UnMerge (cdata.ProjectInstance.EvaluatedProperties, cdata.PreExistingProperties);
- propGroup.IgnoreDefaultValues = false;
- }
+ // Find the properties in all configurations that have the MergeToProject flag set
+ var mergeToProjectProperties = new HashSet<MergedProperty> (GetMergeToProjectProperties (configData));
+ var mergeToProjectPropertyValues = new Dictionary<string, MergedPropertyValue> ();
- // Move properties with common values from configurations to the main
- // property group
- foreach (KeyValuePair<string, MergedPropertyValue> prop in mergeToProjectPropertyValues) {
- if (!prop.Value.IsDefault)
- globalGroup.SetValue (prop.Key, prop.Value.XmlValue, preserveExistingCase: prop.Value.PreserveExistingCase);
- else {
- // if the value is default, only remove the property if it was not already the default to avoid unnecessary project file churn
- globalGroup.SetValue (prop.Key, prop.Value.XmlValue, defaultValue: prop.Value.XmlValue, preserveExistingCase: prop.Value.PreserveExistingCase);
- }
- }
- foreach (SolutionItemConfiguration conf in Configurations) {
- var propGroup = FindPropertyGroup (configData, conf).Group;
- foreach (string mp in mergeToProjectPropertyValues.Keys)
- propGroup.RemoveProperty (mp);
- }
+ foreach (ProjectConfiguration conf in Configurations) {
+ ConfigData cdata = FindPropertyGroup (configData, conf);
+ var propGroup = (MSBuildPropertyGroup)cdata.Group;
+
+ // Get properties wit the MergeToProject flag, and check that the value they have matches the
+ // value all the other groups have so far. If one of the groups have a different value for
+ // the same property, then the property is discarded as mergeable to parent.
+ CollectMergetoprojectProperties (propGroup, mergeToProjectProperties, mergeToProjectPropertyValues);
- // Remove groups corresponding to configurations that have been removed
- // or groups which don't have any property and did not already exist
- foreach (ConfigData cd in configData) {
- if ((!cd.Exists && cd.FullySpecified) || (cd.IsNew && !cd.Group.GetProperties ().Any ()))
- msproject.Remove ((MSBuildPropertyGroup)cd.Group);
+ // Remove properties that have been modified and have the default value. Usually such properties
+ // would be removed when assigning the value, but we set IgnoreDefaultValues=false so that
+ // we can collect MergeToProject properties, so in this case properties are not removed.
+ propGroup.PurgeDefaultProperties ();
+ }
+
+ // Move properties with common values from configurations to the main
+ // property group
+ foreach (KeyValuePair<string, MergedPropertyValue> prop in mergeToProjectPropertyValues) {
+ if (!prop.Value.IsDefault)
+ globalGroup.SetValue (prop.Key, prop.Value.XmlValue, valueType: prop.Value.ValueType);
+ else {
+ // if the value is default, only remove the property if it was not already the default to avoid unnecessary project file churn
+ globalGroup.SetValue (prop.Key, prop.Value.XmlValue, defaultValue: prop.Value.XmlValue, valueType: prop.Value.ValueType);
}
- } finally {
- foreach (var cd in configData)
- if (cd.ProjectInstance != null)
- cd.ProjectInstance.Dispose ();
}
+ foreach (SolutionItemConfiguration conf in Configurations) {
+ var propGroup = FindPropertyGroup (configData, conf).Group;
+ foreach (string mp in mergeToProjectPropertyValues.Keys)
+ propGroup.RemoveProperty (mp);
+ }
+
+ // Remove groups corresponding to configurations that have been removed
+ // or groups which don't have any property and did not already exist
+ foreach (ConfigData cd in configData) {
+ if (!cd.Exists || (cd.IsNew && !cd.Group.GetProperties ().Any ()))
+ msproject.Remove ((MSBuildPropertyGroup)cd.Group);
+ }
+
+ foreach (ProjectConfiguration config in Configurations)
+ config.MainPropertyGroup.ResetIsNewFlags ();
}
SaveProjectItems (monitor, msproject, usedMSBuildItems);
@@ -2536,15 +2530,15 @@ namespace MonoDevelop.Projects
msproject.WriteExternalProjectProperties (this, GetType (), true);
}
- protected virtual void OnWriteConfiguration (ProgressMonitor monitor, ProjectConfiguration config, IMSBuildPropertySet pset)
+ protected virtual void OnWriteConfiguration (ProgressMonitor monitor, ProjectConfiguration config, IPropertySet pset)
{
- config.Write (pset, ToolsVersion);
+ config.Write (pset);
}
IEnumerable<MergedProperty> GetMergeToProjectProperties (List<ConfigData> configData)
{
Dictionary<string,MergedProperty> mergeProps = new Dictionary<string, MergedProperty> ();
- foreach (var cd in configData.Where (d => d.FullySpecified)) {
+ foreach (var cd in configData) {
foreach (var prop in cd.Group.GetProperties ()) {
if (!prop.MergeToMainGroup) {
mergeProps [prop.Name] = null;
@@ -2568,12 +2562,12 @@ namespace MonoDevelop.Projects
if (!mergeToProjectProperties.TryGetValue (pinfo.Name, out mvalue)) {
if (prop != null) {
// This is the first time the value is checked. Just assign it.
- mergeToProjectProperties.Add (pinfo.Name, new MergedPropertyValue (prop.Value, pinfo.PreserveExistingCase, pinfo.IsDefault));
+ mergeToProjectProperties.Add (pinfo.Name, new MergedPropertyValue (prop.Value, pinfo.ValueType, pinfo.IsDefault));
continue;
}
// If there is no value, it can't be merged
}
- else if (prop != null && string.Equals (prop.Value, mvalue.XmlValue, mvalue.PreserveExistingCase ? StringComparison.OrdinalIgnoreCase : StringComparison.Ordinal))
+ else if (prop != null && mvalue.ValueType.Equals (prop.Value, mvalue.XmlValue))
// Same value. It can be merged.
continue;
@@ -2977,12 +2971,12 @@ namespace MonoDevelop.Projects
Project.OnWriteProject (monitor, msproject);
}
- internal protected override void OnReadConfiguration (ProgressMonitor monitor, ProjectConfiguration config, IMSBuildEvaluatedPropertyCollection grp)
+ internal protected override void OnReadConfiguration (ProgressMonitor monitor, ProjectConfiguration config, IPropertySet grp)
{
Project.OnReadConfiguration (monitor, config, grp);
}
- internal protected override void OnWriteConfiguration (ProgressMonitor monitor, ProjectConfiguration config, IMSBuildPropertySet grp)
+ internal protected override void OnWriteConfiguration (ProgressMonitor monitor, ProjectConfiguration config, IPropertySet grp)
{
Project.OnWriteConfiguration (monitor, config, grp);
}
diff --git a/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/ProjectConfiguration.cs b/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/ProjectConfiguration.cs
index b2036953f3..2610230c1b 100644
--- a/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/ProjectConfiguration.cs
+++ b/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/ProjectConfiguration.cs
@@ -40,20 +40,16 @@ namespace MonoDevelop.Projects
public class ProjectConfiguration : SolutionItemConfiguration
{
bool debugTypeWasNone;
- IMSBuildEvaluatedPropertyCollection evaluatedProperties;
IPropertySet properties;
+ MSBuildPropertyGroup mainPropertyGroup;
- public ProjectConfiguration ()
+ public ProjectConfiguration (string id) : base(id)
{
}
- public ProjectConfiguration (string name) : base(name)
+ internal protected virtual void Read (IPropertySet pset)
{
- }
-
- internal protected virtual void Read (IMSBuildEvaluatedPropertyCollection pset, string toolsVersion)
- {
- evaluatedProperties = pset;
+ properties = pset;
intermediateOutputDirectory = pset.GetPathValue ("IntermediateOutputPath");
outputDirectory = pset.GetPathValue ("OutputPath", defaultValue:"." + Path.DirectorySeparatorChar);
@@ -96,7 +92,7 @@ namespace MonoDevelop.Projects
}
}
- internal protected virtual void Write (IPropertySet pset, string toolsVersion)
+ internal protected virtual void Write (IPropertySet pset)
{
pset.SetPropertyOrder ("DebugSymbols", "DebugType", "Optimize", "OutputPath", "DefineConstants", "ErrorReport");
@@ -113,7 +109,7 @@ namespace MonoDevelop.Projects
if (debugType != "none" || !debugTypeWasNone)
pset.SetValue ("DebugSymbols", debugMode, false);
- pset.SetValue ("OutputPath", outputDirectory);
+ pset.SetValue ("OutputPath", outputDirectory, defaultValue:new FilePath ("." + Path.DirectorySeparatorChar));
pset.SetValue ("ConsolePause", pauseConsoleOutput, true);
pset.SetValue ("ExternalConsole", externalConsole, false);
pset.SetValue ("Commandlineparameters", commandLineParameters, "");
@@ -143,42 +139,43 @@ namespace MonoDevelop.Projects
}
/// <summary>
- /// Properties obtained while evaluating this configuration
- /// </summary>
- /// <remarks>This property set contains all properties resulting from evaluating
- /// the project with the Configuration and Platform properties set for this
- /// configuration.</remarks>
- public IReadOnlyPropertySet EvaluatedProperties {
- get { return evaluatedProperties ?? MSBuildEvaluatedPropertyCollection.Empty; }
- }
-
- /// <summary>
/// Property set where the properties for this configuration are defined.
/// </summary>
public IPropertySet Properties {
get {
- if (properties == null) {
+ return properties ?? MainPropertyGroup;
+ }
+ internal set {
+ properties = value;
+ }
+ }
+
+ internal MSBuildPropertyGroup MainPropertyGroup {
+ get {
+ if (mainPropertyGroup == null) {
if (ParentItem == null)
- properties = new MSBuildPropertyGroup ();
+ mainPropertyGroup = new MSBuildPropertyGroup ();
else
- properties = ParentItem.MSBuildProject.CreatePropertyGroup ();
+ mainPropertyGroup = ParentItem.MSBuildProject.CreatePropertyGroup ();
+ mainPropertyGroup.IgnoreDefaultValues = true;
}
- return properties;
+ return mainPropertyGroup;
}
- internal set {
- properties = value;
+ set {
+ mainPropertyGroup = value;
+ mainPropertyGroup.IgnoreDefaultValues = true;
}
}
+ internal MSBuildProjectInstance ProjectInstance { get; set; }
+
FilePath intermediateOutputDirectory = FilePath.Empty;
public virtual FilePath IntermediateOutputDirectory {
get {
if (!intermediateOutputDirectory.IsNullOrEmpty)
return intermediateOutputDirectory;
- if (!string.IsNullOrEmpty (Platform))
- return ParentItem.BaseIntermediateOutputPath.Combine (Platform, Name);
- return ParentItem.BaseIntermediateOutputPath.Combine (Name);
+ return DefaultIntermediateOutputDirectory;
}
set {
if (value.IsNullOrEmpty)
@@ -189,6 +186,16 @@ namespace MonoDevelop.Projects
}
}
+ string DefaultIntermediateOutputDirectory {
+ get {
+ if (ParentItem == null)
+ return string.Empty;
+ if (!string.IsNullOrEmpty (Platform))
+ return ParentItem.BaseIntermediateOutputPath.Combine (Platform, Name);
+ return ParentItem.BaseIntermediateOutputPath.Combine (Name);
+ }
+ }
+
FilePath outputDirectory = "." + Path.DirectorySeparatorChar;
public virtual FilePath OutputDirectory {
get { return outputDirectory; }
@@ -250,14 +257,28 @@ namespace MonoDevelop.Projects
set { runWithWarnings = value; }
}
- public override void CopyFrom (ItemConfiguration conf)
+ protected override void OnCopyFrom (ItemConfiguration configuration, bool isRename)
{
- base.CopyFrom (conf);
+ base.OnCopyFrom (configuration, isRename);
- ProjectConfiguration projectConf = conf as ProjectConfiguration;
+ ProjectConfiguration projectConf = configuration as ProjectConfiguration;
+
+ if (isRename && projectConf.IntermediateOutputDirectory == projectConf.DefaultIntermediateOutputDirectory)
+ intermediateOutputDirectory = null;
+ else
+ intermediateOutputDirectory = projectConf.intermediateOutputDirectory;
- intermediateOutputDirectory = projectConf.intermediateOutputDirectory;
outputDirectory = projectConf.outputDirectory;
+
+ if (isRename && outputDirectory != null) {
+ var ps = outputDirectory.ToString ().Split (Path.DirectorySeparatorChar);
+ int i = Array.IndexOf (ps, configuration.Name);
+ if (i != -1) {
+ ps [i] = Name;
+ outputDirectory = string.Join (Path.DirectorySeparatorChar.ToString (), ps);
+ }
+ }
+
debugMode = projectConf.debugMode;
pauseConsoleOutput = projectConf.pauseConsoleOutput;
externalConsole = projectConf.externalConsole;
@@ -273,7 +294,7 @@ namespace MonoDevelop.Projects
runWithWarnings = projectConf.runWithWarnings;
- ((MSBuildPropertyGroup)Properties).CopyFrom ((MSBuildPropertyGroup)projectConf.Properties);
+ MainPropertyGroup.CopyFrom (projectConf.MainPropertyGroup);
}
public new Project ParentItem {
diff --git a/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/ProjectExtension.cs b/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/ProjectExtension.cs
index e709017ad8..0083170e7c 100644
--- a/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/ProjectExtension.cs
+++ b/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/ProjectExtension.cs
@@ -108,7 +108,7 @@ namespace MonoDevelop.Projects
msproject.ReadExternalProjectProperties (this, GetType (), true);
}
- internal protected virtual void OnReadConfiguration (ProgressMonitor monitor, ProjectConfiguration config, IMSBuildEvaluatedPropertyCollection pset)
+ internal protected virtual void OnReadConfiguration (ProgressMonitor monitor, ProjectConfiguration config, IPropertySet pset)
{
next.OnReadConfiguration (monitor, config, pset);
}
@@ -120,7 +120,7 @@ namespace MonoDevelop.Projects
msproject.WriteExternalProjectProperties (this, GetType (), true);
}
- internal protected virtual void OnWriteConfiguration (ProgressMonitor monitor, ProjectConfiguration config, IMSBuildPropertySet pset)
+ internal protected virtual void OnWriteConfiguration (ProgressMonitor monitor, ProjectConfiguration config, IPropertySet pset)
{
next.OnWriteConfiguration (monitor, config, pset);
}
diff --git a/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/ProjectItemMetadata.cs b/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/ProjectItemMetadata.cs
index 2a4f870b2b..918c7d28a0 100644
--- a/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/ProjectItemMetadata.cs
+++ b/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/ProjectItemMetadata.cs
@@ -222,13 +222,17 @@ namespace MonoDevelop.Projects
return null;
}
- void IPropertySet.SetValue (string name, string value, string defaultValue, bool preserveExistingCase, bool mergeToMainGroup, string condition)
+ void IPropertySet.SetValue (string name, string value, string defaultValue, bool preserveExistingCase, bool mergeToMainGroup, string condition, MSBuildValueType valueType)
{
- SetValue (name, value, defaultValue, preserveExistingCase);
+ SetValue (name, value, defaultValue, preserveExistingCase, valueType);
}
- public void SetValue (string name, string value, string defaultValue = null, bool preserveExistingCase = false)
+ public void SetValue (string name, string value, string defaultValue = null, bool preserveExistingCase = false, MSBuildValueType valueType = null)
{
+ // If no value type is specified, use the default
+ if (valueType == null)
+ valueType = preserveExistingCase ? MSBuildValueType.DefaultPreserveCase : MSBuildValueType.Default;
+
if (value == null && defaultValue == "")
value = "";
var prop = (MSBuildProperty) GetProperty (name);
@@ -236,13 +240,13 @@ namespace MonoDevelop.Projects
if (isDefault) {
// if the value is default, only remove the property if it was not already the default
// to avoid unnecessary project file churn
- if (prop != null && (defaultValue == null || !string.Equals (defaultValue, prop.Value, preserveExistingCase ? StringComparison.OrdinalIgnoreCase : StringComparison.Ordinal)))
+ if (prop != null && (defaultValue == null || !valueType.Equals (defaultValue, prop.Value)))
RemoveProperty (prop);
return;
}
if (prop == null)
prop = AddProperty (name);
- prop.SetValue (value, preserveExistingCase);
+ prop.SetValue (value, valueType:valueType);
prop.HasDefaultValue = isDefault;
}
diff --git a/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/ProjectReference.cs b/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/ProjectReference.cs
index d300980a54..1157b1cf1a 100644
--- a/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/ProjectReference.cs
+++ b/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/ProjectReference.cs
@@ -84,6 +84,8 @@ namespace MonoDevelop.Projects
[ItemProperty ("Package", DefaultValue=null)]
internal string packageName {
get {
+ if (!string.IsNullOrEmpty (package))
+ return package;
SystemPackage sp = Package;
if (sp != null && !sp.IsGacPackage)
return sp.Name;
@@ -672,9 +674,12 @@ namespace MonoDevelop.Projects
if (referenceType == ReferenceType.Package) {
if (cachedPackage != null)
return cachedPackage;
-
- if (!string.IsNullOrEmpty (package))
- return AssemblyContext.GetPackage (package);
+
+ if (!string.IsNullOrEmpty (package)) {
+ var p = AssemblyContext.GetPackage (package);
+ if (p != null)
+ return p;
+ }
// No package is specified, get any of the registered assemblies, giving priority to gaced assemblies
// (because non-gac assemblies should have a package name set)
diff --git a/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/Solution.cs b/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/Solution.cs
index d02a445446..23f0870053 100644
--- a/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/Solution.cs
+++ b/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/Solution.cs
@@ -374,12 +374,12 @@ namespace MonoDevelop.Projects
return new SolutionConfiguration (name);
}
- public SolutionConfiguration AddConfiguration (string name, bool createConfigForItems)
+ public SolutionConfiguration AddConfiguration (string id, bool createConfigForItems)
{
- SolutionConfiguration conf = new SolutionConfiguration (name);
+ SolutionConfiguration conf = new SolutionConfiguration (id);
foreach (SolutionItem item in Items.Where (it => it.SupportsBuild())) {
- if (createConfigForItems && item.GetConfiguration (new ItemConfigurationSelector (name)) == null) {
- SolutionItemConfiguration newc = item.CreateConfiguration (name);
+ if (createConfigForItems && item.GetConfiguration (new ItemConfigurationSelector (id)) == null) {
+ SolutionItemConfiguration newc = item.CreateConfiguration (id);
if (item.DefaultConfiguration != null)
newc.CopyFrom (item.DefaultConfiguration);
item.Configurations.Add (newc);
diff --git a/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/SolutionConfiguration.cs b/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/SolutionConfiguration.cs
index f6510c16e6..28fddf654e 100644
--- a/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/SolutionConfiguration.cs
+++ b/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/SolutionConfiguration.cs
@@ -48,10 +48,6 @@ namespace MonoDevelop.Projects
List<SolutionConfigurationEntry> configurations = new List<SolutionConfigurationEntry> ();
- public SolutionConfiguration ()
- {
- }
-
public SolutionConfiguration (string id): base (id)
{
}
@@ -184,9 +180,9 @@ namespace MonoDevelop.Projects
parentSolution.UpdateDefaultConfigurations ();
}
- public override void CopyFrom (ItemConfiguration configuration)
+ protected override void OnCopyFrom (ItemConfiguration configuration, bool isRename)
{
- base.CopyFrom (configuration);
+ base.OnCopyFrom (configuration, isRename);
SolutionConfiguration conf = (SolutionConfiguration) configuration;
if (parentSolution == null)
diff --git a/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/SolutionItem.cs b/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/SolutionItem.cs
index 11848fc18d..641aee9414 100644
--- a/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/SolutionItem.cs
+++ b/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/SolutionItem.cs
@@ -1107,19 +1107,36 @@ namespace MonoDevelop.Projects
return config;
}
- ItemConfiguration IConfigurationTarget.CreateConfiguration (string name, ConfigurationKind kind)
+ ItemConfiguration IConfigurationTarget.CreateConfiguration (string id, ConfigurationKind kind)
{
- return CreateConfiguration (name, kind);
+ return CreateConfiguration (id, kind);
}
- public SolutionItemConfiguration CreateConfiguration (string name, ConfigurationKind kind = ConfigurationKind.Blank)
+ public SolutionItemConfiguration CreateConfiguration (string name, string platform, ConfigurationKind kind = ConfigurationKind.Blank)
{
- return ItemExtension.OnCreateConfiguration (name, kind);
+ return ItemExtension.OnCreateConfiguration (name + "|" + platform, kind);
+ }
+
+ public SolutionItemConfiguration CreateConfiguration (string id, ConfigurationKind kind = ConfigurationKind.Blank)
+ {
+ return ItemExtension.OnCreateConfiguration (id, kind);
}
- protected virtual SolutionItemConfiguration OnCreateConfiguration (string name, ConfigurationKind kind = ConfigurationKind.Blank)
+ public SolutionItemConfiguration CloneConfiguration (SolutionItemConfiguration configuration, string newName, string newPlatform)
+ {
+ return CloneConfiguration (configuration, newName + "|" + newPlatform);
+ }
+
+ public SolutionItemConfiguration CloneConfiguration (SolutionItemConfiguration configuration, string newId)
+ {
+ var clone = CreateConfiguration (newId);
+ clone.CopyFrom (configuration, true);
+ return clone;
+ }
+
+ protected virtual SolutionItemConfiguration OnCreateConfiguration (string id, ConfigurationKind kind = ConfigurationKind.Blank)
{
- return new SolutionItemConfiguration (name);
+ return new SolutionItemConfiguration (id);
}
void OnConfigurationAddedToCollection (object ob, ConfigurationEventArgs args)
@@ -1346,9 +1363,9 @@ namespace MonoDevelop.Projects
return Item.OnGetItemFiles (includeReferencedFiles);
}
- internal protected override SolutionItemConfiguration OnCreateConfiguration (string name, ConfigurationKind kind)
+ internal protected override SolutionItemConfiguration OnCreateConfiguration (string id, ConfigurationKind kind)
{
- return Item.OnCreateConfiguration (name, kind);
+ return Item.OnCreateConfiguration (id, kind);
}
internal protected override DateTime OnGetLastBuildTime (ConfigurationSelector configuration)
diff --git a/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/SolutionItemConfiguration.cs b/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/SolutionItemConfiguration.cs
index 49bdaaa7a0..3ff754e803 100644
--- a/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/SolutionItemConfiguration.cs
+++ b/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/SolutionItemConfiguration.cs
@@ -39,10 +39,6 @@ namespace MonoDevelop.Projects
{
SolutionItem parentItem;
- public SolutionItemConfiguration ()
- {
- }
-
public SolutionItemConfiguration (string id): base (id)
{
}
diff --git a/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/SolutionItemExtension.cs b/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/SolutionItemExtension.cs
index 012f1b3c58..3852863e78 100644
--- a/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/SolutionItemExtension.cs
+++ b/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/SolutionItemExtension.cs
@@ -135,9 +135,9 @@ namespace MonoDevelop.Projects
}
}
- internal protected virtual SolutionItemConfiguration OnCreateConfiguration (string name, ConfigurationKind kind)
+ internal protected virtual SolutionItemConfiguration OnCreateConfiguration (string id, ConfigurationKind kind)
{
- return next.OnCreateConfiguration (name, kind);
+ return next.OnCreateConfiguration (id, kind);
}
internal protected virtual ProjectFeatures OnGetSupportedFeatures ()
diff --git a/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/UnknownConfiguration.cs b/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/UnknownConfiguration.cs
index 7ce90e1fc9..e7048d0e7d 100644
--- a/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/UnknownConfiguration.cs
+++ b/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/UnknownConfiguration.cs
@@ -33,9 +33,8 @@ namespace MonoDevelop.Projects
{
public class UnknownConfiguration: SolutionItemConfiguration
{
- public UnknownConfiguration ()
+ public UnknownConfiguration (): base ("Unknown Configuration")
{
- Name = "Unknown Configuration";
}
}
}
diff --git a/main/src/core/MonoDevelop.Ide/ExtensionModel/MimeTypes.addin.xml b/main/src/core/MonoDevelop.Ide/ExtensionModel/MimeTypes.addin.xml
index b27e0cb69b..db3172ea38 100644
--- a/main/src/core/MonoDevelop.Ide/ExtensionModel/MimeTypes.addin.xml
+++ b/main/src/core/MonoDevelop.Ide/ExtensionModel/MimeTypes.addin.xml
@@ -25,6 +25,9 @@
<MimeType id="application/glade+xml" _description="Glade File" baseType="application/xml">
<File pattern="*.glade" />
</MimeType>
+ <MimeType id="application/manifest+xml" _description="Manifest File" baseType="application/xml">
+ <File pattern="*.manifest" />
+ </MimeType>
<MimeType id="text/x-changelog" _description="ChangeLog document" isText="true">
<File pattern="ChangeLog|Changelog|CHANGELOG|Changelog"/>
</MimeType>
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.AutoTest.Results/GtkNotebookResult.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.AutoTest.Results/GtkNotebookResult.cs
index 9cc11c6f03..f2ee0c1f87 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.AutoTest.Results/GtkNotebookResult.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.AutoTest.Results/GtkNotebookResult.cs
@@ -34,7 +34,7 @@ namespace MonoDevelop.Components.AutoTest.Results
Notebook noteBook;
int toBeSelected = -1;
- public GtkNotebookResult (Widget notebookWidget) : base (notebookWidget)
+ internal GtkNotebookResult (Widget notebookWidget) : base (notebookWidget)
{
noteBook = notebookWidget as Notebook;
}
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.AutoTest.Results/GtkTreeModelResult.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.AutoTest.Results/GtkTreeModelResult.cs
index 3caf3c1c53..c9158a7980 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.AutoTest.Results/GtkTreeModelResult.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.AutoTest.Results/GtkTreeModelResult.cs
@@ -39,14 +39,14 @@ namespace MonoDevelop.Components.AutoTest.Results
TreeIter? resultIter;
string DesiredText;
- public GtkTreeModelResult (Widget parent, TreeModel treeModel, int column) : base (parent)
+ internal GtkTreeModelResult (Widget parent, TreeModel treeModel, int column) : base (parent)
{
ParentWidget = parent;
TModel = treeModel;
Column = column;
}
- public GtkTreeModelResult (Widget parent, TreeModel treeModel, int column, TreeIter iter) : base (parent)
+ internal GtkTreeModelResult (Widget parent, TreeModel treeModel, int column, TreeIter iter) : base (parent)
{
ParentWidget = parent;
TModel = treeModel;
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.AutoTest.Results/GtkWidgetResult.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.AutoTest.Results/GtkWidgetResult.cs
index 99d00e3ae4..629a3e2eeb 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.AutoTest.Results/GtkWidgetResult.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.AutoTest.Results/GtkWidgetResult.cs
@@ -37,7 +37,7 @@ namespace MonoDevelop.Components.AutoTest.Results
{
Widget resultWidget;
- public GtkWidgetResult (Widget widget)
+ internal GtkWidgetResult (Widget widget)
{
resultWidget = widget;
}
@@ -76,7 +76,7 @@ namespace MonoDevelop.Components.AutoTest.Results
return this;
}
- Window window = resultWidget as Window;
+ var window = resultWidget as Gtk.Window;
if (window != null) {
if (window.Title != null && window.Title.IndexOf (mark) > -1) {
return this;
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.AutoTest.Results/NSObjectResult.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.AutoTest.Results/NSObjectResult.cs
index d760b57158..bcd17d7f81 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.AutoTest.Results/NSObjectResult.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.AutoTest.Results/NSObjectResult.cs
@@ -41,7 +41,7 @@ namespace MonoDevelop.Components.AutoTest.Results
{
NSObject ResultObject;
- public NSObjectResult (NSObject resultObject)
+ internal NSObjectResult (NSObject resultObject)
{
ResultObject = resultObject;
}
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.AutoTest/AutoTestService.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.AutoTest/AutoTestService.cs
index 64b48200c2..0ecdb78e83 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.AutoTest/AutoTestService.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.AutoTest/AutoTestService.cs
@@ -197,7 +197,7 @@ namespace MonoDevelop.Components.AutoTest
public abstract void Replay (AutoTestSession testSession);
}
- public class KeyPressEvent: RecordEvent
+ internal class KeyPressEvent: RecordEvent
{
public Gdk.Key Key { get; set; }
public Gdk.ModifierType Modifiers { get; set; }
@@ -238,7 +238,7 @@ namespace MonoDevelop.Components.AutoTest
}
}
- public class StringEvent: RecordEvent
+ internal class StringEvent: RecordEvent
{
internal string Text;
internal Gdk.ModifierType Modifiers { get; set; }
@@ -278,7 +278,7 @@ namespace MonoDevelop.Components.AutoTest
}
}
- public class CommandEvent: RecordEvent
+ internal class CommandEvent: RecordEvent
{
public object CommandId { get; set; }
public int DataItemIndex { get; set; }
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.Chart/Axis.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.Chart/Axis.cs
index d0e5f2d008..1a3100ff3b 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.Chart/Axis.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.Chart/Axis.cs
@@ -33,7 +33,7 @@ namespace MonoDevelop.Components.Chart
public abstract class Axis
{
int tickSize = 6;
- internal BasicChart Owner;
+ internal ChartWidget Owner;
AxisPosition position;
AxisDimension dim;
bool showLabels = true;
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.Chart/BasicChart.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.Chart/BasicChart.cs
index e1f1862ed4..9bf6b7fd29 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.Chart/BasicChart.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.Chart/BasicChart.cs
@@ -33,7 +33,126 @@ using Gdk;
namespace MonoDevelop.Components.Chart
{
- public class BasicChart: DrawingArea
+ public class BasicChart: Control
+ {
+ ChartWidget widget;
+
+ public BasicChart ()
+ {
+ widget = new ChartWidget ();
+ }
+
+ protected override object CreateNativeWidget ()
+ {
+ return widget;
+ }
+
+ protected internal virtual void OnSelectionChanged ()
+ {
+ if (SelectionChanged != null)
+ SelectionChanged (this, EventArgs.Empty);
+ }
+
+ public event EventHandler SelectionChanged;
+
+ public bool AllowSelection {
+ get { return widget.AllowSelection; }
+ set { widget.AllowSelection = value; }
+ }
+
+ public ChartCursor SelectionStart {
+ get { return widget.SelectionStart; }
+ }
+
+ public ChartCursor SelectionEnd {
+ get { return widget.SelectionEnd; }
+ }
+
+ public ChartCursor ActiveCursor {
+ get { return widget.ActiveCursor; }
+ }
+ public bool ReverseXAxis {
+ get { return widget.ReverseXAxis; }
+ set { widget.ReverseXAxis = value; }
+ }
+
+ public bool ReverseYAxis {
+ get { return widget.ReverseYAxis; }
+ set { widget.ReverseYAxis = value; }
+ }
+
+ public double OriginX {
+ get { return widget.OriginX; }
+ set { widget.OriginX = value; }
+ }
+
+ public double OriginY {
+ get { return widget.OriginY; }
+ set { widget.OriginY = value; }
+ }
+
+ public double StartX {
+ get { return widget.StartX; }
+ set { widget.StartX = value; }
+ }
+
+ public double EndX {
+ get { return widget.EndX; }
+ set { widget.EndX = value; }
+ }
+
+ public double StartY {
+ get { return widget.StartY; }
+ set { widget.StartY = value; }
+ }
+
+ public double EndY {
+ get { return widget.EndY; }
+ set { widget.EndY = value; }
+ }
+
+ public void Reset ()
+ {
+ widget.Reset ();
+ }
+
+ public void AddAxis (Axis ax, AxisPosition position)
+ {
+ widget.AddAxis (ax, position);
+ }
+
+ public void AddSerie (Serie serie)
+ {
+ widget.AddSerie (serie);
+ }
+
+ public void RemoveSerie (Serie serie)
+ {
+ widget.RemoveSerie (serie);
+ }
+
+ public void AddCursor (ChartCursor cursor, AxisDimension dimension)
+ {
+ widget.AddCursor (cursor, dimension);
+ }
+
+ public void RemoveCursor (ChartCursor cursor)
+ {
+ widget.RemoveCursor (cursor);
+ }
+
+ public void SetAutoScale (AxisDimension ad, bool autoStart, bool autoEnd)
+ {
+ widget.SetAutoScale (ad, autoStart, autoEnd);
+ }
+
+ public void Clear ()
+ {
+ widget.Clear ();
+ }
+ }
+
+ class ChartWidget : DrawingArea
{
double startX, endX;
double startY, endY;
@@ -67,8 +186,9 @@ namespace MonoDevelop.Components.Chart
ChartCursor selectionStart;
ChartCursor selectionEnd;
-
- public BasicChart ()
+ BasicChart chart;
+
+ public ChartWidget ()
{
this.Events = EventMask.ButtonPressMask | EventMask.ButtonReleaseMask | EventMask.PointerMotionMask;
selectionStart = new ChartCursor ();
@@ -80,9 +200,12 @@ namespace MonoDevelop.Components.Chart
selectionStart.ValueChanged += new EventHandler (OnSelectionCursorChanged);
selectionEnd.ValueChanged += new EventHandler (OnSelectionCursorChanged);
}
-
- public event EventHandler SelectionChanged;
-
+
+ internal void Initialize (BasicChart owner)
+ {
+ chart = owner;
+ }
+
public bool AllowSelection {
get {
return enableSelection;
@@ -832,7 +955,7 @@ namespace MonoDevelop.Components.Chart
selectionStart = selectionEnd;
selectionEnd = tmp;
}
- OnSelectionChanged ();
+ chart.OnSelectionChanged ();
}
}
@@ -914,12 +1037,6 @@ namespace MonoDevelop.Components.Chart
yrangeChanged = true;
base.OnSizeAllocated (rect);
}
-
- protected virtual void OnSelectionChanged ()
- {
- if (SelectionChanged != null)
- SelectionChanged (this, EventArgs.Empty);
- }
}
public enum BackgroundDisplay
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.Chart/Serie.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.Chart/Serie.cs
index 45475ee559..16869cfc03 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.Chart/Serie.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.Chart/Serie.cs
@@ -37,7 +37,7 @@ namespace MonoDevelop.Components.Chart
string title;
List<Data> dataArray = new List<Data> ();
bool visible = true;
- internal BasicChart Owner;
+ internal ChartWidget Owner;
Cairo.Color color;
bool extendBoundingValues;
DisplayMode mode;
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.Commands/CommandEntry.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.Commands/CommandEntry.cs
index 54fc1fa284..b908b5078f 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.Commands/CommandEntry.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.Commands/CommandEntry.cs
@@ -92,12 +92,12 @@ namespace MonoDevelop.Components.Commands
return manager.GetCommand (cmdId);
}
- internal protected virtual Gtk.MenuItem CreateMenuItem (CommandManager manager)
+ internal virtual Gtk.MenuItem CreateMenuItem (CommandManager manager)
{
return CreateMenuItem (manager, GetCommand (manager), cmdId, true, overrideLabel, disabledVisible);
}
- internal protected virtual Gtk.ToolItem CreateToolItem (CommandManager manager)
+ internal virtual Gtk.ToolItem CreateToolItem (CommandManager manager)
{
if (cmdId == CommandManager.ToCommandId (Command.Separator))
return new Gtk.SeparatorToolItem ();
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.Commands/CommandEntrySet.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.Commands/CommandEntrySet.cs
index 40647d07a6..2514b416bc 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.Commands/CommandEntrySet.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.Commands/CommandEntrySet.cs
@@ -112,7 +112,7 @@ namespace MonoDevelop.Components.Commands
get { return cmds.Count; }
}
- internal protected override Gtk.MenuItem CreateMenuItem (CommandManager manager)
+ internal override Gtk.MenuItem CreateMenuItem (CommandManager manager)
{
Gtk.MenuItem mi;
if (autoHide)
@@ -123,7 +123,7 @@ namespace MonoDevelop.Components.Commands
return mi;
}
- internal protected override Gtk.ToolItem CreateToolItem (CommandManager manager)
+ internal override Gtk.ToolItem CreateToolItem (CommandManager manager)
{
Gtk.Menu menu = manager.CreateMenu (this);
return new MenuToolButton (menu, icon);
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.Commands/CommandFrame.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.Commands/CommandFrame.cs
index 266d6f83af..d29c426593 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.Commands/CommandFrame.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.Commands/CommandFrame.cs
@@ -26,48 +26,15 @@
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
-using Mono.Addins;
-using MonoDevelop.Components.DockToolbars;
+using Gtk;
namespace MonoDevelop.Components.Commands
{
- public class CommandFrame: DockToolbarFrame
+ class CommandFrame: EventBox
{
- CommandManager manager;
-
public CommandFrame (CommandManager manager)
{
- this.manager = manager;
manager.RegisterGlobalHandler (this);
}
-
- [CommandHandler (CommandSystemCommands.ToolbarList)]
- protected void OnViewToolbar (object ob)
- {
- IDockToolbar bar = (IDockToolbar) ob;
- bar.Visible = !bar.Visible;
- }
-
- [CommandUpdateHandler (CommandSystemCommands.ToolbarList)]
- protected void OnUpdateViewToolbar (CommandArrayInfo info)
- {
- foreach (IDockToolbar bar in Toolbars) {
- CommandInfo cmd = new CommandInfo (bar.Title);
- cmd.Checked = bar.Visible;
- cmd.Description = AddinManager.CurrentLocalizer.GetString ("Show toolbar '{0}'", bar.Title);
- info.Add (cmd, bar);
- }
- }
-
- protected override void OnPanelClick (Gdk.EventButton e, Placement placement)
- {
- if (e.TriggersContextMenu ()) {
- CommandEntrySet opset = new CommandEntrySet ();
- opset.AddItem (CommandSystemCommands.ToolbarList);
- Gtk.Menu menu = manager.CreateMenu (opset);
- menu.Popup (null, null, null, 0, e.Time);
- }
- base.OnPanelClick (e, placement);
- }
}
}
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.Commands/CommandManager.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.Commands/CommandManager.cs
index da77e69a41..35c6f1846f 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.Commands/CommandManager.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.Commands/CommandManager.cs
@@ -82,9 +82,10 @@ namespace MonoDevelop.Components.Commands
{
}
- public CommandManager (Gtk.Window root)
+ public CommandManager (Window root)
{
- rootWidget = root;
+ if (root != null)
+ rootWidget = root;
bindings = new KeyBindingManager ();
ActionCommand c = new ActionCommand (CommandSystemCommands.ToolbarList, "Toolbar List", null, null, ActionType.Check);
c.CommandArray = true;
@@ -131,38 +132,13 @@ namespace MonoDevelop.Components.Commands
/// <summary>
/// Creates a menu bar from the menu definition at the provided extension path
/// </summary>
- public Gtk.MenuBar CreateMenuBar (string addinPath)
+ internal Gtk.MenuBar CreateMenuBar (string addinPath)
{
CommandEntrySet cset = CreateCommandEntrySet (addinPath);
return CreateMenuBar (addinPath, cset);
}
/// <summary>
- /// Creates a set of toolbars from the provided extension path
- /// </summary>
- public Gtk.Toolbar[] CreateToolbarSet (string addinPath)
- {
- ArrayList bars = new ArrayList ();
-
- CommandEntrySet cset = CreateCommandEntrySet (addinPath);
- foreach (CommandEntry ce in cset) {
- CommandEntrySet ces = ce as CommandEntrySet;
- if (ces != null)
- bars.Add (CreateToolbar (addinPath + "/" + ces.CommandId, ces));
- }
- return (Gtk.Toolbar[]) bars.ToArray (typeof(Gtk.Toolbar));
- }
-
- /// <summary>
- /// Creates a toolbar from the provided extension path
- /// </summary>
- public Gtk.Toolbar CreateToolbar (string addinPath)
- {
- CommandEntrySet cset = CreateCommandEntrySet (addinPath);
- return CreateToolbar (addinPath, cset);
- }
-
- /// <summary>
/// Creates a menu from the provided extension path
/// </summary>
public Gtk.Menu CreateMenu (string addinPath)
@@ -183,7 +159,7 @@ namespace MonoDevelop.Components.Commands
/// <param name='addinPath'>
/// Extension path to the definition of the menu
/// </param>
- public void ShowContextMenu (Gtk.Widget parent, Gdk.EventButton evt, string addinPath)
+ public void ShowContextMenu (Control parent, Gdk.EventButton evt, string addinPath)
{
ShowContextMenu (parent, evt, CreateCommandEntrySet (addinPath));
}
@@ -203,7 +179,7 @@ namespace MonoDevelop.Components.Commands
/// <param name='addinPath'>
/// Extension path to the definition of the menu
/// </param>
- public void ShowContextMenu (Gtk.Widget parent, Gdk.EventButton evt,
+ public void ShowContextMenu (Control parent, Gdk.EventButton evt,
ExtensionContext ctx, string addinPath)
{
ShowContextMenu (parent, evt, CreateCommandEntrySet (ctx, addinPath));
@@ -460,7 +436,7 @@ namespace MonoDevelop.Components.Commands
/// <summary>
/// Sets the root window. The manager will start the command route at this window, if no other is active.
/// </summary>
- public void SetRootWindow (Gtk.Window root)
+ public void SetRootWindow (Window root)
{
if (rootWidget != null)
rootWidget.KeyPressEvent -= OnKeyPressed;
@@ -718,7 +694,7 @@ namespace MonoDevelop.Components.Commands
/// <param name='entrySet'>
/// Entry set with the definition of the commands to be included in the menu bar
/// </param>
- public Gtk.MenuBar CreateMenuBar (string name, CommandEntrySet entrySet)
+ internal Gtk.MenuBar CreateMenuBar (string name, CommandEntrySet entrySet)
{
Gtk.MenuBar topMenu = new CommandMenuBar (this);
foreach (CommandEntry entry in entrySet) {
@@ -749,7 +725,7 @@ namespace MonoDevelop.Components.Commands
/// <param name='menu'>
/// The menu where to add the commands
/// </param>
- public Gtk.Menu CreateMenu (CommandEntrySet entrySet, CommandMenu menu)
+ internal Gtk.Menu CreateMenu (CommandEntrySet entrySet, CommandMenu menu)
{
foreach (CommandEntry entry in entrySet) {
Gtk.MenuItem mi = entry.CreateMenuItem (this);
@@ -902,7 +878,7 @@ namespace MonoDevelop.Components.Commands
/// <param name='initialCommandTarget'>
/// Initial command route target. The command handler will start looking for command handlers in this object.
/// </param>
- public bool ShowContextMenu (Gtk.Widget parent, Gdk.EventButton evt, CommandEntrySet entrySet,
+ public bool ShowContextMenu (Control parent, Gdk.EventButton evt, CommandEntrySet entrySet,
object initialCommandTarget = null)
{
return ShowContextMenu (parent, evt, entrySet, initialCommandTarget, null);
@@ -926,7 +902,7 @@ namespace MonoDevelop.Components.Commands
/// <param name='closeHandler'>
/// An event handler which will be called when the menu closes
/// </param>
- public bool ShowContextMenu (Gtk.Widget parent, Gdk.EventButton evt, CommandEntrySet entrySet,
+ public bool ShowContextMenu (Control parent, Gdk.EventButton evt, CommandEntrySet entrySet,
object initialCommandTarget, EventHandler closeHandler)
{
#if MAC
@@ -949,7 +925,7 @@ namespace MonoDevelop.Components.Commands
/// <param name="y">The y coordinate.</param>
/// <param name="entrySet">Entry set with the command definitions</param>
/// <param name="initialCommandTarget">Initial command target.</param>
- public bool ShowContextMenu (Gtk.Widget parent, int x, int y, CommandEntrySet entrySet,
+ public bool ShowContextMenu (Control parent, int x, int y, CommandEntrySet entrySet,
object initialCommandTarget = null)
{
#if MAC
@@ -979,7 +955,7 @@ namespace MonoDevelop.Components.Commands
/// <param name='initialCommandTarget'>
/// Initial command route target. The command handler will start looking for command handlers in this object.
/// </param>
- public void ShowContextMenu (Gtk.Widget parent, Gdk.EventButton evt, Gtk.Menu menu,
+ public void ShowContextMenu (Control parent, Gdk.EventButton evt, Gtk.Menu menu,
object initialCommandTarget = null)
{
if (menu is CommandMenu) {
@@ -989,7 +965,7 @@ namespace MonoDevelop.Components.Commands
MonoDevelop.Components.GtkWorkarounds.ShowContextMenu (menu, parent, evt);
}
- public void ShowContextMenu (Gtk.Widget parent, int x, int y, Gtk.Menu menu,
+ public void ShowContextMenu (Control parent, int x, int y, Gtk.Menu menu,
object initialCommandTarget = null)
{
if (menu is CommandMenu) {
@@ -1000,86 +976,6 @@ namespace MonoDevelop.Components.Commands
}
/// <summary>
- /// Creates a toolbar.
- /// </summary>
- /// <returns>
- /// The toolbar.
- /// </returns>
- /// <param name='entrySet'>
- /// Entry with the command definitions
- /// </param>
- public Gtk.Toolbar CreateToolbar (CommandEntrySet entrySet)
- {
- return CreateToolbar ("", entrySet, null);
- }
-
- /// <summary>
- /// Creates a toolbar.
- /// </summary>
- /// <returns>
- /// The toolbar.
- /// </returns>
- /// <param name='entrySet'>
- /// Entry with the command definitions
- /// </param>
- /// <param name='initialTarget'>
- /// Initial command route target. The command handler will start looking for command handlers in this object.
- /// </param>
- public Gtk.Toolbar CreateToolbar (CommandEntrySet entrySet, object initialTarget)
- {
- return CreateToolbar ("", entrySet, initialTarget);
- }
-
- /// <summary>
- /// Creates a toolbar.
- /// </summary>
- /// <returns>
- /// The toolbar.
- /// </returns>
- /// <param name='id'>
- /// Identifier of the toolbar
- /// </param>
- /// <param name='entrySet'>
- /// Entry with the command definitions
- /// </param>
- public Gtk.Toolbar CreateToolbar (string id, CommandEntrySet entrySet)
- {
- return CreateToolbar (id, entrySet, null);
- }
-
- /// <summary>
- /// Creates a toolbar.
- /// </summary>
- /// <returns>
- /// The toolbar.
- /// </returns>
- /// <param name='id'>
- /// Identifier of the toolbar
- /// </param>
- /// <param name='entrySet'>
- /// Entry with the command definitions
- /// </param>
- /// <param name='initialTarget'>
- /// Initial command route target. The command handler will start looking for command handlers in this object.
- /// </param>
- public Gtk.Toolbar CreateToolbar (string id, CommandEntrySet entrySet, object initialTarget)
- {
- CommandToolbar toolbar = new CommandToolbar (this, id, entrySet.Name);
- toolbar.InitialCommandTarget = initialTarget;
-
- foreach (CommandEntry entry in entrySet) {
- Gtk.ToolItem ti = entry.CreateToolItem (this);
- CustomItem ci = ti.Child as CustomItem;
- if (ci != null)
- ci.SetToolbarStyle (toolbar);
- toolbar.Add (ti);
- }
- ToolbarTracker tt = new ToolbarTracker ();
- tt.Track (toolbar);
- return toolbar;
- }
-
- /// <summary>
/// Dispatches a command.
/// </summary>
/// <returns>
@@ -2187,8 +2083,8 @@ namespace MonoDevelop.Components.Commands
public class ActiveWidgetEventArgs: EventArgs
{
- public Gtk.Widget OldActiveWidget { get; internal set; }
- public Gtk.Widget NewActiveWidget { get; internal set; }
+ public Control OldActiveWidget { get; internal set; }
+ public Control NewActiveWidget { get; internal set; }
}
internal class HandlerTypeInfo
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.Commands/CommandMenu.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.Commands/CommandMenu.cs
index dacd57d56a..22abd3aa5f 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.Commands/CommandMenu.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.Commands/CommandMenu.cs
@@ -30,7 +30,7 @@ using System;
namespace MonoDevelop.Components.Commands
{
- public class CommandMenu: Gtk.Menu
+ class CommandMenu: Gtk.Menu
{
CommandEntrySet commandEntrySet;
CommandManager manager;
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.Commands/CommandMenuBar.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.Commands/CommandMenuBar.cs
index b7da31e1be..3302f8da77 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.Commands/CommandMenuBar.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.Commands/CommandMenuBar.cs
@@ -30,7 +30,7 @@ using Gtk;
namespace MonoDevelop.Components.Commands
{
- public class CommandMenuBar: Gtk.MenuBar
+ class CommandMenuBar: Gtk.MenuBar
{
CommandManager manager;
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.Commands/CommandMenuItem.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.Commands/CommandMenuItem.cs
index ef70661b76..040c278780 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.Commands/CommandMenuItem.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.Commands/CommandMenuItem.cs
@@ -32,7 +32,7 @@ using MonoDevelop.Core;
namespace MonoDevelop.Components.Commands
{
- public class CommandMenuItem: Gtk.ImageMenuItem, ICommandMenuItem
+ class CommandMenuItem: Gtk.ImageMenuItem, ICommandMenuItem
{
CommandManager commandManager;
object commandId;
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.Commands/CommandRouterContainer.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.Commands/CommandRouterContainer.cs
index d6693f379e..bc9b1c1d7c 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.Commands/CommandRouterContainer.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.Commands/CommandRouterContainer.cs
@@ -47,11 +47,13 @@ namespace MonoDevelop.Components.Commands
{
this.continueToParent = continueToParent;
}
-
- public CommandRouterContainer (Gtk.Widget child, object target, bool continueToParent) : this (continueToParent)
+
+ public CommandRouterContainer (Control child, object target, bool continueToParent) : this (continueToParent)
{
- if (child != null)
+ if (child != null) {
PackStart (child, true, true, 0);
+ child = null;
+ }
Delegated = target;
}
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.Commands/CommandToggleToolButton.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.Commands/CommandToggleToolButton.cs
index 6f06e25e30..eb7d7d60ee 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.Commands/CommandToggleToolButton.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.Commands/CommandToggleToolButton.cs
@@ -31,7 +31,7 @@ using MonoDevelop.Core;
namespace MonoDevelop.Components.Commands
{
- public class CommandToggleToolButton: Gtk.ToggleToolButton, ICommandUserItem
+ class CommandToggleToolButton: Gtk.ToggleToolButton, ICommandUserItem
{
CommandManager commandManager;
object commandId;
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.Commands/CommandToolButton.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.Commands/CommandToolButton.cs
index 16b63dcaf6..26e3d98df1 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.Commands/CommandToolButton.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.Commands/CommandToolButton.cs
@@ -31,7 +31,7 @@ using MonoDevelop.Core;
namespace MonoDevelop.Components.Commands
{
- public class CommandToolButton: Gtk.ToolButton, ICommandUserItem
+ class CommandToolButton: Gtk.ToolButton, ICommandUserItem
{
CommandManager commandManager;
object commandId;
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.Commands/CommandToolbar.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.Commands/CommandToolbar.cs
deleted file mode 100644
index 320ebedb6e..0000000000
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.Commands/CommandToolbar.cs
+++ /dev/null
@@ -1,79 +0,0 @@
-//
-// CommandToolbar.cs
-//
-// Author:
-// Lluis Sanchez Gual
-//
-// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-
-using System;
-using MonoDevelop.Components.DockToolbars;
-
-namespace MonoDevelop.Components.Commands
-{
- public class CommandToolbar: DockToolbar, ICommandBar
- {
- object initialCommandTarget;
-
- public CommandToolbar (CommandManager manager, string id, string title): base (id, title)
- {
- manager.RegisterCommandBar (this);
- }
-
- internal object InitialCommandTarget {
- get { return initialCommandTarget; }
- set { initialCommandTarget = value; }
- }
-
- protected override void OnShown ()
- {
- base.OnShown ();
- ((ICommandBar)this).Update (null);
- }
-
- void ICommandBar.Update (object defaultTarget)
- {
- if (!Visible)
- return;
-
- if (initialCommandTarget != null)
- defaultTarget = initialCommandTarget;
-
- CommandTargetRoute targetRoute = new CommandTargetRoute (defaultTarget);
- foreach (Gtk.Widget item in Children) {
- if (item is ICommandUserItem)
- ((ICommandUserItem)item).Update (targetRoute);
- else
- item.Show ();
- }
- }
-
- public void SetEnabled (bool enabled)
- {
- foreach (Gtk.Widget item in Children) {
- if (item.GetType () == typeof(Gtk.ToolItem))
- item.Sensitive = enabled;
- }
- }
- }
-}
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.Commands/KeyBindingManager.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.Commands/KeyBindingManager.cs
index ec563318db..3b460a0198 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.Commands/KeyBindingManager.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.Commands/KeyBindingManager.cs
@@ -82,15 +82,15 @@ namespace MonoDevelop.Components.Commands
#region Platform-dependent selection modifiers
//FIXME: these should be named for what they do, not what they are
- public static Gdk.ModifierType SelectionModifierAlt {
+ internal static Gdk.ModifierType SelectionModifierAlt {
get; private set;
}
- public static Gdk.ModifierType SelectionModifierControl {
+ internal static Gdk.ModifierType SelectionModifierControl {
get; private set;
}
- public static Gdk.ModifierType SelectionModifierSuper {
+ internal static Gdk.ModifierType SelectionModifierSuper {
get; private set;
}
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.Commands/LinkCommandEntry.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.Commands/LinkCommandEntry.cs
index 9be78695fa..81b363675e 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.Commands/LinkCommandEntry.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.Commands/LinkCommandEntry.cs
@@ -73,7 +73,7 @@ namespace MonoDevelop.Components.Commands
}
}
- internal protected override Gtk.MenuItem CreateMenuItem (CommandManager manager)
+ internal override Gtk.MenuItem CreateMenuItem (CommandManager manager)
{
Gtk.ImageMenuItem item = new Gtk.ImageMenuItem (text != null ? text : url);
item.Image = new ImageView (icon, Gtk.IconSize.Menu);
@@ -90,7 +90,7 @@ namespace MonoDevelop.Components.Commands
return item;
}
- internal protected override Gtk.ToolItem CreateToolItem (CommandManager manager)
+ internal override Gtk.ToolItem CreateToolItem (CommandManager manager)
{
Gtk.ToolButton item = new Gtk.ToolButton (text);
item.StockId = icon;
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.Commands/MenuToolButton.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.Commands/MenuToolButton.cs
index 1524a03214..737c3694ea 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.Commands/MenuToolButton.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.Commands/MenuToolButton.cs
@@ -30,7 +30,7 @@ using System;
namespace MonoDevelop.Components.Commands
{
- public class MenuToolButton: Gtk.ToolButton
+ internal class MenuToolButton: Gtk.ToolButton
{
Gtk.Menu menu;
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.DockNotebook/PlaceholderWindow.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.DockNotebook/PlaceholderWindow.cs
index 397d413170..756d2b672f 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.DockNotebook/PlaceholderWindow.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.DockNotebook/PlaceholderWindow.cs
@@ -51,7 +51,7 @@ namespace MonoDevelop.Components.DockNotebook
var doc = IdeApp.Workbench.ActiveDocument;
if (doc == null)
return;
- var rootWindow = doc.Window.ActiveViewContent.Control.Toplevel as DockWindow;
+ var rootWindow = doc.Window.ActiveViewContent.Control.GetNativeWidget<Gtk.Widget> ().Toplevel as DockWindow;
if (rootWindow == null)
return;
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.DockToolbars/ArrowWindow.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.DockToolbars/ArrowWindow.cs
deleted file mode 100644
index 8d02dc185d..0000000000
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.DockToolbars/ArrowWindow.cs
+++ /dev/null
@@ -1,136 +0,0 @@
-//
-// ArrowWindow.cs
-//
-// Author:
-// Lluis Sanchez Gual
-//
-// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-
-using System;
-using Gtk;
-using Gdk;
-
-namespace MonoDevelop.Components.DockToolbars
-{
- internal class ArrowWindow: Gtk.Window
- {
- const int LineWidth = 3;
- const int LineLength = 9;
- const int PointerWidth = 13;
- const int PointerLength = 6;
-
- Direction direction;
- Point[] arrow;
- int width, height;
-
- Gdk.GC redgc;
-
- // Where does the arrow point to
- public new enum Direction {
- Up, Down, Left, Right
- }
-
- public ArrowWindow (DockToolbarFrame frame, Direction dir): base (Gtk.WindowType.Popup)
- {
- SkipTaskbarHint = true;
- Decorated = false;
- TransientFor = frame.TopWindow;
-
- direction = dir;
- arrow = CreateArrow ();
- if (direction == Direction.Up || direction == Direction.Down) {
- width = PointerWidth;
- height = LineLength + PointerLength + 1;
- } else {
- height = PointerWidth;
- width = LineLength + PointerLength + 1;
- }
-
- // Create the mask for the arrow
-
- Gdk.Color black, white;
- black = new Gdk.Color (0, 0, 0);
- black.Pixel = 1;
- white = new Gdk.Color (255, 255, 255);
- white.Pixel = 0;
-
- Gdk.Pixmap pm = new Pixmap (this.GdkWindow, width, height, 1);
- Gdk.GC gc = new Gdk.GC (pm);
- gc.Background = white;
- gc.Foreground = white;
- pm.DrawRectangle (gc, true, 0, 0, width, height);
-
- gc.Foreground = black;
- pm.DrawPolygon (gc, false, arrow);
- pm.DrawPolygon (gc, true, arrow);
-
- this.ShapeCombineMask (pm, 0, 0);
-
- Realize ();
-
- redgc = new Gdk.GC (GdkWindow);
- redgc.RgbFgColor = new Gdk.Color (255, 0, 0);
-
- Resize (width, height);
- }
-
- public int Width {
- get { return width; }
- }
-
- public int Height {
- get { return height; }
- }
-
- Point[] CreateArrow ()
- {
- Point[] ps = new Point [8];
- ps [0] = GetPoint (0, (PointerWidth/2) - (LineWidth/2));
- ps [1] = GetPoint (LineLength, (PointerWidth/2) - (LineWidth/2));
- ps [2] = GetPoint (LineLength, 0);
- ps [3] = GetPoint (PointerLength + LineLength, (PointerWidth/2));
- ps [4] = GetPoint (LineLength, PointerWidth - 1);
- ps [5] = GetPoint (LineLength, (PointerWidth/2) + (LineWidth/2));
- ps [6] = GetPoint (0, (PointerWidth/2) + (LineWidth/2));
- ps [7] = ps [0];
- return ps;
- }
-
- Point GetPoint (int x, int y)
- {
- switch (direction) {
- case Direction.Right: return new Point (x, y);
- case Direction.Left: return new Point ((PointerLength + LineLength) - x, y);
- case Direction.Down: return new Point (y, x);
- default: return new Point (y, (PointerLength + LineLength) - x);
- }
- }
-
- protected override bool OnExposeEvent (Gdk.EventExpose args)
- {
- GdkWindow.DrawPolygon (redgc, false, arrow);
- GdkWindow.DrawPolygon (redgc, true, arrow);
- return true;
- }
- }
-}
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.DockToolbars/DockGrip.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.DockToolbars/DockGrip.cs
deleted file mode 100644
index 716763dee1..0000000000
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.DockToolbars/DockGrip.cs
+++ /dev/null
@@ -1,72 +0,0 @@
-//
-// DockGrip.cs
-//
-// Author:
-// Lluis Sanchez Gual
-//
-// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-
-using System;
-using Gtk;
-using Gdk;
-
-namespace MonoDevelop.Components.DockToolbars
-{
- internal class DockGrip: ToolItem
- {
- static int GripSize = MonoDevelop.Core.Platform.IsWindows? 4 : 6; //wimp theme engine looks ugly with width 6
- const int MarginLeft = 1;
- const int MarginRight = 3;
-
- public DockGrip ()
- {
- }
-
- protected override void OnSizeRequested (ref Requisition req)
- {
- if (Orientation == Orientation.Horizontal) {
- req.Width = GripSize + MarginLeft + MarginRight;
- req.Height = 0;
- } else {
- req.Width = 0;
- req.Height = GripSize + MarginLeft + MarginRight;
- }
- }
-
- protected override bool OnExposeEvent (Gdk.EventExpose args)
- {
- Rectangle rect = Allocation;
- if (Orientation == Orientation.Horizontal) {
- rect.Width = GripSize;
- rect.X += MarginLeft;
- } else {
- rect.Height = GripSize;
- rect.Y += MarginLeft;
- }
-
- Gtk.Orientation or = Orientation == Gtk.Orientation.Horizontal ? Gtk.Orientation.Vertical : Gtk.Orientation.Horizontal;
- Gtk.Style.PaintHandle (this.Style, this.ParentWindow, this.State, Gtk.ShadowType.None, args.Area, this, "grip", rect.X, rect.Y, rect.Width, rect.Height, or);
- return true;
- }
- }
-}
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.DockToolbars/DockToolbar.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.DockToolbars/DockToolbar.cs
deleted file mode 100644
index 3e3f6a4b21..0000000000
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.DockToolbars/DockToolbar.cs
+++ /dev/null
@@ -1,410 +0,0 @@
-//
-// DockToolbar.cs
-//
-// Author:
-// Lluis Sanchez Gual
-//
-// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-
-using System;
-using System.Collections.Generic;
-using Gtk;
-using Gdk;
-
-namespace MonoDevelop.Components.DockToolbars
-{
- public class DockToolbar: Toolbar, IDockToolbar
- {
- DockGrip grip;
- DockToolbarFrame parentFrame;
- bool dragging;
- FloatingDock floatingDock;
- string id;
- string title;
-
- int row;
- int offset;
- int shiftOffset = -1;
-
- // Offset requested by the user. It is used to know where the
- // toolbar is expected to move when the window is expanded.
- int anchorOffset;
-
- Animation animation;
- DockToolbarPosition lastPosition;
- DockToolbarStatus defaultStatus;
-
- int defaultSize;
- int defaultHeight;
- bool gotSize = false;
- bool gettingSize;
- Dictionary<Gtk.Widget,int> calculatedSizes = new Dictionary<Gtk.Widget, int> ();
-
- public DockToolbar (string id, string title)
- {
- grip = new DockGrip ();
- Add (grip);
- grip.Hide ();
- this.id = id;
- this.title = title;
- ShowArrow = false;
- }
-
- internal void SetParentFrame (DockToolbarFrame frame)
- {
- parentFrame = frame;
- grip.Show ();
- }
-
- public string Id {
- get { return id; }
- }
-
- public string Title {
- get { return title; }
- }
-
- public bool Floating {
- get { return floatingDock != null; }
- }
-
- bool IDockToolbar.Visible {
- get { return Parent != null; }
- set {
- if (value == ((IDockToolbar)this).Visible)
- return;
-
- if (value) {
- if (lastPosition != null)
- lastPosition.RestorePosition (parentFrame, this);
- else
- defaultStatus.Position.RestorePosition (parentFrame, this);
- } else {
- lastPosition = DockToolbarPosition.Create (this);
- if (Floating) {
- FloatingDock win = FloatingDock;
- win.Detach ();
- win.Destroy ();
- }
- else
- DockPanel.RemoveBar (this);
- }
- }
- }
-
- internal DockToolbarPosition Position {
- get {
- if (((IDockToolbar)this).Visible) return DockToolbarPosition.Create (this);
- else if (lastPosition != null) return lastPosition;
- else return defaultStatus.Position;
- }
- }
-
- internal DockToolbarStatus Status {
- get {
- return new DockToolbarStatus (id, ((IDockToolbar)this).Visible, Position);
- }
- set {
- if (value.Visible) {
- ((IDockToolbar)this).Visible = false;
- lastPosition = value.Position;
- ((IDockToolbar)this).Visible = true;
- } else {
- ((IDockToolbar)this).Visible = false;
- lastPosition = value.Position;
- }
- }
-
- }
-
- internal DockToolbarStatus DefaultStatus {
- get { return defaultStatus; }
- set { defaultStatus = value; }
- }
-
- internal int DockRow {
- get { return row; }
- set { row = value; }
- }
-
- /// <summary>
- /// The current offset of the toolbar
- /// </summary>
- internal int DockOffset {
- get { return offset; }
- set { offset = value; }
- }
-
- internal int DockShiftOffset {
- get { return shiftOffset; }
- set { shiftOffset = value; }
- }
-
- /// <summary>
- /// The ideal offset of the toolbar. It may not be the real offset if the
- /// toolbar has been forced to move to make room for other toolbars
- /// </summary>
- internal int AnchorOffset {
- get { return anchorOffset; }
- set { anchorOffset = value; }
- }
-
- internal int DefaultSize {
- get {
- if (!gotSize) CalcSizes ();
- return defaultSize;
- }
- }
-
- public int DefaultHeight {
- get {
- if (!gotSize) CalcSizes ();
- return defaultHeight;
- }
- }
-
- internal void CalcSizes ()
- {
- // Calculates the real size of the toolbar. ShowArrow=false is
- // needed, since SizeRequest reports 0 size requested if not.
-
- gettingSize = true;
- bool olda = ShowArrow;
- int oldw = WidthRequest;
- int oldh = HeightRequest;
- WidthRequest = -1;
- HeightRequest = -1;
-
- ShowArrow = false;
- Requisition r = SizeRequest ();
- if (Orientation == Orientation.Horizontal) {
- defaultSize = r.Width;
- defaultHeight = r.Height;
- }
- else {
- defaultSize = r.Height;
- defaultHeight = r.Width;
- }
-
- calculatedSizes.Clear ();
- foreach (Widget w in Children) {
- if (!w.Visible)
- continue;
- if (Orientation == Orientation.Horizontal)
- calculatedSizes [w] = w.Allocation.Width;
- else
- calculatedSizes [w] = w.Allocation.Height;
- }
-
- WidthRequest = oldw;
- HeightRequest = oldh;
- ShowArrow = olda;
- gotSize = true;
- gettingSize = false;
- }
-
- internal bool CanDockTo (DockToolbarPanel panel)
- {
- return true;
- }
-
- internal FloatingDock FloatingDock {
- get { return floatingDock; }
- set { floatingDock = value; }
- }
-
- internal DockToolbarPanel DockPanel {
- get { return Parent as DockToolbarPanel; }
- }
-
- internal Animation Animation {
- get { return animation; }
- set { animation = value; }
- }
-
- protected override bool OnButtonPressEvent (EventButton e)
- {
- if (parentFrame != null && e.Button == 1 && !e.TriggersContextMenu ()) {
- if (Orientation == Orientation.Horizontal && e.X <= 10) {
- dragging = true;
- parentFrame.StartDragBar (this, (int)e.X, (int)e.Y, e.Time);
- return true;
- }
- else if (Orientation == Orientation.Vertical && e.Y <= 10) {
- dragging = true;
- parentFrame.StartDragBar (this, (int)e.X, (int)e.Y, e.Time);
- return true;
- }
- }
- return base.OnButtonPressEvent (e);
- }
-
- protected override bool OnButtonReleaseEvent (EventButton e)
- {
- if (e.Button == 1 && dragging) {
- dragging = false;
- parentFrame.EndDragBar (this, e.Time);
- }
- return base.OnButtonReleaseEvent (e);
- }
-
- protected override bool OnExposeEvent (EventExpose evnt)
- {
- //HACK: the WIMP theme engine's rendering is a bit off, need to force it to render wider
- if (MonoDevelop.Core.Platform.IsWindows && Orientation == Orientation.Horizontal) {
- int widen = 1;
- var shadowType = (ShadowType)StyleGetProperty ("shadow-type");
- Style.PaintBox (Style, evnt.Window, State, shadowType, evnt.Area, this, "toolbar",
- Allocation.X - widen, Allocation.Y, Allocation.Width + widen + widen, Allocation.Height);
-
- foreach (Widget child in Children) {
- PropagateExpose (child, evnt);
- }
- return true;
- }
-
- return base.OnExposeEvent (evnt);
- }
-
- bool firstRealized;
- protected override void OnRealized ()
- {
- base.OnRealized ();
- if (!firstRealized) {
- OnItemChange (null, null);
- firstRealized = true;
- }
- }
-
-
- internal void ResetSize ()
- {
- WidthRequest = -1;
- HeightRequest = -1;
- ShowArrow = false;
- }
-
- public int Size {
- set {
- if (Orientation == Orientation.Horizontal) {
- if (value >= DefaultSize)
- WidthRequest = -1;
- else
- WidthRequest = value;
- }
- else {
- if (value >= DefaultSize)
- HeightRequest = -1;
- else
- HeightRequest = value;
- HeightRequest = value;
- }
- }
- get {
- if (Orientation == Orientation.Horizontal)
- return SizeRequest ().Width;
- else
- return SizeRequest ().Height;
- }
- }
-
- public new Orientation Orientation {
- get {
- return base.Orientation;
- }
- set {
- if (value == base.Orientation)
- return;
-
- if (FloatingDock != null) {
- // I create a new dock window because resizing the
- // current one has lots of issues (mainly synchronization
- // problems between the size change of the window and
- // the toolbar).
-
- int x,y;
- FloatingDock w = FloatingDock;
- w.GetPosition (out x, out y);
- w.Detach ();
-
- base.Orientation = value;
-
- FloatingDock fdock = new FloatingDock (parentFrame);
- fdock.Move (x, y);
- fdock.Attach (this);
- w.Destroy ();
- } else
- base.Orientation = value;
- gotSize = false;
- }
- }
-
- protected override void OnAdded (Widget w)
- {
- base.OnAdded (w);
- gotSize = false;
- if (DefaultSizeChanged != null)
- DefaultSizeChanged (this, EventArgs.Empty);
- w.Shown += OnItemChange;
- w.Hidden += OnItemChange;
- w.SizeAllocated += OnItemSizeChange;
- }
-
- protected override void OnRemoved (Widget w)
- {
- base.OnRemoved (w);
- gotSize = false;
- if (DefaultSizeChanged != null)
- DefaultSizeChanged (this, EventArgs.Empty);
- w.Shown -= OnItemChange;
- w.Hidden -= OnItemChange;
- w.SizeAllocated -= OnItemSizeChange;
- }
-
- void OnItemSizeChange (object o, SizeAllocatedArgs args)
- {
- if (gettingSize || !gotSize)
- return;
- int os;
- if (calculatedSizes.TryGetValue ((Gtk.Widget) o, out os)) {
- int ns = (Orientation == Orientation.Horizontal ? args.Allocation.Width : args.Allocation.Height);
- if (os != ns) {
- Gtk.Application.Invoke (delegate {
- OnItemChange (null, null);
- });
- }
- }
- }
-
- void OnItemChange (object o, EventArgs args)
- {
- // This notifies changes in the size of the toolbar
- gotSize = false;
- if (DefaultSizeChanged != null)
- DefaultSizeChanged (this, EventArgs.Empty);
- }
-
- internal event EventHandler DefaultSizeChanged;
- }
-}
-
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.DockToolbars/DockToolbarFrame.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.DockToolbars/DockToolbarFrame.cs
deleted file mode 100644
index e1efdd06a6..0000000000
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.DockToolbars/DockToolbarFrame.cs
+++ /dev/null
@@ -1,397 +0,0 @@
-//
-// DockToolbarFrame.cs
-//
-// Author:
-// Lluis Sanchez Gual
-//
-// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-
-using Gtk;
-using Gdk;
-using System.Xml;
-using System.Xml.Serialization;
-using System.Collections.Generic;
-
-namespace MonoDevelop.Components.DockToolbars
-{
- public class DockToolbarFrame: EventBox
- {
- DockToolbarPanel[] panels;
- DockToolbarPanel targetPanel;
- VBox vbox;
- VBox contentBox;
- DockToolbar dragBar;
- int xDragDif, yDragDif;
- List<DockToolbar> bars = new List<DockToolbar> ();
-
- Dictionary<string,DockToolbarStatus[]> layouts = new Dictionary<string,DockToolbarStatus[]> ();
- string currentLayout = "";
-
- Cursor handCursor = new Cursor (CursorType.Fleur);
-
- public DockToolbarFrame ()
- {
- vbox = new VBox ();
- Add (vbox);
-
- DockToolbarPanel topPanel = new DockToolbarPanel (this, Placement.Top);
- DockToolbarPanel bottomPanel = new DockToolbarPanel (this, Placement.Bottom);
- DockToolbarPanel leftPanel = new DockToolbarPanel (this, Placement.Left);
- DockToolbarPanel rightPanel = new DockToolbarPanel (this, Placement.Right);
-
- panels = new DockToolbarPanel [4];
- panels [(int)Placement.Top] = topPanel;
- panels [(int)Placement.Bottom] = bottomPanel;
- panels [(int)Placement.Left] = leftPanel;
- panels [(int)Placement.Right] = rightPanel;
-
- vbox.PackStart (topPanel, false, false, 0);
-
- HBox hbox = new HBox ();
- contentBox = new VBox ();
-
- hbox.PackStart (leftPanel, false, false, 0);
- hbox.PackStart (contentBox, true, true, 0);
- hbox.PackStart (rightPanel, false, false, 0);
-
- vbox.PackStart (hbox, true, true, 0);
- vbox.PackStart (bottomPanel, false, false, 0);
-
- this.Events = EventMask.ButtonPressMask | EventMask.ButtonReleaseMask | EventMask.PointerMotionMask;
- ShowAll ();
- }
-
- public void AddContent (Widget w)
- {
- contentBox.PackStart (w, true, true, 0);
- }
-
- public void RemoveContent (Widget w)
- {
- contentBox.Remove (w);
- }
-
- public string CurrentLayout {
- get { return currentLayout; }
- set {
- if (value != currentLayout) {
- SaveCurrentLayout ();
- RestoreLayout (value);
- }
- }
- }
-
- public DockToolbarFrameStatus GetStatus ()
- {
- SaveCurrentLayout ();
- DockToolbarFrameStatus col = new DockToolbarFrameStatus ();
- col.Version = DockToolbarFrameStatus.CurrentVersion;
-
- foreach (var layout in layouts) {
- col.Status.Add (new DockToolbarFrameLayout () {
- Id = layout.Key,
- Bars = layout.Value,
- });
- }
- return col;
- }
-
- public void SetStatus (DockToolbarFrameStatus status)
- {
- layouts.Clear ();
- if (status != null && status.Status != null) {
- foreach (DockToolbarFrameLayout c in status.Status) {
- if (status.Version < 2) {
- // Convert from old to new toolbar id
- foreach (DockToolbarStatus ts in c.Bars)
- ts.BarId = ConvertToolbarId (ts.BarId);
- }
- layouts [c.Id] = c.Bars;
- }
- }
- RestoreLayout ("");
- }
-
- public void SaveStatus (XmlWriter writer)
- {
- XmlSerializer ser = new XmlSerializer (typeof(DockToolbarFrameStatus));
- ser.Serialize (writer, GetStatus ());
- }
-
- public void LoadStatus (XmlReader reader)
- {
- layouts.Clear ();
- XmlSerializer ser = new XmlSerializer (typeof(DockToolbarFrameStatus));
- DockToolbarFrameStatus col = (DockToolbarFrameStatus) ser.Deserialize (reader);
- SetStatus (col);
- }
-
- string ConvertToolbarId (string id)
- {
- // Old MD versions include the display name of the toolbar in the id.
- // New MD versions use a different id composition.
- // This method translates the id from the old to the new format (when possible)
-
- int i = id.LastIndexOf ('/');
- if (i == -1)
- return id;
-
- string baseId = id.Substring (0, i + 1);
-
- foreach (DockToolbar t in bars) {
- if (t.Id == id)
- return id;
- if (baseId + t.Title == id)
- return t.Id;
- }
- return id;
- }
-
- public IDockToolbar AddBar (DockToolbar bar)
- {
- return AddBar (bar, Placement.Top, true);
- }
-
- public IDockToolbar AddBar (DockToolbar bar, Placement defaultPanel, bool defaultVisible)
- {
- bar.SetParentFrame (this);
- bars.Add (bar);
-
- DockToolbarPosition pos = new DockedPosition (defaultPanel);
- DockToolbarStatus s = new DockToolbarStatus (bar.Id, defaultVisible, pos);
- bar.DefaultStatus = s;
- bar.Status = s;
-
- return bar;
- }
-
- public void RemoveToolbar(DockToolbar bar)
- {
- IDockToolbar db = (IDockToolbar)bar;
- db.Visible = false;
- bar.Destroy();
- bars.Remove(bar);
- }
-
- public void ClearToolbars ()
- {
- foreach (DockToolbar bar in bars) {
- IDockToolbar db = (IDockToolbar) bar;
- db.Visible = false;
- bar.Destroy ();
- }
- bars.Clear ();
- }
-
- public IDockToolbar GetBar (string id)
- {
- foreach (DockToolbar bar in bars)
- if (bar.Id == id) return bar;
- return null;
- }
-
- public ICollection<DockToolbar> Toolbars {
- get { return bars; }
- }
-
- public void ResetToolbarPositions ()
- {
- foreach (DockToolbarPanel panel in panels)
- panel.ResetBarPositions (false);
- }
-
- void SaveCurrentLayout ()
- {
- DockToolbarStatus[] status = SaveStatus ();
- layouts [currentLayout] = status;
- }
-
- void RestoreLayout (string layout)
- {
- DockToolbarStatus[] status;
- layouts.TryGetValue (layout, out status);
- RestoreStatus (status);
- currentLayout = layout;
- }
-
- internal void DeleteLayout (string layout)
- {
- if (layouts.ContainsKey (layout))
- layouts.Remove (layout);
- }
-
- DockToolbarStatus[] SaveStatus ()
- {
- DockToolbarStatus[] status = new DockToolbarStatus [bars.Count];
- for (int n=0; n<bars.Count; n++) {
- DockToolbar bar = (DockToolbar) bars [n];
- status [n] = bar.Status;
- }
- return status;
- }
-
- void RestoreStatus (DockToolbarStatus[] status)
- {
- foreach (IDockToolbar b in bars)
- b.Visible = false;
-
- if (status == null) {
- foreach (DockToolbar bar in bars)
- bar.Status = bar.DefaultStatus;
- } else {
- foreach (DockToolbarStatus s in status) {
- DockToolbar bar = (DockToolbar) GetBar (s.BarId);
- if (bar != null)
- bar.Status = s;
- }
- }
- }
-
- internal int DockMargin {
- get { return 7; }
- }
-
- internal void DockToolbar (DockToolbar bar, Placement placement, int offset, int row)
- {
- DockToolbarPanel p = GetPanel (placement);
- if (row != -1)
- p.AddDockToolbar (bar, offset, row);
- else
- p.AddDockToolbar (bar);
- }
-
- internal void FloatBar (DockToolbar bar, Orientation orientation, int x, int y)
- {
- FloatingDock fdock = new FloatingDock (this);
- fdock.Move (x, y);
- bar.ResetSize ();
- fdock.Attach (bar);
- bar.Orientation = orientation;
- }
-
- internal Gtk.Window TopWindow {
- get {
- Widget w = Parent;
- while (w != null && !(w is Gtk.Window))
- w = w.Parent;
- return (Gtk.Window) w;
- }
- }
-
- DockToolbarPanel GetPanel (Placement o)
- {
- return panels [(int)o];
- }
-
- protected override bool OnMotionNotifyEvent (EventMotion e)
- {
- if (dragBar != null) {
- int sx,sy;
- this.GdkWindow.GetOrigin (out sx, out sy);
- int rx = (int)e.XRoot - sx;
- int ry = (int)e.YRoot - sy;
-
- if (dragBar.Floating) {
- bool foundPanel = false;
- dragBar.FloatingDock.Move ((int)e.XRoot + xDragDif, (int)e.YRoot + yDragDif);
- Rectangle barRect = new Rectangle (rx + xDragDif, ry + yDragDif, dragBar.Allocation.Width, dragBar.DefaultHeight);
- foreach (DockToolbarPanel p in panels) {
- if (p.Allocation.IntersectsWith (barRect)) {
- if (targetPanel != null && targetPanel != p)
- targetPanel.EndDragBar (dragBar);
- p.Reposition (dragBar, rx, ry, xDragDif, yDragDif);
- targetPanel = p;
- foundPanel = true;
- break;
- }
- }
- if (!foundPanel && targetPanel != null)
- targetPanel.EndDragBar (dragBar);
- } else {
- DockToolbarPanel panel = (DockToolbarPanel) dragBar.Parent;
- panel.Reposition (dragBar, rx, ry, xDragDif, yDragDif);
- }
- }
- return base.OnMotionNotifyEvent (e);
- }
-
- internal void StartDragBar (DockToolbar bar, int x, int y, uint time)
- {
- dragBar = bar;
- xDragDif = -x;
- yDragDif = -y;
- Pointer.Grab (this.GdkWindow, false, EventMask.ButtonPressMask | EventMask.ButtonReleaseMask | EventMask.PointerMotionMask, null, handCursor, time);
- if (!bar.Floating) {
- DockToolbarPanel panel = (DockToolbarPanel) dragBar.Parent;
- panel.StartDragBar (bar);
- }
- }
-
- internal void EndDragBar (DockToolbar bar, uint time)
- {
- Pointer.Ungrab (time);
- if (targetPanel != null) {
- targetPanel.DropDragBar (bar);
- targetPanel.EndDragBar (bar);
- }
- dragBar = null;
- }
-
- protected override bool OnButtonReleaseEvent (EventButton e)
- {
- if (dragBar != null)
- EndDragBar (dragBar, e.Time);
-
- return base.OnButtonReleaseEvent (e);
- }
-
- protected override bool OnButtonPressEvent (Gdk.EventButton e)
- {
- if (e.TriggersContextMenu ()) {
- int sx,sy;
- this.GdkWindow.GetOrigin (out sx, out sy);
- int rx = (int)e.XRoot - sx;
- int ry = (int)e.YRoot - sy;
-
- foreach (DockToolbarPanel p in panels) {
- if (p.Allocation.Contains (rx, ry))
- OnPanelClick (e, p.Placement);
- }
- }
- return base.OnButtonPressEvent (e);
- }
-
- protected virtual void OnPanelClick (Gdk.EventButton e, Placement placement)
- {
- }
-
- protected override void OnDestroyed ()
- {
- if (handCursor != null) {
- handCursor.Dispose ();
- handCursor = null;
- }
- base.OnDestroyed ();
- }
- }
-}
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.DockToolbars/DockToolbarFrameLayout.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.DockToolbars/DockToolbarFrameLayout.cs
deleted file mode 100644
index 1330a6aa25..0000000000
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.DockToolbars/DockToolbarFrameLayout.cs
+++ /dev/null
@@ -1,42 +0,0 @@
-//
-// DockToolbarFrameLayout.cs
-//
-// Author:
-// Lluis Sanchez Gual
-//
-// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-
-using System;
-using System.Xml.Serialization;
-
-namespace MonoDevelop.Components.DockToolbars
-{
- public class DockToolbarFrameLayout
- {
- [XmlAttribute ("id")]
- public string Id;
-
- [XmlElement ("dockbar")]
- public DockToolbarStatus[] Bars;
- }
-}
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.DockToolbars/DockToolbarFrameStatus.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.DockToolbars/DockToolbarFrameStatus.cs
deleted file mode 100644
index 95d34d70b0..0000000000
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.DockToolbars/DockToolbarFrameStatus.cs
+++ /dev/null
@@ -1,45 +0,0 @@
-//
-// DockToolbarFrameStatus.cs
-//
-// Author:
-// Lluis Sanchez Gual
-//
-// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-
-using System;
-using System.Collections;
-using System.Xml.Serialization;
-
-namespace MonoDevelop.Components.DockToolbars
-{
- public class DockToolbarFrameStatus
- {
- internal const int CurrentVersion = 2;
-
- [XmlElement ("version")]
- public int Version = 1;
-
- [XmlElement ("layout", typeof(DockToolbarFrameLayout))]
- public ArrayList Status = new ArrayList ();
- }
-}
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.DockToolbars/DockToolbarPanel.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.DockToolbars/DockToolbarPanel.cs
deleted file mode 100644
index dcbec75139..0000000000
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.DockToolbars/DockToolbarPanel.cs
+++ /dev/null
@@ -1,1034 +0,0 @@
-//
-// DockToolbarPanel.cs
-//
-// Author:
-// Lluis Sanchez Gual
-//
-// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-
-using System;
-using Gtk;
-using Gdk;
-using System.Collections;
-
-namespace MonoDevelop.Components.DockToolbars
-{
- internal class DockToolbarPanel: FixedPanel
- {
- DockToolbarFrame parentFrame;
- ArrayList bars = new ArrayList ();
- Orientation orientation;
-
- ArrowWindow placeholderArrow1;
- ArrowWindow placeholderArrow2;
- PlaceholderWindow placeholder;
- bool currentPlaceholderHorz;
-
- int dropOffset;
- int dropRow = -1;
- bool dropNewRow;
- bool enableAnimations = true;
-
- public DockToolbarPanel (DockToolbarFrame parentFrame, Placement placement)
- {
- // ResizeMode = ResizeMode.Immediate;
- Placement = placement;
- switch (placement) {
- case Placement.Top:
- this.orientation = Orientation.Horizontal;
- break;
- case Placement.Bottom:
- this.orientation = Orientation.Horizontal;
- break;
- case Placement.Left:
- this.orientation = Orientation.Vertical;
- break;
- case Placement.Right:
- this.orientation = Orientation.Vertical;
- break;
- }
-
- this.parentFrame = parentFrame;
- }
-
- public Orientation Orientation {
- get { return orientation; }
- }
-
- public void AddDockToolbar (DockToolbar bar)
- {
- bool ea = EnableAnimation (false);
-
- Put (bar, 0, 0);
- bar.Orientation = orientation;
-
- if (bars.Count > 0 && IsRealized) {
- DockToolbar last = (DockToolbar) bars [bars.Count - 1];
- int width = bar.DefaultSize;
- int lastx = last.DockOffset + last.DefaultSize;
-
- if (lastx + width <= PanelWidth)
- MoveBar (bar, lastx, last.DockRow, false);
- else
- MoveBar (bar, 0, last.DockRow + 1, false);
- bar.AnchorOffset = bar.DockOffset;
- InternalAdd (bar);
- SortBars ();
- } else {
- MoveBar (bar, 0, 0);
- bar.AnchorOffset = bar.DockOffset;
- InternalAdd (bar);
- }
-
- EnableAnimation (ea);
- }
-
- public void AddDockToolbar (DockToolbar bar, int offset, int row)
- {
- bool ea = EnableAnimation (false);
- InternalAdd (bar);
- Put (bar, 0, 0);
- bar.Orientation = orientation;
- MoveBar (bar, offset, row, false);
- bar.AnchorOffset = offset;
- SortBars ();
- UpdateRowSizes (bar.DockRow);
- EnableAnimation (ea);
- }
-
- void InternalAdd (DockToolbar bar)
- {
- bars.Add (bar);
- bar.DefaultSizeChanged += new EventHandler (OnBarSizeChanged);
- }
-
- public void RemoveBar (DockToolbar bar)
- {
- if (IsSingleBarRow (bar))
- RemoveRow (bar.DockRow);
-
- Remove (bar);
- bars.Remove (bar);
- bar.DefaultSizeChanged -= new EventHandler (OnBarSizeChanged);
-
- UpdateRowHeight (bar.DockRow);
- PackBars ();
- }
-
- protected override void OnRealized ()
- {
- base.OnRealized ();
- ResetBarPositions (false);
- }
-
- public void ResetBarPositions (bool animate)
- {
- int x=0, row=0;
- int width = PanelWidth;
-
- bool ea = EnableAnimation (animate);
-
- foreach (DockToolbar b in bars) {
- int barw = GetChildWidth (b);
- if (x + barw < width)
- MoveBar (b, x, row);
- else {
- row++;
- x = 0;
- MoveBar (b, 0, row);
- }
- x += barw;
- }
- SortBars ();
- EnableAnimation (ea);
- }
-
- void SetPlaceholder (DockToolbar bar, int offset, int row)
- {
- if (dropRow != row && dropRow != -1)
- RestoreShiftedBars (dropRow);
-
- ShowPlaceholder (bar, false, offset, GetRowTop (row), GetChildWidth (bar), GetRowSize (row));
-
- dropOffset = offset;
- dropRow = row;
- dropNewRow = false;
- }
-
- void SetNewRowPlaceholder (DockToolbar bar, int offset, int toprow)
- {
- if (dropRow != -1)
- RestoreShiftedBars (dropRow);
-
- int y = GetRowTop (toprow) - parentFrame.DockMargin;
- int h = parentFrame.DockMargin * 2;
- ShowPlaceholder (bar, true, offset, y, GetChildWidth (bar), h);
-
- dropOffset = offset;
- dropRow = toprow;
- dropNewRow = true;
- }
-
- void ShowPlaceholder (DockToolbar bar, bool horz, int x, int y, int w, int h)
- {
- if (orientation != Orientation.Horizontal)
- horz = !horz;
-
- PanelToWindow (x, y, w, h, out x, out y, out w, out h);
-
- bool created = false;
-
- if (placeholder == null || horz != currentPlaceholderHorz) {
- HidePlaceholder ();
- placeholder = new PlaceholderWindow (parentFrame);
- placeholderArrow1 = new ArrowWindow (parentFrame, horz ? ArrowWindow.Direction.Right : ArrowWindow.Direction.Down);
- placeholderArrow2 = new ArrowWindow (parentFrame, horz ? ArrowWindow.Direction.Left : ArrowWindow.Direction.Up);
- currentPlaceholderHorz = horz;
- created = true;
- }
-
- int sx, sy;
- this.GdkWindow.GetOrigin (out sx, out sy);
- sx += x;
- sy += y;
-
- int mg = -4;
- placeholder.Move (sx - mg, sy - mg);
- placeholder.Resize (w + mg*2, h + mg * 2);
-
- if (horz) {
- placeholderArrow1.Move (sx - placeholderArrow1.Width, sy + (h/2) - placeholderArrow1.Height/2);
- placeholderArrow2.Move (sx + w, sy + (h/2) - placeholderArrow1.Height/2);
- } else {
- int px = sx + w/2 - placeholderArrow1.Width/2;
- if (px < 0) px = 0;
- placeholderArrow1.Move (px, sy - placeholderArrow1.Height);
- placeholderArrow2.Move (px, sy + h);
- }
-
- if (created) {
- placeholder.Show ();
- placeholder.Present ();
- if (bar.FloatingDock != null)
- bar.FloatingDock.Present ();
- placeholderArrow1.Present ();
- placeholderArrow2.Present ();
- }
- }
-
- void HidePlaceholder ()
- {
- if (placeholder == null) return;
- placeholder.Destroy ();
- placeholder = null;
- placeholderArrow1.Destroy ();
- placeholderArrow1 = null;
- placeholderArrow2.Destroy ();
- placeholderArrow2 = null;
-
- if (dropRow != -1 && !dropNewRow) {
- RestoreShiftedBars (dropRow);
- dropRow = -1;
- }
- }
-
- bool IsPlaceHolderVisible {
- get { return placeholder != null; }
- }
-
- public void StartDragBar (DockToolbar bar)
- {
- }
-
- public void DropDragBar (DockToolbar bar)
- {
- if (!IsPlaceHolderVisible) return;
-
- foreach (DockToolbar b in bars) {
- if (b.DockRow == dropRow && b.DockShiftOffset != -1) {
- b.DockShiftOffset = -1;
- b.AnchorOffset = b.DockRow;
- }
- }
-
- if (dropRow != -1) {
- if (dropNewRow)
- InsertRow (bar, dropOffset, dropRow);
- else {
- MoveBar (bar, dropOffset, dropRow);
- UpdateRowHeight (dropRow);
- }
- SortBars ();
- dropRow = -1;
- }
- }
-
- public void EndDragBar (DockToolbar bar)
- {
- if (IsPlaceHolderVisible) {
- HidePlaceholder ();
- }
- }
-
- void RestoreShiftedBars (int row)
- {
- foreach (DockToolbar b in bars) {
- if (b.DockRow == row && b.DockShiftOffset != -1) {
- MoveBar (b, b.DockShiftOffset, b.DockRow, false);
- b.DockShiftOffset = -1;
- }
- }
- }
-
- public void Reposition (DockToolbar bar, int xcursor, int ycursor, int difx, int dify)
- {
- if (!bar.CanDockTo (this))
- return;
-
- bar.Orientation = orientation;
-
- int x, y;
- WindowToPanel (xcursor + difx, ycursor + dify, bar.Allocation.Width, bar.Allocation.Height, out x, out y);
- WindowToPanel (xcursor, ycursor, 0, 0, out xcursor, out ycursor);
-
- RepositionInternal (bar, x, y, xcursor, ycursor);
- }
-
- void RepositionInternal (DockToolbar bar, int x, int y, int xcursor, int ycursor)
- {
- int width = GetChildWidth (bar);
-
- ycursor = y + bar.DefaultHeight / 2;
-
- if (bars.Count == 0 && bar.Floating) {
- SetNewRowPlaceholder (bar, x, 0);
- return;
- }
-
- int dx = (x + width) - PanelWidth;
- if (dx > parentFrame.DockMargin && !bar.Floating) {
- HidePlaceholder ();
- FloatBar (bar, x, y);
- return;
- }
- else if (dx > 0)
- x -= dx;
- else if (x < -parentFrame.DockMargin && !bar.Floating) {
- HidePlaceholder ();
- FloatBar (bar, x, y);
- return;
- }
- else if (x < 0)
- x = 0;
-
- int nx = x;
- int row = -1;
-
- // Get the old bar y position
-
- int panelBottom = GetPanelBottom ();
-
- if (ycursor < - parentFrame.DockMargin || ycursor > panelBottom + parentFrame.DockMargin) {
- HidePlaceholder ();
- FloatBar (bar, x, y);
- return;
- }
-
- int rtop = 0;
- int prevtop = 0;
- row = 0;
- while (ycursor >= rtop) {
- prevtop = rtop;
- row++;
- if (rtop >= panelBottom) break;
- rtop += GetRowSize (row - 1);
- }
-
- row--;
- int ry = ycursor - prevtop;
-
- if (ry <= parentFrame.DockMargin && ry >= 0) {
- SetNewRowPlaceholder (bar, x, row);
- FloatBar (bar, x, y);
- return;
- } else if (ry >= (GetRowSize(row) - parentFrame.DockMargin) || (ry < 0 && -ry < parentFrame.DockMargin)) {
- SetNewRowPlaceholder (bar, x, row + 1);
- FloatBar (bar, x, y);
- return;
- }
-
- // Can't create a new row. Try to fit the bar in the current row
- // Find the first bar in the row:
-
- int ns = -1;
- for (int n=0; n<bars.Count; n++) {
- DockToolbar b = (DockToolbar)bars[n];
-
- // Ignore the bar being moved
- if (b == bar) continue;
-
- if (b.DockRow == row) {
- ns = n;
- break;
- }
- }
-
- if (ns == -1) {
- // There are no other bars, no problem then
- if (bar.Floating) {
- SetPlaceholder (bar, nx, row);
- return;
- }
-
- if ((nx == bar.DockOffset && row == bar.DockRow) || (row != bar.DockRow)) {
- SetPlaceholder (bar, nx, row);
- FloatBar (bar, x, y);
- return;
- }
-
- HidePlaceholder ();
- MoveBar (bar, nx, row);
- return;
- }
-
- // Compute the available space, and find the bars at the
- // left and the right of the bar being moved
-
- int gapsTotal = 0;
- int lastx = 0;
- int leftIndex=-1, rightIndex = -1;
- int gapsLeft = 0, gapsRight = 0;
-
- for (int n=ns; n<bars.Count; n++) {
- DockToolbar b = (DockToolbar)bars[n];
-
- // Ignore the bar being moved
- if (b == bar) continue;
-
- if (b.DockRow != row) break;
- int bx = b.DockOffset;
-
- if (bx > x && (rightIndex == -1))
- rightIndex = n;
- else if (bx <= x)
- leftIndex = n;
-
- if (bx < x)
- gapsLeft += bx - lastx;
- else {
- if (lastx < x) {
- gapsLeft += x - lastx;
- gapsRight += bx - x;
- } else
- gapsRight += bx - lastx;
- }
-
- gapsTotal += bx - lastx;
- lastx = GetChildRightOffset (b);
- }
-
- if (lastx < x) {
- gapsLeft += x - lastx;
- gapsRight += PanelWidth - x;
- } else {
- gapsRight += PanelWidth - lastx;
- }
-
- gapsTotal += PanelWidth - lastx;
-
- // Is there room for the bar?
- if (gapsTotal < width) {
- HidePlaceholder ();
- FloatBar (bar, x, y);
- return;
- }
-
- // Shift the bars at the left and the right
-
- int oversizeLeft = 0;
- int oversizeRight = 0;
-
- if (leftIndex != -1) {
- int r = GetChildRightOffset ((DockToolbar) bars [leftIndex]);
- oversizeLeft = r - nx;
- }
-
- if (rightIndex != -1) {
- int r = ((DockToolbar) bars [rightIndex]).DockOffset;
- oversizeRight = (nx + width) - r;
- }
-
- if (oversizeLeft > gapsLeft)
- oversizeRight += (oversizeLeft - gapsLeft);
- else if (oversizeRight > gapsRight)
- oversizeLeft += (oversizeRight - gapsRight);
-
- if (leftIndex != -1 && oversizeLeft > 0) {
- ShiftBar (leftIndex, -oversizeLeft);
- nx = GetChildRightOffset ((DockToolbar) bars [leftIndex]);
- }
-
- if (rightIndex != -1 && oversizeRight > 0) {
- ShiftBar (rightIndex, oversizeRight);
- nx = ((DockToolbar) bars [rightIndex]).DockOffset - width;
- }
-
-
- if (bar.Floating) {
- SetPlaceholder (bar, nx, row);
- return;
- }
-
- if ((nx == bar.DockOffset && row == bar.DockRow) || (row != bar.DockRow)) {
- if (bar.Floating) {
- SetPlaceholder (bar, nx, row);
- FloatBar (bar, x, y);
- }
- return;
- }
-
- HidePlaceholder ();
- MoveBar (bar, nx, row);
- }
-
- void FloatBar (DockToolbar bar, int x, int y)
- {
- if (bar.Floating) return;
-
- int wx,wy,w,h;
- PanelToWindow (x, y, GetChildWidth (bar), bar.DefaultHeight, out x, out y, out w, out h);
-
- this.GdkWindow.GetOrigin (out wx, out wy);
- RemoveBar (bar);
- parentFrame.FloatBar (bar, orientation, wx + x, wy + y);
- }
-
- void ShiftBar (int index, int size)
- {
- DockToolbar bar = (DockToolbar) bars [index];
- if (bar.DockShiftOffset == -1)
- bar.DockShiftOffset = bar.DockOffset;
-
- if (size > 0) {
- int rp = GetChildRightOffset (bar);
- int gap = PanelWidth - rp;
- if (index + 1 < bars.Count) {
- DockToolbar obar = (DockToolbar) bars [index + 1];
- if (bar.DockRow == obar.DockRow) {
- gap = obar.DockOffset - rp;
- if (gap < size) {
- ShiftBar (index + 1, size - gap);
- gap = obar.DockOffset - rp;
- }
- }
- }
- if (gap > size)
- gap = size;
- if (gap > 0)
- MoveBar (bar, bar.DockOffset + gap, bar.DockRow, false);
- } else {
- size = -size;
- int lp = bar.DockOffset;
- int gap = lp;
- if (index > 0) {
- DockToolbar obar = (DockToolbar) bars [index - 1];
- if (bar.DockRow == obar.DockRow) {
- gap = lp - GetChildRightOffset (obar);
- if (gap < size) {
- ShiftBar (index - 1, gap - size);
- gap = lp - GetChildRightOffset (obar);
- }
- }
- }
-
- if (gap > size)
- gap = size;
- if (gap > 0)
- MoveBar (bar, bar.DockOffset - gap, bar.DockRow, false);
- }
- }
-
- void MoveBar (DockToolbar bar, int x, int row)
- {
- MoveBar (bar, x, row, true);
- }
-
- void MoveBar (DockToolbar bar, int x, int row, bool setAnchorOffset)
- {
- int rt = GetRowTop (row);
-
- bar.DockRow = row;
- bar.DockOffset = x;
-
- if (bar.Floating) {
- FloatingDock win = bar.FloatingDock;
- win.Detach ();
- win.Destroy ();
-
- InternalAdd (bar);
- Put (bar, x, rt);
- SortBars ();
- ResetAnchorOffsets (row);
-
- } else {
- if (setAnchorOffset)
- ResetAnchorOffsets (row);
-
- InternalMove (bar, x, rt, true);
- }
- }
-
- void ResetAnchorOffsets (int row)
- {
- for (int n=0; n<bars.Count; n++) {
- DockToolbar b = (DockToolbar) bars [n];
- if (b.DockRow < row) continue;
- if (b.DockRow > row) return;
- b.AnchorOffset = b.DockOffset;
- }
- }
-
- void UpdateRowHeight (int row)
- {
- int nr = row + 1;
- bool ea = EnableAnimation (false);
- for (int n=0; n<bars.Count; n++) {
- DockToolbar b = (DockToolbar) bars [n];
- if (b.DockRow < nr) continue;
- MoveBar (b, b.DockOffset, b.DockRow);
- }
- EnableAnimation (ea);
- }
-
- void OnBarSizeChanged (object s, EventArgs e)
- {
- if (IsRealized)
- UpdateRowSizes (((DockToolbar)s).DockRow);
- }
-
- void UpdateRowSizes (int row)
- {
- int lastx = 0;
- for (int n=0; n<bars.Count; n++) {
- DockToolbar b = (DockToolbar) bars [n];
- if (b.DockRow < row) continue;
- if (b.DockRow > row) break;
- if (b.AnchorOffset < lastx)
- b.AnchorOffset = lastx;
- lastx = b.AnchorOffset + b.DefaultSize;
- }
- PackBars ();
- }
-
- protected override void OnSizeAllocated (Rectangle rect)
- {
- Rectangle oldRect = Allocation;
- base.OnSizeAllocated (rect);
-
- if (!rect.Equals (oldRect))
- PackBars ();
- }
-
- void PackBars ()
- {
- bool ea = EnableAnimation (false);
- int n=0;
- while (n < bars.Count)
- n = PackRow (n);
- EnableAnimation (ea);
- }
-
- int PackRow (int sn)
- {
- // The 'sn' parameter is the index if the first toolbar of the row.
- // It returns the index of the first toolbar of the next row
-
- int n = sn;
- int row = ((DockToolbar)bars[n]).DockRow;
- int lastx = 0;
- int gaps = 0;
-
- // Calculates the free space in the row
-
- while (n < bars.Count) {
- DockToolbar bar = (DockToolbar) bars [n];
- if (bar.DockRow != row) break;
-
- if (bar.AnchorOffset > lastx)
- gaps += bar.AnchorOffset - lastx;
-
- lastx = bar.AnchorOffset + bar.DefaultSize;
- n++;
- }
-
- if (lastx <= PanelWidth) {
- for (int i=sn; i<n; i++) {
- DockToolbar b = (DockToolbar) bars[i];
- if (b.AnchorOffset != b.DockOffset)
- MoveBar (b, b.AnchorOffset, b.DockRow, false);
- if (b.Size != b.DefaultSize) {
- b.ShowArrow = false;
- b.Size = b.DefaultSize;
- }
- }
- return n;
- }
-
- int barsSize = lastx - gaps;
- double gapShrink = 0;
-
- int[] sizeReduction = new int [n - sn];
-
- if (barsSize > PanelWidth) {
- int remSize = barsSize - PanelWidth;
- while (remSize > 0) {
- int oldRemSize = remSize;
- for (int k=n-1; k >= sn; k--) {
- int pos = k - sn;
- DockToolbar bar = (DockToolbar) bars [k];
- int newReduction = GetBarReduction (bar, remSize, sizeReduction [pos]);
- sizeReduction [pos] += newReduction;
- remSize -= newReduction;
- }
- if (oldRemSize == remSize)
- break;
- }
- }
- else
- gapShrink = ((double)(PanelWidth - barsSize)) / (double)gaps;
-
- lastx = 0;
- int newlastx = 0;
- for (int i=sn; i < n; i++) {
- DockToolbar bar = (DockToolbar) bars [i];
- int gap = bar.AnchorOffset - lastx;
- lastx = bar.AnchorOffset + bar.DefaultSize;
-
- int nx = (int)(newlastx + ((double)gap * gapShrink));
- if (nx != bar.DockOffset)
- MoveBar (bar, nx, bar.DockRow, false);
-
- int nw = bar.DefaultSize - sizeReduction [i - sn];
- if (nw != bar.Size) {
- bar.ShowArrow = nw != bar.DefaultSize;
- bar.Size = nw;
- }
- newlastx = bar.DockOffset + nw;
- }
-
- return n;
- }
-
- int GetBarReduction (DockToolbar bar, int sizeToReduce, int currentReduction)
- {
- Gtk.Widget[] children = bar.Children;
- int w = bar.DefaultSize;
- int arrowSize = 0;
- bar.Forall (delegate (Gtk.Widget wa) {
- if (wa is ToggleButton) {
- arrowSize = bar.Orientation == Orientation.Horizontal ? wa.SizeRequest ().Width : wa.SizeRequest ().Height;
- }
- });
- for (int n=children.Length - 1; n >= 1; n--) {
- if (!children [n].Visible)
- continue;
- int x;
- if (bar.Orientation == Orientation.Horizontal)
- x = children [n].Allocation.X - bar.Allocation.X;
- else
- x = children [n].Allocation.Y - bar.Allocation.Y;
- int rightSize = w - x - 1;
- if (rightSize > currentReduction) {
- int prevRequest = Orientation == Orientation.Horizontal ? children [n-1].SizeRequest ().Width : children [n-1].SizeRequest ().Height;
- if (prevRequest > arrowSize*2)
- continue;
- int newReduction = rightSize - currentReduction;
- if (newReduction > sizeToReduce)
- newReduction = sizeToReduce;
-
- int minSize = Orientation == Orientation.Horizontal ? children[0].SizeRequest ().Width : children[0].SizeRequest ().Height;
- minSize += arrowSize + 6;
- if (bar.DefaultSize - (currentReduction + newReduction) < minSize)
- newReduction = (bar.DefaultSize - minSize) - currentReduction;
-
- return newReduction;
- }
- }
- return 0;
- }
-
- int GetPanelBottom ()
- {
- if (bars.Count > 0) {
- DockToolbar bar = (DockToolbar) bars [bars.Count - 1];
- return GetRowTop (bar.DockRow + 1);
- }
- else
- return 0;
- }
-
- bool IsSingleBarRow (DockToolbar bar)
- {
- int row = bar.DockRow;
- foreach (DockToolbar b in bars) {
- if (bar != b && b.DockRow == row)
- return false;
- }
- return true;
- }
-
- void InsertRow (DockToolbar ibar, int offset, int row)
- {
- MoveBar (ibar, offset, row);
- foreach (DockToolbar bar in bars) {
- if (ibar != bar && bar.DockRow >= row)
- bar.DockRow++;
- }
- SortBars ();
- UpdateRowHeight (row);
- }
-
- void RemoveRow (int row)
- {
- foreach (DockToolbar bar in bars) {
- if (bar.DockRow >= row)
- MoveBar (bar, bar.DockOffset, bar.DockRow - 1, false);
- }
- }
-
- int GetChildRightOffset (DockToolbar bar)
- {
- return bar.DockOffset + bar.Size;
- }
-
- int GetRowSize (int row)
- {
- int max = 0;
- for (int n=0; n<bars.Count; n++) {
- DockToolbar b = (DockToolbar) bars [n];
- if (b.DockRow < row) continue;
- if (b.DockRow > row) return max;
- max = Math.Max (b.DefaultHeight, max);
- }
- return max;
- }
-
- int GetRowTop (int row)
- {
- int t = 0;
- for (int n=0; n < row; n++)
- t += GetRowSize (n);
- return t;
- }
-
- int MaxRow {
- get {
- var lastBar = (DockToolbar)bars[bars.Count -1];
- return lastBar.DockRow;
- }
- }
-
- void SortBars ()
- {
- bars.Sort (DocBarComparer.Instance);
- }
-
- void InternalMove (DockToolbar bar, int x, int y, bool animate)
- {
- if (bar.Animation != null) {
- bar.Animation.Cancel ();
- bar.Animation = null;
- }
-
- if (animate && enableAnimations) {
- bar.Animation = new MoveAnimation (this, bar, x, y);
- bar.Animation.Start ();
- }
- else
- Move (bar, x, y);
- }
-
- bool EnableAnimation (bool enable)
- {
- bool r = enableAnimations;
- enableAnimations = enable;
- return r;
- }
-
- protected override bool OnExposeEvent (EventExpose evnt)
- {
- //leave this plain unless there are horizontal children, so that the panel matches the toolbars
- //see DockToolbar.OnExposeEvent
- if (bars.Count == 0 || this.Orientation != Orientation.Horizontal)
- return base.OnExposeEvent (evnt);
-
- // get a proper GTK+ toolbar style by using one of the children, i.e. a DockToolbar, a subclass of GtkToolbar
- var styleProvider = (Widget)bars[0];
- var shadowType = (ShadowType) styleProvider.StyleGetProperty ("shadow-type");
-
- //render each row separately, so the theme treats each as a row, and they match the individual toolbars' themed painting
- int row = MaxRow;
- for (int i = bars.Count - 1; i >= 0; i--) {
- var bar = (DockToolbar) bars[i];
- if (bar.DockRow == row) {
- row--;
- //HACK: On Mac, PaintBox seems to fill the whole area instead of using it for clipping
- //so we create a new area for the row, to stop it overpainting other rows
- //otoh this could improve performance when only single rows are repainted, because we can intersect with invalidated area
- var rowArea = new Rectangle (Allocation.X, bar.Allocation.Y, Allocation.Width, bar.Allocation.Height);
- var invalidated = Gdk.Rectangle.Intersect (evnt.Area, rowArea);
- Style.PaintBox (bar.Style, evnt.Window, State, shadowType, invalidated, bar, "toolbar",
- rowArea.X, rowArea.Y, rowArea.Width, rowArea.Height);
- }
- }
-
- foreach (DockToolbar bar in bars)
- this.PropagateExpose (bar, evnt);
- return true;
- }
-
- //ensures that all widgets in each row have consistent allocation
- public override Requisition GetChildRequisition (Widget w)
- {
- var r = w.ChildRequisition;
- var t = (DockToolbar) w;
- var size = GetRowSize (t.DockRow);
- if (orientation == Orientation.Horizontal) {
- r.Height = size;
- } else {
- r.Width = size;
- }
- return r;
- }
- }
-
-
- internal class DocBarComparer: IComparer
- {
- internal static DocBarComparer Instance = new DocBarComparer ();
-
- public int Compare (object a, object b)
- {
- DockToolbar b1 = (DockToolbar) a;
- DockToolbar b2 = (DockToolbar) b;
-
- if (b1.DockRow < b2.DockRow) return -1;
- else if (b1.DockRow > b2.DockRow) return 1;
- else if (b1.DockOffset < b2.DockOffset) return -1;
- else if (b1.DockOffset > b2.DockOffset) return 1;
- else return 0;
- }
- }
-
- internal abstract class AnimationManager
- {
- static ArrayList anims = new ArrayList ();
- static int s = 0;
-
- public static void Animate (Animation a)
- {
- if (anims.Count == 0)
- GLib.Timeout.Add (10, new GLib.TimeoutHandler (Animate));
- anims.Add (a);
- }
-
- public static void CancelAnimation (Animation a)
- {
- anims.Remove (a);
- }
-
- public static bool Animate ()
- {
- s++;
- ArrayList toDelete = new ArrayList ();
- foreach (Animation a in anims)
- if (!a.Run ())
- toDelete.Add (a);
-
- foreach (object ob in toDelete)
- anims.Remove (ob);
-
- return anims.Count != 0;
- }
- }
-
- internal abstract class Animation
- {
- protected Widget widget;
-
- public Animation (Widget w)
- {
- widget = w;
- }
-
- public void Start ()
- {
- AnimationManager.Animate (this);
- }
-
- public void Cancel ()
- {
- AnimationManager.CancelAnimation (this);
- }
-
- internal protected abstract bool Run ();
- }
-
- internal class MoveAnimation: Animation
- {
- FixedPanel panel;
- float destx, desty;
- float curx, cury;
-
- public MoveAnimation (FixedPanel f, Widget w, int destx, int desty): base (w)
- {
- panel = f;
- int x, y;
- f.GetPosition (w, out x, out y);
- curx = (float)x;
- cury = (float)y;
- this.destx = (float) destx;
- this.desty = (float) desty;
- }
-
- internal protected override bool Run ()
- {
- float dx = destx - curx;
- float dy = desty - cury;
-
- dx = dx / 4;
- dy = dy / 4;
-
- curx += dx;
- cury += dy;
-
- panel.Move (widget, (int)curx, (int)cury);
-
- if(Math.Abs (dx) < 0.1 && Math.Abs (dy) < 0.1) {
- panel.Move (widget, (int)destx, (int)desty);
- return false;
- } else
- return true;
- }
- }
-}
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.DockToolbars/DockToolbarPosition.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.DockToolbars/DockToolbarPosition.cs
deleted file mode 100644
index dbf9121040..0000000000
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.DockToolbars/DockToolbarPosition.cs
+++ /dev/null
@@ -1,52 +0,0 @@
-//
-// DockToolbarPosition.cs
-//
-// Author:
-// Lluis Sanchez Gual
-//
-// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-
-using System;
-using Gtk;
-using Gdk;
-using System.Collections;
-using System.Xml;
-using System.Xml.Serialization;
-
-namespace MonoDevelop.Components.DockToolbars
-{
- [XmlInclude (typeof(DockedPosition))]
- [XmlInclude (typeof(FloatingPosition))]
- public class DockToolbarPosition
- {
- internal virtual void RestorePosition (DockToolbarFrame frame, DockToolbar bar) {}
-
- internal static DockToolbarPosition Create (DockToolbar bar)
- {
- if (bar.Floating)
- return new FloatingPosition (bar);
- else
- return new DockedPosition (bar);
- }
- }
-}
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.DockToolbars/DockToolbarStatus.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.DockToolbars/DockToolbarStatus.cs
deleted file mode 100644
index 6db8ebd857..0000000000
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.DockToolbars/DockToolbarStatus.cs
+++ /dev/null
@@ -1,71 +0,0 @@
-//
-// DockToolbarStatus.cs
-//
-// Author:
-// Lluis Sanchez Gual
-//
-// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-
-using System;
-using System.Xml.Serialization;
-
-namespace MonoDevelop.Components.DockToolbars
-{
- [XmlType ("dockBar")]
- public class DockToolbarStatus
- {
- bool visible;
- DockToolbarPosition position;
- string id;
-
- public DockToolbarStatus ()
- {
- }
-
- public DockToolbarStatus (string id, bool visible, DockToolbarPosition position)
- {
- this.visible = visible;
- this.position = position;
- this.id = id;
- }
-
- [XmlAttribute ("id")]
- public string BarId {
- get { return id; }
- set { id = value; }
- }
-
- [XmlElement ("visible")]
- public bool Visible {
- get { return visible; }
- set { visible = value; }
- }
-
- [XmlElement ("dockedPosition", typeof(DockedPosition))]
- [XmlElement ("floatingPosition", typeof(FloatingPosition))]
- public DockToolbarPosition Position {
- get { return position; }
- set { position = value; }
- }
- }
-}
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.DockToolbars/DockedPosition.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.DockToolbars/DockedPosition.cs
deleted file mode 100644
index a3b3132c22..0000000000
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.DockToolbars/DockedPosition.cs
+++ /dev/null
@@ -1,81 +0,0 @@
-//
-// DockedPosition.cs
-//
-// Author:
-// Lluis Sanchez Gual
-//
-// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-
-using System;
-using System.Xml.Serialization;
-
-namespace MonoDevelop.Components.DockToolbars
-{
- [XmlType ("dockedPosition")]
- public class DockedPosition: DockToolbarPosition
- {
- Placement placement;
- int dockOffset;
- int dockRow;
-
- public DockedPosition ()
- {
- }
-
- internal DockedPosition (DockToolbar bar)
- {
- dockOffset = bar.AnchorOffset;
- dockRow = bar.DockRow;
- placement = ((DockToolbarPanel)bar.Parent).Placement;
- }
-
- internal DockedPosition (Placement placement)
- {
- this.placement = placement;
- dockRow = -1;
- }
-
- [XmlAttribute ("offset")]
- public int DockOffset {
- get { return dockOffset; }
- set { dockOffset = value; }
- }
-
- [XmlAttribute ("row")]
- public int DockRow {
- get { return dockRow; }
- set { dockRow = value; }
- }
-
- [XmlAttribute ("placement")]
- public Placement Placement {
- get { return placement; }
- set { placement = value; }
- }
-
- internal override void RestorePosition (DockToolbarFrame frame, DockToolbar bar)
- {
- frame.DockToolbar (bar, placement, dockOffset, dockRow);
- }
- }
-}
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.DockToolbars/FixedPanel.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.DockToolbars/FixedPanel.cs
deleted file mode 100644
index 90ca29dfe6..0000000000
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.DockToolbars/FixedPanel.cs
+++ /dev/null
@@ -1,270 +0,0 @@
-//
-// FixedPanel.cs
-//
-// Author:
-// Lluis Sanchez Gual
-//
-// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-
-using System;
-using System.Collections;
-using Gtk;
-using Gdk;
-
-namespace MonoDevelop.Components.DockToolbars
-{
- public enum Placement
- {
- Top, Bottom, Left, Right
- }
-
- public class FixedPanel: Container
- {
- ArrayList widgets = new ArrayList ();
- Placement placement = Placement.Top;
-
- public FixedPanel ()
- {
- GtkWorkarounds.FixContainerLeak (this);
-
- WidgetFlags |= WidgetFlags.NoWindow;
- }
-
- public Placement Placement {
- get { return placement; }
- set { placement = value; }
- }
-
- public override GLib.GType ChildType ()
- {
- return Widget.GType;
- }
-
- public void Put (Widget w, int x, int y)
- {
- WidgetPosition wpos = new WidgetPosition ();
- wpos.X = x;
- wpos.Y = y;
- wpos.Widget = w;
- widgets.Add (wpos);
- w.Parent = this;
- QueueResize ();
- }
-
- public void Move (Widget w, int x, int y)
- {
- int n = GetWidgetPosition (w);
- if (n != -1) {
- WidgetPosition wpos = (WidgetPosition) widgets [n];
- if (wpos.X == x && wpos.Y == y) return;
- wpos.X = x;
- wpos.Y = y;
- QueueResize ();
- }
- }
-
- public bool GetPosition (Widget w, out int x, out int y)
- {
- int n = GetWidgetPosition (w);
- if (n != -1) {
- WidgetPosition wpos = (WidgetPosition) widgets [n];
- x = wpos.X;
- y = wpos.Y;
- return true;
- }
- x = y = 0;
- return false;
- }
-
- public virtual Requisition GetChildRequisition (Widget w)
- {
- return w.ChildRequisition;
- }
-
- public int GetChildWidth (Widget w)
- {
- // ResizeChildren ();
- if (placement == Placement.Top || placement == Placement.Bottom)
- return w.Allocation.Width;
- else
- return w.Allocation.Height;
- }
-
- public int GetChildHeight (Widget w)
- {
- if (placement == Placement.Top || placement == Placement.Bottom)
- return w.Allocation.Height;
- else
- return w.Allocation.Width;
- }
-
- public int PanelWidth {
- get {
- if (placement == Placement.Top || placement == Placement.Bottom)
- return Allocation.Width;
- else
- return Allocation.Height;
- }
- }
-
- public void WindowToPanel (int x, int y, int w, int h, out int rx, out int ry)
- {
- switch (placement) {
- case Placement.Top:
- rx = x - Allocation.X;
- ry = y - Allocation.Y;
- break;
- case Placement.Bottom:
- rx = x - Allocation.X;
- ry = Allocation.Bottom - y - h - 1;
- break;
- case Placement.Left:
- rx = y - Allocation.Y;
- ry = x - Allocation.X;
- break;
- default:
- rx = y - Allocation.Y;
- ry = Allocation.Right - x - w - 1;
- break;
- }
- }
-
- public void PanelToWindow (int x, int y, int w, int h, out int rx, out int ry, out int rw, out int rh)
- {
- switch (placement) {
- case Placement.Top:
- rx = x + Allocation.X;
- ry = y + Allocation.Y;
- rw = w;
- rh = h;
- break;
- case Placement.Bottom:
- rx = x + Allocation.X;
- ry = Allocation.Bottom - y - h - 1;
- rw = w;
- rh = h;
- break;
- case Placement.Left:
- rx = y + Allocation.X;
- ry = x + Allocation.Y;
- rw = h;
- rh = w;
- break;
- default:
- rx = Allocation.Right - y - h - 1;
- ry = x + Allocation.Y;
- rw = h;
- rh = w;
- break;
- }
- }
-
- protected override void OnAdded (Widget w)
- {
- Put (w, 0, 0);
- }
-
- protected override void OnRemoved (Widget w)
- {
- int i = GetWidgetPosition (w);
- if (i != -1) {
- widgets.RemoveAt (i);
- w.Unparent ();
- QueueResize ();
- }
- }
-
- int GetWidgetPosition (Widget w)
- {
- for (int n=0; n<widgets.Count; n++)
- if (((WidgetPosition)widgets[n]).Widget == w)
- return n;
- return -1;
- }
-
- protected override void OnSizeRequested (ref Requisition req)
- {
- req.Width = req.Height = 0;
- foreach (WidgetPosition pos in widgets) {
- Requisition wreq = pos.Widget.SizeRequest ();
- if (placement == Placement.Top || placement == Placement.Bottom) {
- if (pos.X + wreq.Width > req.Width)
- req.Width = pos.X + wreq.Width;
- if (pos.Y + wreq.Height > req.Height)
- req.Height = pos.Y + wreq.Height;
- } else {
- if (pos.Y + wreq.Width > req.Width)
- req.Width = pos.Y + wreq.Width;
- if (pos.X + wreq.Height > req.Height)
- req.Height = pos.X + wreq.Height;
- }
- }
- if (placement == Placement.Top || placement == Placement.Bottom)
- req.Width = 0;
- else
- req.Height = 0;
- }
-
- protected override void OnSizeAllocated (Gdk.Rectangle rect)
- {
- base.OnSizeAllocated (rect);
- foreach (WidgetPosition pos in widgets) {
- Requisition req = GetChildRequisition (pos.Widget);
- Rectangle crect = new Rectangle (pos.X, pos.Y, req.Width, req.Height);
- switch (placement) {
- case Placement.Top:
- break;
- case Placement.Bottom:
- crect.Y = Allocation.Height - crect.Y - crect.Height;
- break;
- case Placement.Left: {
- int t = crect.X; crect.X=crect.Y; crect.Y=t;
- break;
- }
- case Placement.Right: {
- int t = crect.X; crect.X=crect.Y; crect.Y=t;
- crect.X = Allocation.Width - crect.X - crect.Width;
- break;
- }
- }
- crect.X += Allocation.X;
- crect.Y += Allocation.Y;
- pos.Widget.SizeAllocate (crect);
- }
- }
-
- protected override void ForAll (bool include_internals, Gtk.Callback callback)
- {
- WidgetPosition[] positions = (WidgetPosition[]) widgets.ToArray (typeof (WidgetPosition));
- foreach (WidgetPosition pos in positions)
- callback (pos.Widget);
- }
- }
-
- class WidgetPosition
- {
- public int X;
- public int Y;
- public Widget Widget;
- }
-}
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.DockToolbars/FloatingDock.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.DockToolbars/FloatingDock.cs
deleted file mode 100644
index 2cf64c9985..0000000000
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.DockToolbars/FloatingDock.cs
+++ /dev/null
@@ -1,65 +0,0 @@
-//
-// FloatingDock.cs
-//
-// Author:
-// Lluis Sanchez Gual
-//
-// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-
-using System;
-using Gtk;
-using Gdk;
-
-namespace MonoDevelop.Components.DockToolbars
-{
- internal class FloatingDock: Gtk.Window
- {
- DockToolbar bar;
-
- public FloatingDock (DockToolbarFrame frame): base (Gtk.WindowType.Toplevel)
- {
- SkipTaskbarHint = true;
- Decorated = false;
- TransientFor = frame.TopWindow;
- }
-
- public void Attach (DockToolbar bar)
- {
- this.bar = bar;
- bar.FloatingDock = this;
- Frame f = new Frame ();
- f.Shadow = ShadowType.Out;
- f.Add (bar);
- Add (f);
- f.Show ();
- bar.Show ();
- Show ();
- }
-
- public void Detach ()
- {
- bar.FloatingDock = null;
- ((Frame)bar.Parent).Remove (bar);
- }
- }
-}
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.DockToolbars/FloatingPosition.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.DockToolbars/FloatingPosition.cs
deleted file mode 100644
index 56261d72e8..0000000000
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.DockToolbars/FloatingPosition.cs
+++ /dev/null
@@ -1,75 +0,0 @@
-//
-// FloatingPosition.cs
-//
-// Author:
-// Lluis Sanchez Gual
-//
-// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-
-using System;
-using Gtk;
-using System.Xml.Serialization;
-
-namespace MonoDevelop.Components.DockToolbars
-{
- [XmlType ("floatingPosition")]
- public class FloatingPosition: DockToolbarPosition
- {
- Orientation orientation;
- int x;
- int y;
-
- public FloatingPosition ()
- {
- }
-
- internal FloatingPosition (DockToolbar bar)
- {
- orientation = bar.Orientation;
- bar.FloatingDock.GetPosition (out x, out y);
- }
-
- [XmlAttribute ("x")]
- public int X {
- get { return x; }
- set { x = value; }
- }
-
- [XmlAttribute ("y")]
- public int Y {
- get { return y; }
- set { y = value; }
- }
-
- [XmlAttribute ("orientation")]
- public Orientation Orientation {
- get { return orientation; }
- set { orientation = value; }
- }
-
- internal override void RestorePosition (DockToolbarFrame frame, DockToolbar bar)
- {
- frame.FloatBar (bar, orientation, x, y);
- }
- }
-}
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.DockToolbars/IDockBar.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.DockToolbars/IDockBar.cs
deleted file mode 100644
index 121347720d..0000000000
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.DockToolbars/IDockBar.cs
+++ /dev/null
@@ -1,37 +0,0 @@
-//
-// IDockToolbar.cs
-//
-// Author:
-// Lluis Sanchez Gual
-//
-// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-
-namespace MonoDevelop.Components.DockToolbars
-{
- public interface IDockToolbar
- {
- string Id { get; }
- string Title { get; }
- bool Visible { get; set; }
- }
-}
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.DockToolbars/PlaceholderWindow.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.DockToolbars/PlaceholderWindow.cs
deleted file mode 100644
index 9ed4fd72de..0000000000
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.DockToolbars/PlaceholderWindow.cs
+++ /dev/null
@@ -1,55 +0,0 @@
-//
-// PlaceholderWindow.cs
-//
-// Author:
-// Lluis Sanchez Gual
-//
-// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-
-
-namespace MonoDevelop.Components.DockToolbars
-{
- internal class PlaceholderWindow: Gtk.Window
- {
- Gdk.GC redgc;
-
- public PlaceholderWindow (DockToolbarFrame frame): base (Gtk.WindowType.Toplevel)
- {
- SkipTaskbarHint = true;
- Decorated = false;
- TransientFor = frame.TopWindow;
- Realize ();
- redgc = new Gdk.GC (GdkWindow);
- redgc.RgbFgColor = new Gdk.Color (255, 0, 0);
- }
-
- protected override bool OnExposeEvent (Gdk.EventExpose args)
- {
- base.OnExposeEvent (args);
- int w, h;
- this.GetSize (out w, out h);
- this.GdkWindow.DrawRectangle (redgc, false, 0, 0, w-1, h-1);
- return true;
- }
- }
-}
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.Docking/DockBar.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.Docking/DockBar.cs
index d621ea15b6..d269d7b6f1 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.Docking/DockBar.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.Docking/DockBar.cs
@@ -35,7 +35,7 @@ using MonoDevelop.Ide.Gui;
namespace MonoDevelop.Components.Docking
{
- public class DockBar: Gtk.EventBox
+ class DockBar: Gtk.EventBox
{
Gtk.PositionType position;
Box box;
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.Docking/DockFrame.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.Docking/DockFrame.cs
index 81fef0e9cb..69fd7e7b03 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.Docking/DockFrame.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.Docking/DockFrame.cs
@@ -40,7 +40,7 @@ using MonoDevelop.Core;
namespace MonoDevelop.Components.Docking
{
- public class DockFrame: HBox, IAnimatable
+ class DockFrame: HBox, IAnimatable
{
internal const double ItemDockCenterArea = 0.4;
internal const int GroupDockSeparatorSize = 40;
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.Docking/DockGroupItem.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.Docking/DockGroupItem.cs
index bd754980fb..00108eb7d8 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.Docking/DockGroupItem.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.Docking/DockGroupItem.cs
@@ -260,7 +260,7 @@ namespace MonoDevelop.Components.Docking
if (floatRect.Equals (Gdk.Rectangle.Zero)) {
int x, y;
item.Widget.TranslateCoordinates (item.Widget.Toplevel, 0, 0, out x, out y);
- Gtk.Window win = Frame.Toplevel as Window;
+ Gtk.Window win = Frame.Toplevel as Gtk.Window;
if (win != null) {
int wx, wy;
win.GetPosition (out wx, out wy);
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.Docking/DockItem.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.Docking/DockItem.cs
index 25ab57cef6..d62e622aad 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.Docking/DockItem.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.Docking/DockItem.cs
@@ -30,14 +30,14 @@
using System;
using System.Xml;
-using Gtk;
using Mono.Unix;
namespace MonoDevelop.Components.Docking
{
public class DockItem
{
- Widget content;
+ Control content;
+ Gtk.Widget gtkContent;
DockItemContainer widget;
string defaultLocation;
bool defaultVisible = true;
@@ -79,11 +79,6 @@ namespace MonoDevelop.Components.Docking
currentVisualStyle = regionStyle = frame.GetRegionStyleForItem (this);
}
- internal DockItem (DockFrame frame, Widget w, string id): this (frame, id)
- {
- content = w;
- }
-
public string Id {
get { return id; }
}
@@ -204,35 +199,36 @@ namespace MonoDevelop.Components.Docking
UpdateContentVisibleStatus ();
}
- public Widget Content {
+ public Control Content {
get {
return content;
}
set {
content = value;
+ gtkContent = content.GetNativeWidget<Gtk.Widget> ();
if (!gettingContent && widget != null)
widget.UpdateContent ();
}
}
- public DockItemToolbar GetToolbar (PositionType position)
+ public DockItemToolbar GetToolbar (DockPositionType position)
{
switch (position) {
- case PositionType.Top:
- if (toolbarTop == null)
- toolbarTop = new DockItemToolbar (this, PositionType.Top);
+ case DockPositionType.Top:
+ if (toolbarTop == null)
+ toolbarTop = new DockItemToolbar (this, DockPositionType.Top);
return toolbarTop;
- case PositionType.Bottom:
+ case DockPositionType.Bottom:
if (toolbarBottom == null)
- toolbarBottom = new DockItemToolbar (this, PositionType.Bottom);
+ toolbarBottom = new DockItemToolbar (this, DockPositionType.Bottom);
return toolbarBottom;
- case PositionType.Left:
+ case DockPositionType.Left:
if (toolbarLeft == null)
- toolbarLeft = new DockItemToolbar (this, PositionType.Left);
+ toolbarLeft = new DockItemToolbar (this, DockPositionType.Left);
return toolbarLeft;
- case PositionType.Right:
+ case DockPositionType.Right:
if (toolbarRight == null)
- toolbarRight = new DockItemToolbar (this, PositionType.Right);
+ toolbarRight = new DockItemToolbar (this, DockPositionType.Right);
return toolbarRight;
default: throw new ArgumentException ();
}
@@ -344,20 +340,20 @@ namespace MonoDevelop.Components.Docking
internal void SetFocus ()
{
- SetFocus (Content);
+ SetFocus (gtkContent);
}
- internal static void SetFocus (Widget w)
+ internal static void SetFocus (Gtk.Widget w)
{
- w.ChildFocus (DirectionType.Down);
+ w.ChildFocus (Gtk.DirectionType.Down);
- Window win = w.Toplevel as Gtk.Window;
+ Gtk.Window win = w.Toplevel as Gtk.Window;
if (win == null)
return;
// Make sure focus is not given to internal children
if (win.Focus != null) {
- Container c = win.Focus.Parent as Container;
+ Gtk.Container c = win.Focus.Parent as Gtk.Container;
if (c.Children.Length == 0)
win.Focus = c;
}
@@ -409,15 +405,15 @@ namespace MonoDevelop.Components.Docking
ResetMode ();
SetRegionStyle (frame.GetRegionStyleForItem (this));
- floatingWindow = new DockFloatingWindow ((Window)frame.Toplevel, GetWindowTitle ());
+ floatingWindow = new DockFloatingWindow ((Gtk.Window)frame.Toplevel, GetWindowTitle ());
Ide.IdeApp.CommandService.RegisterTopWindow (floatingWindow);
- VBox box = new VBox ();
+ Gtk.VBox box = new Gtk.VBox ();
box.Show ();
box.PackStart (TitleTab, false, false, 0);
box.PackStart (Widget, true, true, 0);
floatingWindow.Add (box);
- floatingWindow.DeleteEvent += delegate (object o, DeleteEventArgs a) {
+ floatingWindow.DeleteEvent += delegate (object o, Gtk.DeleteEventArgs a) {
if (behavior == DockItemBehavior.CantClose)
Status = DockItemStatus.Dockable;
else
@@ -534,34 +530,34 @@ namespace MonoDevelop.Components.Docking
internal void ShowDockPopupMenu (uint time)
{
- Menu menu = new Menu ();
+ Gtk.Menu menu = new Gtk.Menu ();
// Hide menuitem
if ((Behavior & DockItemBehavior.CantClose) == 0) {
- MenuItem mitem = new MenuItem (Catalog.GetString("Hide"));
+ Gtk.MenuItem mitem = new Gtk.MenuItem (Catalog.GetString("Hide"));
mitem.Activated += delegate { Visible = false; };
menu.Append (mitem);
}
- MenuItem citem;
+ Gtk.MenuItem citem;
// Auto Hide menuitem
if ((Behavior & DockItemBehavior.CantAutoHide) == 0 && Status != DockItemStatus.AutoHide) {
- citem = new MenuItem (Catalog.GetString("Minimize"));
+ citem = new Gtk.MenuItem (Catalog.GetString("Minimize"));
citem.Activated += delegate { Status = DockItemStatus.AutoHide; };
menu.Append (citem);
}
if (Status != DockItemStatus.Dockable) {
// Dockable menuitem
- citem = new MenuItem (Catalog.GetString("Dock"));
+ citem = new Gtk.MenuItem (Catalog.GetString("Dock"));
citem.Activated += delegate { Status = DockItemStatus.Dockable; };
menu.Append (citem);
}
// Floating menuitem
if ((Behavior & DockItemBehavior.NeverFloating) == 0 && Status != DockItemStatus.Floating) {
- citem = new MenuItem (Catalog.GetString("Undock"));
+ citem = new Gtk.MenuItem (Catalog.GetString("Undock"));
citem.Activated += delegate { Status = DockItemStatus.Floating; };
menu.Append (citem);
}
@@ -588,13 +584,13 @@ namespace MonoDevelop.Components.Docking
// See BXC9883 - Xamarin Studio hides when there is a nonmodal floating window and it loses focus
// https://bugzilla.xamarin.com/show_bug.cgi?id=9883
//
- class DockFloatingWindow : Window
+ class DockFloatingWindow : Gtk.Window
{
- public DockFloatingWindow (Window dockParent, string title) : base (title)
+ public DockFloatingWindow (Gtk.Window dockParent, string title) : base (title)
{
this.DockParent = dockParent;
}
- public Window DockParent { get; private set; }
+ public Gtk.Window DockParent { get; private set; }
}
}
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.Docking/DockItemContainer.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.Docking/DockItemContainer.cs
index b5f6c3440b..10b599f9ee 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.Docking/DockItemContainer.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.Docking/DockItemContainer.cs
@@ -53,21 +53,21 @@ namespace MonoDevelop.Components.Docking
ShowAll ();
- mainBox.PackStart (item.GetToolbar (PositionType.Top).Container, false, false, 0);
+ mainBox.PackStart (item.GetToolbar (DockPositionType.Top).Container, false, false, 0);
HBox hbox = new HBox ();
hbox.Show ();
- hbox.PackStart (item.GetToolbar (PositionType.Left).Container, false, false, 0);
+ hbox.PackStart (item.GetToolbar (DockPositionType.Left).Container, false, false, 0);
contentBox = new HBox ();
contentBox.Show ();
hbox.PackStart (contentBox, true, true, 0);
- hbox.PackStart (item.GetToolbar (PositionType.Right).Container, false, false, 0);
+ hbox.PackStart (item.GetToolbar (DockPositionType.Right).Container, false, false, 0);
mainBox.PackStart (hbox, true, true, 0);
- mainBox.PackStart (item.GetToolbar (PositionType.Bottom).Container, false, false, 0);
+ mainBox.PackStart (item.GetToolbar (DockPositionType.Bottom).Container, false, false, 0);
}
DockVisualStyle visualStyle;
@@ -119,13 +119,13 @@ namespace MonoDevelop.Components.Docking
if (widget != null)
SetTreeStyle (widget);
- item.GetToolbar (PositionType.Top).SetStyle (VisualStyle);
- item.GetToolbar (PositionType.Left).SetStyle (VisualStyle);
- item.GetToolbar (PositionType.Right).SetStyle (VisualStyle);
- item.GetToolbar (PositionType.Bottom).SetStyle (VisualStyle);
+ item.GetToolbar (DockPositionType.Top).SetStyle (VisualStyle);
+ item.GetToolbar (DockPositionType.Left).SetStyle (VisualStyle);
+ item.GetToolbar (DockPositionType.Right).SetStyle (VisualStyle);
+ item.GetToolbar (DockPositionType.Bottom).SetStyle (VisualStyle);
if (VisualStyle.TabStyle == DockTabStyle.Normal)
- ModifyBg (StateType.Normal, VisualStyle.PadBackgroundColor.Value);
+ ModifyBg (StateType.Normal, VisualStyle.PadBackgroundColor.Value.ToGdkColor ());
else
ModifyBg (StateType.Normal, Style.Background(StateType.Normal));
}
@@ -152,8 +152,8 @@ namespace MonoDevelop.Components.Docking
{
var w = (Gtk.TreeView)sender;
if (VisualStyle.TreeBackgroundColor != null) {
- w.ModifyBase (StateType.Normal, VisualStyle.TreeBackgroundColor.Value);
- w.ModifyBase (StateType.Insensitive, VisualStyle.TreeBackgroundColor.Value);
+ w.ModifyBase (StateType.Normal, VisualStyle.TreeBackgroundColor.Value.ToGdkColor ());
+ w.ModifyBase (StateType.Insensitive, VisualStyle.TreeBackgroundColor.Value.ToGdkColor ());
} else {
w.ModifyBase (StateType.Normal, Parent.Style.Base (StateType.Normal));
w.ModifyBase (StateType.Insensitive, Parent.Style.Base (StateType.Insensitive));
@@ -164,7 +164,7 @@ namespace MonoDevelop.Components.Docking
{
if (VisualStyle.TabStyle == DockTabStyle.Normal) {
Gdk.GC gc = new Gdk.GC (GdkWindow);
- gc.RgbFgColor = VisualStyle.PadBackgroundColor.Value;
+ gc.RgbFgColor = VisualStyle.PadBackgroundColor.Value.ToGdkColor ();
evnt.Window.DrawRectangle (gc, true, Allocation);
gc.Dispose ();
}
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.Docking/DockItemTitleTab.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.Docking/DockItemTitleTab.cs
index 36282ff460..0ab3b7d059 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.Docking/DockItemTitleTab.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.Docking/DockItemTitleTab.cs
@@ -127,7 +127,7 @@ namespace MonoDevelop.Components.Docking
tabIcon.Visible = visualStyle.ShowPadTitleIcon.Value;
if (IsRealized) {
if (labelWidget != null)
- labelWidget.ModifyFg (StateType.Normal, visualStyle.PadTitleLabelColor.Value);
+ labelWidget.ModifyFg (StateType.Normal, visualStyle.PadTitleLabelColor.Value.ToGdkColor ());
}
var r = WidthRequest;
WidthRequest = -1;
@@ -426,7 +426,7 @@ namespace MonoDevelop.Components.Docking
var alloc = Allocation;
Gdk.GC bgc = new Gdk.GC (GdkWindow);
- var c = VisualStyle.PadBackgroundColor.Value.ToXwtColor ();
+ var c = VisualStyle.PadBackgroundColor.Value;
c.Light *= 0.7;
bgc.RgbFgColor = c.ToGdkColor ();
bool first = true;
@@ -442,7 +442,7 @@ namespace MonoDevelop.Components.Docking
if (Active || (first && last)) {
Gdk.GC gc = new Gdk.GC (GdkWindow);
- gc.RgbFgColor = VisualStyle.PadBackgroundColor.Value;
+ gc.RgbFgColor = VisualStyle.PadBackgroundColor.Value.ToGdkColor ();
evnt.Window.DrawRectangle (gc, true, alloc);
if (!first)
evnt.Window.DrawLine (bgc, alloc.X, alloc.Y, alloc.X, alloc.Y + alloc.Height - 1);
@@ -452,7 +452,7 @@ namespace MonoDevelop.Components.Docking
} else {
Gdk.GC gc = new Gdk.GC (GdkWindow);
- gc.RgbFgColor = tabStrip != null ? tabStrip.VisualStyle.InactivePadBackgroundColor.Value : frame.DefaultVisualStyle.InactivePadBackgroundColor.Value;
+ gc.RgbFgColor = tabStrip != null ? tabStrip.VisualStyle.InactivePadBackgroundColor.Value.ToGdkColor () : frame.DefaultVisualStyle.InactivePadBackgroundColor.Value.ToGdkColor ();
evnt.Window.DrawRectangle (gc, true, alloc);
gc.Dispose ();
evnt.Window.DrawLine (bgc, alloc.X, alloc.Y + alloc.Height - 1, alloc.X + alloc.Width - 1, alloc.Y + alloc.Height - 1);
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.Docking/DockItemToolbar.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.Docking/DockItemToolbar.cs
index ec361eae31..e2d2cf1066 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.Docking/DockItemToolbar.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.Docking/DockItemToolbar.cs
@@ -25,6 +25,7 @@
// THE SOFTWARE.
using System;
+using System.Linq;
using Gtk;
namespace MonoDevelop.Components.Docking
@@ -34,11 +35,11 @@ namespace MonoDevelop.Components.Docking
DockItem parentItem;
Gtk.Widget frame;
Box box;
- PositionType position;
+ DockPositionType position;
bool empty = true;
CustomFrame topFrame;
- internal DockItemToolbar (DockItem parentItem, PositionType position)
+ internal DockItemToolbar (DockItem parentItem, DockPositionType position)
{
this.parentItem = parentItem;
@@ -65,7 +66,7 @@ namespace MonoDevelop.Components.Docking
}*/
this.position = position;
- if (position == PositionType.Top || position == PositionType.Bottom)
+ if (position == DockPositionType.Top || position == DockPositionType.Bottom)
box = new HBox (false, 3);
else
box = new VBox (false, 3);
@@ -79,7 +80,7 @@ namespace MonoDevelop.Components.Docking
internal void SetStyle (DockVisualStyle style)
{
- topFrame.BackgroundColor = style.PadBackgroundColor.Value;
+ topFrame.BackgroundColor = style.PadBackgroundColor.Value.ToGdkColor ();
}
public DockItem DockItem {
@@ -90,29 +91,30 @@ namespace MonoDevelop.Components.Docking
get { return frame; }
}
- public PositionType Position {
+ public DockPositionType Position {
get { return this.position; }
}
- public void Add (Widget widget)
+ public void Add (Control widget)
{
Add (widget, false);
}
- public void Add (Widget widget, bool fill)
+ public void Add (Control widget, bool fill)
{
Add (widget, fill, -1);
}
- public void Add (Widget widget, bool fill, int padding)
+ public void Add (Control widget, bool fill, int padding)
{
Add (widget, fill, padding, -1);
}
- void Add (Widget widget, bool fill, int padding, int index)
+ void Add (Control control, bool fill, int padding, int index)
{
int defaultPadding = 3;
-
+
+ Widget widget = control;
if (widget is Button) {
((Button)widget).Relief = ReliefStyle.None;
((Button)widget).FocusOnClick = false;
@@ -141,12 +143,12 @@ namespace MonoDevelop.Components.Docking
}
}
- public void Insert (Widget w, int index)
+ public void Insert (Control w, int index)
{
Add (w, false, 0, index);
}
- public void Remove (Widget widget)
+ public void Remove (Control widget)
{
box.Remove (widget);
}
@@ -170,24 +172,79 @@ namespace MonoDevelop.Components.Docking
frame.ShowAll ();
}
- public Widget[] Children {
- get { return box.Children; }
+ public Control[] Children {
+ get { return box.Children.Select (child => (Control)child).ToArray (); }
}
}
- public class DockToolButton: Gtk.Button
+ public class DockToolButton : Control
{
- public DockToolButton (string stockId)
+ public DockToolButtonImage Image {
+ get { return (ImageView)button.Image; }
+ set { button.Image = (ImageView)value; }
+ }
+
+ public string TooltipText {
+ get { return button.TooltipText; }
+ set { button.TooltipText = value; }
+ }
+
+ public string Label {
+ get { return button.Label; }
+ set { button.Label = value; }
+ }
+
+ Gtk.Button button;
+
+ public DockToolButton (string stockId) : this (stockId, null)
{
- Image = new ImageView (stockId, IconSize.Menu);
- Image.Show ();
}
public DockToolButton (string stockId, string label)
{
+ button = new Button ();
Label = label;
+
Image = new ImageView (stockId, IconSize.Menu);
- Image.Show ();
+ button.Image.Show ();
+ }
+
+ protected override object CreateNativeWidget ()
+ {
+ return button;
+ }
+
+ public event EventHandler Clicked {
+ add {
+ button.Clicked += value;
+ }
+ remove {
+ button.Clicked -= value;
+ }
+ }
+
+ public class DockToolButtonImage : Control
+ {
+ ImageView image;
+ internal DockToolButtonImage (ImageView image)
+ {
+ this.image = image;
+ }
+
+ protected override object CreateNativeWidget ()
+ {
+ return image;
+ }
+
+ public static implicit operator ImageView (DockToolButtonImage d)
+ {
+ return d.GetNativeWidget<ImageView> ();
+ }
+
+ public static implicit operator DockToolButtonImage (ImageView d)
+ {
+ return new DockToolButtonImage (d);
+ }
}
}
}
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui/IAttachableViewContent.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.Docking/DockPositionType.cs
index 2d24756c3b..0191134cec 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui/IAttachableViewContent.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.Docking/DockPositionType.cs
@@ -1,21 +1,21 @@
-//
-// IAttachableViewContent.cs
-//
+//
+// DockPositionType.cs
+//
// Author:
-// Mike Krüger <mkrueger@novell.com>
-//
-// Copyright (c) 2009 Novell, Inc (http://www.novell.com)
-//
+// Lluis Sanchez Gual <lluis@xamarin.com>
+//
+// Copyright (c) 2015 Xamarin, Inc (http://www.xamarin.com)
+//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
-//
+//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
-//
+//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
@@ -26,15 +26,14 @@
using System;
-namespace MonoDevelop.Ide.Gui
+namespace MonoDevelop.Components.Docking
{
- public interface IAttachableViewContent : IBaseViewContent
+ public enum DockPositionType
{
- void Selected ();
- void Deselected ();
-
- void BeforeSave();
-
- void BaseContentChanged ();
+ Left,
+ Right,
+ Top,
+ Bottom
}
}
+
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.Docking/DockVisualStyle.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.Docking/DockVisualStyle.cs
index 195aea35ad..79bece8eb1 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.Docking/DockVisualStyle.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.Docking/DockVisualStyle.cs
@@ -29,14 +29,14 @@ namespace MonoDevelop.Components.Docking
{
public sealed class DockVisualStyle
{
- public Gdk.Color? PadBackgroundColor { get; set; }
- public Gdk.Color? PadTitleLabelColor { get; set; }
+ public Xwt.Drawing.Color? PadBackgroundColor { get; set; }
+ public Xwt.Drawing.Color? PadTitleLabelColor { get; set; }
public DockTabStyle? TabStyle { get; set; }
- public Gdk.Color? TreeBackgroundColor { get; set; }
+ public Xwt.Drawing.Color? TreeBackgroundColor { get; set; }
public bool? ShowPadTitleIcon { get; set; }
public bool? UppercaseTitles { get; set; }
public bool? ExpandedTabs { get; set; }
- public Gdk.Color? InactivePadBackgroundColor { get; set; }
+ public Xwt.Drawing.Color? InactivePadBackgroundColor { get; set; }
public int? PadTitleHeight { get; set; }
// When set, pads in a region with this style can't be stacked horizontally
@@ -83,14 +83,14 @@ namespace MonoDevelop.Components.Docking
public static DockVisualStyle CreateDefaultStyle ()
{
DockVisualStyle s = new DockVisualStyle ();
- s.PadBackgroundColor = new Gdk.Color (0,0,0);
- s.PadTitleLabelColor = new Gdk.Color (0,0,0);
+ s.PadBackgroundColor = new Xwt.Drawing.Color (0,0,0);
+ s.PadTitleLabelColor = new Xwt.Drawing.Color (0,0,0);
s.TabStyle = DockTabStyle.Normal;
s.TreeBackgroundColor = null;
s.ShowPadTitleIcon = true;
s.UppercaseTitles = false;
s.ExpandedTabs = false;
- s.InactivePadBackgroundColor = new Gdk.Color (0,0,0);
+ s.InactivePadBackgroundColor = new Xwt.Drawing.Color (0,0,0);
s.PadTitleHeight = -1;
s.SingleRowMode = false;
s.SingleColumnMode = false;
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.Docking/TabStrip.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.Docking/TabStrip.cs
index ab5b7f8dfd..3609358c4d 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.Docking/TabStrip.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.Docking/TabStrip.cs
@@ -275,12 +275,12 @@ namespace MonoDevelop.Components.Docking
if (TabStrip.VisualStyle.TabStyle == DockTabStyle.Normal) {
var alloc = Allocation;
Gdk.GC gc = new Gdk.GC (GdkWindow);
- gc.RgbFgColor = TabStrip.VisualStyle.InactivePadBackgroundColor.Value;
+ gc.RgbFgColor = TabStrip.VisualStyle.InactivePadBackgroundColor.Value.ToGdkColor ();
evnt.Window.DrawRectangle (gc, true, alloc);
gc.Dispose ();
Gdk.GC bgc = new Gdk.GC (GdkWindow);
- var c = TabStrip.VisualStyle.PadBackgroundColor.Value.ToXwtColor ();
+ var c = TabStrip.VisualStyle.PadBackgroundColor.Value;
c.Light *= 0.7;
bgc.RgbFgColor = c.ToGdkColor ();
evnt.Window.DrawLine (bgc, alloc.X, alloc.Y + alloc.Height - 1, alloc.X + alloc.Width - 1, alloc.Y + alloc.Height - 1);
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.Extensions/PlatformDialog.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.Extensions/PlatformDialog.cs
index a1a9b55c2b..4b3c1fd7b4 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.Extensions/PlatformDialog.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.Extensions/PlatformDialog.cs
@@ -35,7 +35,7 @@ namespace MonoDevelop.Components.Extensions
public class PlatformDialogData
{
public string Title { get; set; }
- public Gtk.Window TransientFor { get; set; }
+ public Window TransientFor { get; set; }
}
public interface IDialogHandler<T> where T: PlatformDialogData
@@ -84,7 +84,7 @@ namespace MonoDevelop.Components.Extensions
/// <summary>
/// Parent window.
/// </summary>
- public Gtk.Window TransientFor {
+ public Window TransientFor {
get { return data.TransientFor; }
set { data.TransientFor = value; }
}
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.Extensions/TextQuestionDialog.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.Extensions/TextQuestionDialog.cs
index 043010872f..f9fe9d90b9 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.Extensions/TextQuestionDialog.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.Extensions/TextQuestionDialog.cs
@@ -65,9 +65,9 @@ namespace MonoDevelop.Components.Extensions
protected override bool RunDefault ()
{
- Dialog md = null;
+ Gtk.Dialog md = null;
try {
- md = new Dialog (Caption, TransientFor, DialogFlags.Modal | DialogFlags.DestroyWithParent) {
+ md = new Gtk.Dialog (Caption, TransientFor, DialogFlags.Modal | DialogFlags.DestroyWithParent) {
HasSeparator = false,
BorderWidth = 6,
};
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.MainToolbar/CommandSearchCategory.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.MainToolbar/CommandSearchCategory.cs
index ab01eea88d..bd2f9c96fb 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.MainToolbar/CommandSearchCategory.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.MainToolbar/CommandSearchCategory.cs
@@ -52,7 +52,7 @@ namespace MonoDevelop.Components.MainToolbar
).ToList();
}
- public CommandSearchCategory (Widget widget) : base (GettextCatalog.GetString("Commands"))
+ public CommandSearchCategory () : base (GettextCatalog.GetString("Commands"))
{
}
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.MainToolbar/FileSearchCategory.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.MainToolbar/FileSearchCategory.cs
index eb42236909..960d80e4ba 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.MainToolbar/FileSearchCategory.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.MainToolbar/FileSearchCategory.cs
@@ -42,7 +42,7 @@ namespace MonoDevelop.Components.MainToolbar
{
class FileSearchCategory : SearchCategory
{
- public FileSearchCategory (Widget widget) : base (GettextCatalog.GetString("Files"))
+ public FileSearchCategory () : base (GettextCatalog.GetString("Files"))
{
}
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.MainToolbar/MainToolbar.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.MainToolbar/MainToolbar.cs
index f70fcec652..d0bfc5b028 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.MainToolbar/MainToolbar.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.MainToolbar/MainToolbar.cs
@@ -264,7 +264,7 @@ namespace MonoDevelop.Components.MainToolbar
protected override bool OnButtonPressEvent (Gdk.EventButton evnt)
{
if (evnt.Button == 1 && evnt.Window == GdkWindow) {
- var window = (Window)Toplevel;
+ var window = (Gtk.Window)Toplevel;
if (!DesktopService.GetIsFullscreen (window)) {
window.BeginMoveDrag (1, (int)evnt.XRoot, (int)evnt.YRoot, evnt.Time);
return true;
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.MainToolbar/ResultsDataSource.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.MainToolbar/ResultsDataSource.cs
index 5180a7dbbf..bffa3c343e 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.MainToolbar/ResultsDataSource.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.MainToolbar/ResultsDataSource.cs
@@ -45,14 +45,12 @@ namespace MonoDevelop.Components.MainToolbar
{
class ResultsDataSource: List<SearchResult>, ISearchDataSource
{
-
- Gtk.Widget widget;
+
SearchResult bestResult;
int bestRank = int.MinValue;
- public ResultsDataSource (Gtk.Widget widget)
+ public ResultsDataSource ()
{
- this.widget = widget;
}
public void SortUpToN (MonoDevelop.Components.MainToolbar.SearchCategory.DataItemComparer comparison, int n)
@@ -125,14 +123,14 @@ namespace MonoDevelop.Components.MainToolbar
{
if (isSelected)
return GLib.Markup.EscapeText (this [item].PlainText);
- return this [item].GetMarkupText (widget);
+ return this [item].GetMarkupText ();
}
string ISearchDataSource.GetDescriptionMarkup (int item, bool isSelected)
{
if (isSelected)
return GLib.Markup.EscapeText (this [item].Description);
- return this [item].GetDescriptionMarkupText (widget);
+ return this [item].GetDescriptionMarkupText ();
}
ISegment ISearchDataSource.GetRegion (int item)
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.MainToolbar/SearchInSolutionSearchCategory.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.MainToolbar/SearchInSolutionSearchCategory.cs
index 0c57c32c68..c882f1f992 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.MainToolbar/SearchInSolutionSearchCategory.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.MainToolbar/SearchInSolutionSearchCategory.cs
@@ -93,7 +93,7 @@ namespace MonoDevelop.Components.MainToolbar
FindInFilesDialog.SearchReplace (pattern.Pattern, null, new WholeSolutionScope (), options, null);
}
- public override string GetMarkupText (Gtk.Widget widget)
+ public override string GetMarkupText ()
{
return GettextCatalog.GetString ("Search in Solution...");
}
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.MainToolbar/SearchPopupWindow.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.MainToolbar/SearchPopupWindow.cs
index 0ad1bf0cc4..20e7d96ecb 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.MainToolbar/SearchPopupWindow.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.MainToolbar/SearchPopupWindow.cs
@@ -124,9 +124,8 @@ namespace MonoDevelop.Components.MainToolbar
this.AllowShrink = false;
this.AllowGrow = false;
- categories.Add (new FileSearchCategory (this));
- categories.Add (new CommandSearchCategory (this));
-
+ categories.Add (new FileSearchCategory ());
+ categories.Add (new CommandSearchCategory ());
categories.Add (new SearchInSolutionSearchCategory ());
foreach (var cat in AddinManager.GetExtensionObjects<SearchCategory> ("/MonoDevelop/Ide/SearchCategories")) {
categories.Add (cat);
@@ -384,8 +383,8 @@ namespace MonoDevelop.Components.MainToolbar
Gdk.Size retVal = new Gdk.Size ();
int ox, oy;
GetPosition (out ox, out oy);
- Gdk.Rectangle geometry = DesktopService.GetUsableMonitorGeometry (Screen, Screen.GetMonitorAtPoint (ox, oy));
- var maxHeight = geometry.Height * 4 / 5;
+ Xwt.Rectangle geometry = DesktopService.GetUsableMonitorGeometry (Screen.Number, Screen.GetMonitorAtPoint (ox, oy));
+ int maxHeight = (int)geometry.Height * 4 / 5;
double startY = yMargin + ChildAllocation.Y;
double y = startY;
calculatedItems = 0;
@@ -404,7 +403,7 @@ namespace MonoDevelop.Components.MainToolbar
calculatedItems++;
}
}
- retVal.Width = Math.Min (geometry.Width * 4 / 5, 480);
+ retVal.Width = Math.Min ((int)geometry.Width * 4 / 5, 480);
if (Math.Abs (y - startY) < 1) {
layout.SetMarkup (GettextCatalog.GetString ("No matches"));
int w, h;
@@ -1081,8 +1080,8 @@ namespace MonoDevelop.Components.MainToolbar
string GetRowMarkup (SearchResult result)
{
- string txt = "<span foreground=\"" + Styles.ColorGetHex (Styles.GlobalSearch.ResultTextColor) + "\">" + result.GetMarkupText(this) +"</span>";
- string desc = result.GetDescriptionMarkupText (this);
+ string txt = "<span foreground=\"" + Styles.ColorGetHex (Styles.GlobalSearch.ResultTextColor) + "\">" + result.GetMarkupText() +"</span>";
+ string desc = result.GetDescriptionMarkupText ();
if (!string.IsNullOrEmpty (desc))
txt += "<span foreground=\"" + Styles.ColorGetHex (Styles.GlobalSearch.ResultDescriptionTextColor) + "\" size=\"small\">\n" + desc + "</span>";
return txt;
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.MainToolbar/SearchResult.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.MainToolbar/SearchResult.cs
index bcca959283..4f0b8eda81 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.MainToolbar/SearchResult.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.MainToolbar/SearchResult.cs
@@ -55,12 +55,12 @@ namespace MonoDevelop.Components.MainToolbar
{
protected string match;
- public virtual string GetMarkupText (Widget widget)
+ public virtual string GetMarkupText ()
{
- return HighlightMatch (widget, PlainText, match);
+ return HighlightMatch (PlainText, match);
}
- public virtual string GetDescriptionMarkupText (Widget widget)
+ public virtual string GetDescriptionMarkupText ()
{
return Ambience.EscapeText (Description);
}
@@ -99,7 +99,7 @@ namespace MonoDevelop.Components.MainToolbar
Rank = rank;
}
- protected static string HighlightMatch (Widget widget, string text, string toMatch)
+ protected static string HighlightMatch (string text, string toMatch)
{
var lane = StringMatcher.GetMatcher (toMatch, true).GetMatch (text);
StringBuilder result = new StringBuilder ();
@@ -253,9 +253,9 @@ namespace MonoDevelop.Components.MainToolbar
}
}
- public override string GetMarkupText (Widget widget)
+ public override string GetMarkupText ()
{
- return HighlightMatch (widget, MatchedString, match);
+ return HighlightMatch (MatchedString, match);
}
public override bool CanActivate {
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.PropertyGrid.Editors/CollectionEditor.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.PropertyGrid.Editors/CollectionEditor.cs
index 1e76269be3..a4070bdd75 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.PropertyGrid.Editors/CollectionEditor.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.PropertyGrid.Editors/CollectionEditor.cs
@@ -87,14 +87,14 @@ namespace MonoDevelop.Components.PropertyGrid.PropertyEditors
TreeIter previousIter = TreeIter.Zero;
//dialogue and buttons
- Dialog dialog = new Dialog () {
+ var dialog = new Gtk.Dialog () {
Title = displayName + " Editor",
Modal = true,
AllowGrow = true,
AllowShrink = true,
};
IdeTheme.ApplyTheme (dialog);
- var toplevel = this.Container.Toplevel as Window;
+ var toplevel = this.Container.GetNativeWidget<Gtk.Widget> ().Toplevel as Gtk.Window;
if (toplevel != null)
dialog.TransientFor = toplevel;
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.PropertyGrid.Editors/ColorEditorCell.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.PropertyGrid.Editors/ColorEditorCell.cs
index f5242c009c..6a1b998f5e 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.PropertyGrid.Editors/ColorEditorCell.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.PropertyGrid.Editors/ColorEditorCell.cs
@@ -63,7 +63,7 @@ namespace MonoDevelop.Components.PropertyGrid.PropertyEditors
gc.RgbFgColor = GetColor ();
int yd = (bounds.Height - ColorBoxSize) / 2;
window.DrawRectangle (gc, true, bounds.X, bounds.Y + yd, ColorBoxSize - 1, ColorBoxSize - 1);
- window.DrawRectangle (Container.Style.BlackGC, false, bounds.X, bounds.Y + yd, ColorBoxSize - 1, ColorBoxSize - 1);
+ window.DrawRectangle (Container.GetNativeWidget<Gtk.Widget> ().Style.BlackGC, false, bounds.X, bounds.Y + yd, ColorBoxSize - 1, ColorBoxSize - 1);
bounds.X += ColorBoxSize + ColorBoxSpacing;
bounds.Width -= ColorBoxSize + ColorBoxSpacing;
base.Render (window, ctx, bounds, state);
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.PropertyGrid/PropertyEditorCell.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.PropertyGrid/PropertyEditorCell.cs
index 7aa4c1407a..ba459d1be6 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.PropertyGrid/PropertyEditorCell.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.PropertyGrid/PropertyEditorCell.cs
@@ -52,7 +52,7 @@ namespace MonoDevelop.Components.PropertyGrid
get { return context; }
}
- public Widget Container {
+ public Control Container {
get { return container; }
}
@@ -255,7 +255,7 @@ namespace MonoDevelop.Components.PropertyGrid
get { return context.PropertyDescriptor; }
}
- public Widget Container {
+ public Control Container {
get { return container; }
}
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.Theming/GtkColors.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.Theming/GtkColors.cs
index 8cc8de1800..b8f578ff10 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.Theming/GtkColors.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.Theming/GtkColors.cs
@@ -43,7 +43,7 @@ namespace MonoDevelop.Components.Theming
Foreground
}
- public class GtkColors
+ class GtkColors
{
private Cairo.Color[] gtk_colors;
private Widget widget;
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.Theming/GtkTheme.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.Theming/GtkTheme.cs
index 8dba0ef095..a59672a7cc 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.Theming/GtkTheme.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.Theming/GtkTheme.cs
@@ -32,7 +32,7 @@ using Gtk;
namespace MonoDevelop.Components.Theming
{
- public class GtkTheme : Theme
+ class GtkTheme : Theme
{
private Cairo.Color rule_color;
private Cairo.Color border_color;
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.Theming/Theme.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.Theming/Theme.cs
index 9c9e23af08..123786d761 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.Theming/Theme.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.Theming/Theme.cs
@@ -41,7 +41,7 @@ namespace MonoDevelop.Components.Theming
Descending
}
- public abstract class Theme
+ abstract class Theme
{
private static Cairo.Color black = new Cairo.Color (0, 0, 0);
private Stack<ThemeContext> contexts = new Stack<ThemeContext> ();
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.Theming/ThemeContext.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.Theming/ThemeContext.cs
index 2ab2799458..2ac3a795ec 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.Theming/ThemeContext.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.Theming/ThemeContext.cs
@@ -31,7 +31,7 @@ using Cairo;
namespace MonoDevelop.Components.Theming
{
- public class ThemeContext
+ class ThemeContext
{
private double radius = 3.0;
public double Radius {
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.Theming/ThemeEngine.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.Theming/ThemeEngine.cs
index 044079e17b..d600082cd9 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.Theming/ThemeEngine.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.Theming/ThemeEngine.cs
@@ -28,7 +28,7 @@ using System;
namespace MonoDevelop.Components.Theming
{
- public static class ThemeEngine
+ static class ThemeEngine
{
private static Type theme_type;
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui/AbstractAttachableViewContent.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Components/ButtonEvent.cs
index 26ee6fd478..7896d1ec4d 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui/AbstractAttachableViewContent.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Components/ButtonEvent.cs
@@ -1,21 +1,21 @@
-//
-// AbstractAttachableViewContent.cs
-//
+//
+// ButtonEventArgs.cs
+//
// Author:
-// Mike Krüger <mkrueger@novell.com>
-//
-// Copyright (c) 2009 Novell, Inc (http://www.novell.com)
-//
+// therzok <marius.ungureanu@xamarin.com>
+//
+// Copyright (c) 2015 therzok
+//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
-//
+//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
-//
+//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
@@ -23,27 +23,41 @@
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
-
using System;
-namespace MonoDevelop.Ide.Gui
+namespace MonoDevelop.Components
{
- public abstract class AbstractAttachableViewContent : AbstractBaseViewContent, IAttachableViewContent
+ public class ButtonEvent : Xwt.ButtonEventArgs
{
- public virtual void Selected ()
- {
- }
-
- public virtual void Deselected ()
+ public ButtonEvent ()
{
}
-
- public virtual void BeforeSave ()
+
+ Gdk.EventButton native;
+ new bool Handled { get; set; }
+
+ public static implicit operator ButtonEvent (Gdk.EventButton args)
{
+ int numPress;
+ if (args.Type == Gdk.EventType.TwoButtonPress)
+ numPress = 2;
+ else if (args.Type == Gdk.EventType.ThreeButtonPress)
+ numPress = 3;
+ else
+ numPress = 1;
+ return new ButtonEvent {
+ native = args,
+ X = args.X,
+ Y = args.Y,
+ Button = (Xwt.PointerButton)args.Button,
+ MultiplePress = numPress,
+ };
}
- public virtual void BaseContentChanged ()
+ public static implicit operator Gdk.EventButton (ButtonEvent args)
{
+ return args.native;
}
}
}
+
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Components/CompactDialog.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Components/CompactDialog.cs
index ac218f22ec..1f2a461cea 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Components/CompactDialog.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Components/CompactDialog.cs
@@ -28,7 +28,7 @@ using Gtk;
namespace MonoDevelop.Components
{
- public class CompactDialog: Dialog
+ public class CompactDialog: Gtk.Dialog
{
public CompactDialog ()
{
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Components/ContextMenu.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Components/ContextMenu.cs
index 2507b7dcae..2d24d52336 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Components/ContextMenu.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Components/ContextMenu.cs
@@ -34,7 +34,7 @@ namespace MonoDevelop.Components
public ContextMenu ()
{
- items = new ContextMenuItemCollection (this);
+ items = new ContextMenuItemCollection ();
}
public ContextMenuItemCollection Items {
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Components/ContextMenuItemCollection.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Components/ContextMenuItemCollection.cs
index 576d512b14..848b7970b1 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Components/ContextMenuItemCollection.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Components/ContextMenuItemCollection.cs
@@ -31,7 +31,7 @@ namespace MonoDevelop.Components
{
public class ContextMenuItemCollection: Collection<ContextMenuItem>
{
- internal ContextMenuItemCollection (ContextMenu parent)
+ internal ContextMenuItemCollection ()
{
}
}
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Components/Control.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Components/Control.cs
index ee58994619..b9da8f0b15 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Components/Control.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Components/Control.cs
@@ -24,6 +24,7 @@
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
using System;
+using System.Collections.Generic;
using MonoDevelop.Components.Commands;
#if MAC
@@ -33,19 +34,21 @@ using MonoDevelop.Components.Mac;
namespace MonoDevelop.Components
{
- public class Control: IDisposable
+ public class Control : IDisposable
{
- object nativeWidget;
+ internal static Dictionary<object, WeakReference<Control>> cache = new Dictionary<object, WeakReference<Control>> ();
+ internal object nativeWidget;
protected Control ()
{
}
- public Control (object widget)
+ Control (object widget)
{
if (widget == null)
- throw new ArgumentNullException ("widget");
+ throw new ArgumentNullException (nameof (widget));
this.nativeWidget = widget;
+ cache.Add (nativeWidget, new WeakReference<Control> (this));
}
protected virtual object CreateNativeWidget ()
@@ -56,9 +59,16 @@ namespace MonoDevelop.Components
public T GetNativeWidget<T> ()
{
if (nativeWidget == null) {
+ var toCache = this;
var w = CreateNativeWidget ();
- if (!(w is T))
- w = ConvertToType (typeof(T), w);
+ if (!(w is T)) {
+ var temp = w as Control;
+ while (temp != null) {
+ w = temp.GetNativeWidget<T> ();
+ temp = w as Control;
+ }
+ w = ConvertToType (typeof (T), w);
+ }
if (w is Gtk.Widget) {
var gtkWidget = (Gtk.Widget)w;
var c = new CommandRouterContainer (gtkWidget, this, true);
@@ -69,9 +79,17 @@ namespace MonoDevelop.Components
GC.SuppressFinalize (this);
Dispose (true);
};
- }
- else
+ toCache = c;
+ } else {
nativeWidget = w;
+ }
+ WeakReference<Control> cached;
+ Control target;
+ if (cache.TryGetValue (nativeWidget, out cached) && cached.TryGetTarget (out target)) {
+ if (target != toCache)
+ throw new Exception ();
+ } else
+ cache.Add (nativeWidget, new WeakReference<Control> (toCache));
}
if (nativeWidget is T)
return (T)nativeWidget;
@@ -84,27 +102,70 @@ namespace MonoDevelop.Components
if (t.IsInstanceOfType (w))
return w;
- #if MAC
- if (w is NSView && t == typeof(Gtk.Widget)) {
+#if MAC
+ if (w is NSView && t == typeof (Gtk.Widget)) {
var ww = GtkMacInterop.NSViewToGtkWidget ((NSView)w);
ww.Show ();
return ww;
}
- if (w is Gtk.Widget && t == typeof(NSView)) {
+ if (w is Gtk.Widget && t == typeof (NSView)) {
return new GtkEmbed ((Gtk.Widget)w);
}
- #endif
+#endif
throw new NotSupportedException ();
}
+#if MAC
+ public static implicit operator NSView (Control d)
+ {
+ return d.GetNativeWidget<NSView> ();
+ }
+
+ public static implicit operator Control (NSView d)
+ {
+ if (d == null)
+ return null;
+
+ return GetImplicit<Control, NSView> (d) ?? new Control (d);
+ }
+#endif
+
public static implicit operator Gtk.Widget (Control d)
{
- return d.GetNativeWidget<Gtk.Widget> ();
+ return d?.GetNativeWidget<Gtk.Widget> ();
}
public static implicit operator Control (Gtk.Widget d)
{
- return new Control (d);
+ if (d == null)
+ return null;
+
+ var control = GetImplicit<Control, Gtk.Widget>(d);
+ if (control == null) {
+ control = new Control (d);
+ d.Destroyed += delegate {
+ GC.SuppressFinalize (control);
+ control.Dispose (true);
+ };
+ }
+ return control;
+ }
+
+ internal static T GetImplicit<T, U> (U native) where T : Control where U : class
+ {
+ WeakReference<Control> cached;
+ Control target;
+
+ if (cache.TryGetValue (native, out cached)) {
+ if (cached.TryGetTarget (out target)) {
+ var ret = target as T;
+ if (ret != null)
+ return ret;
+ }
+
+ cache.Remove (native);
+ }
+ return null;
}
public void GrabFocus ()
@@ -112,22 +173,35 @@ namespace MonoDevelop.Components
// TODO
}
+
+ public bool HasFocus {
+ get
+ {
+ // TODO
+ if (nativeWidget is Gtk.Widget)
+ return ((Gtk.Widget)nativeWidget).HasFocus;
+ return false;
+ }
+ }
+
public void Dispose ()
{
if (nativeWidget is Gtk.Widget) {
((Gtk.Widget)nativeWidget).Destroy ();
return;
}
- #if MAC
+#if MAC
else if (nativeWidget is NSView)
((NSView)nativeWidget).Dispose ();
- #endif
+#endif
Dispose (true);
}
protected virtual void Dispose (bool disposing)
{
+ if (nativeWidget != null)
+ cache.Remove (nativeWidget);
}
}
}
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui/IBaseViewContent.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Components/Dialog.cs
index ad246af631..8b70e3bf4b 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui/IBaseViewContent.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Components/Dialog.cs
@@ -1,9 +1,10 @@
-// IBaseViewContent.cs
+//
+// Dialog.cs
//
// Author:
-// Viktoria Dudka (viktoriad@remobjects.com)
+// therzok <marius.ungureanu@xamarin.com>
//
-// Copyright (c) 2009 RemObjects Software
+// Copyright (c) 2015 therzok
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
@@ -22,29 +23,45 @@
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
-//
-//
-
using System;
-using Gtk;
-using System.Collections.Generic;
-namespace MonoDevelop.Ide.Gui
+namespace MonoDevelop.Components
{
- public interface IBaseViewContent : IDisposable
+ public class Dialog : Window
{
- IWorkbenchWindow WorkbenchWindow { get; set; }
- Widget Control { get; }
-
- /// <summary>
- /// The label used for the subview list.
- /// </summary>
- string TabPageLabel { get; }
+ protected Dialog ()
+ {
+ }
+
+ Dialog (object widget)
+ {
+ if (widget == null)
+ throw new ArgumentNullException (nameof (widget));
- object GetContent (Type type);
- IEnumerable<T> GetContents<T> () where T : class;
+ this.nativeWidget = widget;
+ cache.Add (widget, new WeakReference<Control> (this));
+ }
- bool CanReuseView (string fileName);
- void RedrawContent ();
+ public static implicit operator Gtk.Dialog (Dialog d)
+ {
+ return d?.GetNativeWidget<Gtk.Dialog> ();
+ }
+
+ public static implicit operator Dialog (Gtk.Dialog d)
+ {
+ if (d == null)
+ return null;
+
+ var dialog = GetImplicit<Dialog, Gtk.Dialog>(d);
+ if (dialog == null) {
+ dialog = new Dialog (d);
+ d.Destroyed += delegate {
+ GC.SuppressFinalize (dialog);
+ dialog.Dispose (true);
+ };
+ }
+ return dialog;
+ }
}
-} \ No newline at end of file
+}
+
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Components/DropDownBox.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Components/DropDownBox.cs
index df6e49c424..9c950c757a 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Components/DropDownBox.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Components/DropDownBox.cs
@@ -141,12 +141,12 @@ namespace MonoDevelop.Components
window.WidthRequest = Allocation.Width;
int width, height;
window.GetSizeRequest (out width, out height);
- Gdk.Rectangle geometry = DesktopService.GetUsableMonitorGeometry (Screen, Screen.GetMonitorAtPoint (dx, dy));
+ Xwt.Rectangle geometry = DesktopService.GetUsableMonitorGeometry (Screen.Number, Screen.GetMonitorAtPoint (dx, dy));
if (dy + height > geometry.Bottom)
dy = oy + this.Allocation.Y - height;
if (dx + width > geometry.Right)
- dx = geometry.Right - width;
+ dx = (int)geometry.Right - width;
window.Move (dx, dy);
window.ShowAll ();
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Components/DropDownBoxListWindow.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Components/DropDownBoxListWindow.cs
index f3e7ea1c89..81a0a1a6d6 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Components/DropDownBoxListWindow.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Components/DropDownBoxListWindow.cs
@@ -31,7 +31,7 @@ using System.Text;
namespace MonoDevelop.Components
{
- public class DropDownBoxListWindow : Window
+ public class DropDownBoxListWindow : Gtk.Window
{
readonly ScrolledWindow vScrollbar;
internal ListWidget list;
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Components/FileChooserAction.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Components/FileChooserAction.cs
index 280379a4a8..1136f7bde7 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Components/FileChooserAction.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Components/FileChooserAction.cs
@@ -53,7 +53,6 @@ namespace MonoDevelop.Components
return Gtk.FileChooserAction.Save;
else
throw new NotSupportedException ();
-
}
}
}
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Components/PathBar.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Components/PathBar.cs
index 24c0e948ad..67d203a874 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Components/PathBar.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Components/PathBar.cs
@@ -148,14 +148,14 @@ namespace MonoDevelop.Components
const int spacing = arrowLeftPadding + arrowRightPadding + arrowSize;
const int minRegionSelectorWidth = 30;
- Func<int, Widget> createMenuForItem;
+ Func<int, Control> createMenuForItem;
Widget menuWidget;
bool pressMenuWasVisible;
int pressHoverIndex;
int menuIndex;
uint hideTimeout;
- public PathBar (Func<int, Widget> createMenuForItem)
+ public PathBar (Func<int, Control> createMenuForItem)
{
this.Events = EventMask.ExposureMask |
EventMask.EnterNotifyMask |
@@ -544,18 +544,21 @@ namespace MonoDevelop.Components
int dy = oy + this.Allocation.Bottom;
var req = widget.SizeRequest ();
-
- Gdk.Rectangle geometry = DesktopService.GetUsableMonitorGeometry (Screen, Screen.GetMonitorAtPoint (dx, dy));
+
+ Xwt.Rectangle geometry = DesktopService.GetUsableMonitorGeometry (Screen.Number, Screen.GetMonitorAtPoint (dx, dy));
+ int geomWidth = (int)geometry.Width;
+ int geomLeft = (int)geometry.Left;
+ int geomRight = (int)geometry.Right;
int width = System.Math.Max (req.Width, w);
- if (width >= geometry.Width - spacing * 2) {
- width = geometry.Width - spacing * 2;
- dx = geometry.Left + spacing;
+ if (width >= geomWidth - spacing * 2) {
+ width = geomWidth - spacing * 2;
+ dx = geomLeft + spacing;
}
widget.WidthRequest = width;
if (dy + req.Height > geometry.Bottom)
dy = oy + this.Allocation.Y - req.Height;
- if (dx + width > geometry.Right)
- dx = geometry.Right - width;
+ if (dx + width > geomRight)
+ dx = geomRight - width;
(widget as Gtk.Window).Move (dx, dy);
(widget as Gtk.Window).Resize (width, req.Height);
widget.GrabFocus ();
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Components/RoundedFrame.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Components/RoundedFrame.cs
index 597e9dc134..43b4cb2286 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Components/RoundedFrame.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Components/RoundedFrame.cs
@@ -38,9 +38,6 @@ namespace MonoDevelop.Components
public class RoundedFrame : Bin
{
private Theme theme;
- protected Theme Theme {
- get { return theme; }
- }
private int frame_width = 3;
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Components/TooltipWindow.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Components/TooltipWindow.cs
index 95036e0cbe..f2cfc14f3a 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Components/TooltipWindow.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Components/TooltipWindow.cs
@@ -116,19 +116,23 @@ namespace MonoDevelop.Components
// LimitWidth (fittedWidth);
// }
- Gdk.Rectangle geometry = DesktopService.GetUsableMonitorGeometry (Screen, Screen.GetMonitorAtPoint (x, y));
+ Xwt.Rectangle geometry = DesktopService.GetUsableMonitorGeometry (Screen.Number, Screen.GetMonitorAtPoint (x, y));
+ int left = (int)geometry.Left;
+ int top = (int)geometry.Top;
+ int width = (int)geometry.Width;
+ int height = (int)geometry.Height;
if (NudgeHorizontal) {
if (allocation.Width <= geometry.Width && x + allocation.Width >= geometry.Left + geometry.Width - edgeGap)
- x = geometry.Left + (geometry.Width - allocation.Width - edgeGap);
- if (x <= geometry.Left + edgeGap)
- x = geometry.Left + edgeGap;
+ x = left + (width - allocation.Width - edgeGap);
+ if (x <= left + edgeGap)
+ x = left + edgeGap;
}
if (NudgeVertical) {
if (allocation.Height <= geometry.Height && y + allocation.Height >= geometry.Top + geometry.Height - edgeGap)
- y = geometry.Top + (geometry.Height - allocation.Height - edgeGap);
- if (y <= geometry.Top + edgeGap)
- y = geometry.Top + edgeGap;
+ y = top + (height - allocation.Height - edgeGap);
+ if (y <= top + edgeGap)
+ y = top + edgeGap;
}
if (y != oldY || x != oldX)
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Components/Window.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Components/Window.cs
new file mode 100644
index 0000000000..8ce4da0a59
--- /dev/null
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Components/Window.cs
@@ -0,0 +1,67 @@
+//
+// Window.cs
+//
+// Author:
+// therzok <marius.ungureanu@xamarin.com>
+//
+// Copyright (c) 2015 therzok
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+using System;
+
+namespace MonoDevelop.Components
+{
+ public class Window : Control
+ {
+ protected Window ()
+ {
+ }
+
+ Window (object widget)
+ {
+ if (widget == null)
+ throw new ArgumentNullException (nameof (widget));
+
+ this.nativeWidget = widget;
+ cache.Add (widget, new WeakReference<Control> (this));
+ }
+
+ public static implicit operator Gtk.Window (Window d)
+ {
+ return d?.GetNativeWidget<Gtk.Window> ();
+ }
+
+ public static implicit operator Window (Gtk.Window d)
+ {
+ if (d == null)
+ return null;
+
+ var window = GetImplicit<Window, Gtk.Window>(d);
+ if (window == null) {
+ window = new Window (d);
+ d.Destroyed += delegate {
+ GC.SuppressFinalize (window);
+ window.Dispose (true);
+ };
+ }
+ return window;
+ }
+ }
+}
+
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.CodeCompletion/CompletionListWindow.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.CodeCompletion/CompletionListWindow.cs
index 561de196da..dde3550304 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.CodeCompletion/CompletionListWindow.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.CodeCompletion/CompletionListWindow.cs
@@ -447,15 +447,15 @@ namespace MonoDevelop.Ide.CodeCompletion
return;
// Note: we add back the TextOffset here in case X and X+TextOffset are on different monitors.
- Gdk.Rectangle geometry = DesktopService.GetUsableMonitorGeometry (Screen, Screen.GetMonitorAtPoint (X + TextOffset, Y));
+ Xwt.Rectangle geometry = DesktopService.GetUsableMonitorGeometry (Screen.Number, Screen.GetMonitorAtPoint (X + TextOffset, Y));
previousHeight = h;
previousWidth = w;
if (X + w > geometry.Right)
- X = geometry.Right - w;
+ X = (int)geometry.Right - w;
else if (X < geometry.Left)
- X = geometry.Left;
+ X = (int)geometry.Left;
if (Y + h > geometry.Bottom || yPosition == WindowPositonY.Top) {
// Put the completion-list window *above* the cursor
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.CodeCompletion/ParameterInformationWindowManager.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.CodeCompletion/ParameterInformationWindowManager.cs
index 22cbeff405..5473fbab24 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.CodeCompletion/ParameterInformationWindowManager.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.CodeCompletion/ParameterInformationWindowManager.cs
@@ -232,8 +232,8 @@ namespace MonoDevelop.Ide.CodeCompletion
wasAbove = false;
var lastMethod = methods [methods.Count - 1];
int curParam = window.Ext != null ? window.Ext.GetCurrentParameterIndex (lastMethod.MethodProvider.StartOffset) : 0;
- var geometry2 = DesktopService.GetUsableMonitorGeometry (window.Screen, window.Screen.GetMonitorAtPoint (X, Y));
- window.ShowParameterInfo (lastMethod.MethodProvider, lastMethod.CurrentOverload, curParam - 1, geometry2.Width);
+ var geometry2 = DesktopService.GetUsableMonitorGeometry (window.Screen.Number, window.Screen.GetMonitorAtPoint (X, Y));
+ window.ShowParameterInfo (lastMethod.MethodProvider, lastMethod.CurrentOverload, curParam - 1, (int)geometry2.Width);
PositionParameterInfoWindow (window.Allocation);
}
@@ -269,12 +269,12 @@ namespace MonoDevelop.Ide.CodeCompletion
Y = ctx.TriggerYCoord;
}
- var geometry = DesktopService.GetUsableMonitorGeometry (window.Screen, window.Screen.GetMonitorAtPoint (X, Y));
+ var geometry = DesktopService.GetUsableMonitorGeometry (window.Screen.Number, window.Screen.GetMonitorAtPoint (X, Y));
- window.ShowParameterInfo (md.MethodProvider, md.CurrentOverload, cparam - 1, geometry.Width);
+ window.ShowParameterInfo (md.MethodProvider, md.CurrentOverload, cparam - 1, (int)geometry.Width);
if (X + allocation.Width > geometry.Right)
- X = geometry.Right - allocation.Width;
+ X = (int)geometry.Right - allocation.Width;
if (Y < geometry.Top)
Y = ctx.TriggerYCoord;
if (wasAbove || Y + allocation.Height > geometry.Bottom) {
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.CodeCompletion/TooltipInformationWindow.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.CodeCompletion/TooltipInformationWindow.cs
index ee0b8cb241..0162f506d6 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.CodeCompletion/TooltipInformationWindow.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.CodeCompletion/TooltipInformationWindow.cs
@@ -118,8 +118,8 @@ namespace MonoDevelop.Ide.CodeCompletion
headLabel.Visible = !string.IsNullOrEmpty (o.SignatureMarkup);
int x, y;
GetPosition (out x, out y);
- var geometry = DesktopService.GetUsableMonitorGeometry (Screen, Screen.GetMonitorAtPoint (x, y));
- headLabel.MaxWidth = Math.Max (geometry.Width / 5, 480);
+ var geometry = DesktopService.GetUsableMonitorGeometry (Screen.Number, Screen.GetMonitorAtPoint (x, y));
+ headLabel.MaxWidth = Math.Max ((int)geometry.Width / 5, 480);
if (Theme.DrawPager && overloads.Count > 1) {
headLabel.WidthRequest = headLabel.RealWidth + 70;
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.CodeTemplates/CodeTemplatePanel.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.CodeTemplates/CodeTemplatePanel.cs
index fde8a432b0..2a6cf53298 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.CodeTemplates/CodeTemplatePanel.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.CodeTemplates/CodeTemplatePanel.cs
@@ -218,12 +218,12 @@ namespace MonoDevelop.Ide.CodeTemplates
return templateStore.AppendValues (iter, template, template.Shortcut, null);
}
}
-
+
internal class CodeTemplatePane : OptionsPanel
{
CodeTemplatePanelWidget codeTemplatePanelWidget;
- public override Widget CreatePanelWidget ()
+ public override Control CreatePanelWidget ()
{
return codeTemplatePanelWidget = new CodeTemplatePanelWidget (this.ParentDialog);
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Codons/PadCodon.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Codons/PadCodon.cs
index 3b4d753ef8..738f59f7e1 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Codons/PadCodon.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Codons/PadCodon.cs
@@ -45,7 +45,7 @@ namespace MonoDevelop.Ide.Codons
[ExtensionNode ("Pad", "Registers a pad to be shown in the workbench.")]
public class PadCodon : ExtensionNode
{
- IPadContent content;
+ PadContent content;
string id;
[NodeAttribute("_label", "Display name of the pad.", Localizable=true)]
@@ -75,20 +75,20 @@ namespace MonoDevelop.Ide.Codons
bool initializeCalled;
- public IPadContent PadContent {
+ public PadContent PadContent {
get {
return content;
}
}
- public IPadContent InitializePadContent (IPadWindow window)
+ public PadContent InitializePadContent (IPadWindow window)
{
if (content == null) {
content = CreatePad ();
- content.Initialize (window);
+ content.Init (window);
ApplyPreferences ();
} else if (!initializeCalled) {
- content.Initialize (window);
+ content.Init (window);
ApplyPreferences ();
}
initializeCalled = true;
@@ -142,12 +142,12 @@ namespace MonoDevelop.Ide.Codons
{
}
- public PadCodon (IPadContent content, string id, string label, string defaultPlacement, string icon)
+ public PadCodon (PadContent content, string id, string label, string defaultPlacement, string icon)
: this (content, id, label, defaultPlacement, DockItemStatus.Dockable, icon)
{
}
- public PadCodon (IPadContent content, string id, string label, string defaultPlacement, DockItemStatus defaultStatus, string icon)
+ public PadCodon (PadContent content, string id, string label, string defaultPlacement, DockItemStatus defaultStatus, string icon)
{
this.id = id;
this.content = content;
@@ -157,10 +157,10 @@ namespace MonoDevelop.Ide.Codons
this.defaultStatus = defaultStatus;
}
- protected virtual IPadContent CreatePad ()
+ protected virtual PadContent CreatePad ()
{
Counters.PadsLoaded++;
- return (IPadContent) Addin.CreateInstance (className, true);
+ return (PadContent) Addin.CreateInstance (className, true);
}
PadUserPrefs preferences = null;
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Codons/SolutionPadCodon.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Codons/SolutionPadCodon.cs
index 634bbcc02f..4c1bd3c34a 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Codons/SolutionPadCodon.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Codons/SolutionPadCodon.cs
@@ -73,7 +73,7 @@ namespace MonoDevelop.Ide.Codons
options = (TreePadOption[]) ops.ToArray (typeof(TreePadOption));
}
- protected override IPadContent CreatePad ()
+ protected override PadContent CreatePad ()
{
if (builders == null)
BuildChildren ();
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Commands/EditCommands.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Commands/EditCommands.cs
index 19fc6f5e7f..a980d23841 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Commands/EditCommands.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Commands/EditCommands.cs
@@ -157,6 +157,15 @@ namespace MonoDevelop.Ide.Commands
{
protected override void Run ()
{
+ #if WIN32
+ var wintv = System.Windows.Input.Keyboard.FocusedElement;
+ var cmd = System.Windows.Input.ApplicationCommands.Copy;
+ if (wintv != null && cmd.CanExecute (null, wintv)) {
+ cmd.Execute (null, wintv);
+ return;
+ }
+ #endif
+
if (IdeApp.Workbench.RootWindow.HasToplevelFocus) {
Gtk.Editable editable = IdeApp.Workbench.RootWindow.Focus as Gtk.Editable;
if (editable != null) {
@@ -177,14 +186,6 @@ namespace MonoDevelop.Ide.Commands
}
#endif
}
-#if WIN32
- var wintv = System.Windows.Input.Keyboard.FocusedElement;
- var cmd = System.Windows.Input.ApplicationCommands.Copy;
- if (wintv != null && cmd.CanExecute (null, wintv)) {
- cmd.Execute (null, wintv);
- return;
- }
-#endif
}
protected override void Update (CommandInfo info)
@@ -207,6 +208,15 @@ namespace MonoDevelop.Ide.Commands
{
protected override void Run ()
{
+ #if WIN32
+ var wintv = System.Windows.Input.Keyboard.FocusedElement;
+ var cmd = System.Windows.Input.ApplicationCommands.Cut;
+ if (wintv != null && cmd.CanExecute(null, wintv)) {
+ cmd.Execute(null, wintv);
+ return;
+ }
+ #endif
+
if (IdeApp.Workbench.RootWindow.HasToplevelFocus) {
Gtk.Editable editable = IdeApp.Workbench.RootWindow.Focus as Gtk.Editable;
if (editable != null) {
@@ -226,15 +236,7 @@ namespace MonoDevelop.Ide.Commands
return;
}
#endif
- }
-#if WIN32
- var wintv = System.Windows.Input.Keyboard.FocusedElement;
- var cmd = System.Windows.Input.ApplicationCommands.Cut;
- if (wintv != null && cmd.CanExecute(null, wintv)) {
- cmd.Execute(null, wintv);
- return;
- }
-#endif
+ }
}
protected override void Update (CommandInfo info)
@@ -265,6 +267,14 @@ namespace MonoDevelop.Ide.Commands
{
protected override void Run ()
{
+ #if WIN32
+ var wintv = System.Windows.Input.Keyboard.FocusedElement;
+ var cmd = System.Windows.Input.ApplicationCommands.Paste;
+ if (wintv != null && cmd.CanExecute (null, wintv)) {
+ cmd.Execute (null, wintv);
+ return;
+ }
+ #endif
if (IdeApp.Workbench.RootWindow.HasToplevelFocus) {
Gtk.Editable editable = IdeApp.Workbench.RootWindow.Focus as Gtk.Editable;
if (editable != null) {
@@ -285,14 +295,6 @@ namespace MonoDevelop.Ide.Commands
}
#endif
}
-#if WIN32
- var wintv = System.Windows.Input.Keyboard.FocusedElement;
- var cmd = System.Windows.Input.ApplicationCommands.Paste;
- if (wintv != null && cmd.CanExecute (null, wintv)) {
- cmd.Execute (null, wintv);
- return;
- }
-#endif
}
protected override void Update (CommandInfo info)
@@ -342,6 +344,14 @@ namespace MonoDevelop.Ide.Commands
{
protected override void Run ()
{
+ #if WIN32
+ var wintv = System.Windows.Input.Keyboard.FocusedElement;
+ var cmd = System.Windows.Input.ApplicationCommands.SelectAll;
+ if (wintv != null && cmd.CanExecute (null, wintv)) {
+ cmd.Execute (null, wintv);
+ return;
+ }
+ #endif
if (IdeApp.Workbench.RootWindow.HasToplevelFocus) {
Gtk.Editable editable = IdeApp.Workbench.RootWindow.Focus as Gtk.Editable;
if (editable != null) {
@@ -361,14 +371,6 @@ namespace MonoDevelop.Ide.Commands
}
#endif
}
-#if WIN32
- var wintv = System.Windows.Input.Keyboard.FocusedElement;
- var cmd = System.Windows.Input.ApplicationCommands.SelectAll;
- if (wintv != null && cmd.CanExecute (null, wintv)) {
- cmd.Execute (null, wintv);
- return;
- }
-#endif
}
protected override void Update (CommandInfo info)
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Commands/FileTabCommands.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Commands/FileTabCommands.cs
index 20ace23f75..ae70c81ae8 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Commands/FileTabCommands.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Commands/FileTabCommands.cs
@@ -50,7 +50,7 @@ namespace MonoDevelop.Ide.Commands
class CloseAllHandler : CommandHandler
{
- protected virtual IViewContent GetDocumentException ()
+ protected virtual ViewContent GetDocumentException ()
{
return null;
}
@@ -86,7 +86,7 @@ namespace MonoDevelop.Ide.Commands
class CloseAllButThisHandler : CloseAllHandler
{
- protected override IViewContent GetDocumentException ()
+ protected override ViewContent GetDocumentException ()
{
var active = IdeApp.Workbench.ActiveDocument;
return active == null ? null : active.Window.ViewContent;
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Desktop/PlatformService.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Desktop/PlatformService.cs
index 2e66e750f7..1a4c3e94d6 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Desktop/PlatformService.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Desktop/PlatformService.cs
@@ -424,15 +424,23 @@ namespace MonoDevelop.Ide.Desktop
return new DesktopApplication[0];
}
- public virtual Gdk.Rectangle GetUsableMonitorGeometry (Gdk.Screen screen, int monitor)
+ public virtual Xwt.Rectangle GetUsableMonitorGeometry (int screenNumber, int monitorNumber)
{
- return screen.GetMonitorGeometry (monitor);
+ var screen = Gdk.Display.Default.GetScreen (screenNumber);
+ var rect = screen.GetMonitorGeometry (monitorNumber);
+
+ return new Xwt.Rectangle {
+ X = rect.X,
+ Y = rect.Y,
+ Width = rect.Width,
+ Height = rect.Height,
+ };
}
/// <summary>
/// Grab the desktop focus for the window.
/// </summary>
- public virtual void GrabDesktopFocus (Gtk.Window window)
+ internal virtual void GrabDesktopFocus (Gtk.Window window)
{
if (Platform.IsWindows && window.IsRealized) {
/* On Windows calling Present() will break out of window edge snapping mode. */
@@ -463,9 +471,9 @@ namespace MonoDevelop.Ide.Desktop
toolbarBox.PackStart ((MainToolbar)toolbar, true, true, 0);
}
- public virtual bool GetIsFullscreen (Gtk.Window window)
+ public virtual bool GetIsFullscreen (Window window)
{
- return ((bool?) window.Data ["isFullScreen"]) ?? false;
+ return ((bool?) window.GetNativeWidget <Gtk.Window> ().Data ["isFullScreen"]) ?? false;
}
public virtual bool IsModalDialogRunning ()
@@ -474,26 +482,27 @@ namespace MonoDevelop.Ide.Desktop
return windows.Any (w => w.Modal && w.Visible);
}
- public virtual void SetIsFullscreen (Gtk.Window window, bool isFullscreen)
+ public virtual void SetIsFullscreen (Window window, bool isFullscreen)
{
- window.Data ["isFullScreen"] = isFullscreen;
+ Gtk.Window windowControl = window;
+ windowControl.Data ["isFullScreen"] = isFullscreen;
if (isFullscreen) {
- window.Fullscreen ();
+ windowControl.Fullscreen ();
} else {
- window.Unfullscreen ();
- SetMainWindowDecorations (window);
+ windowControl.Unfullscreen ();
+ SetMainWindowDecorations (windowControl);
}
}
- public virtual void AddChildWindow (Gtk.Window parent, Gtk.Window child)
+ internal virtual void AddChildWindow (Gtk.Window parent, Gtk.Window child)
{
}
- public virtual void RemoveChildWindow (Gtk.Window parent, Gtk.Window child)
+ internal virtual void RemoveChildWindow (Gtk.Window parent, Gtk.Window child)
{
}
- public virtual void PlaceWindow (Gtk.Window window, int x, int y, int width, int height)
+ internal virtual void PlaceWindow (Gtk.Window window, int x, int y, int width, int height)
{
window.Move (x, y);
window.Resize (width, height);
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Extension/AbstractNavigationExtension.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Extension/AbstractNavigationExtension.cs
index 33c015e4a7..3df2ccee30 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Extension/AbstractNavigationExtension.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Extension/AbstractNavigationExtension.cs
@@ -24,13 +24,187 @@
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
using System;
+using System.Collections;
+using System.Collections.Generic;
+using System.Threading.Tasks;
+using ICSharpCode.NRefactory.Editor;
+using System.Threading;
+using MonoDevelop.Core;
+
namespace MonoDevelop.Ide.Editor.Extension
{
- public class AbstractNavigationExtension
+ public abstract class AbstractNavigationExtension : TextEditorExtension
{
- public AbstractNavigationExtension ()
+ uint timerId;
+
+ #region Key handling
+ static bool linksShown;
+
+ static bool LinksShown {
+ get {
+ return linksShown;
+ }
+ set {
+ if (value == linksShown)
+ return;
+ linksShown = value;
+ OnLinksShownChanged (EventArgs.Empty);
+ }
+ }
+
+ static void OnLinksShownChanged (EventArgs e)
{
+ LinksShownChanged?.Invoke (null, e);
}
- }
-}
+ public static event EventHandler LinksShownChanged;
+
+ static uint snooperId;
+
+
+ public class NavigationSegment : ISegment
+ {
+ public int Offset { get; private set; }
+
+ public int Length { get; private set; }
+
+ public int EndOffset {
+ get {
+ return Offset + Length;
+ }
+ }
+
+ public Action Activate { get; private set; }
+
+ public NavigationSegment (int offset, int length, System.Action activate)
+ {
+ this.Offset = offset;
+ this.Length = length;
+ this.Activate = activate;
+ }
+ }
+
+ static AbstractNavigationExtension ()
+ {
+ snooperId = Gtk.Key.SnooperInstall (TooltipKeySnooper);
+ //if (snooperId != 0)
+ // Gtk.Key.SnooperRemove (snooperId);
+ }
+
+
+ static int TooltipKeySnooper (Gtk.Widget widget, Gdk.EventKey evnt)
+ {
+ if (evnt != null && evnt.Type == Gdk.EventType.KeyPress) {
+ LinksShown = IsTriggerKey (evnt);
+ }
+ if (evnt != null && evnt.Type == Gdk.EventType.KeyRelease && IsTriggerKey (evnt)) {
+ LinksShown = false;
+ }
+ return 0; //FALSE
+ }
+
+ static bool IsTriggerKey (Gdk.EventKey evnt)
+ {
+ #if MAC
+ return evnt.Key == Gdk.Key.Meta_L || evnt.Key == Gdk.Key.Meta_R;
+ #else
+ return evnt.Key == Gdk.Key.Control_L || evnt.Key == Gdk.Key.Control_R;
+ #endif
+ }
+ #endregion
+
+ #region Extension API
+
+ protected abstract Task<IEnumerable<NavigationSegment>> RequestLinksAsync (int offset, int length, CancellationToken token);
+
+ #endregion
+
+ protected override void Initialize ()
+ {
+ LinksShownChanged += AbstractNavigationExtension_LinksShownChanged;
+ this.DocumentContext.DocumentParsed += DocumentContext_DocumentParsed;
+ this.Editor.LineShown += Editor_LineShown;
+ if (LinksShown)
+ ShowLinks ();
+ }
+
+ void AbstractNavigationExtension_LinksShownChanged (object sender, EventArgs e)
+ {
+ RemoveTimer ();
+ if (LinksShown) {
+ timerId = GLib.Timeout.Add (250, delegate {
+ timerId = 0;
+ ShowLinks ();
+ return false;
+ });
+ } else {
+ HideLinks ();
+ }
+ }
+
+ void DocumentContext_DocumentParsed (object sender, EventArgs e)
+ {
+ if (LinksShown)
+ ShowLinks ();
+ }
+
+ List<ITextSegmentMarker> markers = new List<ITextSegmentMarker> ();
+
+ async void ShowLinks ()
+ {
+ HideLinks ();
+ try {
+ foreach (var line in Editor.VisibleLines) {
+ if (line.Length <= 0)
+ continue;
+ foreach (var segment in await RequestLinksAsync (line.Offset, line.Length, default (CancellationToken))) {
+ var marker = Editor.TextMarkerFactory.CreateLinkMarker (Editor, segment.Offset, segment.Length, delegate { segment.Activate (); });
+ marker.OnlyShowLinkOnHover = true;
+ Editor.AddMarker (marker);
+ markers.Add (marker);
+ }
+ }
+ } catch (Exception e) {
+ LoggingService.LogError ("Error while retrieving nav links.", e);
+ }
+ }
+
+ async void Editor_LineShown (object sender, Ide.Editor.LineEventArgs e)
+ {
+ if (LinksShown) {
+ var line = e.Line;
+ foreach (var segment in await RequestLinksAsync (line.Offset, line.Length, default (CancellationToken))) {
+ var marker = Editor.TextMarkerFactory.CreateLinkMarker (Editor, segment.Offset, segment.Length, delegate { segment.Activate (); });
+ marker.OnlyShowLinkOnHover = true;
+ Editor.AddMarker (marker);
+ markers.Add (marker);
+ }
+ }
+ }
+
+ void HideLinks ()
+ {
+ foreach (var m in markers) {
+ Editor.RemoveMarker (m);
+ }
+ markers.Clear ();
+ }
+
+ void RemoveTimer ()
+ {
+ if (timerId != 0)
+ GLib.Source.Remove (timerId);
+ }
+
+ public override void Dispose ()
+ {
+ LinksShownChanged -= AbstractNavigationExtension_LinksShownChanged;
+ DocumentContext.DocumentParsed -= DocumentContext_DocumentParsed;
+ Editor.LineShown -= Editor_LineShown;
+ HideLinks ();
+ RemoveTimer ();
+ base.Dispose ();
+ }
+
+ }
+} \ No newline at end of file
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Extension/AbstractUsagesExtension.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Extension/AbstractUsagesExtension.cs
index 3c80bf6d19..8b2544d82f 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Extension/AbstractUsagesExtension.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Extension/AbstractUsagesExtension.cs
@@ -150,6 +150,7 @@ namespace MonoDevelop.Ide.Editor.Extension
});
}
+ } catch (OperationCanceledException) {
} catch (Exception e) {
LoggingService.LogError ("Unhandled Exception in HighlightingUsagesExtension", e);
} finally {
@@ -174,7 +175,7 @@ namespace MonoDevelop.Ide.Editor.Extension
RemoveMarkers ();
RemoveTimer ();
if (!Editor.IsSomethingSelected)
- popupTimer = GLib.Timeout.Add (1000, () => { DelayedTooltipShow (); return false; } );
+ popupTimer = GLib.Timeout.Add (250, () => { DelayedTooltipShow (); return false; } );
}
void ClearQuickTasks ()
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Extension/TextEditorExtension.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Extension/TextEditorExtension.cs
index 5b3c86c311..a6b4cf594c 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Extension/TextEditorExtension.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Extension/TextEditorExtension.cs
@@ -30,6 +30,8 @@ using MonoDevelop.Core;
using MonoDevelop.Ide.Editor;
using MonoDevelop.Ide.Gui;
using MonoDevelop.Ide.TypeSystem;
+using System.Collections;
+using System.Collections.Generic;
namespace MonoDevelop.Ide.Editor.Extension
{
@@ -97,6 +99,21 @@ namespace MonoDevelop.Ide.Editor.Extension
{
return Next;
}
+
+ internal protected virtual object OnGetContent (Type type)
+ {
+ if (type.IsInstanceOfType (this))
+ return this;
+ else
+ return null;
+ }
+
+ internal protected virtual IEnumerable<object> OnGetContents (Type type)
+ {
+ var c = OnGetContent (type);
+ if (c != null)
+ yield return c;
+ }
}
class TextEditorExtensionMarker : TextEditorExtension
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Highlighting/ColorScheme.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Highlighting/ColorScheme.cs
index beebcb8216..48cff66ce5 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Highlighting/ColorScheme.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Highlighting/ColorScheme.cs
@@ -202,6 +202,11 @@ namespace MonoDevelop.Ide.Editor.Highlighting
[ColorDescription("Message Bubble Warning IconMargin")]
public AmbientColor MessageBubbleWarningIconMargin { get; private set; }
+ [ColorDescription("Link Color")]
+ public AmbientColor LinkColor { get; private set; }
+
+ [ColorDescription("Link Color(Active)")]
+ public AmbientColor ActiveLinkColor { get; private set; }
#endregion
#region Text Colors
@@ -627,6 +632,25 @@ namespace MonoDevelop.Ide.Editor.Highlighting
[ColorDescription(ScriptStringKey, VSSetting="Script String")]
public ChunkStyle ScriptString { get; private set; }
+ public const string RegexSetConstructsKey = "String(Regex Set Constructs)";
+ [ColorDescription(RegexSetConstructsKey)]
+ public ChunkStyle RegexSetConstructs { get; private set; }
+
+ public const string RegexCharacterClassKey = "String(Regex Character Class)";
+ [ColorDescription(RegexCharacterClassKey)]
+ public ChunkStyle RegexCharacterClass { get; private set; }
+
+ public const string RegexGroupingConstructsKey = "String(Regex Grouping Constructs)";
+ [ColorDescription(RegexGroupingConstructsKey)]
+ public ChunkStyle RegexGroupingConstructs { get; private set; }
+
+ public const string RegexEscapeCharacterKey = "String(Regex Escape Character)";
+ [ColorDescription(RegexEscapeCharacterKey)]
+ public ChunkStyle RegexEscapeCharacter { get; private set; }
+
+ public const string RegexAltEscapeCharacterKey = "String(Regex Alt Escape Character)";
+ [ColorDescription(RegexAltEscapeCharacterKey)]
+ public ChunkStyle RegexAltEscapeCharacter { get; private set; }
#endregion
internal class PropertyDecsription
@@ -656,7 +680,6 @@ namespace MonoDevelop.Ide.Editor.Highlighting
return ambientColors.Values;
}
}
-
static ColorScheme ()
{
foreach (var property in typeof(ColorScheme).GetProperties ()) {
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/DefaultSourceEditorOptions.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/DefaultSourceEditorOptions.cs
index 68b9808a11..64915e042e 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/DefaultSourceEditorOptions.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/DefaultSourceEditorOptions.cs
@@ -387,7 +387,7 @@ namespace MonoDevelop.Ide.Editor
}
}
- ConfigurationProperty<LineEndingConversion> lineEndingConversion = ConfigurationProperty.Create("LineEndingConversion", LineEndingConversion.Ask);
+ ConfigurationProperty<LineEndingConversion> lineEndingConversion = ConfigurationProperty.Create("LineEndingConversion", LineEndingConversion.LeaveAsIs);
public LineEndingConversion LineEndingConversion {
get {
return lineEndingConversion;
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/ITextSegmentMarker.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/ITextSegmentMarker.cs
index 954980f1ef..e1f797135b 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/ITextSegmentMarker.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/ITextSegmentMarker.cs
@@ -80,10 +80,13 @@ namespace MonoDevelop.Ide.Editor
{
bool IsInsideSmartTag (double x, double y);
- bool IsInsideWindow (Gtk.MotionNotifyEventArgs args);
-
event EventHandler ShowPopup;
event EventHandler CancelPopup;
}
+
+ public interface ILinkTextMarker : ITextSegmentMarker
+ {
+ bool OnlyShowLinkOnHover { get; set; }
+ }
}
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/InternalExtensionAPI/ITextEditorImpl.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/InternalExtensionAPI/ITextEditorImpl.cs
index e489b7d0e7..89d74ad7fc 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/InternalExtensionAPI/ITextEditorImpl.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/InternalExtensionAPI/ITextEditorImpl.cs
@@ -78,8 +78,12 @@ namespace MonoDevelop.Ide.Editor
}
}
- interface ITextEditorImpl : IViewContent, IDisposable
+ interface ITextEditorImpl : IDisposable
{
+ ViewContent ViewContent { get; }
+
+ string ContentName { get; set; }
+
EditMode EditMode { get; }
ITextEditorOptions Options { get; set; }
@@ -243,5 +247,8 @@ namespace MonoDevelop.Ide.Editor
void AddOverlay (Control messageOverlayContent, Func<int> sizeFunc);
void RemoveOverlay (Control messageOverlayContent);
void UpdateBraceMatchingResult (BraceMatchingResult? result);
+
+ IEnumerable<IDocumentLine> VisibleLines { get; }
+ event EventHandler<LineEventArgs> LineShown;
}
} \ No newline at end of file
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/InternalExtensionAPI/ITextMarkerFactory.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/InternalExtensionAPI/ITextMarkerFactory.cs
index 8c674cd425..68f0ac8651 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/InternalExtensionAPI/ITextMarkerFactory.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/InternalExtensionAPI/ITextMarkerFactory.cs
@@ -48,7 +48,7 @@ namespace MonoDevelop.Ide.Editor
#region Segment marker
ITextSegmentMarker CreateUsageMarker (TextEditor editor, Usage usage);
- ITextSegmentMarker CreateLinkMarker (TextEditor editor, int offset, int length, Action<LinkRequest> activateLink);
+ ILinkTextMarker CreateLinkMarker (TextEditor editor, int offset, int length, Action<LinkRequest> activateLink);
IGenericTextSegmentMarker CreateGenericTextSegmentMarker (TextEditor editor, TextSegmentMarkerEffect effect, int offset, int length);
ISmartTagMarker CreateSmartTagMarker (TextEditor editor, int offset, DocumentLocation realLocation);
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/Projection/ProjectedTooltipProvider.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/Projection/ProjectedTooltipProvider.cs
index 15b92336f2..322f33f984 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/Projection/ProjectedTooltipProvider.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/Projection/ProjectedTooltipProvider.cs
@@ -35,12 +35,8 @@ namespace MonoDevelop.Ide.Editor.Projection
readonly Projection projection;
readonly TooltipProvider projectedTooltipProvider;
- public ProjectedTooltipProvider (TextEditor editor, DocumentContext ctx, Projection projection, TooltipProvider projectedTooltipProvider)
+ public ProjectedTooltipProvider (Projection projection, TooltipProvider projectedTooltipProvider)
{
- if (editor == null)
- throw new ArgumentNullException ("editor");
- if (ctx == null)
- throw new ArgumentNullException ("ctx");
if (projection == null)
throw new ArgumentNullException ("projection");
if (projectedTooltipProvider == null)
@@ -68,7 +64,7 @@ namespace MonoDevelop.Ide.Editor.Projection
return projectedTooltipProvider.IsInteractive (editor, tipWindow);
}
- public override void ShowTooltipWindow (TextEditor editor, Control tipWindow, TooltipItem item, Gdk.ModifierType modifierState, int mouseX, int mouseY)
+ public override void ShowTooltipWindow (TextEditor editor, Control tipWindow, TooltipItem item, Xwt.ModifierKeys modifierState, int mouseX, int mouseY)
{
projectedTooltipProvider.ShowTooltipWindow (editor, tipWindow, item, modifierState, mouseX, mouseY);
}
@@ -78,7 +74,7 @@ namespace MonoDevelop.Ide.Editor.Projection
projectedTooltipProvider.GetRequiredPosition (editor, tipWindow, out requiredWidth, out xalign);
}
- public override Control CreateTooltipWindow (TextEditor editor, DocumentContext ctx, TooltipItem item, int offset, Gdk.ModifierType modifierState)
+ public override Control CreateTooltipWindow (TextEditor editor, DocumentContext ctx, TooltipItem item, int offset, Xwt.ModifierKeys modifierState)
{
foreach (var pseg in projection.ProjectedSegments) {
if (pseg.ContainsOriginal (offset)) {
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/TextEditor.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/TextEditor.cs
index 06f0a3ed49..3631e25186 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/TextEditor.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/TextEditor.cs
@@ -996,7 +996,7 @@ namespace MonoDevelop.Ide.Editor
}
TextEditorViewContent viewContent;
- internal IViewContent GetViewContent ()
+ internal ViewContent GetViewContent ()
{
if (viewContent == null) {
viewContent = new TextEditorViewContent (this, textEditorImpl);
@@ -1130,32 +1130,37 @@ namespace MonoDevelop.Ide.Editor
public T GetContent<T>() where T : class
{
+ return GetContents<T> ().FirstOrDefault ();
+ }
+
+ public IEnumerable<T> GetContents<T>() where T : class
+ {
T result = textEditorImpl as T;
if (result != null)
- return result;
+ yield return result;
var ext = textEditorImpl.EditorExtension;
while (ext != null) {
result = ext as T;
if (result != null)
- return result;
+ yield return result;
ext = ext.Next;
}
- return null;
}
- public IEnumerable<T> GetContents<T>() where T : class
+ public IEnumerable<object> GetContents (Type type)
{
- T result = textEditorImpl as T;
- if (result != null)
- yield return result;
+ var res = Enumerable.Empty<object> ();
+ if (type.IsInstanceOfType (textEditorImpl))
+ res = res.Concat (textEditorImpl);
+
var ext = textEditorImpl.EditorExtension;
while (ext != null) {
- result = ext as T;
- if (result != null)
- yield return result;
+ res = res.Concat (ext.OnGetContents (type));
ext = ext.Next;
}
+ return res;
}
+
#endregion
public string GetPangoMarkup (int offset, int length)
@@ -1329,7 +1334,7 @@ namespace MonoDevelop.Ide.Editor
foreach (var tp in projection.ProjectedEditor.allProviders) {
if (!tp.IsValidFor (projection.ProjectedEditor.MimeType))
continue;
- var newProvider = new ProjectedTooltipProvider (this, ctx, projection, (TooltipProvider)tp.CreateInstance ());
+ var newProvider = new ProjectedTooltipProvider (projection, (TooltipProvider)tp.CreateInstance ());
projectedProviders.Add (newProvider);
textEditorImpl.AddTooltipProvider (newProvider);
}
@@ -1400,5 +1405,9 @@ namespace MonoDevelop.Ide.Editor
Runtime.AssertMainThread ();
textEditorImpl.UpdateBraceMatchingResult (result);
}
+
+
+ internal IEnumerable<IDocumentLine> VisibleLines { get { return textEditorImpl.VisibleLines; } }
+ internal event EventHandler<LineEventArgs> LineShown { add { textEditorImpl.LineShown += value; } remove { textEditorImpl.LineShown -= value; } }
}
} \ No newline at end of file
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/TextEditorDisplayBinding.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/TextEditorDisplayBinding.cs
index 1fe76c43a0..5c626bbdab 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/TextEditorDisplayBinding.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/TextEditorDisplayBinding.cs
@@ -93,7 +93,7 @@ namespace MonoDevelop.Ide.Editor
return false;
}
- public IViewContent CreateContent (FilePath fileName, string mimeType, Project ownerProject)
+ public ViewContent CreateContent (FilePath fileName, string mimeType, Project ownerProject)
{
var editor = TextEditorFactory.CreateNewEditor ();
editor.MimeType = mimeType;
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/TextEditorViewContent.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/TextEditorViewContent.cs
index abbb316157..66c01967b0 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/TextEditorViewContent.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/TextEditorViewContent.cs
@@ -1,4 +1,4 @@
-//
+//
// TextEditorViewContent.cs
//
// Author:
@@ -52,10 +52,10 @@ using System.Collections.Immutable;
namespace MonoDevelop.Ide.Editor
{
/// <summary>
- /// The TextEditor object needs to be available through IBaseViewContent.GetContent therefore we need to insert a
+ /// The TextEditor object needs to be available through BaseViewContent.GetContent therefore we need to insert a
/// decorator in between.
/// </summary>
- class TextEditorViewContent : IViewContent, ICommandRouter, IQuickTaskProvider
+ class TextEditorViewContent : ViewContent, ICommandRouter, IQuickTaskProvider
{
readonly TextEditor textEditor;
readonly ITextEditorImpl textEditorImpl;
@@ -66,9 +66,9 @@ namespace MonoDevelop.Ide.Editor
public TextEditorViewContent (TextEditor textEditor, ITextEditorImpl textEditorImpl)
{
if (textEditor == null)
- throw new ArgumentNullException ("textEditor");
+ throw new ArgumentNullException (nameof (textEditor));
if (textEditorImpl == null)
- throw new ArgumentNullException ("textEditorImpl");
+ throw new ArgumentNullException (nameof (textEditorImpl));
this.textEditor = textEditor;
this.textEditorImpl = textEditorImpl;
this.textEditor.MimeTypeChanged += UpdateTextEditorOptions;
@@ -86,6 +86,7 @@ namespace MonoDevelop.Ide.Editor
void HandleDirtyChanged (object sender, EventArgs e)
{
+ IsDirty = textEditorImpl.ViewContent.IsDirty;
InformAutoSave ();
}
@@ -110,7 +111,7 @@ namespace MonoDevelop.Ide.Editor
if (autoSaveTask != null && !autoSaveTask.IsCompleted)
return false;
- autoSaveTask = AutoSave.InformAutoSaveThread (textEditor.CreateSnapshot (), textEditor.FileName, textEditorImpl.IsDirty);
+ autoSaveTask = AutoSave.InformAutoSaveThread (textEditor.CreateSnapshot (), textEditor.FileName, IsDirty);
autoSaveTimer = 0;
return false;
});
@@ -163,11 +164,11 @@ namespace MonoDevelop.Ide.Editor
CancelDocumentParsedUpdate ();
var token = src.Token;
var caretLocation = textEditor.CaretLocation;
- Task.Run (() => {
+ Task.Run (async () => {
try {
- UpdateErrorUndelines (ctx, ctx.ParsedDocument, token);
- UpdateQuickTasks (ctx, ctx.ParsedDocument, token);
- UpdateFoldings (ctx.ParsedDocument, caretLocation, false, token);
+ await UpdateErrorUndelines (ctx, ctx.ParsedDocument, token);
+ await UpdateQuickTasks (ctx, ctx.ParsedDocument, token);
+ await UpdateFoldings (ctx.ParsedDocument, caretLocation, false, token);
} catch (OperationCanceledException) {
// ignore
}
@@ -230,7 +231,7 @@ namespace MonoDevelop.Ide.Editor
"CS1513" // } expected
};
- async void UpdateErrorUndelines (DocumentContext ctx, ParsedDocument parsedDocument, CancellationToken token)
+ async Task UpdateErrorUndelines (DocumentContext ctx, ParsedDocument parsedDocument, CancellationToken token)
{
if (!DefaultSourceEditorOptions.Instance.UnderlineErrors || parsedDocument == null || isDisposed)
return;
@@ -265,7 +266,7 @@ namespace MonoDevelop.Ide.Editor
}
#endregion
CancellationTokenSource src = new CancellationTokenSource ();
- void UpdateFoldings (ParsedDocument parsedDocument, DocumentLocation caretLocation, bool firstTime = false, CancellationToken token = default (CancellationToken))
+ async Task UpdateFoldings (ParsedDocument parsedDocument, DocumentLocation caretLocation, bool firstTime = false, CancellationToken token = default (CancellationToken))
{
if (parsedDocument == null || !textEditor.Options.ShowFoldMargin || isDisposed)
return;
@@ -276,7 +277,7 @@ namespace MonoDevelop.Ide.Editor
try {
var foldSegments = new List<IFoldSegment> ();
- foreach (FoldingRegion region in parsedDocument.GetFoldingsAsync(token).Result) {
+ foreach (FoldingRegion region in await parsedDocument.GetFoldingsAsync(token)) {
if (token.IsCancellationRequested)
return;
var type = FoldingType.Unknown;
@@ -338,7 +339,7 @@ namespace MonoDevelop.Ide.Editor
}
}
- void RunFirstTimeFoldUpdate (string text)
+ async Task RunFirstTimeFoldUpdate (string text)
{
if (string.IsNullOrEmpty (text))
return;
@@ -350,267 +351,125 @@ namespace MonoDevelop.Ide.Editor
} else {
var normalParser = TypeSystemService.GetParser (textEditor.MimeType);
if (normalParser != null) {
- parsedDocument = normalParser.Parse(
+ parsedDocument = await normalParser.Parse(
new MonoDevelop.Ide.TypeSystem.ParseOptions {
FileName = textEditor.FileName,
Content = new StringTextSource(text),
Project = Project
- }).Result;
+ });
}
}
if (parsedDocument != null) {
- UpdateFoldings (parsedDocument, textEditor.CaretLocation, true);
+ await UpdateFoldings (parsedDocument, textEditor.CaretLocation, true);
}
}
-
- #region IViewFContent implementation
-
- event EventHandler IViewContent.ContentNameChanged {
- add {
- textEditorImpl.ContentNameChanged += value;
- }
- remove {
- textEditorImpl.ContentNameChanged -= value;
- }
+ protected override void OnContentNameChanged ()
+ {
+ base.OnContentNameChanged ();
+ textEditorImpl.ContentName = ContentName;
}
- event EventHandler IViewContent.ContentChanged {
- add {
- textEditorImpl.ContentChanged += value;
- }
- remove {
- textEditorImpl.ContentChanged -= value;
- }
- }
- event EventHandler IViewContent.DirtyChanged {
- add {
- textEditorImpl.DirtyChanged += value;
- }
- remove {
- textEditorImpl.DirtyChanged -= value;
- }
- }
-
- event EventHandler IViewContent.BeforeSave {
- add {
- textEditorImpl.BeforeSave += value;
- }
- remove {
- textEditorImpl.BeforeSave -= value;
- }
- }
+ #region IViewFContent implementation
- void IViewContent.Load (FileOpenInformation fileOpenInformation)
+ public override async Task Load (FileOpenInformation fileOpenInformation)
{
- this.textEditorImpl.DirtyChanged -= HandleDirtyChanged;
- this.textEditor.TextChanged -= HandleTextChanged;
- textEditorImpl.Load (fileOpenInformation);
- RunFirstTimeFoldUpdate (textEditor.Text);
- textEditorImpl.InformLoadComplete ();
- this.textEditor.TextChanged += HandleTextChanged;
- this.textEditorImpl.DirtyChanged += HandleDirtyChanged;
- }
-
- void IViewContent.Load (string fileName)
- {
- this.textEditorImpl.DirtyChanged -= HandleDirtyChanged;
- this.textEditor.TextChanged -= HandleTextChanged;
- textEditorImpl.Load (new FileOpenInformation (fileName));
- RunFirstTimeFoldUpdate (textEditor.Text);
+ textEditorImpl.ViewContent.DirtyChanged -= HandleDirtyChanged;
+ textEditor.TextChanged -= HandleTextChanged;
+ await textEditorImpl.ViewContent.Load (fileOpenInformation);
+ await RunFirstTimeFoldUpdate (textEditor.Text);
textEditorImpl.InformLoadComplete ();
- this.textEditor.TextChanged += HandleTextChanged;
- this.textEditorImpl.DirtyChanged += HandleDirtyChanged;
+ textEditor.TextChanged += HandleTextChanged;
+ textEditorImpl.ViewContent.DirtyChanged += HandleDirtyChanged;
}
- void IViewContent.LoadNew (System.IO.Stream content, string mimeType)
+ public override async Task LoadNew (Stream content, string mimeType)
{
textEditor.MimeType = mimeType;
string text = null;
if (content != null) {
- Encoding encoding;
- bool hadBom;
- text = TextFileUtility.GetText (content, out encoding, out hadBom);
- textEditor.Text = text;
- textEditor.Encoding = encoding;
- textEditor.UseBOM = hadBom;
+ var res = await TextFileUtility.GetTextAsync (content);
+ text = textEditor.Text = res.Text;
+ textEditor.Encoding = res.Encoding;
+ textEditor.UseBOM = res.HasBom;
}
- RunFirstTimeFoldUpdate (text);
+ await RunFirstTimeFoldUpdate (text);
textEditorImpl.InformLoadComplete ();
}
- void IViewContent.Save (FileSaveInformation fileSaveInformation)
+ public override Task Save (FileSaveInformation fileSaveInformation)
{
if (!string.IsNullOrEmpty (fileSaveInformation.FileName))
AutoSave.RemoveAutoSaveFile (fileSaveInformation.FileName);
- textEditorImpl.Save (fileSaveInformation);
+ return textEditorImpl.ViewContent.Save (fileSaveInformation);
}
- void IViewContent.Save (string fileName)
- {
- if (!string.IsNullOrEmpty (fileName))
- AutoSave.RemoveAutoSaveFile (fileName);
- textEditorImpl.Save (new FileSaveInformation (fileName));
- }
-
- void IViewContent.Save ()
+ public override Task Save ()
{
if (!string.IsNullOrEmpty (textEditorImpl.ContentName))
AutoSave.RemoveAutoSaveFile (textEditorImpl.ContentName);
- textEditorImpl.Save ();
+ return textEditorImpl.ViewContent.Save ();
}
- void IViewContent.DiscardChanges ()
+ public override void DiscardChanges ()
{
if (autoSaveTask != null)
autoSaveTask.Wait (TimeSpan.FromSeconds (5));
RemoveAutoSaveTimer ();
if (!string.IsNullOrEmpty (textEditorImpl.ContentName))
AutoSave.RemoveAutoSaveFile (textEditorImpl.ContentName);
- textEditorImpl.DiscardChanges ();
- }
-
- public MonoDevelop.Projects.Project Project {
- get {
- return textEditorImpl.Project;
- }
- set {
- textEditorImpl.Project = value;
- UpdateTextEditorOptions (null, null);
- }
- }
-
- string IViewContent.PathRelativeToProject {
- get {
- return textEditorImpl.PathRelativeToProject;
- }
+ textEditorImpl.ViewContent.DiscardChanges ();
}
- string IViewContent.ContentName {
- get {
- return textEditorImpl.ContentName;
- }
- set {
- textEditorImpl.ContentName = value;
- }
- }
-
- string IViewContent.UntitledName {
- get {
- return textEditorImpl.UntitledName;
- }
- set {
- textEditorImpl.UntitledName = value;
- }
- }
-
- string IViewContent.StockIconId {
- get {
- return textEditorImpl.StockIconId;
- }
- }
-
- bool IViewContent.IsUntitled {
- get {
- return textEditorImpl.IsUntitled;
- }
- }
-
- bool IViewContent.IsViewOnly {
- get {
- return textEditorImpl.IsViewOnly;
- }
- }
-
- bool IViewContent.IsFile {
- get {
- return textEditorImpl.IsFile;
- }
- }
-
- bool IViewContent.IsDirty {
- get {
- return textEditorImpl.IsDirty;
- }
- set {
- textEditorImpl.IsDirty = value;
- }
+ protected override void OnSetProject (MonoDevelop.Projects.Project project)
+ {
+ base.OnSetProject (project);
+ textEditorImpl.ViewContent.Project = project;
+ UpdateTextEditorOptions (null, null);
}
- bool IViewContent.IsReadOnly {
+ public override ProjectReloadCapability ProjectReloadCapability {
get {
- return textEditorImpl.IsReadOnly;
+ return textEditorImpl.ViewContent.ProjectReloadCapability;
}
}
#endregion
- #region IBaseViewContent implementation
- object IBaseViewContent.GetContent (Type type)
- {
- if (type.IsAssignableFrom (typeof(TextEditor)))
- return textEditor;
- var ext = textEditorImpl.EditorExtension;
- while (ext != null) {
- if (type.IsInstanceOfType (ext))
- return ext;
- ext = ext.Next;
- }
- return textEditorImpl.GetContent (type);
- }
+ #region BaseViewContent implementation
- public virtual IEnumerable<T> GetContents<T> () where T : class
+ protected override IEnumerable<object> OnGetContents (Type type)
{
- if (typeof(T) == typeof(TextEditor)) {
- yield return (T)(object)textEditor;
- yield break;
- }
- var result = this as T;
- if (result != null) {
- yield return result;
- }
+ var res = base.OnGetContents (type);
+
+ if (type == typeof (TextEditor))
+ return res.Concat (textEditor);
+
var ext = textEditorImpl.EditorExtension;
while (ext != null) {
- result = ext as T;
- if (result != null) {
- yield return result;
- }
+ res = res.Concat (ext.OnGetContents (type));
ext = ext.Next;
}
- foreach (var cnt in textEditorImpl.GetContents<T> ()) {
- yield return cnt;
- }
+ res = res.Concat (textEditorImpl.ViewContent.GetContents (type));
+ return res;
}
- bool IBaseViewContent.CanReuseView (string fileName)
+ protected override void OnWorkbenchWindowChanged ()
{
- return textEditorImpl.CanReuseView (fileName);
+ base.OnWorkbenchWindowChanged ();
+ textEditorImpl.ViewContent.WorkbenchWindow = WorkbenchWindow;
}
- void IBaseViewContent.RedrawContent ()
- {
- textEditorImpl.RedrawContent ();
- }
-
- IWorkbenchWindow IBaseViewContent.WorkbenchWindow {
- get {
- return textEditorImpl.WorkbenchWindow;
- }
- set {
- textEditorImpl.WorkbenchWindow = value;
- }
- }
-
- Gtk.Widget IBaseViewContent.Control {
+ public override Control Control {
get {
return textEditor;
}
}
- string IBaseViewContent.TabPageLabel {
+ public override string TabPageLabel {
get {
- return textEditorImpl.TabPageLabel;
+ return textEditorImpl.ViewContent.TabPageLabel;
}
}
@@ -618,13 +477,17 @@ namespace MonoDevelop.Ide.Editor
#region IDisposable implementation
bool isDisposed;
- void IDisposable.Dispose ()
+
+ public override void Dispose ()
{
if (isDisposed)
return;
+
+ base.Dispose ();
+
isDisposed = true;
CancelDocumentParsedUpdate ();
- textEditorImpl.DirtyChanged -= HandleDirtyChanged;
+ textEditorImpl.ViewContent.DirtyChanged -= HandleDirtyChanged;
textEditor.MimeTypeChanged -= UpdateTextEditorOptions;
textEditor.TextChanged -= HandleTextChanged;
textEditor.DocumentContextChanged -= HandleDocumentContextChanged;
@@ -903,7 +766,7 @@ namespace MonoDevelop.Ide.Editor
}
}
- async void UpdateQuickTasks (DocumentContext ctx, ParsedDocument doc, CancellationToken token)
+ async Task UpdateQuickTasks (DocumentContext ctx, ParsedDocument doc, CancellationToken token)
{
if (isDisposed)
return;
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/TextMarkerFactory.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/TextMarkerFactory.cs
index 09cc6680c8..0a1530f5a1 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/TextMarkerFactory.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/TextMarkerFactory.cs
@@ -71,12 +71,12 @@ namespace MonoDevelop.Ide.Editor
return editor.TextMarkerFactory.CreateUsageMarker (editor, usage);
}
- public static ITextSegmentMarker CreateLinkMarker (TextEditor editor, int offset, int length, Action<LinkRequest> activateLink)
+ public static ILinkTextMarker CreateLinkMarker (TextEditor editor, int offset, int length, Action<LinkRequest> activateLink)
{
return editor.TextMarkerFactory.CreateLinkMarker (editor, offset, length, activateLink);
}
- public static ITextSegmentMarker CreateLinkMarker (TextEditor editor, ISegment segment, Action<LinkRequest> activateLink)
+ public static ILinkTextMarker CreateLinkMarker (TextEditor editor, ISegment segment, Action<LinkRequest> activateLink)
{
if (segment == null)
throw new ArgumentNullException ("segment");
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/TooltipProvider.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/TooltipProvider.cs
index 0ab178ea0c..259bad2056 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/TooltipProvider.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/TooltipProvider.cs
@@ -100,7 +100,7 @@ namespace MonoDevelop.Ide.Editor
xalign = 0.5;
}
- public virtual Control CreateTooltipWindow (TextEditor editor, DocumentContext ctx, TooltipItem item, int offset, Gdk.ModifierType modifierState)
+ public virtual Control CreateTooltipWindow (TextEditor editor, DocumentContext ctx, TooltipItem item, int offset, Xwt.ModifierKeys modifierState)
{
return null;
}
@@ -110,7 +110,7 @@ namespace MonoDevelop.Ide.Editor
return editor.GetContent<ITextEditorImpl> ().GetEditorAllocation ();
}
- void ShowTipInfoWindow (TextEditor editor, TooltipInformationWindow tipWindow, TooltipItem item, Gdk.ModifierType modifierState, int mouseX, int mouseY)
+ void ShowTipInfoWindow (TextEditor editor, TooltipInformationWindow tipWindow, TooltipItem item, Xwt.ModifierKeys modifierState, int mouseX, int mouseY)
{
Gtk.Widget editorWidget = editor;
@@ -131,7 +131,7 @@ namespace MonoDevelop.Ide.Editor
tipWindow.ShowPopup (editorWidget, caret, PopupPosition.Top);
}
- public virtual void ShowTooltipWindow (TextEditor editor, Control tipWindow, TooltipItem item, Gdk.ModifierType modifierState, int mouseX, int mouseY)
+ public virtual void ShowTooltipWindow (TextEditor editor, Control tipWindow, TooltipItem item, Xwt.ModifierKeys modifierState, int mouseX, int mouseY)
{
if (tipWindow == null)
return;
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.ExternalTools/ExternalToolPanel.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.ExternalTools/ExternalToolPanel.cs
index 6fde8c756a..6a0ac1acfd 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.ExternalTools/ExternalToolPanel.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.ExternalTools/ExternalToolPanel.cs
@@ -44,7 +44,7 @@ namespace MonoDevelop.Ide.ExternalTools
{
ExternalToolPanelWidget widget;
- public override Widget CreatePanelWidget ()
+ public override Control CreatePanelWidget ()
{
return widget = new ExternalToolPanelWidget ();
}
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.FindInFiles/SearchResultPad.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.FindInFiles/SearchResultPad.cs
index 57ad2848d0..91ad074358 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.FindInFiles/SearchResultPad.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.FindInFiles/SearchResultPad.cs
@@ -24,18 +24,19 @@
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-
+//
+
using System.Collections.Generic;
using MonoDevelop.Ide.Gui;
using MonoDevelop.Core;
using MonoDevelop.Components.Commands;
using MonoDevelop.Ide.Commands;
using System.Threading;
-
+using MonoDevelop.Components;
+
namespace MonoDevelop.Ide.FindInFiles
{
- public class SearchResultPad : AbstractPadContent
+ public class SearchResultPad : PadContent
{
readonly SearchResultWidget widget = new SearchResultWidget ();
@@ -45,7 +46,7 @@ namespace MonoDevelop.Ide.FindInFiles
}
}
- public override Gtk.Widget Control {
+ public override Control Control {
get {
return widget;
}
@@ -95,7 +96,7 @@ namespace MonoDevelop.Ide.FindInFiles
widget.AddRange (results);
}
- public override void Initialize (IPadWindow window)
+ protected override void Initialize (IPadWindow window)
{
window.Icon = Stock.FindIcon;
base.Initialize (window);
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.FindInFiles/SearchResultWidget.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.FindInFiles/SearchResultWidget.cs
index d6c91dd71d..ba3f8f9c5e 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.FindInFiles/SearchResultWidget.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.FindInFiles/SearchResultWidget.cs
@@ -44,7 +44,7 @@ using System.Threading;
using MonoDevelop.Ide.Editor;
using MonoDevelop.Core.Text;
using MonoDevelop.Ide.Editor.Highlighting;
-
+using System.Threading.Tasks;
namespace MonoDevelop.Ide.FindInFiles
{
@@ -828,9 +828,9 @@ namespace MonoDevelop.Ide.FindInFiles
{
}
- protected override Gui.Document DoShow ()
+ protected override async Task<Gui.Document> DoShow ()
{
- var doc = base.DoShow ();
+ var doc = await base.DoShow ();
if (doc == null)
return null;
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Fonts/FontChooserPanel.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Fonts/FontChooserPanel.cs
index 810820ff66..af8be3166b 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Fonts/FontChooserPanel.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Fonts/FontChooserPanel.cs
@@ -24,7 +24,7 @@
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
using System;
-using Gtk;
+using MonoDevelop.Components;
using MonoDevelop.Ide.Gui.Dialogs;
namespace MonoDevelop.Ide.Fonts
@@ -33,7 +33,7 @@ namespace MonoDevelop.Ide.Fonts
{
FontChooserPanelWidget widget;
- public override Widget CreatePanelWidget ()
+ public override Control CreatePanelWidget ()
{
return widget = new FontChooserPanelWidget ();
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Content/IPathedDocument.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Content/IPathedDocument.cs
index 8491b1fd68..d7df693e08 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Content/IPathedDocument.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Content/IPathedDocument.cs
@@ -35,7 +35,7 @@ namespace MonoDevelop.Ide.Gui.Content
{
PathEntry[] CurrentPath { get; }
- Gtk.Widget CreatePathWidget (int index);
+ Control CreatePathWidget (int index);
event EventHandler<DocumentPathChangedEventArgs> PathChanged;
}
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Content/ISupportsProjectReload.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Content/ISupportsProjectReload.cs
deleted file mode 100644
index c417f56dda..0000000000
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Content/ISupportsProjectReload.cs
+++ /dev/null
@@ -1,62 +0,0 @@
-//
-// ISupportsProjectReload.cs
-//
-// Author:
-// Lluis Sanchez Gual <lluis@novell.com>
-//
-// Copyright (c) 2009 Novell, Inc (http://www.novell.com)
-//
-// Permission is hereby granted, free of charge, to any person obtaining a copy
-// of this software and associated documentation files (the "Software"), to deal
-// in the Software without restriction, including without limitation the rights
-// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the Software is
-// furnished to do so, subject to the following conditions:
-//
-// The above copyright notice and this permission notice shall be included in
-// all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-// THE SOFTWARE.
-
-using System;
-using MonoDevelop.Projects;
-
-namespace MonoDevelop.Ide.Gui.Content
-{
- /// <summary>
- /// To be implemented by views which can survive a project or solution reloading
- /// </summary>
- public interface ISupportsProjectReload
- {
- ProjectReloadCapability ProjectReloadCapability { get; }
-
- /// <summary>
- /// Called to update the project bound to the view.
- /// </summary>
- /// <param name="project">
- /// New project to assign to the view. It can be null.
- /// </param>
- void Update (Project project);
- }
-
- public enum ProjectReloadCapability
- {
- None = 0,
-
- /// <summary>
- /// It can keep unsaved data. Some status (such as undo queue) may be lost.
- /// </summary>
- UnsavedData = 1,
-
- /// <summary>
- /// It can keep unsaved data and status.
- /// </summary>
- Full = 2
- }
-}
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Dialogs/DirtyFilesDialog.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Dialogs/DirtyFilesDialog.cs
index 21826eecbf..caceb45d9b 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Dialogs/DirtyFilesDialog.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Dialogs/DirtyFilesDialog.cs
@@ -7,6 +7,7 @@ using Gtk;
using MonoDevelop.Core;
using MonoDevelop.Ide.Gui;
using MonoDevelop.Components;
+using System.Threading.Tasks;
namespace MonoDevelop.Ide.Gui.Dialogs
{
@@ -36,7 +37,7 @@ namespace MonoDevelop.Ide.Gui.Dialogs
if (!doc.IsDirty)
continue;
- IViewContent viewcontent = doc.Window.ViewContent;
+ ViewContent viewcontent = doc.Window.ViewContent;
if (groupByProject && viewcontent.Project != null) {
TreeIter projIter = TreeIter.Zero;
@@ -122,19 +123,28 @@ namespace MonoDevelop.Ide.Gui.Dialogs
base.OnDestroyed ();
}
- void SaveAndQuit (object o, EventArgs e)
+ async void SaveAndQuit (object o, EventArgs e)
{
+ Sensitive = false;
+
+ List<Task> saveTasks = new List<Task> ();
tsFiles.Foreach (delegate (TreeModel model, TreePath path, TreeIter iter) {
var window = tsFiles.GetValue (iter, 2) as SdiWorkspaceWindow;
if (window == null)
return false;
if ((bool)tsFiles.GetValue (iter, 1)) {
- window.ViewContent.Save (window.ViewContent.ContentName);
+ saveTasks.Add (window.ViewContent.Save (window.ViewContent.ContentName));
} else {
window.ViewContent.DiscardChanges ();
}
return false;
});
+
+ try {
+ await Task.WhenAll (saveTasks);
+ } finally {
+ Sensitive = true;
+ }
Respond (Gtk.ResponseType.Ok);
Hide ();
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Dialogs/FeedbackDialog.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Dialogs/FeedbackDialog.cs
index 79deec486f..bdac2a013f 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Dialogs/FeedbackDialog.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Dialogs/FeedbackDialog.cs
@@ -31,7 +31,7 @@ using MonoDevelop.Projects;
namespace MonoDevelop.Ide.Gui.Dialogs
{
- public class FeedbackDialog: Gtk.Window
+ class FeedbackDialog: Gtk.Window
{
Gtk.VBox mainBox;
EntryWithEmptyMessage mailEntry;
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Dialogs/IOptionsPanel.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Dialogs/IOptionsPanel.cs
index 1dde9bf57f..167195dde8 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Dialogs/IOptionsPanel.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Dialogs/IOptionsPanel.cs
@@ -26,7 +26,7 @@
//
using System;
-using Gtk;
+using MonoDevelop.Components;
namespace MonoDevelop.Ide.Gui.Dialogs
{
@@ -34,7 +34,7 @@ namespace MonoDevelop.Ide.Gui.Dialogs
{
void Initialize (OptionsDialog dialog, object dataObject);
- Widget CreatePanelWidget ();
+ Control CreatePanelWidget ();
bool IsVisible ();
bool ValidateChanges ();
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Dialogs/ItemOptionsDialog.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Dialogs/ItemOptionsDialog.cs
index e37db85cab..f7b322d16f 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Dialogs/ItemOptionsDialog.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Dialogs/ItemOptionsDialog.cs
@@ -27,6 +27,7 @@
using System;
using Mono.Addins;
+using MonoDevelop.Components;
using MonoDevelop.Projects.Extensions;
using MonoDevelop.Ide.Gui.Dialogs;
using MonoDevelop.Projects;
@@ -39,7 +40,7 @@ namespace MonoDevelop.Ide.Gui.Dialogs
{
}
- public ItemOptionsDialog (Gtk.Window parentWindow, object dataObject)
+ public ItemOptionsDialog (Window parentWindow, object dataObject)
: base (parentWindow, dataObject, "/MonoDevelop/ProjectModel/Gui/ItemOptionPanels")
{
}
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Dialogs/MimeTypePolicyOptionsSection.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Dialogs/MimeTypePolicyOptionsSection.cs
index 20a6c0e57c..6f77e3e99f 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Dialogs/MimeTypePolicyOptionsSection.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Dialogs/MimeTypePolicyOptionsSection.cs
@@ -30,6 +30,7 @@ using Gtk;
using System.Linq;
using Mono.Addins;
+using MonoDevelop.Components;
using MonoDevelop.Core;
using MonoDevelop.Ide.Gui.Dialogs;
using MonoDevelop.Projects;
@@ -87,7 +88,7 @@ namespace MonoDevelop.Ide.Gui.Dialogs
isRoot = false;
}
- public override Widget CreatePanelWidget ()
+ public override Control CreatePanelWidget ()
{
HBox hbox = new HBox (false, 6);
Label label = new Label ();
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Dialogs/MultiConfigItemOptionsDialog.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Dialogs/MultiConfigItemOptionsDialog.cs
index 4bacbbb978..cd211d5b9f 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Dialogs/MultiConfigItemOptionsDialog.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Dialogs/MultiConfigItemOptionsDialog.cs
@@ -27,6 +27,7 @@
using System;
using System.Collections.Generic;
+using MonoDevelop.Components;
using MonoDevelop.Core;
using MonoDevelop.Ide.Gui.Dialogs;
using MonoDevelop.Projects;
@@ -43,7 +44,7 @@ namespace MonoDevelop.Ide.Gui.Dialogs
{
}
- public MultiConfigItemOptionsDialog (Gtk.Window parentWindow, object dataObject): base (parentWindow, dataObject)
+ public MultiConfigItemOptionsDialog (Window parentWindow, object dataObject): base (parentWindow, dataObject)
{
IConfigurationTarget ct = DataObject as IConfigurationTarget;
if (ct == null)
@@ -132,13 +133,13 @@ namespace MonoDevelop.Ide.Gui.Dialogs
ConfigurationData data = new ConfigurationData (entry);
foreach (ItemConfiguration conf in entry.Configurations) {
- ItemConfiguration copy = (ItemConfiguration) conf.Clone ();
+ ItemConfiguration copy = entry.CloneConfiguration (conf, conf.Id);
data.Configurations.Add (copy);
}
if (entry is Solution) {
foreach (SolutionFolderItem e in ((Solution)entry).Items) {
if (e is SolutionItem)
- data.children.Add (ConfigurationData.Build ((SolutionItem) e));
+ data.children.Add (Build ((SolutionItem) e));
}
}
return data;
@@ -201,7 +202,7 @@ namespace MonoDevelop.Ide.Gui.Dialogs
if (sourceName != null) {
ItemConfiguration sc = configurations [sourceName];
if (sc != null)
- conf.CopyFrom (sc);
+ conf.CopyFrom (sc, true);
else
sourceName = null;
}
@@ -242,13 +243,17 @@ namespace MonoDevelop.Ide.Gui.Dialogs
ConfigurationsChanged (this, null);
}
- public void RenameConfiguration (string oldName, string newName, bool renameChildConfigurations)
+ public ItemConfiguration RenameConfiguration (string oldName, string newName, bool renameChildConfigurations)
{
renameData.Add (new RenameData { OldName = oldName, NewName = newName });
-
+ ItemConfiguration newConf = null;
+
ItemConfiguration cc = configurations [oldName];
if (cc != null) {
- cc.Id = newName;
+ newConf = entry.CreateConfiguration (newName, ConfigurationKind.Blank);
+ newConf.CopyFrom (cc, true);
+ int i = configurations.IndexOf (cc);
+ configurations [i] = newConf;
}
if (renameChildConfigurations) {
if (entry is Solution) {
@@ -264,6 +269,7 @@ namespace MonoDevelop.Ide.Gui.Dialogs
}
if (ConfigurationsChanged != null)
ConfigurationsChanged (this, null);
+ return newConf;
}
public event EventHandler ConfigurationsChanged;
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Dialogs/MultiConfigItemOptionsPanel.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Dialogs/MultiConfigItemOptionsPanel.cs
index a199f98283..84125c5e78 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Dialogs/MultiConfigItemOptionsPanel.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Dialogs/MultiConfigItemOptionsPanel.cs
@@ -28,6 +28,7 @@
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
+using MonoDevelop.Components;
using MonoDevelop.Core;
using MonoDevelop.Ide.Gui.Dialogs;
using MonoDevelop.Projects;
@@ -96,7 +97,7 @@ namespace MonoDevelop.Ide.Gui.Dialogs
}
}
- Gtk.Widget IOptionsPanel.CreatePanelWidget ()
+ Control IOptionsPanel.CreatePanelWidget ()
{
Gtk.VBox cbox = new Gtk.VBox (false, 6);
Gtk.HBox combosBox = new Gtk.HBox (false, 6);
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Dialogs/OptionsDialog.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Dialogs/OptionsDialog.cs
index ac8a67e228..6f6b26eb9a 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Dialogs/OptionsDialog.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Dialogs/OptionsDialog.cs
@@ -82,10 +82,10 @@ namespace MonoDevelop.Ide.Gui.Dialogs
{
}
- public OptionsDialog (Gtk.Window parentWindow, object dataObject, string extensionPath) : this (parentWindow, dataObject, extensionPath, true)
+ public OptionsDialog (MonoDevelop.Components.Window parentWindow, object dataObject, string extensionPath) : this (parentWindow, dataObject, extensionPath, true)
{}
- public OptionsDialog (Gtk.Window parentWindow, object dataObject, string extensionPath, bool removeEmptySections)
+ public OptionsDialog (MonoDevelop.Components.Window parentWindow, object dataObject, string extensionPath, bool removeEmptySections)
{
buttonCancel = new Gtk.Button (Gtk.Stock.Cancel);
AddActionWidget (this.buttonCancel, ResponseType.Cancel);
@@ -251,7 +251,7 @@ namespace MonoDevelop.Ide.Gui.Dialogs
}
}
- protected Gtk.Widget MainBox {
+ protected Control MainBox {
get { return pageFrame; }
}
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Dialogs/OptionsPanel.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Dialogs/OptionsPanel.cs
index 629f8e80b3..231af21a07 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Dialogs/OptionsPanel.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Dialogs/OptionsPanel.cs
@@ -26,7 +26,7 @@
//
using System;
-using Gtk;
+using MonoDevelop.Components;
namespace MonoDevelop.Ide.Gui.Dialogs
{
@@ -41,7 +41,7 @@ namespace MonoDevelop.Ide.Gui.Dialogs
this.dataObject = dataObject;
}
- public abstract Widget CreatePanelWidget ();
+ public abstract Control CreatePanelWidget ();
public virtual bool IsVisible ()
{
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Dialogs/PolicyOptionsPanel.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Dialogs/PolicyOptionsPanel.cs
index 41ddeab812..29421b3e2d 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Dialogs/PolicyOptionsPanel.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Dialogs/PolicyOptionsPanel.cs
@@ -31,6 +31,7 @@ using System.Collections.Generic;
using Gtk;
using System.Linq;
+using MonoDevelop.Components;
using MonoDevelop.Core;
using MonoDevelop.Ide.Gui.Dialogs;
using MonoDevelop.Projects;
@@ -57,7 +58,7 @@ namespace MonoDevelop.Ide.Gui.Dialogs
{
}
- Widget IOptionsPanel.CreatePanelWidget ()
+ Control IOptionsPanel.CreatePanelWidget ()
{
HBox hbox = new HBox (false, 6);
Label label = new Label ();
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Dialogs/ProgressDialog.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Dialogs/ProgressDialog.cs
index 2ffc9f9694..58586584fe 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Dialogs/ProgressDialog.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Dialogs/ProgressDialog.cs
@@ -25,8 +25,9 @@
// THE SOFTWARE.
using System;
-using Gtk;
using System.Collections.Generic;
+using Gtk;
+using MonoDevelop.Components;
using MonoDevelop.Core;
using System.Threading;
@@ -47,7 +48,7 @@ namespace MonoDevelop.Ide.Gui.Dialogs
{
}
- public ProgressDialog (Window parent, bool allowCancel, bool showDetails)
+ public ProgressDialog (MonoDevelop.Components.Window parent, bool allowCancel, bool showDetails)
{
MonoDevelop.Components.IdeTheme.ApplyTheme (this);
this.Build ();
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Dialogs/SelectFileFormatDialog.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Dialogs/SelectFileFormatDialog.cs
index 11909769fa..aa2cffd702 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Dialogs/SelectFileFormatDialog.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Dialogs/SelectFileFormatDialog.cs
@@ -32,7 +32,7 @@ using MonoDevelop.Projects.MSBuild;
namespace MonoDevelop.Ide.Gui.Dialogs
{
- public partial class SelectFileFormatDialog : Gtk.Dialog
+ partial class SelectFileFormatDialog : Gtk.Dialog
{
List<MSBuildFileFormat> formats = new List<MSBuildFileFormat> ();
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.OptionPanels/AddInsOptionsPanel.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.OptionPanels/AddInsOptionsPanel.cs
index c9c80eed25..391e56cc8e 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.OptionPanels/AddInsOptionsPanel.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.OptionPanels/AddInsOptionsPanel.cs
@@ -35,7 +35,6 @@ using MonoDevelop.Core;
using Mono.Addins;
using MonoDevelop.Projects;
-using Gtk;
using MonoDevelop.Components;
using MonoDevelop.Core.Setup;
using MonoDevelop.Ide.Updater;
@@ -51,7 +50,7 @@ namespace MonoDevelop.Ide.Gui.OptionPanels
return !AddinManager.IsAddinLoaded ("MonoDevelop.Xamarin.Ide");
}
- public override Widget CreatePanelWidget ()
+ public override Control CreatePanelWidget ()
{
return widget = new AddInsPanelWidget ();
}
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.OptionPanels/AssemblyFoldersPanel.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.OptionPanels/AssemblyFoldersPanel.cs
index 33344a8e0f..3fb3386763 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.OptionPanels/AssemblyFoldersPanel.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.OptionPanels/AssemblyFoldersPanel.cs
@@ -26,7 +26,7 @@
using System;
using System.Collections.Generic;
-using Gtk;
+using MonoDevelop.Components;
using MonoDevelop.Core;
using MonoDevelop.Ide.Gui.Dialogs;
@@ -36,7 +36,7 @@ namespace MonoDevelop.Ide.Gui.OptionPanels
{
AssemblyFoldersPanelWidget widget;
- public override Widget CreatePanelWidget ()
+ public override Control CreatePanelWidget ()
{
return widget = new AssemblyFoldersPanelWidget ();
}
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.OptionPanels/AuthorInformationPanel.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.OptionPanels/AuthorInformationPanel.cs
index 5be3812412..5794110212 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.OptionPanels/AuthorInformationPanel.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.OptionPanels/AuthorInformationPanel.cs
@@ -27,6 +27,7 @@
//
using System;
+using MonoDevelop.Components;
using MonoDevelop.Projects;
using MonoDevelop.Ide.Projects;
using MonoDevelop.Ide.Gui.Dialogs;
@@ -37,8 +38,8 @@ namespace MonoDevelop.Ide.Gui.OptionPanels
{
AuthorInformationPanelWidget widget;
Solution solution;
-
- public override Gtk.Widget CreatePanelWidget ()
+
+ public override Control CreatePanelWidget ()
{
return widget = new AuthorInformationPanelWidget (solution.LocalAuthorInformation);
}
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.OptionPanels/BuildMessagePanel.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.OptionPanels/BuildMessagePanel.cs
index 5c4b193e2c..c833527b69 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.OptionPanels/BuildMessagePanel.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.OptionPanels/BuildMessagePanel.cs
@@ -25,9 +25,9 @@
// THE SOFTWARE.
using System;
+using MonoDevelop.Components;
using MonoDevelop.Core;
using MonoDevelop.Ide.Gui.Dialogs;
-using Gtk;
namespace MonoDevelop.Ide.Gui.OptionPanels
{
@@ -36,7 +36,7 @@ namespace MonoDevelop.Ide.Gui.OptionPanels
{
BuildMessagePanelWidget widget;
- public override Widget CreatePanelWidget ()
+ public override Control CreatePanelWidget ()
{
return widget = new BuildMessagePanelWidget ();
}
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.OptionPanels/BuildPanel.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.OptionPanels/BuildPanel.cs
index bac0ec7fb6..0e68a80066 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.OptionPanels/BuildPanel.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.OptionPanels/BuildPanel.cs
@@ -27,7 +27,7 @@
using System;
-using Gtk;
+using MonoDevelop.Components;
using MonoDevelop.Ide.Gui.Dialogs;
using MonoDevelop.Projects.MSBuild;
@@ -37,7 +37,7 @@ namespace MonoDevelop.Ide.Gui.OptionPanels
{
BuildPanelWidget widget;
- public override Widget CreatePanelWidget ()
+ public override Control CreatePanelWidget ()
{
return (widget = new BuildPanelWidget ());
}
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.OptionPanels/GlobalAuthorInformationPanel.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.OptionPanels/GlobalAuthorInformationPanel.cs
index 51c97c3afd..6f7b9c48e9 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.OptionPanels/GlobalAuthorInformationPanel.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.OptionPanels/GlobalAuthorInformationPanel.cs
@@ -27,6 +27,7 @@
//
using System;
+using MonoDevelop.Components;
using MonoDevelop.Core;
using MonoDevelop.Ide.Gui.Dialogs;
using MonoDevelop.Projects;
@@ -36,8 +37,8 @@ namespace MonoDevelop.Ide.Gui.OptionPanels
class GlobalAuthorInformationPanel : OptionsPanel
{
GlobalAuthorInformationPanelWidget widget;
-
- public override Gtk.Widget CreatePanelWidget ()
+
+ public override Control CreatePanelWidget ()
{
return widget = new GlobalAuthorInformationPanelWidget ();
}
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.OptionPanels/IDEStyleOptionsPanel.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.OptionPanels/IDEStyleOptionsPanel.cs
index c293fb9901..9b77a7cb0d 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.OptionPanels/IDEStyleOptionsPanel.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.OptionPanels/IDEStyleOptionsPanel.cs
@@ -31,11 +31,11 @@ using System;
using System.Collections;
using System.Collections.Generic;
+using MonoDevelop.Components;
using MonoDevelop.Core;
using MonoDevelop.Ide.Gui.Dialogs;
using MonoDevelop.Components.Commands;
using Mono.Addins;
-using Gtk;
using System.Linq;
namespace MonoDevelop.Ide.Gui.OptionPanels
@@ -44,7 +44,7 @@ namespace MonoDevelop.Ide.Gui.OptionPanels
{
IDEStyleOptionsPanelWidget widget;
- public override Widget CreatePanelWidget ()
+ public override Control CreatePanelWidget ()
{
return widget = new IDEStyleOptionsPanelWidget ();
}
@@ -55,7 +55,7 @@ namespace MonoDevelop.Ide.Gui.OptionPanels
}
}
- public partial class IDEStyleOptionsPanelWidget : Gtk.Bin
+ partial class IDEStyleOptionsPanelWidget : Gtk.Bin
{
string currentTheme;
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.OptionPanels/KeyBindingsPanel.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.OptionPanels/KeyBindingsPanel.cs
index f1754c228c..38f1e0c420 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.OptionPanels/KeyBindingsPanel.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.OptionPanels/KeyBindingsPanel.cs
@@ -217,7 +217,7 @@ namespace MonoDevelop.Ide.Gui.OptionPanels
KeyBindingService.SaveCurrentBindings ();
}
- public Gtk.Widget CreatePanelWidget ()
+ public Control CreatePanelWidget ()
{
SortedDictionary<string, Command> commands = new SortedDictionary<string, Command> ();
string translatedOther = GettextCatalog.GetString ("Other");
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.OptionPanels/LoadSavePanel.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.OptionPanels/LoadSavePanel.cs
index 96a007e013..2266b7d19b 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.OptionPanels/LoadSavePanel.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.OptionPanels/LoadSavePanel.cs
@@ -36,7 +36,6 @@ using MonoDevelop.Core;
using MonoDevelop.Ide.Gui;
using MonoDevelop.Projects;
-using Gtk;
using MonoDevelop.Components;
#pragma warning disable 612
@@ -54,7 +53,7 @@ namespace MonoDevelop.Ide.Gui.OptionPanels
LoadSavePanelWidget widget;
- public override Widget CreatePanelWidget ()
+ public override Control CreatePanelWidget ()
{
return widget = new LoadSavePanelWidget ();
}
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.OptionPanels/LogAgentOptionsPanel.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.OptionPanels/LogAgentOptionsPanel.cs
index ba485c2d81..b50e0ea557 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.OptionPanels/LogAgentOptionsPanel.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.OptionPanels/LogAgentOptionsPanel.cs
@@ -27,6 +27,7 @@
using System;
using Gtk;
using MonoDevelop.Ide.Gui.Dialogs;
+using MonoDevelop.Components;
using MonoDevelop.Core;
using MonoDevelop.Core.LogReporting;
@@ -36,7 +37,7 @@ namespace MonoDevelop.Ide.Gui.OptionPanels
{
LogAgentPanelWidget widget;
- public override Widget CreatePanelWidget ()
+ public override Control CreatePanelWidget ()
{
return widget = new LogAgentPanelWidget ();
}
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.OptionPanels/MaintenanceOptionsPanel.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.OptionPanels/MaintenanceOptionsPanel.cs
index 334c99bba3..39676d4217 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.OptionPanels/MaintenanceOptionsPanel.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.OptionPanels/MaintenanceOptionsPanel.cs
@@ -25,8 +25,8 @@
// THE SOFTWARE.
using System;
+using MonoDevelop.Components;
using MonoDevelop.Ide.Gui.Dialogs;
-using Gtk;
namespace MonoDevelop.Ide.Gui.OptionPanels
{
@@ -34,7 +34,7 @@ namespace MonoDevelop.Ide.Gui.OptionPanels
{
MaintenanceOptionsPanelWidget widget;
- public override Widget CreatePanelWidget ()
+ public override Control CreatePanelWidget ()
{
return widget = new MaintenanceOptionsPanelWidget ();
}
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.OptionPanels/MonoRuntimePanel.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.OptionPanels/MonoRuntimePanel.cs
index 3a5f86ff36..511320179f 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.OptionPanels/MonoRuntimePanel.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.OptionPanels/MonoRuntimePanel.cs
@@ -41,7 +41,7 @@ namespace MonoDevelop.Ide.Gui.OptionPanels
{
MonoRuntimePanelWidget widget;
- public override Widget CreatePanelWidget ()
+ public override Control CreatePanelWidget ()
{
return widget = new MonoRuntimePanelWidget ();
}
@@ -122,13 +122,13 @@ namespace MonoDevelop.Ide.Gui.OptionPanels
return Environment.GetFolderPath (IntPtr.Size == 8?
Environment.SpecialFolder.ProgramFilesX86 : Environment.SpecialFolder.ProgramFiles);
}
-
+
protected virtual void OnButtonAddClicked (object sender, System.EventArgs e)
{
var dlg = new SelectFolderDialog (GettextCatalog.GetString ("Select the mono installation prefix")) {
TransientFor = this.Toplevel as Gtk.Window,
};
-
+
//set a platform-dependent default folder for the dialog if possible
if (Platform.IsWindows) {
// ProgramFilesX86 is broken on 32-bit WinXP
@@ -139,17 +139,32 @@ namespace MonoDevelop.Ide.Gui.OptionPanels
if (System.IO.Directory.Exists ("/usr"))
dlg.CurrentFolder = "/usr";
}
-
+
if (!dlg.Run ())
return;
-
- var rinfo = new MonoRuntimeInfo (dlg.SelectedFile);
- if (!rinfo.IsValidRuntime) {
- MessageService.ShowError (GettextCatalog.GetString ("Mono runtime not found"), GettextCatalog.GetString ("Please provide a valid directory prefix where mono is installed (for example, /usr)"));
- return;
+
+ var rinfo64 = new MonoRuntimeInfo (dlg.SelectedFile, true);
+ var rinfo32 = new MonoRuntimeInfo (dlg.SelectedFile, false);
+ if (rinfo64.IsValidRuntime && rinfo32.IsValidRuntime) {
+ newInfos.Add (rinfo64);
+ store.AppendValues (rinfo64.DisplayName, rinfo64);
+ newInfos.Add (rinfo32);
+ store.AppendValues (rinfo32.DisplayName, rinfo32);
+ } else if (rinfo64.IsValidRuntime) {
+ newInfos.Add (rinfo64);
+ store.AppendValues (rinfo64.DisplayName, rinfo64);
+ } else if (rinfo32.IsValidRuntime) {
+ newInfos.Add (rinfo32);
+ store.AppendValues (rinfo32.DisplayName, rinfo32);
+ } else {
+ var rinfo = new MonoRuntimeInfo (dlg.SelectedFile, null);
+ if (rinfo.IsValidRuntime) {
+ newInfos.Add (rinfo);
+ store.AppendValues (rinfo.DisplayName, rinfo);
+ } else {
+ MessageService.ShowError (GettextCatalog.GetString ("Mono runtime not found"), GettextCatalog.GetString ("Please provide a valid directory prefix where mono is installed (for example, /usr)"));
+ }
}
- newInfos.Add (rinfo);
- store.AppendValues (rinfo.DisplayName, rinfo);
}
protected virtual void OnButtonRemoveClicked (object sender, System.EventArgs e)
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.OptionPanels/SdkLocationPanel.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.OptionPanels/SdkLocationPanel.cs
index e3575c9171..1a4972f73c 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.OptionPanels/SdkLocationPanel.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.OptionPanels/SdkLocationPanel.cs
@@ -39,7 +39,7 @@ namespace MonoDevelop.Ide.Gui.OptionPanels
{
SdkLocationWidget w;
- public override Widget CreatePanelWidget ()
+ public override Control CreatePanelWidget ()
{
return w = new SdkLocationWidget (this);
}
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.OptionPanels/TasksOptionsPanel.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.OptionPanels/TasksOptionsPanel.cs
index 5baa949a56..1f4862e455 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.OptionPanels/TasksOptionsPanel.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.OptionPanels/TasksOptionsPanel.cs
@@ -233,7 +233,7 @@ namespace MonoDevelop.Ide.Gui.OptionPanels
{
TasksPanelWidget widget;
- public override Widget CreatePanelWidget ()
+ public override Control CreatePanelWidget ()
{
widget = new TasksPanelWidget ();
widget.Load ();
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.OptionPanels/TextStylePolicyPanel.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.OptionPanels/TextStylePolicyPanel.cs
index 4135b233d5..d6bd13b7d2 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.OptionPanels/TextStylePolicyPanel.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.OptionPanels/TextStylePolicyPanel.cs
@@ -25,6 +25,7 @@
//THE SOFTWARE.
using System;
+using MonoDevelop.Components;
using MonoDevelop.Core;
using MonoDevelop.Projects.Policies;
using MonoDevelop.Ide.Projects;
@@ -38,7 +39,7 @@ namespace MonoDevelop.Ide.Gui.OptionPanels
{
TextStylePolicyPanelWidget widget;
- public override Gtk.Widget CreatePanelWidget ()
+ public override Control CreatePanelWidget ()
{
widget = new TextStylePolicyPanelWidget (this);
widget.Show ();
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Pads.ClassPad/ClassBrowserPad.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Pads.ClassPad/ClassBrowserPad.cs
index cce9569a07..6c49cf3f8a 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Pads.ClassPad/ClassBrowserPad.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Pads.ClassPad/ClassBrowserPad.cs
@@ -32,6 +32,7 @@ using MonoDevelop.Core;
using MonoDevelop.Ide.Gui;
using MonoDevelop.Projects;
using MonoDevelop.Ide.Gui.Components;
+using MonoDevelop.Components;
namespace MonoDevelop.Ide.Gui.Pads.ClassBrowser
{
@@ -39,13 +40,13 @@ namespace MonoDevelop.Ide.Gui.Pads.ClassBrowser
{
ClassBrowserPadWidget widget;
- public override Gtk.Widget Control {
+ public override Control Control {
get {
return widget;
}
}
- public override void Initialize (IPadWindow container)
+ protected override void Initialize (IPadWindow container)
{
base.Initialize (container);
this.widget = new ClassBrowserPadWidget (base.TreeView, container);
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Pads.ProjectPad/ProjectFileNodeBuilder.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Pads.ProjectPad/ProjectFileNodeBuilder.cs
index 6dbdbbf110..6bcec43c58 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Pads.ProjectPad/ProjectFileNodeBuilder.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Pads.ProjectPad/ProjectFileNodeBuilder.cs
@@ -191,7 +191,7 @@ namespace MonoDevelop.Ide.Gui.Pads.ProjectPad
if (file.Project != null)
newProjectFile = file.Project.Files.GetFileWithVirtualPath (newPath.ToRelative (file.Project.BaseDirectory));
- if (!FileService.IsValidPath (newPath)) {
+ if (!FileService.IsValidPath (newPath) || ProjectFolderCommandHandler.ContainsDirectorySeparator (newName)) {
MessageService.ShowWarning (GettextCatalog.GetString ("The name you have chosen contains illegal characters. Please choose a different name."));
} else if ((newProjectFile != null && newProjectFile != file) || File.Exists (file.FilePath.ParentDirectory.Combine (newName))) {
// If there is already a file under the newPath which is *different*, then throw an exception
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Pads.ProjectPad/ProjectFolderNodeBuilder.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Pads.ProjectPad/ProjectFolderNodeBuilder.cs
index 89bc9dbf4b..ebe5b7fd6a 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Pads.ProjectPad/ProjectFolderNodeBuilder.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Pads.ProjectPad/ProjectFolderNodeBuilder.cs
@@ -151,7 +151,7 @@ namespace MonoDevelop.Ide.Gui.Pads.ProjectPad
if (oldFoldername != newFoldername) {
try {
- if (!FileService.IsValidPath (newFoldername)) {
+ if (!FileService.IsValidPath (newFoldername) || ContainsDirectorySeparator (newName)) {
MessageService.ShowWarning (GettextCatalog.GetString ("The name you have chosen contains illegal characters. Please choose a different name."));
return;
}
@@ -177,7 +177,7 @@ namespace MonoDevelop.Ide.Gui.Pads.ProjectPad
}
}
}
-
+
public override void DeleteMultipleItems ()
{
var projects = new Set<SolutionItem> ();
@@ -370,6 +370,10 @@ namespace MonoDevelop.Ide.Gui.Pads.ProjectPad
return true;
return false;
}
-
+
+ internal static bool ContainsDirectorySeparator (string name)
+ {
+ return name.Contains (Path.DirectorySeparatorChar) || name.Contains (Path.AltDirectorySeparatorChar);
+ }
}
}
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Pads.ProjectPad/SystemFileNodeBuilder.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Pads.ProjectPad/SystemFileNodeBuilder.cs
index 2188ddec1f..54834f3f25 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Pads.ProjectPad/SystemFileNodeBuilder.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Pads.ProjectPad/SystemFileNodeBuilder.cs
@@ -100,7 +100,7 @@ namespace MonoDevelop.Ide.Gui.Pads.ProjectPad
string newname = Path.Combine (Path.GetDirectoryName (oldname), newName);
if (newname != oldname) {
try {
- if (!FileService.IsValidPath (newname)) {
+ if (!FileService.IsValidPath (newname) || ProjectFolderCommandHandler.ContainsDirectorySeparator (newName)) {
MessageService.ShowWarning (GettextCatalog.GetString ("The name you have chosen contains illegal characters. Please choose a different name."));
} else if (File.Exists (newname) || Directory.Exists (newname)) {
MessageService.ShowWarning (GettextCatalog.GetString ("File or directory name is already in use. Please choose a different one."));
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Pads/DefaultMonitorPad.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Pads/DefaultMonitorPad.cs
index a21834b581..1224e93802 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Pads/DefaultMonitorPad.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Pads/DefaultMonitorPad.cs
@@ -45,9 +45,8 @@ using MonoDevelop.Components;
namespace MonoDevelop.Ide.Gui.Pads
{
- internal class DefaultMonitorPad : IPadContent
+ internal class DefaultMonitorPad : PadContent
{
- IPadWindow window;
LogView logView;
Button buttonStop;
ToggleButton buttonPin;
@@ -57,7 +56,6 @@ namespace MonoDevelop.Ide.Gui.Pads
Pad statusSourcePad;
string icon;
- string id;
int instanceNum;
string typeTag;
@@ -73,15 +71,14 @@ namespace MonoDevelop.Ide.Gui.Pads
IdeApp.Workspace.FirstWorkspaceItemOpened += OnCombineOpen;
IdeApp.Workspace.LastWorkspaceItemClosed += OnCombineClosed;
- Control.ShowAll ();
+ logView.ShowAll ();
}
- void IPadContent.Initialize (IPadWindow window)
+ protected override void Initialize (IPadWindow window)
{
- this.window = window;
window.Icon = icon;
- DockItemToolbar toolbar = window.GetToolbar (PositionType.Right);
+ DockItemToolbar toolbar = window.GetToolbar (DockPositionType.Right);
buttonStop = new Button (new ImageView (Stock.Stop, IconSize.Menu));
buttonStop.Clicked += new EventHandler (OnButtonStopClick);
@@ -106,10 +103,6 @@ namespace MonoDevelop.Ide.Gui.Pads
get { return logView; }
}
- public IPadWindow Window {
- get { return this.window; }
- }
-
public Pad StatusSourcePad {
get { return this.statusSourcePad; }
set { this.statusSourcePad = value; }
@@ -159,9 +152,9 @@ namespace MonoDevelop.Ide.Gui.Pads
monitor = (LogViewProgressMonitor) logView.GetProgressMonitor ();
Runtime.RunInMainThread (delegate {
- window.HasNewData = false;
- window.HasErrors = false;
- window.IsWorking = true;
+ Window.HasNewData = false;
+ Window.HasErrors = false;
+ Window.IsWorking = true;
buttonStop.Sensitive = true;
});
@@ -175,16 +168,16 @@ namespace MonoDevelop.Ide.Gui.Pads
public void EndProgress ()
{
Runtime.RunInMainThread (delegate {
- if (window != null) {
- window.IsWorking = false;
+ if (Window != null) {
+ Window.IsWorking = false;
if (monitor.Errors.Length > 0)
- window.HasErrors = true;
+ Window.HasErrors = true;
else
- window.HasNewData = true;
+ Window.HasNewData = true;
}
buttonStop.Sensitive = false;
progressStarted = false;
- if (window == null)
+ if (Window == null)
buttonClear.Sensitive = false;
if (monitor.Errors.Length > 0) {
@@ -200,15 +193,10 @@ namespace MonoDevelop.Ide.Gui.Pads
});
}
- public virtual Gtk.Widget Control {
+ public override Control Control {
get { return logView; }
}
- public string Id {
- get { return id; }
- set { id = value; }
- }
-
public string DefaultPlacement {
get { return "Bottom"; }
}
@@ -225,15 +213,11 @@ namespace MonoDevelop.Ide.Gui.Pads
}
}
- public virtual void Dispose ()
+ public override void Dispose ()
{
logView.Clear ();
IdeApp.Workspace.FirstWorkspaceItemOpened -= OnCombineOpen;
IdeApp.Workspace.LastWorkspaceItemClosed -= OnCombineClosed;
}
-
- public void RedrawContent()
- {
- }
}
}
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Pads/ErrorListPad.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Pads/ErrorListPad.cs
index 23aa9e4bbb..cd461a48d1 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Pads/ErrorListPad.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Pads/ErrorListPad.cs
@@ -53,7 +53,7 @@ using System.Linq;
namespace MonoDevelop.Ide.Gui.Pads
{
- class ErrorListPad : IPadContent
+ class ErrorListPad : PadContent
{
HPaned control;
ScrolledWindow sw;
@@ -70,7 +70,6 @@ namespace MonoDevelop.Ide.Gui.Pads
int warningCount;
int infoCount;
bool initialLogShow = true;
- IPadWindow window;
Menu menu;
Dictionary<ToggleAction, int> columnsActions = new Dictionary<ToggleAction, int> ();
@@ -107,7 +106,7 @@ namespace MonoDevelop.Ide.Gui.Pads
internal const int Category = 7;
}
- public Gtk.Widget Control {
+ public override Control Control {
get {
if (control == null)
CreateControl ();
@@ -115,16 +114,15 @@ namespace MonoDevelop.Ide.Gui.Pads
}
}
- public string Id {
+ public override string Id {
get { return "MonoDevelop.Ide.Gui.Pads.ErrorListPad"; }
}
- void IPadContent.Initialize (IPadWindow window)
+ protected override void Initialize (IPadWindow window)
{
- this.window = window;
window.Title = GettextCatalog.GetString ("Errors");
- DockItemToolbar toolbar = window.GetToolbar (PositionType.Top);
+ DockItemToolbar toolbar = window.GetToolbar (DockPositionType.Top);
errorBtn = new ToggleButton { Name = "toggleErrors" };
errorBtn.Active = ShowErrors;
@@ -234,7 +232,7 @@ namespace MonoDevelop.Ide.Gui.Pads
outputView = new LogView { Name = "buildOutput" };
control.Add2 (outputView);
- Control.ShowAll ();
+ control.ShowAll ();
control.SizeAllocated += HandleControlSizeAllocated;
@@ -318,10 +316,6 @@ namespace MonoDevelop.Ide.Gui.Pads
{
PropertyService.Set ("Monodevelop.ErrorListColumns", string.Join (";", view.Columns.Select (c => c.Visible ? "TRUE" : "FALSE")));
}
-
- public void RedrawContent()
- {
- }
Gtk.Menu CreateMenu ()
{
@@ -727,10 +721,6 @@ namespace MonoDevelop.Ide.Gui.Pads
Clear();
}
- public void Dispose ()
- {
- }
-
void OnRowActivated (object o, RowActivatedArgs args)
{
OnTaskJumpto (null, null);
@@ -883,11 +873,11 @@ namespace MonoDevelop.Ide.Gui.Pads
void UpdatePadIcon ()
{
if (errorCount > 0)
- window.Icon = "md-errors-list-has-errors";
+ Window.Icon = "md-errors-list-has-errors";
else if (warningCount > 0)
- window.Icon = "md-errors-list-has-warnings";
+ Window.Icon = "md-errors-list-has-warnings";
else
- window.Icon = "md-errors-list";
+ Window.Icon = "md-errors-list";
}
private void ItemToggled (object o, ToggledArgs args)
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Pads/MonodocTreePad.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Pads/MonodocTreePad.cs
index 0eb985da7d..07388bac91 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Pads/MonodocTreePad.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Pads/MonodocTreePad.cs
@@ -35,10 +35,11 @@ using Monodoc;
using MonoDevelop.Core;
using MonoDevelop.Ide.Gui;
using MonoDevelop.Projects;
+using MonoDevelop.Components;
namespace MonoDevelop.Ide.Gui.Pads
{
- internal class HelpTree : AbstractPadContent
+ internal class HelpTree : PadContent
{
TreeStore store;
MonoDevelop.Ide.Gui.Components.PadTreeView tree_view;
@@ -78,7 +79,7 @@ namespace MonoDevelop.Ide.Gui.Pads
} while (store.IterNext (ref child_iter));
}
}
- Control.ShowAll ();
+ scroller.ShowAll ();
}
Hashtable populated = new Hashtable ();
@@ -126,7 +127,7 @@ namespace MonoDevelop.Ide.Gui.Pads
}
}
- public override Gtk.Widget Control {
+ public override Control Control {
get { return scroller; }
}
}
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Pads/TaskListPad.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Pads/TaskListPad.cs
index 4f7b747dce..1836978ab0 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Pads/TaskListPad.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Pads/TaskListPad.cs
@@ -41,10 +41,11 @@ using MonoDevelop.Projects;
using Gtk;
using Gdk;
using MonoDevelop.Components.Docking;
+using MonoDevelop.Components;
namespace MonoDevelop.Ide.Gui.Pads
{
- class TaskListPad : IPadContent
+ class TaskListPad : PadContent
{
Widget control;
ITaskListView activeView;
@@ -58,31 +59,20 @@ namespace MonoDevelop.Ide.Gui.Pads
//content view
ScrolledWindow sw;
- public Gtk.Widget Control {
+ public override Control Control {
get {
return control;
}
}
- public string Id {
- get { return "MonoDevelop.Ide.Gui.Pads.TaskListPad"; }
- }
-
public string DefaultPlacement {
get { return "Bottom"; }
}
- public void RedrawContent()
- {
- control.QueueDraw ();
- }
-
- public void Dispose ()
- {
- }
-
public TaskListPad ()
- {
+ {
+ Id = "MonoDevelop.Ide.Gui.Pads.TaskListPad";
+
VBox vbox = new VBox ();
switcherComboList = new ListStore (typeof (string), typeof (ITaskListView), typeof (string));
@@ -127,9 +117,9 @@ namespace MonoDevelop.Ide.Gui.Pads
switcherCombo.Active = pos;
}
- void IPadContent.Initialize (IPadWindow window)
+ override protected void Initialize (IPadWindow window)
{
- toolbar = window.GetToolbar (PositionType.Top);
+ toolbar = window.GetToolbar (DockPositionType.Top);
toolbar.Add (switcherCombo);
toolbar.ShowAll ();
switcherCombo.Changed += new EventHandler (OnContentSwitched);
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Pads/TreeViewPad.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Pads/TreeViewPad.cs
index 421845feda..281911c168 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Pads/TreeViewPad.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Pads/TreeViewPad.cs
@@ -38,7 +38,7 @@ namespace MonoDevelop.Ide.Gui.Pads
/// <summary>
/// This class implements a project browser.
/// </summary>
- public class TreeViewPad : AbstractPadContent, IMementoCapable, ICommandDelegatorRouter
+ public class TreeViewPad : PadContent, IMementoCapable, ICommandDelegatorRouter
{
internal Action Initializer;
@@ -50,7 +50,7 @@ namespace MonoDevelop.Ide.Gui.Pads
}
}
- public override Gtk.Widget Control {
+ public override Control Control {
get {
return treeView;
}
@@ -62,7 +62,7 @@ namespace MonoDevelop.Ide.Gui.Pads
treeView.Tree.EnableAutoTooltips ();
}
- public override void Initialize (IPadWindow container)
+ protected override void Initialize (IPadWindow container)
{
base.Initialize (container);
TreeView.Id = Id;
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui/AbstractBaseViewContent.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui/AbstractBaseViewContent.cs
deleted file mode 100644
index 8c441c2e52..0000000000
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui/AbstractBaseViewContent.cs
+++ /dev/null
@@ -1,99 +0,0 @@
-// AbstractBaseViewContent.cs
-//
-// Author:
-// Viktoria Dudka (viktoriad@remobjects.com)
-//
-// Copyright (c) 2009 RemObjects Software
-//
-// Permission is hereby granted, free of charge, to any person obtaining a copy
-// of this software and associated documentation files (the "Software"), to deal
-// in the Software without restriction, including without limitation the rights
-// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the Software is
-// furnished to do so, subject to the following conditions:
-//
-// The above copyright notice and this permission notice shall be included in
-// all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-// THE SOFTWARE.
-//
-//
-
-using System;
-using System.Collections.Generic;
-using System.Text;
-using MonoDevelop.Core;
-
-namespace MonoDevelop.Ide.Gui
-{
- public abstract class AbstractBaseViewContent : IBaseViewContent
- {
- IWorkbenchWindow workbenchWindow = null;
-
- #region IBaseViewContent Members
-
- public abstract Gtk.Widget Control { get; }
-
- public virtual IWorkbenchWindow WorkbenchWindow {
- get { return workbenchWindow; }
- set {
- if (workbenchWindow != value) {
- workbenchWindow = value;
- OnWorkbenchWindowChanged (EventArgs.Empty);
- }
- }
- }
-
- public virtual string TabPageLabel { get { return GettextCatalog.GetString ("Content"); } }
-
- public virtual void RedrawContent ()
- {
- }
-
- public virtual bool CanReuseView (string fileName)
- {
- return false;
- }
-
- public virtual object GetContent (Type type)
- {
- if (type.IsInstanceOfType (this))
- return this;
- else
- return null;
- }
-
- public virtual IEnumerable<T> GetContents<T> () where T : class
- {
- var t = this as T;
- if (t != null)
- yield return t;
- }
-
-
- #endregion
-
- #region IDisposable Members
-
- public virtual void Dispose ()
- {
- }
-
- #endregion
-
- public event EventHandler WorkbenchWindowChanged;
-
- protected virtual void OnWorkbenchWindowChanged (EventArgs e)
- {
- if (WorkbenchWindowChanged != null) {
- WorkbenchWindowChanged (this, e);
- }
- }
- }
-}
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui/AbstractPadContent.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui/AbstractPadContent.cs
deleted file mode 100644
index 2000c9c0c4..0000000000
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui/AbstractPadContent.cs
+++ /dev/null
@@ -1,92 +0,0 @@
-// AbstractPadContent.cs
-//
-// Author:
-// Viktoria Dudka (viktoriad@remobjects.com)
-//
-// Copyright (c) 2009 RemObjects Software
-//
-// Permission is hereby granted, free of charge, to any person obtaining a copy
-// of this software and associated documentation files (the "Software"), to deal
-// in the Software without restriction, including without limitation the rights
-// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the Software is
-// furnished to do so, subject to the following conditions:
-//
-// The above copyright notice and this permission notice shall be included in
-// all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-// THE SOFTWARE.
-//
-//
-
-using System;
-using System.Collections.Generic;
-using System.Text;
-using MonoDevelop.Core;
-
-namespace MonoDevelop.Ide.Gui
-{
- public abstract class AbstractPadContent : IPadContent
- {
- protected AbstractPadContent () : this (null, null)
- {
- }
-
- public AbstractPadContent (string title) : this (title, null)
- {
- }
-
- private IconId icon;
- private string title;
- public AbstractPadContent (string title, IconId icon)
- {
- this.Id = GetType ().FullName;
- this.icon = icon;
- this.title = title;
- }
-
- public string Id { get; set; }
-
- private IPadWindow window = null;
- public IPadWindow Window {
- get { return window; }
- }
-
- #region IPadContent Members
-
- public virtual void Initialize (IPadWindow container)
- {
- if (title != null)
- container.Title = title;
-
- if (icon != IconId.Null)
- container.Icon = icon;
-
- window = container;
- }
-
- public abstract Gtk.Widget Control {
- get;
- }
-
- public virtual void RedrawContent ()
- {
- }
-
- #endregion
-
- #region IDisposable Members
-
- public virtual void Dispose ()
- {
- }
-
- #endregion
- }
-}
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui/BaseViewContent.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui/BaseViewContent.cs
new file mode 100644
index 0000000000..893bf654f2
--- /dev/null
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui/BaseViewContent.cs
@@ -0,0 +1,167 @@
+// BaseViewContent.cs
+//
+// Author:
+// Viktoria Dudka (viktoriad@remobjects.com)
+//
+// Copyright (c) 2009 RemObjects Software
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+//
+//
+
+using System;
+using System.Linq;
+using System.Collections.Generic;
+using System.Text;
+using MonoDevelop.Components;
+using MonoDevelop.Core;
+using System.Collections.Immutable;
+using MonoDevelop.Projects;
+using MonoDevelop.Components;
+
+namespace MonoDevelop.Ide.Gui
+{
+ public abstract class BaseViewContent : IDisposable
+ {
+ IWorkbenchWindow workbenchWindow;
+ Project project;
+
+ public abstract Control Control { get; }
+
+ public IWorkbenchWindow WorkbenchWindow {
+ get { return workbenchWindow; }
+ set {
+ if (workbenchWindow != value) {
+ workbenchWindow = value;
+ OnWorkbenchWindowChanged ();
+ }
+ }
+ }
+
+ public virtual string TabPageLabel {
+ get {
+ return GettextCatalog.GetString ("Content");
+ }
+ }
+
+ public virtual bool CanReuseView (string fileName)
+ {
+ return false;
+ }
+
+ public object GetContent (Type type)
+ {
+ return GetContents (type).FirstOrDefault ();
+ }
+
+ public T GetContent<T> () where T : class
+ {
+ return GetContents<T> ().FirstOrDefault ();
+ }
+
+ public IEnumerable<T> GetContents<T> () where T : class
+ {
+ return OnGetContents (typeof (T)).Cast<T> ();
+ }
+
+ public IEnumerable<object> GetContents (Type type)
+ {
+ return OnGetContents (type);
+ }
+
+ protected virtual object OnGetContent (Type type)
+ {
+ if (type.IsInstanceOfType (this))
+ return this;
+ else
+ return null;
+ }
+
+ protected virtual IEnumerable<object> OnGetContents (Type type)
+ {
+ var c = OnGetContent (type);
+ if (c != null)
+ yield return c;
+ }
+
+ public virtual void Dispose ()
+ {
+ }
+
+ protected virtual void OnWorkbenchWindowChanged ()
+ {
+ }
+
+ internal protected virtual void OnSelected ()
+ {
+ }
+
+ internal protected virtual void OnDeselected ()
+ {
+ }
+
+ /// <summary>
+ /// Gets or sets the project bound to the view
+ /// </summary>
+ public Project Project {
+ get {
+ return project;
+ }
+ set {
+ OnSetProject (value);
+ }
+ }
+
+ /// <summary>
+ /// Called to update the project bound to the view.
+ /// </summary>
+ /// <param name="project">
+ /// New project assigned to the view. It can be null.
+ /// </param>
+ protected virtual void OnSetProject (Project project)
+ {
+ this.project = project;
+ }
+
+ /// <summary>
+ /// Gets the capability of this view for being reassigned a project
+ /// </summary>
+ /// <value>The project reload capability.</value>
+ public virtual ProjectReloadCapability ProjectReloadCapability {
+ get {
+ return ProjectReloadCapability.None;
+ }
+ }
+ }
+
+ public enum ProjectReloadCapability
+ {
+ None = 0,
+
+ /// <summary>
+ /// It can keep unsaved data. Some status (such as undo queue) may be lost.
+ /// </summary>
+ UnsavedData = 1,
+
+ /// <summary>
+ /// It can keep unsaved data and status.
+ /// </summary>
+ Full = 2
+ }
+}
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui/DefaultWorkbench.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui/DefaultWorkbench.cs
index be328013bb..e7e504b519 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui/DefaultWorkbench.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui/DefaultWorkbench.cs
@@ -38,7 +38,7 @@ using MonoDevelop.Ide.Codons;
using MonoDevelop.Components.Commands;
using MonoDevelop.Components.Docking;
-using MonoDevelop.Components.DockToolbars;
+using GLib;
using Gtk;
using MonoDevelop.Components;
using MonoDevelop.Ide.Extensions;
@@ -68,7 +68,7 @@ namespace MonoDevelop.Ide.Gui
List<string> layouts = new List<string> ();
List<PadCodon> padContentCollection = new List<PadCodon> ();
- List<IViewContent> viewContentCollection = new List<IViewContent> ();
+ List<ViewContent> viewContentCollection = new List<ViewContent> ();
Dictionary<PadCodon, IPadWindow> padWindows = new Dictionary<PadCodon, IPadWindow> ();
Dictionary<IPadWindow, PadCodon> padCodons = new Dictionary<IPadWindow, PadCodon> ();
@@ -80,7 +80,7 @@ namespace MonoDevelop.Ide.Gui
Rectangle normalBounds = new Rectangle(0, 0, MinimumWidth, MinimumHeight);
Gtk.Container rootWidget;
- DockToolbarFrame toolbarFrame;
+ CommandFrame toolbarFrame;
DockFrame dock;
SdiDragNotebook tabControl;
Gtk.MenuBar topMenu;
@@ -173,7 +173,7 @@ namespace MonoDevelop.Ide.Gui
var oldLayout = dock.CurrentLayout;
InitializeLayout (value);
- toolbarFrame.CurrentLayout = dock.CurrentLayout = value;
+ dock.CurrentLayout = value;
DestroyFullViewLayouts (oldLayout);
@@ -195,7 +195,7 @@ namespace MonoDevelop.Ide.Gui
}
}
- internal List<IViewContent> InternalViewContentCollection {
+ internal List<ViewContent> InternalViewContentCollection {
get {
Debug.Assert(viewContentCollection != null);
return viewContentCollection;
@@ -311,7 +311,7 @@ namespace MonoDevelop.Ide.Gui
topMenu = null;
}
- public void CloseContent (IViewContent content)
+ public void CloseContent (ViewContent content)
{
if (viewContentCollection.Contains(content)) {
if (content.Project != null)
@@ -324,8 +324,8 @@ namespace MonoDevelop.Ide.Gui
{
try {
closeAll = true;
- List<IViewContent> fullList = new List<IViewContent>(viewContentCollection);
- foreach (IViewContent content in fullList) {
+ List<ViewContent> fullList = new List<ViewContent>(viewContentCollection);
+ foreach (ViewContent content in fullList) {
IWorkbenchWindow window = content.WorkbenchWindow;
if (window != null)
window.CloseWindow(true);
@@ -336,7 +336,7 @@ namespace MonoDevelop.Ide.Gui
}
}
- private Xwt.Drawing.Image PrepareShowView (IViewContent content)
+ private Xwt.Drawing.Image PrepareShowView (ViewContent content)
{
viewContentCollection.Add (content);
@@ -365,7 +365,7 @@ namespace MonoDevelop.Ide.Gui
return mimeimage;
}
- public virtual void ShowView (IViewContent content, bool bringToFront, IViewDisplayBinding binding = null, DockNotebook notebook = null)
+ public virtual void ShowView (ViewContent content, bool bringToFront, IViewDisplayBinding binding = null, DockNotebook notebook = null)
{
bool isFile = content.IsFile;
if (!isFile) {
@@ -538,7 +538,7 @@ namespace MonoDevelop.Ide.Gui
try {
IWorkbenchWindow window = ActiveWorkbenchWindow;
if (window != null) {
- if (window.ActiveViewContent.Control.Toplevel == this)
+ if (window.ActiveViewContent.Control.GetNativeWidget<Gtk.Widget> ().Toplevel == this)
Title = GetTitle (window);
} else {
Title = GetDefaultTitle ();
@@ -557,7 +557,7 @@ namespace MonoDevelop.Ide.Gui
return BrandingService.ApplicationName;
}
- public Properties GetStoredMemento (IViewContent content)
+ public Properties GetStoredMemento (ViewContent content)
{
if (content != null && content.ContentName != null) {
string directory = UserProfile.Current.CacheDir.Combine ("temp");
@@ -589,7 +589,6 @@ namespace MonoDevelop.Ide.Gui
}
memento.WindowState = GdkWindow.State;
memento.FullScreen = fullscreen;
- memento.ToolbarStatus = toolbarFrame.GetStatus ();
return memento.ToProperties ();
}
set {
@@ -611,7 +610,6 @@ namespace MonoDevelop.Ide.Gui
}
//GdkWindow.State = memento.WindowState;
FullScreen = memento.FullScreen;
- toolbarFrame.SetStatus (memento.ToolbarStatus);
}
Decorated = true;
}
@@ -621,15 +619,15 @@ namespace MonoDevelop.Ide.Gui
{
foreach (FileEventInfo e in args) {
if (e.IsDirectory) {
- IViewContent[] views = new IViewContent [viewContentCollection.Count];
+ ViewContent[] views = new ViewContent [viewContentCollection.Count];
viewContentCollection.CopyTo (views, 0);
- foreach (IViewContent content in views) {
+ foreach (ViewContent content in views) {
if (content.ContentName.StartsWith (e.FileName)) {
((SdiWorkspaceWindow)content.WorkbenchWindow).CloseWindow (true, true);
}
}
} else {
- foreach (IViewContent content in viewContentCollection) {
+ foreach (ViewContent content in viewContentCollection) {
if (content.ContentName != null &&
content.ContentName == e.FileName) {
((SdiWorkspaceWindow)content.WorkbenchWindow).CloseWindow (true, true);
@@ -644,13 +642,13 @@ namespace MonoDevelop.Ide.Gui
{
foreach (FileCopyEventInfo e in args) {
if (e.IsDirectory) {
- foreach (IViewContent content in viewContentCollection) {
+ foreach (ViewContent content in viewContentCollection) {
if (content.ContentName != null && ((FilePath)content.ContentName).IsChildPathOf (e.SourceFile)) {
content.ContentName = e.TargetFile.Combine (((FilePath) content.ContentName).FileName);
}
}
} else {
- foreach (IViewContent content in viewContentCollection) {
+ foreach (ViewContent content in viewContentCollection) {
if (content.ContentName != null &&
content.ContentName == e.SourceFile) {
content.ContentName = e.TargetFile;
@@ -702,7 +700,7 @@ namespace MonoDevelop.Ide.Gui
bool showDirtyDialog = false;
- foreach (IViewContent content in viewContentCollection)
+ foreach (ViewContent content in viewContentCollection)
{
if (content.IsDirty) {
showDirtyDialog = true;
@@ -836,7 +834,7 @@ namespace MonoDevelop.Ide.Gui
toolbarFrame.AddContent (hbox);
*/
- toolbarFrame.AddContent (dock);
+ toolbarFrame.Add (dock);
// Create the notebook for the various documents.
tabControl = new SdiDragNotebook (this);
@@ -922,25 +920,27 @@ namespace MonoDevelop.Ide.Gui
var barHeight = tabControl.BarHeight;
DockVisualStyle style = new DockVisualStyle ();
- style.PadTitleLabelColor = Styles.PadLabelColor.ToGdkColor ();
- style.PadBackgroundColor = Styles.PadBackground.ToGdkColor ();
- style.TreeBackgroundColor = Styles.BaseBackgroundColor.ToGdkColor ();
- style.InactivePadBackgroundColor = Styles.InactivePadBackground.ToGdkColor ();
+ style.PadTitleLabelColor = Styles.PadLabelColor;
+ style.PadBackgroundColor = Styles.PadBackground;
+ style.TreeBackgroundColor = Styles.BaseBackgroundColor;
+ style.InactivePadBackgroundColor = Styles.InactivePadBackground;
style.PadTitleHeight = barHeight;
dock.DefaultVisualStyle = style;
style = new DockVisualStyle ();
- style.PadTitleLabelColor = Styles.PadLabelColor.ToGdkColor ();
+ style.PadTitleLabelColor = Styles.PadLabelColor;
style.PadTitleHeight = barHeight;
style.ShowPadTitleIcon = false;
style.UppercaseTitles = false;
style.ExpandedTabs = true;
- style.PadBackgroundColor = Styles.BrowserPadBackground.ToGdkColor ();
- style.InactivePadBackgroundColor = Styles.InactiveBrowserPadBackground.ToGdkColor ();
- style.TreeBackgroundColor = Styles.BrowserPadBackground.ToGdkColor ();
+ style.PadBackgroundColor = Styles.BrowserPadBackground;
+ style.InactivePadBackgroundColor = Styles.InactiveBrowserPadBackground;
+ style.TreeBackgroundColor = Styles.BrowserPadBackground;
dock.SetDockItemStyle ("ProjectPad", style);
dock.SetDockItemStyle ("ClassPad", style);
+
+
// dock.SetRegionStyle ("Documents/Left", style);
//dock.SetRegionStyle ("Documents/Right", style);
@@ -1020,11 +1020,6 @@ namespace MonoDevelop.Ide.Gui
IdeApp.Workbench.ReorderDocuments (oldPlacement, newPlacement);
}
- public void ResetToolbars ()
- {
- toolbarFrame.ResetToolbarPositions ();
- }
-
bool IsInFullViewMode {
get {
return dock.CurrentLayout.EndsWith (fullViewModeTag);
@@ -1072,7 +1067,6 @@ namespace MonoDevelop.Ide.Gui
{
if (oldLayout != null && oldLayout.EndsWith (fullViewModeTag)) {
dock.DeleteLayout (oldLayout);
- toolbarFrame.DeleteLayout (oldLayout);
}
}
@@ -1080,19 +1074,17 @@ namespace MonoDevelop.Ide.Gui
{
if (IsInFullViewMode) {
var oldLayout = dock.CurrentLayout;
- toolbarFrame.CurrentLayout = dock.CurrentLayout = CurrentLayout;
+ dock.CurrentLayout = CurrentLayout;
DestroyFullViewLayouts (oldLayout);
} else {
string fullViewLayout = CurrentLayout + fullViewModeTag;
if (!dock.HasLayout (fullViewLayout))
dock.CreateLayout (fullViewLayout, true);
- toolbarFrame.CurrentLayout = dock.CurrentLayout = fullViewLayout;
+ dock.CurrentLayout = fullViewLayout;
foreach (DockItem it in dock.GetItems ()) {
if (it.Behavior != DockItemBehavior.Locked && it.Visible)
it.Status = DockItemStatus.AutoHide;
}
- foreach (var tb in toolbarFrame.Toolbars)
- tb.Status = new DockToolbarStatus (tb.Id, false, tb.Position);
}
}
@@ -1293,18 +1285,12 @@ namespace MonoDevelop.Ide.Gui
void CreatePadContent (bool force, PadCodon padCodon, PadWindow window, DockItem item)
{
if (force || item.Content == null) {
- IPadContent newContent = padCodon.InitializePadContent (window);
+ PadContent newContent = padCodon.InitializePadContent (window);
- Gtk.Widget pcontent;
- if (newContent is Widget) {
- pcontent = newContent.Control;
- } else {
- PadCommandRouterContainer crc = new PadCommandRouterContainer (window, newContent.Control, newContent, true);
- crc.Show ();
- pcontent = crc;
- }
-
- PadCommandRouterContainer router = new PadCommandRouterContainer (window, pcontent, toolbarFrame, false);
+ Gtk.Widget crc = new PadCommandRouterContainer (window, newContent.Control, newContent, true);
+ crc.Show ();
+
+ Gtk.Widget router = new PadCommandRouterContainer (window, crc, toolbarFrame, false);
router.Show ();
item.Content = router;
}
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui/DisplayBindingService.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui/DisplayBindingService.cs
index 9c2a7c1f3e..527ad99970 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui/DisplayBindingService.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui/DisplayBindingService.cs
@@ -130,7 +130,7 @@ namespace MonoDevelop.Ide.Gui
//dummy binding, anchor point for extension tree
class DefaultDisplayBinding : IViewDisplayBinding
{
- public IViewContent CreateContent (FilePath fileName, string mimeType, Project ownerProject)
+ public ViewContent CreateContent (FilePath fileName, string mimeType, Project ownerProject)
{
throw new InvalidOperationException ();
}
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui/DockItemToolbarLoader.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui/DockItemToolbarLoader.cs
index 1da544f488..7307ae1c66 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui/DockItemToolbarLoader.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui/DockItemToolbarLoader.cs
@@ -29,6 +29,7 @@ using System.Drawing;
using MonoDevelop.Ide.Gui;
using MonoDevelop.Ide.Codons;
using MonoDevelop.Core;
+using MonoDevelop.Components;
using MonoDevelop.Components.Docking;
using MonoDevelop.Components.Commands;
using Gtk;
@@ -39,7 +40,7 @@ namespace MonoDevelop.Ide.Gui
{
public static class DockItemToolbarLoader
{
- public static void Add (this DockItemToolbar toolbar, CommandEntrySet entrySet, Gtk.Widget commandTarget)
+ public static void Add (this DockItemToolbar toolbar, CommandEntrySet entrySet, Control commandTarget)
{
CommandDockBar dockBar = new CommandDockBar (toolbar, commandTarget);
foreach (CommandEntry entry in entrySet) {
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui/Document.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui/Document.cs
index bf96b0db03..4be5df551c 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui/Document.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui/Document.cs
@@ -117,7 +117,13 @@ namespace MonoDevelop.Ide.Gui
return null;
}
-
+
+ internal ProjectReloadCapability ProjectReloadCapability {
+ get {
+ return Window.ViewContent.ProjectReloadCapability;
+ }
+ }
+
public override IEnumerable<T> GetContents<T> ()
{
foreach (var cnt in window.ViewContent.GetContents<T> ()) {
@@ -307,7 +313,7 @@ namespace MonoDevelop.Ide.Gui
viewsRO = null;
}
- DocumentView WrapView (IBaseViewContent content)
+ DocumentView WrapView (BaseViewContent content)
{
if (content == null)
return null;
@@ -319,7 +325,7 @@ namespace MonoDevelop.Ide.Gui
public override string Name {
get {
- IViewContent view = Window.ViewContent;
+ ViewContent view = Window.ViewContent;
return view.IsUntitled ? view.UntitledName : view.ContentName;
}
}
@@ -333,8 +339,13 @@ namespace MonoDevelop.Ide.Gui
public bool IsViewOnly {
get { return Window.ViewContent.IsViewOnly; }
}
-
- public void Reload ()
+
+ public Task Reload ()
+ {
+ return ReloadTask ();
+ }
+
+ async Task ReloadTask ()
{
ICustomXmlSerializer memento = null;
IMementoCapable mc = GetContent<IMementoCapable> ();
@@ -342,13 +353,18 @@ namespace MonoDevelop.Ide.Gui
memento = mc.Memento;
}
window.ViewContent.DiscardChanges ();
- window.ViewContent.Load (new FileOpenInformation (window.ViewContent.ContentName) { IsReloadOperation = true });
+ await window.ViewContent.Load (new FileOpenInformation (window.ViewContent.ContentName) { IsReloadOperation = true });
if (memento != null) {
mc.Memento = memento;
}
}
-
- public void Save ()
+
+ public Task Save ()
+ {
+ return SaveTask ();
+ }
+
+ async Task SaveTask ()
{
// suspend type service "check all file loop" since we have already a parsed document.
// Or at least one that updates "soon".
@@ -358,32 +374,32 @@ namespace MonoDevelop.Ide.Gui
return;
if (!Window.ViewContent.IsFile) {
- Window.ViewContent.Save ();
+ await Window.ViewContent.Save ();
return;
}
if (Window.ViewContent.ContentName == null) {
- SaveAs ();
+ await SaveAs ();
} else {
- try {
- FileService.RequestFileEdit (Window.ViewContent.ContentName, true);
+ try {
+ FileService.RequestFileEdit ((FilePath)Window.ViewContent.ContentName, true);
} catch (Exception ex) {
MessageService.ShowError (GettextCatalog.GetString ("The file could not be saved."), ex.Message, ex);
}
FileAttributes attr = FileAttributes.ReadOnly | FileAttributes.Directory | FileAttributes.Offline | FileAttributes.System;
- if (!File.Exists (Window.ViewContent.ContentName) || (File.GetAttributes (window.ViewContent.ContentName) & attr) != 0) {
- SaveAs ();
+ if (!File.Exists ((string)Window.ViewContent.ContentName) || (File.GetAttributes ((string)window.ViewContent.ContentName) & attr) != 0) {
+ await SaveAs();
} else {
string fileName = Window.ViewContent.ContentName;
// save backup first
- if (IdeApp.Preferences.CreateFileBackupCopies) {
- Window.ViewContent.Save (fileName + "~");
- FileService.NotifyFileChanged (fileName);
- }
- Window.ViewContent.Save (fileName);
- OnSaved (EventArgs.Empty);
+ if (IdeApp.Preferences.CreateFileBackupCopies) {
+ await Window.ViewContent.Save (fileName + "~");
+ FileService.NotifyFileChanged (fileName);
+ }
+ await Window.ViewContent.Save (fileName);
+ OnSaved(EventArgs.Empty);
}
}
} finally {
@@ -405,17 +421,21 @@ namespace MonoDevelop.Ide.Gui
}
}
- public void SaveAs ()
+ public Task SaveAs ()
{
- SaveAs (null);
+ return SaveAs (null);
}
-
- public void SaveAs (string filename)
+
+ public Task SaveAs (string filename)
+ {
+ return SaveAsTask (filename);
+ }
+
+ async Task SaveAsTask (string filename)
{
if (Window.ViewContent.IsViewOnly || !Window.ViewContent.IsFile)
return;
-
Encoding encoding = null;
var tbuffer = GetContent <ITextSource> ();
@@ -434,8 +454,8 @@ namespace MonoDevelop.Ide.Gui
if (Window.ViewContent.IsUntitled)
dlg.InitialFileName = Window.ViewContent.UntitledName;
else {
- dlg.CurrentFolder = Path.GetDirectoryName (Window.ViewContent.ContentName);
- dlg.InitialFileName = Path.GetFileName (Window.ViewContent.ContentName);
+ dlg.CurrentFolder = Path.GetDirectoryName ((string)Window.ViewContent.ContentName);
+ dlg.InitialFileName = Path.GetFileName ((string)Window.ViewContent.ContentName);
}
if (!dlg.Run ())
@@ -460,15 +480,15 @@ namespace MonoDevelop.Ide.Gui
if (tbuffer != null && encoding != null)
TextFileUtility.WriteText (filename + "~", tbuffer.Text, encoding, tbuffer.UseBOM);
else
- Window.ViewContent.Save (new FileSaveInformation (filename + "~", encoding));
+ await Window.ViewContent.Save (new FileSaveInformation (filename + "~", encoding));
}
TypeSystemService.RemoveSkippedfile (FileName);
// do actual save
- Window.ViewContent.Save (new FileSaveInformation (filename, encoding));
+ await Window.ViewContent.Save (new FileSaveInformation (filename, encoding));
DesktopService.RecentFiles.AddFile (filename, (Project)null);
OnSaved (EventArgs.Empty);
- UpdateParseDocument ();
+ await UpdateParseDocument ();
}
public bool Close ()
@@ -668,13 +688,11 @@ namespace MonoDevelop.Ide.Gui
UnloadAdhocProject ();
if (adhocProject == null)
analysisDocument = null;
- ISupportsProjectReload pr = GetContent<ISupportsProjectReload> ();
- if (pr != null) {
+ if (Window.ViewContent.ProjectReloadCapability != ProjectReloadCapability.None) {
// Unsubscribe project events
if (Window.ViewContent.Project != null)
Window.ViewContent.Project.Modified -= HandleProjectModified;
Window.ViewContent.Project = project;
- pr.Update (project);
}
if (project != null)
project.Modified += HandleProjectModified;
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui/DocumentToolbar.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui/DocumentToolbar.cs
index 936b0434f0..2761ce2b7f 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui/DocumentToolbar.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui/DocumentToolbar.cs
@@ -24,6 +24,7 @@
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
using System;
+using System.Linq;
using Gtk;
using MonoDevelop.Components;
@@ -48,29 +49,30 @@ namespace MonoDevelop.Ide.Gui
frame = al;
}
- internal Widget Container {
+ internal Control Container {
get { return frame; }
}
- public void Add (Widget widget)
+ public void Add (Control widget)
{
Add (widget, false);
}
- public void Add (Widget widget, bool fill)
+ public void Add (Control widget, bool fill)
{
Add (widget, fill, -1);
}
- public void Add (Widget widget, bool fill, int padding)
+ public void Add (Control widget, bool fill, int padding)
{
Add (widget, fill, padding, -1);
}
- void Add (Widget widget, bool fill, int padding, int index)
+ void Add (Control control, bool fill, int padding, int index)
{
int defaultPadding = 3;
+ Gtk.Widget widget = control;
if (widget is Button) {
((Button)widget).Relief = ReliefStyle.None;
((Button)widget).FocusOnClick = false;
@@ -116,12 +118,12 @@ namespace MonoDevelop.Ide.Gui
}
}
- public void Insert (Widget w, int index)
+ public void Insert (Control w, int index)
{
Add (w, false, 0, index);
}
- public void Remove (Widget widget)
+ public void Remove (Control widget)
{
box.Remove (widget);
}
@@ -145,8 +147,8 @@ namespace MonoDevelop.Ide.Gui
frame.ShowAll ();
}
- public Widget[] Children {
- get { return box.Children; }
+ public Control[] Children {
+ get { return box.Children.Select (w => (Control)w).ToArray (); }
}
class ToolbarBox: Gtk.Alignment
@@ -179,19 +181,73 @@ namespace MonoDevelop.Ide.Gui
}
}
- public class DocumentToolButton: Gtk.Button
+ public class DocumentToolButton : Control
{
- public DocumentToolButton (string stockId)
+ public DocumentToolButtonImage Image {
+ get { return (ImageView)button.Image; }
+ set { button.Image = (ImageView)value; }
+ }
+
+ public string TooltipText {
+ get { return button.TooltipText; }
+ set { button.TooltipText = value; }
+ }
+
+ public string Label {
+ get { return button.Label; }
+ set { button.Label = value; }
+ }
+
+ Gtk.Button button;
+
+ public DocumentToolButton (string stockId) : this (stockId, null)
{
- Image = new ImageView (stockId, IconSize.Menu);
- Image.Show ();
}
-
+
public DocumentToolButton (string stockId, string label)
{
+ button = new Button ();
Label = label;
Image = new ImageView (stockId, IconSize.Menu);
- Image.Show ();
+ button.Image.Show ();
+ }
+
+ protected override object CreateNativeWidget ()
+ {
+ return button;
+ }
+
+ public event EventHandler Clicked {
+ add {
+ button.Clicked += value;
+ }
+ remove {
+ button.Clicked -= value;
+ }
+ }
+
+ public class DocumentToolButtonImage : Control
+ {
+ ImageView image;
+ internal DocumentToolButtonImage (ImageView image)
+ {
+ this.image = image;
+ }
+
+ protected override object CreateNativeWidget ()
+ {
+ return image;
+ }
+
+ public static implicit operator ImageView (DocumentToolButtonImage d)
+ {
+ return d.GetNativeWidget<ImageView> ();
+ }
+
+ public static implicit operator DocumentToolButtonImage (ImageView d)
+ {
+ return new DocumentToolButtonImage (d);
+ }
}
}
}
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui/DocumentView.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui/DocumentView.cs
index e92d2e985b..d190c1f258 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui/DocumentView.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui/DocumentView.cs
@@ -29,16 +29,16 @@ namespace MonoDevelop.Ide.Gui
{
public class DocumentView
{
- IBaseViewContent content;
+ BaseViewContent content;
Document document;
- internal DocumentView (Document doc, IBaseViewContent content)
+ internal DocumentView (Document doc, BaseViewContent content)
{
document = doc;
this.content = content;
}
- internal IBaseViewContent BaseContent {
+ internal BaseViewContent BaseContent {
get { return content; }
}
@@ -53,8 +53,8 @@ namespace MonoDevelop.Ide.Gui
public void Select ()
{
- if (content is IAttachableViewContent)
- document.Window.SwitchView ((IAttachableViewContent)content);
+ if (content is BaseViewContent)
+ document.Window.SwitchView ((BaseViewContent)content);
else
document.Window.SwitchView (0);
}
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui/FileViewer.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui/FileViewer.cs
index dbd798402d..a39569c75c 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui/FileViewer.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui/FileViewer.cs
@@ -30,6 +30,7 @@ using System;
using MonoDevelop.Ide.Codons;
using MonoDevelop.Ide.Desktop;
using System.Text;
+using System.Threading.Tasks;
namespace MonoDevelop.Ide.Gui
{
@@ -84,18 +85,18 @@ namespace MonoDevelop.Ide.Gui
return app.GetHashCode ();
}
- public Document OpenFile (string filePath)
+ public Task<Document> OpenFile (string filePath)
{
return OpenFile (filePath, null);
}
- public Document OpenFile (string filePath, Encoding encoding)
+ public Task<Document> OpenFile (string filePath, Encoding encoding)
{
if (binding != null)
return IdeApp.Workbench.OpenDocument (filePath, null, -1, -1, OpenDocumentOptions.Default, encoding, binding);
else {
app.Launch (filePath);
- return null;
+ return Task.FromResult<Document> (null);
}
}
}
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui/HiddenTextEditorViewContent.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui/HiddenTextEditorViewContent.cs
index cb55076e14..0bfd0a0563 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui/HiddenTextEditorViewContent.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui/HiddenTextEditorViewContent.cs
@@ -26,13 +26,15 @@
using System;
using MonoDevelop.Ide.Gui.Content;
+using MonoDevelop.Components;
using MonoDevelop.Core;
using MonoDevelop.Ide.Editor;
using MonoDevelop.Core.Text;
+using System.Threading.Tasks;
namespace MonoDevelop.Ide.Gui
{
- public class HiddenTextEditorViewContent : MonoDevelop.Ide.Gui.AbstractViewContent, IServiceProvider
+ public class HiddenTextEditorViewContent : MonoDevelop.Ide.Gui.ViewContent, IServiceProvider
{
readonly TextEditor editor;
@@ -42,7 +44,7 @@ namespace MonoDevelop.Ide.Gui
}
}
- public override Gtk.Widget Control {
+ public override Control Control {
get {
return null;
}
@@ -60,10 +62,6 @@ namespace MonoDevelop.Ide.Gui
Name = editor.FileName;
}
- public override void Load (FileOpenInformation fileOpenInformation)
- {
- }
-
public FilePath Name {
get;
set;
@@ -227,11 +225,12 @@ namespace MonoDevelop.Ide.Gui
handler (this, e);
}
- public override object GetContent (Type type)
+ protected override object OnGetContent (Type type)
{
if (type.IsAssignableFrom (typeof(TextEditor)))
return Editor;
- return base.GetContent (type);
+ else
+ return base.OnGetContent (type);
}
}
}
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui/HiddenWorkbenchWindow.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui/HiddenWorkbenchWindow.cs
index fedbecc6e8..34d6fef15f 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui/HiddenWorkbenchWindow.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui/HiddenWorkbenchWindow.cs
@@ -61,15 +61,15 @@ namespace MonoDevelop.Ide.Gui
get { return AddinManager.AddinEngine; }
}
- MonoDevelop.Ide.Gui.IViewContent viewContent;
- public MonoDevelop.Ide.Gui.IViewContent ViewContent {
+ MonoDevelop.Ide.Gui.ViewContent viewContent;
+ public MonoDevelop.Ide.Gui.ViewContent ViewContent {
get { return viewContent; }
set { viewContent = value; }
}
- public IEnumerable<IAttachableViewContent> SubViewContents { get { return new IAttachableViewContent[0]; } }
+ public IEnumerable<BaseViewContent> SubViewContents { get { return new BaseViewContent[0]; } }
- public MonoDevelop.Ide.Gui.IBaseViewContent ActiveViewContent {
+ public MonoDevelop.Ide.Gui.BaseViewContent ActiveViewContent {
get { return ViewContent;}
set {}
}
@@ -86,7 +86,7 @@ namespace MonoDevelop.Ide.Gui
public void SwitchView (int viewNumber)
{
}
- public void SwitchView (MonoDevelop.Ide.Gui.IAttachableViewContent subViewContent)
+ public void SwitchView (MonoDevelop.Ide.Gui.BaseViewContent subViewContent)
{
}
@@ -95,26 +95,26 @@ namespace MonoDevelop.Ide.Gui
return -1;
}
- public void AttachViewContent (MonoDevelop.Ide.Gui.IAttachableViewContent subViewContent)
+ public void AttachViewContent (MonoDevelop.Ide.Gui.BaseViewContent subViewContent)
{
}
- public void InsertViewContent (int index, MonoDevelop.Ide.Gui.IAttachableViewContent subViewContent)
+ public void InsertViewContent (int index, MonoDevelop.Ide.Gui.BaseViewContent subViewContent)
{
}
- public DocumentToolbar GetToolbar (IBaseViewContent targetView)
+ public DocumentToolbar GetToolbar (BaseViewContent targetView)
{
return null;
}
public event EventHandler TitleChanged { add {} remove {} }
- public event EventHandler DocumentChanged { add {} remove {} }
- public event MonoDevelop.Ide.Gui.WorkbenchWindowEventHandler Closing { add {} remove {} }
- public event MonoDevelop.Ide.Gui.WorkbenchWindowEventHandler Closed { add {} remove {} }
- public event MonoDevelop.Ide.Gui.ActiveViewContentEventHandler ActiveViewContentChanged { add {} remove {} }
+ public event EventHandler DocumentChanged { add {} remove {} }
+ public event MonoDevelop.Ide.Gui.WorkbenchWindowEventHandler Closing { add {} remove {} }
+ public event MonoDevelop.Ide.Gui.WorkbenchWindowEventHandler Closed { add {} remove {} }
+ public event MonoDevelop.Ide.Gui.ActiveViewContentEventHandler ActiveViewContentChanged { add {} remove {} }
public event EventHandler ViewsChanged { add {} remove {} }
}
}
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui/IDisplayBinding.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui/IDisplayBinding.cs
index be4b654032..1ddfa22ac5 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui/IDisplayBinding.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui/IDisplayBinding.cs
@@ -53,7 +53,7 @@ namespace MonoDevelop.Ide.Gui
///<summary>A display binding that opens a new view within the workspace.</summary>
public interface IViewDisplayBinding : IDisplayBinding
{
- IViewContent CreateContent (FilePath fileName, string mimeType, Project ownerProject);
+ ViewContent CreateContent (FilePath fileName, string mimeType, Project ownerProject);
string Name { get; }
}
@@ -66,7 +66,7 @@ namespace MonoDevelop.Ide.Gui
///<summary>A display binding that attaches to an existing view in the workspace.</summary>
public interface IAttachableDisplayBinding
{
- bool CanAttachTo (IViewContent content);
- IAttachableViewContent CreateViewContent (IViewContent viewContent);
+ bool CanAttachTo (ViewContent content);
+ BaseViewContent CreateViewContent (ViewContent viewContent);
}
} \ No newline at end of file
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui/IPadContainer.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui/IPadContainer.cs
index 4a28eb46bb..756be72f31 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui/IPadContainer.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui/IPadContainer.cs
@@ -92,12 +92,12 @@ namespace MonoDevelop.Ide.Gui
/// <summary>
/// Interface providing the content widget
/// </summary>
- IPadContent Content { get; }
+ PadContent Content { get; }
/// <summary>
/// Returns a toolbar for the pad.
/// </summary>
- DockItemToolbar GetToolbar (Gtk.PositionType position);
+ DockItemToolbar GetToolbar (DockPositionType position);
/// <summary>
/// Brings the pad to the front.
@@ -137,7 +137,7 @@ namespace MonoDevelop.Ide.Gui
bool isWorking;
bool hasErrors;
bool hasNewData;
- IPadContent content;
+ PadContent content;
PadCodon codon;
DefaultWorkbench workbench;
@@ -151,7 +151,7 @@ namespace MonoDevelop.Ide.Gui
this.icon = codon.Icon;
}
- public IPadContent Content {
+ public PadContent Content {
get {
CreateContent ();
return content;
@@ -253,7 +253,7 @@ namespace MonoDevelop.Ide.Gui
}
}
- public DockItemToolbar GetToolbar (Gtk.PositionType position)
+ public DockItemToolbar GetToolbar (DockPositionType position)
{
return Item.GetToolbar (position);
}
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui/IViewContent.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui/IViewContent.cs
deleted file mode 100644
index 0c76d3cc02..0000000000
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui/IViewContent.cs
+++ /dev/null
@@ -1,66 +0,0 @@
-// IViewContent.cs
-//
-// Author:
-// Viktoria Dudka (viktoriad@remobjects.com)
-//
-// Copyright (c) 2009 RemObjects Software
-//
-// Permission is hereby granted, free of charge, to any person obtaining a copy
-// of this software and associated documentation files (the "Software"), to deal
-// in the Software without restriction, including without limitation the rights
-// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the Software is
-// furnished to do so, subject to the following conditions:
-//
-// The above copyright notice and this permission notice shall be included in
-// all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-// THE SOFTWARE.
-//
-//
-
-using System;
-using MonoDevelop.Projects;
-
-namespace MonoDevelop.Ide.Gui
-{
- public interface IViewContent : IBaseViewContent
- {
- Project Project { get; set; }
-
- string PathRelativeToProject { get; }
- string ContentName { get; set; }
- string UntitledName { get; set; }
- string StockIconId { get; }
-
- bool IsUntitled { get; }
- bool IsViewOnly { get; }
- bool IsFile { get; }
- bool IsDirty { get; set; }
- bool IsReadOnly { get; }
-
- void Load (FileOpenInformation fileOpenInformation);
- void Load (string fileName);
- void LoadNew (System.IO.Stream content, string mimeType);
- void Save (FileSaveInformation fileSaveInformation);
- void Save (string fileName);
- void Save ();
-
- /// <summary>
- /// Discards all changes. This method is called before a dirty file is closed. It tells the view
- /// content to remove all autosave data of the file.
- /// </summary>
- void DiscardChanges ();
-
- event EventHandler ContentNameChanged;
- event EventHandler ContentChanged;
- event EventHandler DirtyChanged;
- event EventHandler BeforeSave;
- }
-}
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui/IWorkbenchWindow.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui/IWorkbenchWindow.cs
index 4548bd5deb..8bcc0cde5c 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui/IWorkbenchWindow.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui/IWorkbenchWindow.cs
@@ -35,10 +35,10 @@ namespace MonoDevelop.Ide.Gui
{
public interface IWorkbenchWindow
{
- IViewContent ViewContent { get; }
- IBaseViewContent ActiveViewContent { get; set; }
+ ViewContent ViewContent { get; }
+ BaseViewContent ActiveViewContent { get; set; }
- IEnumerable<IAttachableViewContent> SubViewContents { get; }
+ IEnumerable<BaseViewContent> SubViewContents { get; }
Document Document { get; set; }
string DocumentType { get; set; }
@@ -46,11 +46,11 @@ namespace MonoDevelop.Ide.Gui
bool ShowNotification { get; set; }
ExtensionContext ExtensionContext { get; }
- void AttachViewContent (IAttachableViewContent subViewContent);
- void InsertViewContent (int index, IAttachableViewContent subViewContent);
+ void AttachViewContent (BaseViewContent subViewContent);
+ void InsertViewContent (int index, BaseViewContent subViewContent);
void SwitchView (int index);
- void SwitchView (IAttachableViewContent subViewContent);
+ void SwitchView (BaseViewContent subViewContent);
int FindView <T>();
bool CloseWindow (bool force);
@@ -59,7 +59,7 @@ namespace MonoDevelop.Ide.Gui
/// <summary>
/// Returns a toolbar for the pad.
/// </summary>
- DocumentToolbar GetToolbar (IBaseViewContent targetView);
+ DocumentToolbar GetToolbar (BaseViewContent targetView);
event EventHandler DocumentChanged;
event WorkbenchWindowEventHandler Closed;
@@ -91,12 +91,12 @@ namespace MonoDevelop.Ide.Gui
public delegate void ActiveViewContentEventHandler (object o, ActiveViewContentEventArgs e);
public class ActiveViewContentEventArgs : EventArgs
{
- private IBaseViewContent content = null;
- public IBaseViewContent Content {
+ private BaseViewContent content = null;
+ public BaseViewContent Content {
get { return content; }
}
- public ActiveViewContentEventArgs (IBaseViewContent content)
+ public ActiveViewContentEventArgs (BaseViewContent content)
{
this.content = content;
}
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui/PadContent.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui/PadContent.cs
index ff9d31b89a..c173e1c009 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui/PadContent.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui/PadContent.cs
@@ -1,4 +1,4 @@
-// IPadContent.cs
+// IPadContent.cs
//
// Author:
// Viktoria Dudka (viktoriad@remobjects.com)
@@ -27,13 +27,54 @@
using System;
using Gtk;
+using MonoDevelop.Components;
namespace MonoDevelop.Ide.Gui
{
- public interface IPadContent : IDisposable
+ public abstract class PadContent : IDisposable
{
- Widget Control { get; }
+ IPadWindow window;
+ string icon;
+ string title;
- void Initialize (IPadWindow window);
+ protected PadContent (string title, string icon = null): this()
+ {
+ this.icon = icon;
+ this.title = title;
+ }
+
+ protected PadContent ()
+ {
+ Id = GetType ().FullName;
+ }
+
+ public virtual string Id { get; set; }
+
+ public IPadWindow Window {
+ get { return window; }
+ }
+
+ public abstract Control Control { get; }
+
+ internal void Init (IPadWindow window)
+ {
+ this.window = window;
+
+ if (title != null)
+ window.Title = title;
+
+ if (icon != null)
+ window.Icon = icon;
+
+ Initialize (window);
+ }
+
+ protected virtual void Initialize (IPadWindow window)
+ {
+ }
+
+ public virtual void Dispose ()
+ {
+ }
}
}
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui/PadFontChanger.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui/PadFontChanger.cs
index 7f74c2eb22..c88b74afbc 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui/PadFontChanger.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui/PadFontChanger.cs
@@ -26,6 +26,7 @@
using System;
using Pango;
+using MonoDevelop.Components;
using MonoDevelop.Core;
namespace MonoDevelop.Ide.Gui
@@ -38,12 +39,12 @@ namespace MonoDevelop.Ide.Gui
Action<FontDescription> updater;
Action resizer;
- public PadFontChanger (Gtk.Widget styleSource, Action<FontDescription> updater)
+ public PadFontChanger (Control styleSource, Action<FontDescription> updater)
: this (styleSource, updater, null)
{
}
- public PadFontChanger (Gtk.Widget styleSource, Action<FontDescription> updater, Action resizer)
+ public PadFontChanger (Control styleSource, Action<FontDescription> updater, Action resizer)
{
this.styleSource = styleSource;
this.updater = updater;
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui/ProjectLoadProgressMonitor.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui/ProjectLoadProgressMonitor.cs
index bc19460982..acf648032b 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui/ProjectLoadProgressMonitor.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui/ProjectLoadProgressMonitor.cs
@@ -29,7 +29,7 @@ using MonoDevelop.Projects.Extensions;
namespace MonoDevelop.Ide.Gui
{
- public class GtkProjectLoadProgressMonitor : ProjectLoadProgressMonitor
+ class GtkProjectLoadProgressMonitor : ProjectLoadProgressMonitor
{
MigrationType? Migration {
get; set;
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui/SdiWorkspaceWindow.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui/SdiWorkspaceWindow.cs
index e937b4faaf..e1fa1b3d15 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui/SdiWorkspaceWindow.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui/SdiWorkspaceWindow.cs
@@ -44,16 +44,16 @@ namespace MonoDevelop.Ide.Gui
internal class SdiWorkspaceWindow : EventBox, IWorkbenchWindow, ICommandDelegatorRouter
{
DefaultWorkbench workbench;
- IViewContent content;
+ ViewContent content;
ExtensionContext extensionContext;
FileTypeCondition fileTypeCondition = new FileTypeCondition ();
- List<IBaseViewContent> viewContents = new List<IBaseViewContent> ();
+ List<BaseViewContent> viewContents = new List<BaseViewContent> ();
Notebook subViewNotebook = null;
Tabstrip subViewToolbar = null;
PathBar pathBar = null;
HBox toolbarBox = null;
- Dictionary<IBaseViewContent,DocumentToolbar> documentToolbars = new Dictionary<IBaseViewContent, DocumentToolbar> ();
+ Dictionary<BaseViewContent,DocumentToolbar> documentToolbars = new Dictionary<BaseViewContent, DocumentToolbar> ();
VBox box;
DockNotebookTab tab;
@@ -89,7 +89,7 @@ namespace MonoDevelop.Ide.Gui
SetDockNotebookTabTitle ();
}
- public SdiWorkspaceWindow (DefaultWorkbench workbench, IViewContent content, DockNotebook tabControl, DockNotebookTab tabLabel) : base ()
+ public SdiWorkspaceWindow (DefaultWorkbench workbench, ViewContent content, DockNotebook tabControl, DockNotebookTab tabLabel) : base ()
{
this.workbench = workbench;
this.tabControl = tabControl;
@@ -115,8 +115,6 @@ namespace MonoDevelop.Ide.Gui
content.ContentNameChanged += new EventHandler(SetTitleEvent);
content.DirtyChanged += HandleDirtyChanged;
- content.BeforeSave += new EventHandler(BeforeSave);
- content.ContentChanged += new EventHandler (OnContentChanged);
box.Show ();
Add (box);
@@ -205,15 +203,15 @@ namespace MonoDevelop.Ide.Gui
}
}
- public IEnumerable<IAttachableViewContent> SubViewContents {
+ public IEnumerable<BaseViewContent> SubViewContents {
get {
- return viewContents.OfType<IAttachableViewContent> ();
+ return viewContents.OfType<BaseViewContent> ();
}
}
// caution use activeView with care !!
- IBaseViewContent activeView = null;
- public IBaseViewContent ActiveViewContent {
+ BaseViewContent activeView = null;
+ public BaseViewContent ActiveViewContent {
get {
if (activeView != null)
return activeView;
@@ -233,7 +231,7 @@ namespace MonoDevelop.Ide.Gui
ShowPage (viewNumber);
}
- public void SwitchView (IAttachableViewContent view)
+ public void SwitchView (BaseViewContent view)
{
if (subViewNotebook != null)
ShowPage (viewContents.IndexOf (view));
@@ -359,7 +357,7 @@ namespace MonoDevelop.Ide.Gui
}
}
- public DocumentToolbar GetToolbar (IBaseViewContent targetView)
+ public DocumentToolbar GetToolbar (BaseViewContent targetView)
{
DocumentToolbar toolbar;
if (!documentToolbars.TryGetValue (targetView, out toolbar)) {
@@ -373,15 +371,7 @@ namespace MonoDevelop.Ide.Gui
return toolbar;
}
- void BeforeSave(object sender, EventArgs e)
- {
- IAttachableViewContent secondaryViewContent = ActiveViewContent as IAttachableViewContent;
- if (secondaryViewContent != null) {
- secondaryViewContent.BeforeSave ();
- }
- }
-
- public IViewContent ViewContent {
+ public ViewContent ViewContent {
get {
return content;
}
@@ -419,7 +409,7 @@ namespace MonoDevelop.Ide.Gui
myUntitledTitle = baseName + System.IO.Path.GetExtension (content.UntitledName);
while (found) {
found = false;
- foreach (IViewContent windowContent in workbench.InternalViewContentCollection) {
+ foreach (ViewContent windowContent in workbench.InternalViewContentCollection) {
string title = windowContent.WorkbenchWindow.Title;
if (title.EndsWith("+")) {
title = title.Substring(0, title.Length - 1);
@@ -449,13 +439,6 @@ namespace MonoDevelop.Ide.Gui
}
}
- public void OnContentChanged (object o, EventArgs e)
- {
- foreach (IAttachableViewContent subContent in SubViewContents) {
- subContent.BaseContentChanged ();
- }
- }
-
public bool CloseWindow (bool force)
{
return CloseWindow (force, false);
@@ -485,7 +468,7 @@ namespace MonoDevelop.Ide.Gui
}
if (viewContents != null) {
- foreach (IAttachableViewContent sv in SubViewContents) {
+ foreach (BaseViewContent sv in SubViewContents) {
sv.Dispose ();
}
viewContents = null;
@@ -494,8 +477,6 @@ namespace MonoDevelop.Ide.Gui
if (content != null) {
content.ContentNameChanged -= new EventHandler(SetTitleEvent);
content.DirtyChanged -= HandleDirtyChanged;
- content.BeforeSave -= new EventHandler(BeforeSave);
- content.ContentChanged -= new EventHandler (OnContentChanged);
content.WorkbenchWindow = null;
content.Dispose ();
content = null;
@@ -566,8 +547,9 @@ namespace MonoDevelop.Ide.Gui
// may happen before the main content is added to 'box', so we
// have to check if the content is already parented or not
- if (this.ViewContent.Control.Parent != null)
- box.Remove (this.ViewContent.Control);
+ Gtk.Widget viewWidget = ViewContent.Control;
+ if (viewWidget.Parent != null)
+ box.Remove (viewWidget);
subViewNotebook = new Notebook ();
subViewNotebook.TabPos = PositionType.Bottom;
@@ -590,12 +572,12 @@ namespace MonoDevelop.Ide.Gui
#endregion
- public void AttachViewContent (IAttachableViewContent subViewContent)
+ public void AttachViewContent (BaseViewContent subViewContent)
{
InsertViewContent (viewContents.Count, subViewContent);
}
- public void InsertViewContent (int index, IAttachableViewContent subViewContent)
+ public void InsertViewContent (int index, BaseViewContent subViewContent)
{
// need to create child Notebook when first IAttachableViewContent is added
CheckCreateSubViewContents ();
@@ -604,19 +586,17 @@ namespace MonoDevelop.Ide.Gui
subViewContent.WorkbenchWindow = this;
InsertButton (index, subViewContent.TabPageLabel, subViewContent);
- OnContentChanged (null, null);
-
if (ViewsChanged != null)
ViewsChanged (this, EventArgs.Empty);
}
- protected Tab AddButton (string label, IBaseViewContent viewContent)
+ protected Tab AddButton (string label, BaseViewContent viewContent)
{
return InsertButton (viewContents.Count, label, viewContent);
}
bool updating = false;
- protected Tab InsertButton (int index, string label, IBaseViewContent viewContent)
+ protected Tab InsertButton (int index, string label, BaseViewContent viewContent)
{
CheckCreateSubViewToolbar ();
updating = true;
@@ -642,7 +622,7 @@ namespace MonoDevelop.Ide.Gui
addedContent = true;
}
- int page = viewContents.IndexOf ((IBaseViewContent) tab.Tag);
+ int page = viewContents.IndexOf ((BaseViewContent) tab.Tag);
SetCurrentView (page);
QueueDraw ();
};
@@ -723,39 +703,39 @@ namespace MonoDevelop.Ide.Gui
void SetCurrentView (int newIndex)
{
- IAttachableViewContent subViewContent;
+ BaseViewContent subViewContent;
int oldIndex = subViewNotebook.CurrentPage;
subViewNotebook.CurrentPage = newIndex;
if (oldIndex != -1) {
- subViewContent = viewContents[oldIndex] as IAttachableViewContent;
+ subViewContent = viewContents[oldIndex] as BaseViewContent;
if (subViewContent != null)
- subViewContent.Deselected ();
+ subViewContent.OnDeselected ();
}
- subViewContent = viewContents[newIndex] as IAttachableViewContent;
+ subViewContent = viewContents[newIndex] as BaseViewContent;
DetachFromPathedDocument ();
MonoDevelop.Ide.Gui.Content.IPathedDocument pathedDocument;
- if (newIndex < 0 || newIndex == viewContents.IndexOf (ViewContent)) {
- pathedDocument = Document != null ? Document.GetContent<IPathedDocument> () : (IPathedDocument) ViewContent.GetContent (typeof(IPathedDocument));
+ if (newIndex < 0 || newIndex == viewContents.IndexOf ((BaseViewContent)ViewContent)) {
+ pathedDocument = Document != null ? Document.GetContent<IPathedDocument> () : (IPathedDocument)ViewContent.GetContent (typeof(IPathedDocument));
} else {
- pathedDocument = (IPathedDocument) viewContents[newIndex].GetContent (typeof(IPathedDocument));
+ pathedDocument = (IPathedDocument)viewContents[newIndex].GetContent (typeof(IPathedDocument));
}
var toolbarVisible = false;
foreach (var t in documentToolbars) {
toolbarVisible = ActiveViewContent == t.Key;
- t.Value.Container.Visible = toolbarVisible;
+ t.Value.Container.GetNativeWidget<Gtk.Widget> ().Visible = toolbarVisible;
}
if (pathedDocument != null && !toolbarVisible)
AttachToPathedDocument (pathedDocument);
if (subViewContent != null)
- subViewContent.Selected ();
+ subViewContent.OnSelected ();
OnActiveViewContentChanged (new ActiveViewContentEventArgs (this.ActiveViewContent));
}
@@ -775,12 +755,8 @@ namespace MonoDevelop.Ide.Gui
if (((Gtk.Window)Toplevel).HasToplevelFocus)
DockNotebook.ActiveNotebook = (SdiDragNotebook)Parent.Parent;
- Gtk.Widget w = content as Gtk.Widget;
- if (w != this.tabPage) {
- // Route commands to the view
- return ActiveViewContent;
- } else
- return null;
+ // Route commands to the view
+ return ActiveViewContent;
}
void SetDockNotebookTabTitle ()
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui/ViewCommandHandlers.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui/ViewCommandHandlers.cs
index 0a671e198b..0d312aa706 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui/ViewCommandHandlers.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui/ViewCommandHandlers.cs
@@ -159,8 +159,13 @@ namespace MonoDevelop.Ide.Gui
[CommandUpdateHandler (EditCommands.Cut)]
protected void OnUpdateCut (CommandInfo info)
{
+ bool inWpf = false;
+ #if WIN32
+ if (System.Windows.Input.Keyboard.FocusedElement != null)
+ inWpf = true;
+ #endif
IClipboardHandler handler = GetContent <IClipboardHandler> ();
- if (handler != null && handler.EnableCut)
+ if (!inWpf && handler != null && handler.EnableCut)
info.Enabled = true;
else
info.Bypass = true;
@@ -177,8 +182,13 @@ namespace MonoDevelop.Ide.Gui
[CommandUpdateHandler (EditCommands.Copy)]
protected void OnUpdateCopy (CommandInfo info)
{
+ bool inWpf = false;
+ #if WIN32
+ if (System.Windows.Input.Keyboard.FocusedElement != null)
+ inWpf = true;
+ #endif
IClipboardHandler handler = GetContent <IClipboardHandler> ();
- if (handler != null && handler.EnableCopy)
+ if (!inWpf && handler != null && handler.EnableCopy)
info.Enabled = true;
else
info.Bypass = true;
@@ -195,8 +205,13 @@ namespace MonoDevelop.Ide.Gui
[CommandUpdateHandler (EditCommands.Paste)]
protected void OnUpdatePaste (CommandInfo info)
{
+ bool inWpf = false;
+ #if WIN32
+ if (System.Windows.Input.Keyboard.FocusedElement != null)
+ inWpf = true;
+ #endif
IClipboardHandler handler = GetContent <IClipboardHandler> ();
- if (handler != null && handler.EnablePaste)
+ if (!inWpf && handler != null && handler.EnablePaste)
info.Enabled = true;
else
info.Bypass = true;
@@ -231,8 +246,13 @@ namespace MonoDevelop.Ide.Gui
[CommandUpdateHandler (EditCommands.SelectAll)]
protected void OnUpdateSelectAll (CommandInfo info)
{
+ bool inWpf = false;
+ #if WIN32
+ if (System.Windows.Input.Keyboard.FocusedElement != null)
+ inWpf = true;
+ #endif
IClipboardHandler handler = GetContent <IClipboardHandler> ();
- if (handler != null)
+ if (!inWpf && handler != null)
info.Enabled = handler.EnableSelectAll;
else
info.Bypass = true;
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui/AbstractViewContent.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui/ViewContent.cs
index 620ca00313..e7f69e98e4 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui/AbstractViewContent.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui/ViewContent.cs
@@ -1,4 +1,4 @@
-// AbstractViewContent.cs
+// ViewContent.cs
//
// Author:
// Viktoria Dudka (viktoriad@remobjects.com)
@@ -28,29 +28,33 @@
using System;
using System.Collections.Generic;
using System.Text;
+using MonoDevelop.Components;
+using System.Threading.Tasks;
using MonoDevelop.Core;
using MonoDevelop.Projects;
using Xwt;
namespace MonoDevelop.Ide.Gui
{
- public abstract class AbstractViewContent : AbstractBaseViewContent, IViewContent
+ public abstract class ViewContent : BaseViewContent
{
- #region IViewContent Members
+ #region ViewContent Members
- private string untitledName = "";
- public virtual string UntitledName {
+ string untitledName = "";
+ string contentName;
+ bool isDirty;
+
+ public string UntitledName {
get { return untitledName; }
set { untitledName = value; }
}
- private string contentName;
- public virtual string ContentName {
+ public string ContentName {
get { return contentName; }
set {
if (value != contentName) {
contentName = value;
- OnContentNameChanged (EventArgs.Empty);
+ OnContentNameChanged ();
}
}
}
@@ -59,13 +63,12 @@ namespace MonoDevelop.Ide.Gui
get { return (contentName == null); }
}
- private bool isDirty;
public virtual bool IsDirty {
get { return isDirty; }
set {
if (value != isDirty) {
isDirty = value;
- OnDirtyChanged (EventArgs.Empty);
+ OnDirtyChanged ();
}
}
}
@@ -74,12 +77,13 @@ namespace MonoDevelop.Ide.Gui
get { return false; }
}
-
public virtual bool IsHidden {
get { return false; }
}
- public virtual bool IsViewOnly { get; set; }
+ public virtual bool IsViewOnly {
+ get { return false; }
+ }
public virtual bool IsFile {
get { return true; }
@@ -89,24 +93,21 @@ namespace MonoDevelop.Ide.Gui
get { return null; }
}
- public virtual Project Project { get; set; }
-
- public string PathRelativeToProject {
+ internal string PathRelativeToProject {
get { return Project == null ? null : FileService.AbsoluteToRelativePath (Project.BaseDirectory, ContentName); }
}
- public virtual void Save ()
+ public virtual Task Save ()
{
- OnBeforeSave (EventArgs.Empty);
- this.Save (contentName);
+ return Save (contentName);
}
- public void Save (string fileName)
+ public Task Save (FilePath fileName)
{
- Save (new FileSaveInformation (fileName));
+ return Save (new FileSaveInformation (fileName));
}
- public virtual void Save (FileSaveInformation fileSaveInformation)
+ public virtual Task Save (FileSaveInformation fileSaveInformation)
{
throw new NotImplementedException ();
}
@@ -115,57 +116,44 @@ namespace MonoDevelop.Ide.Gui
{
}
- public abstract void Load (FileOpenInformation fileOpenInformation);
+ public virtual Task Load (FileOpenInformation fileOpenInformation)
+ {
+ return Task.FromResult (true);
+ }
- public void Load (string fileName)
+ public Task Load (FilePath fileName)
{
- Load (new FileOpenInformation (fileName, null));
+ return Load (new FileOpenInformation (fileName, null));
}
- public virtual void LoadNew (System.IO.Stream content, string mimeType)
+ public virtual Task LoadNew (System.IO.Stream content, string mimeType)
{
throw new NotSupportedException ();
}
- public event EventHandler ContentNameChanged;
+ internal event EventHandler ContentNameChanged;
public event EventHandler DirtyChanged;
- public event EventHandler BeforeSave;
-
- public event EventHandler ContentChanged;
-
#endregion
- public virtual void OnContentChanged (EventArgs e)
- {
- if (ContentChanged != null)
- ContentChanged (this, e);
- }
-
- public virtual void OnDirtyChanged (EventArgs e)
+ protected virtual void OnDirtyChanged ()
{
if (DirtyChanged != null)
- DirtyChanged (this, e);
- }
-
- public virtual void OnBeforeSave (EventArgs e)
- {
- if (BeforeSave != null)
- BeforeSave (this, e);
+ DirtyChanged (this, EventArgs.Empty);
}
- public virtual void OnContentNameChanged (EventArgs e)
+ protected virtual void OnContentNameChanged ()
{
if (ContentNameChanged != null)
- ContentNameChanged (this, e);
+ ContentNameChanged (this, EventArgs.Empty);
}
}
- public abstract class AbstractXwtViewContent :AbstractViewContent
+ public abstract class AbstractXwtViewContent : ViewContent
{
- public override Gtk.Widget Control {
+ public override Control Control {
get {
return (Gtk.Widget)Toolkit.CurrentEngine.GetNativeWidget (Widget);
}
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui/Workbench.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui/Workbench.cs
index 0975b1d62e..8b12ce0ca6 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui/Workbench.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui/Workbench.cs
@@ -52,6 +52,8 @@ using MonoDevelop.Components.Docking;
using MonoDevelop.Components.DockNotebook;
using System.Text;
using MonoDevelop.Ide.Editor;
+using MonoDevelop.Components;
+using System.Threading.Tasks;
namespace MonoDevelop.Ide.Gui
{
@@ -62,7 +64,6 @@ namespace MonoDevelop.Ide.Gui
{
readonly ProgressMonitorManager monitors = new ProgressMonitorManager ();
readonly List<Document> documents = new List<Document> ();
- // readonly List<Split> splits = new List<Split> ();
DefaultWorkbench workbench;
PadCollection pads;
@@ -179,7 +180,7 @@ namespace MonoDevelop.Ide.Gui
}
}
- public WorkbenchWindow RootWindow {
+ public Gtk.Window RootWindow {
get { return workbench; }
}
@@ -343,13 +344,13 @@ namespace MonoDevelop.Ide.Gui
static AlertButton PromptToSaveChanges (Document doc)
{
- return MessageService.GenericAlert (MonoDevelop.Ide.Gui.Stock.Warning,
+ return MessageService.GenericAlert (MonoDevelop.Ide.Gui.Stock.Warning,
GettextCatalog.GetString ("Save the changes to document '{0}' before creating a new solution?",
- doc.Window.ViewContent.IsUntitled
+ (object)(doc.Window.ViewContent.IsUntitled
? doc.Window.ViewContent.UntitledName
- : System.IO.Path.GetFileName (doc.Window.ViewContent.ContentName)),
+ : System.IO.Path.GetFileName (doc.Window.ViewContent.ContentName))),
"",
- AlertButton.Cancel, doc.Window.ViewContent.IsUntitled ? AlertButton.SaveAs : AlertButton.Save);
+ AlertButton.Cancel, doc.Window.ViewContent.IsUntitled ? AlertButton.SaveAs : AlertButton.Save);
}
public void CloseAllDocuments (bool leaveActiveDocumentOpen)
@@ -380,58 +381,58 @@ namespace MonoDevelop.Ide.Gui
return WrapPad (content);
}
- public Pad AddPad (IPadContent padContent, string id, string label, string defaultPlacement, IconId icon)
+ public Pad AddPad (PadContent padContent, string id, string label, string defaultPlacement, IconId icon)
{
return AddPad (new PadCodon (padContent, id, label, defaultPlacement, icon));
}
- public Pad AddPad (IPadContent padContent, string id, string label, string defaultPlacement, DockItemStatus defaultStatus, IconId icon)
+ public Pad AddPad (PadContent padContent, string id, string label, string defaultPlacement, DockItemStatus defaultStatus, IconId icon)
{
return AddPad (new PadCodon (padContent, id, label, defaultPlacement, defaultStatus, icon));
}
- public Pad ShowPad (IPadContent padContent, string id, string label, string defaultPlacement, IconId icon)
+ public Pad ShowPad (PadContent padContent, string id, string label, string defaultPlacement, IconId icon)
{
return ShowPad (new PadCodon (padContent, id, label, defaultPlacement, icon));
}
- public Pad ShowPad (IPadContent padContent, string id, string label, string defaultPlacement, DockItemStatus defaultStatus, IconId icon)
+ public Pad ShowPad (PadContent padContent, string id, string label, string defaultPlacement, DockItemStatus defaultStatus, IconId icon)
{
return ShowPad (new PadCodon (padContent, id, label, defaultPlacement, defaultStatus, icon));
}
[Obsolete("Use OpenDocument (FilePath fileName, Project project, bool bringToFront)")]
- public Document OpenDocument (FilePath fileName, bool bringToFront)
+ public Task<Document> OpenDocument (FilePath fileName, bool bringToFront)
{
return OpenDocument (fileName, bringToFront ? OpenDocumentOptions.Default : OpenDocumentOptions.Default & ~OpenDocumentOptions.BringToFront);
}
[Obsolete("Use OpenDocument (FilePath fileName, Project project, OpenDocumentOptions options = OpenDocumentOptions.Default)")]
- public Document OpenDocument (FilePath fileName, OpenDocumentOptions options = OpenDocumentOptions.Default)
+ public Task<Document> OpenDocument (FilePath fileName, OpenDocumentOptions options = OpenDocumentOptions.Default)
{
return OpenDocument (fileName, -1, -1, options, null, null);
}
[Obsolete("Use OpenDocument (FilePath fileName, Project project, Encoding encoding, OpenDocumentOptions options = OpenDocumentOptions.Default)")]
- public Document OpenDocument (FilePath fileName, Encoding encoding, OpenDocumentOptions options = OpenDocumentOptions.Default)
+ public Task<Document> OpenDocument (FilePath fileName, Encoding encoding, OpenDocumentOptions options = OpenDocumentOptions.Default)
{
return OpenDocument (fileName, -1, -1, options, encoding, null);
}
[Obsolete("Use OpenDocument (FilePath fileName, Project project, int line, int column, OpenDocumentOptions options = OpenDocumentOptions.Default)")]
- public Document OpenDocument (FilePath fileName, int line, int column, OpenDocumentOptions options = OpenDocumentOptions.Default)
+ public Task<Document> OpenDocument (FilePath fileName, int line, int column, OpenDocumentOptions options = OpenDocumentOptions.Default)
{
return OpenDocument (fileName, line, column, options, null, null);
}
[Obsolete("Use OpenDocument (FilePath fileName, Project project, int line, int column, Encoding encoding, OpenDocumentOptions options = OpenDocumentOptions.Default)")]
- public Document OpenDocument (FilePath fileName, int line, int column, Encoding encoding, OpenDocumentOptions options = OpenDocumentOptions.Default)
+ public Task<Document> OpenDocument (FilePath fileName, int line, int column, Encoding encoding, OpenDocumentOptions options = OpenDocumentOptions.Default)
{
return OpenDocument (fileName, line, column, options, encoding, null);
}
[Obsolete("Use OpenDocument (FilePath fileName, Project project, int line, int column, OpenDocumentOptions options, Encoding encoding, IViewDisplayBinding binding)")]
- internal Document OpenDocument (FilePath fileName, int line, int column, OpenDocumentOptions options, Encoding encoding, IViewDisplayBinding binding)
+ internal Task<Document> OpenDocument (FilePath fileName, int line, int column, OpenDocumentOptions options, Encoding encoding, IViewDisplayBinding binding)
{
var openFileInfo = new FileOpenInformation (fileName, null) {
Options = options,
@@ -444,32 +445,32 @@ namespace MonoDevelop.Ide.Gui
}
- public Document OpenDocument (FilePath fileName, Project project, bool bringToFront)
+ public Task<Document> OpenDocument (FilePath fileName, Project project, bool bringToFront)
{
return OpenDocument (fileName, project, bringToFront ? OpenDocumentOptions.Default : OpenDocumentOptions.Default & ~OpenDocumentOptions.BringToFront);
}
- public Document OpenDocument (FilePath fileName, Project project, OpenDocumentOptions options = OpenDocumentOptions.Default)
+ public Task<Document> OpenDocument (FilePath fileName, Project project, OpenDocumentOptions options = OpenDocumentOptions.Default)
{
return OpenDocument (fileName, project, -1, -1, options, null, null);
}
- public Document OpenDocument (FilePath fileName, Project project, Encoding encoding, OpenDocumentOptions options = OpenDocumentOptions.Default)
+ public Task<Document> OpenDocument (FilePath fileName, Project project, Encoding encoding, OpenDocumentOptions options = OpenDocumentOptions.Default)
{
return OpenDocument (fileName, project, -1, -1, options, encoding, null);
}
- public Document OpenDocument (FilePath fileName, Project project, int line, int column, OpenDocumentOptions options = OpenDocumentOptions.Default)
+ public Task<Document> OpenDocument (FilePath fileName, Project project, int line, int column, OpenDocumentOptions options = OpenDocumentOptions.Default)
{
return OpenDocument (fileName, project, line, column, options, null, null);
}
- public Document OpenDocument (FilePath fileName, Project project, int line, int column, Encoding encoding, OpenDocumentOptions options = OpenDocumentOptions.Default)
+ public Task<Document> OpenDocument (FilePath fileName, Project project, int line, int column, Encoding encoding, OpenDocumentOptions options = OpenDocumentOptions.Default)
{
return OpenDocument (fileName, project, line, column, options, encoding, null);
}
- internal Document OpenDocument (FilePath fileName, Project project, int line, int column, OpenDocumentOptions options, Encoding encoding, IViewDisplayBinding binding)
+ internal Task<Document> OpenDocument (FilePath fileName, Project project, int line, int column, OpenDocumentOptions options, Encoding encoding, IViewDisplayBinding binding)
{
var openFileInfo = new FileOpenInformation (fileName, project) {
Options = options,
@@ -498,7 +499,7 @@ namespace MonoDevelop.Ide.Gui
}
}
- internal Document OpenDocument (FilePath fileName, Project project, int line, int column, OpenDocumentOptions options, Encoding Encoding, IViewDisplayBinding binding, DockNotebook dockNotebook)
+ internal Task<Document> OpenDocument (FilePath fileName, Project project, int line, int column, OpenDocumentOptions options, Encoding Encoding, IViewDisplayBinding binding, DockNotebook dockNotebook)
{
var openFileInfo = new FileOpenInformation (fileName, project) {
Options = options,
@@ -512,7 +513,7 @@ namespace MonoDevelop.Ide.Gui
return OpenDocument (openFileInfo);
}
- public Document OpenDocument (FileOpenInformation info)
+ public async Task<Document> OpenDocument (FileOpenInformation info)
{
if (string.IsNullOrEmpty (info.FileName))
return null;
@@ -522,7 +523,7 @@ namespace MonoDevelop.Ide.Gui
if (info.Options.HasFlag (OpenDocumentOptions.TryToReuseViewer)) {
Counters.OpenDocumentTimer.Trace ("Look for open document");
foreach (Document doc in Documents) {
- IBaseViewContent vcFound = null;
+ BaseViewContent vcFound = null;
//search all ViewContents to see if they can "re-use" this filename
if (doc.Window.ViewContent.CanReuseView (info.FileName))
@@ -557,7 +558,7 @@ namespace MonoDevelop.Ide.Gui
true
);
- RealOpenFile (pm, info);
+ await RealOpenFile (pm, info);
pm.Dispose ();
if (info.NewContent != null) {
@@ -578,7 +579,7 @@ namespace MonoDevelop.Ide.Gui
}
}
- IViewContent BatchOpenDocument (ProgressMonitor monitor, FilePath fileName, Project project, int line, int column, DockNotebook dockNotebook)
+ async Task<ViewContent> BatchOpenDocument (ProgressMonitor monitor, FilePath fileName, Project project, int line, int column, DockNotebook dockNotebook)
{
if (string.IsNullOrEmpty (fileName))
return null;
@@ -591,13 +592,13 @@ namespace MonoDevelop.Ide.Gui
DockNotebook = dockNotebook
};
- RealOpenFile (monitor, openFileInfo);
+ await RealOpenFile (monitor, openFileInfo);
return openFileInfo.NewContent;
}
}
- public Document OpenDocument (IViewContent content, bool bringToFront)
+ public Document OpenDocument (ViewContent content, bool bringToFront)
{
workbench.ShowView (content, bringToFront);
if (bringToFront)
@@ -625,7 +626,7 @@ namespace MonoDevelop.Ide.Gui
if (binding == null)
throw new ApplicationException("Can't create display binding for mime type: " + mimeType);
- IViewContent newContent = binding.CreateContent (defaultName, mimeType, null);
+ ViewContent newContent = binding.CreateContent (defaultName, mimeType, null);
using (content) {
newContent.LoadNew (content, mimeType);
}
@@ -652,7 +653,7 @@ namespace MonoDevelop.Ide.Gui
"MonoDevelop.TextEditor.Document.Document.DefaultDocumentAggregatorProperties",
new Properties()));
- public void ShowGlobalPreferencesDialog (Gtk.Window parentWindow, string panelId, Action<OptionsDialog> configurationAction = null)
+ public void ShowGlobalPreferencesDialog (Window parentWindow, string panelId, Action<OptionsDialog> configurationAction = null)
{
if (parentWindow == null)
parentWindow = IdeApp.Workbench.RootWindow;
@@ -681,12 +682,12 @@ namespace MonoDevelop.Ide.Gui
}
}
- public void ShowDefaultPoliciesDialog (Gtk.Window parentWindow)
+ public void ShowDefaultPoliciesDialog (Window parentWindow)
{
ShowDefaultPoliciesDialog (parentWindow, null);
}
- public void ShowDefaultPoliciesDialog (Gtk.Window parentWindow, string panelId)
+ public void ShowDefaultPoliciesDialog (Window parentWindow, string panelId)
{
if (parentWindow == null)
parentWindow = IdeApp.Workbench.RootWindow;
@@ -810,6 +811,7 @@ namespace MonoDevelop.Ide.Gui
: System.IO.Path.GetFileName (viewContent.ContentName)),
GettextCatalog.GetString ("If you don't save, all changes will be permanently lost."),
AlertButton.CloseWithoutSave, AlertButton.Cancel, viewContent.IsUntitled ? AlertButton.SaveAs : AlertButton.Save);
+
if (result == AlertButton.Save || result == AlertButton.SaveAs) {
FindDocument (window).Save ();
args.Cancel = viewContent.IsDirty;
@@ -862,7 +864,7 @@ namespace MonoDevelop.Ide.Gui
return project;
}
- void RealOpenFile (ProgressMonitor monitor, FileOpenInformation openFileInfo)
+ async Task<bool> RealOpenFile (ProgressMonitor monitor, FileOpenInformation openFileInfo)
{
FilePath fileName;
@@ -872,7 +874,7 @@ namespace MonoDevelop.Ide.Gui
if (origName == null) {
monitor.ReportError (GettextCatalog.GetString ("Invalid file name"), null);
- return;
+ return false;
}
fileName = openFileInfo.FileName;
@@ -882,7 +884,7 @@ namespace MonoDevelop.Ide.Gui
//Debug.Assert(FileService.IsValidPath(fileName));
if (FileService.IsDirectory (fileName)) {
monitor.ReportError (GettextCatalog.GetString ("{0} is a directory", fileName), null);
- return;
+ return false;
}
// test, if file fileName exists
@@ -893,14 +895,14 @@ namespace MonoDevelop.Ide.Gui
if (doc.Window.ViewContent.IsUntitled && doc.Window.ViewContent.UntitledName == origName) {
doc.Select ();
openFileInfo.NewContent = doc.Window.ViewContent;
- return;
+ return true;
}
}
}
if (!File.Exists (fileName)) {
monitor.ReportError (GettextCatalog.GetString ("File not found: {0}", fileName), null);
- return;
+ return false;
}
}
@@ -933,7 +935,7 @@ namespace MonoDevelop.Ide.Gui
if (binding != null) {
if (viewBinding != null) {
var fw = new LoadFileWrapper (monitor, workbench, viewBinding, project, openFileInfo);
- fw.Invoke (fileName);
+ await fw.Invoke (fileName);
} else {
var extBinding = (IExternalDisplayBinding)binding;
var app = extBinding.GetApplication (fileName, null, project);
@@ -949,11 +951,14 @@ namespace MonoDevelop.Ide.Gui
} catch (Exception ex) {
LoggingService.LogError ("Error opening file: " + fileName, ex);
MessageService.ShowError (GettextCatalog.GetString ("File '{0}' could not be opened", fileName));
+ return false;
}
}
} catch (Exception ex) {
monitor.ReportError ("", ex);
+ return false;
}
+ return true;
}
void OnStoringWorkspaceUserPreferences (object s, UserPreferencesEventArgs args)
@@ -1035,7 +1040,7 @@ namespace MonoDevelop.Ide.Gui
return dp;
}
- void OnLoadingWorkspaceUserPreferences (object s, UserPreferencesEventArgs args)
+ async void OnLoadingWorkspaceUserPreferences (object s, UserPreferencesEventArgs args)
{
WorkbenchUserPrefs prefs = args.Properties.GetValue<WorkbenchUserPrefs> ("MonoDevelop.Ide.Workbench");
if (prefs == null)
@@ -1045,21 +1050,21 @@ namespace MonoDevelop.Ide.Gui
IdeApp.Workbench.LockActiveWindowChangeEvent ();
NavigationHistoryService.LogActiveDocument ();
- List<Tuple<IViewContent,string>> docViews = new List<Tuple<IViewContent,string>> ();
+ List<Tuple<ViewContent,string>> docViews = new List<Tuple<ViewContent,string>> ();
FilePath baseDir = args.Item.BaseDirectory;
var floatingWindows = new List<DockWindow> ();
using (ProgressMonitor pm = ProgressMonitors.GetStatusProgressMonitor (GettextCatalog.GetString ("Loading workspace documents"), Stock.StatusSolutionOperation, true)) {
var docList = prefs.Files.Distinct (new DocumentUserPrefsFilenameComparer ()).OrderBy (d => d.NotebookId).ToList ();
- OpenDocumentsInContainer (pm, baseDir, docViews, docList, workbench.TabControl.Container);
+ await OpenDocumentsInContainer (pm, baseDir, docViews, docList, workbench.TabControl.Container);
foreach (var fw in prefs.FloatingWindows) {
var dockWindow = new DockWindow ();
dockWindow.Move (fw.X, fw.Y);
dockWindow.Resize (fw.Width, fw.Height);
docList = fw.Files.Distinct (new DocumentUserPrefsFilenameComparer ()).OrderBy (d => d.NotebookId).ToList ();
- OpenDocumentsInContainer (pm, baseDir, docViews, docList, dockWindow.Container);
+ await OpenDocumentsInContainer (pm, baseDir, docViews, docList, dockWindow.Container);
floatingWindows.Add (dockWindow);
}
@@ -1103,7 +1108,7 @@ namespace MonoDevelop.Ide.Gui
}
}
- void OpenDocumentsInContainer (ProgressMonitor pm, FilePath baseDir, List<Tuple<IViewContent,string>> docViews, List<DocumentUserPrefs> list, DockNotebookContainer container)
+ async Task<bool> OpenDocumentsInContainer (ProgressMonitor pm, FilePath baseDir, List<Tuple<ViewContent,string>> docViews, List<DocumentUserPrefs> list, DockNotebookContainer container)
{
int currentNotebook = -1;
DockNotebook nb = container.GetFirstNotebook ();
@@ -1117,14 +1122,15 @@ namespace MonoDevelop.Ide.Gui
currentNotebook = doc.NotebookId;
}
// TODO: Get the correct project.
- var view = IdeApp.Workbench.BatchOpenDocument (pm, fileName, null, doc.Line, doc.Column, nb);
+ var view = await IdeApp.Workbench.BatchOpenDocument (pm, fileName, null, doc.Line, doc.Column, nb);
if (view != null) {
- var t = new Tuple<IViewContent,string> (view, fileName);
+ var t = new Tuple<ViewContent,string> (view, fileName);
docViews.Add (t);
}
}
}
+ return true;
}
internal Document FindDocument (IWorkbenchWindow window)
@@ -1135,7 +1141,7 @@ namespace MonoDevelop.Ide.Gui
return null;
}
- internal Pad FindPad (IPadContent padContent)
+ internal Pad FindPad (PadContent padContent)
{
foreach (Pad pad in Pads)
if (pad.Content == padContent)
@@ -1150,7 +1156,7 @@ namespace MonoDevelop.Ide.Gui
internal void ReorderDocuments (int oldPlacement, int newPlacement)
{
- IViewContent content = workbench.InternalViewContentCollection[oldPlacement];
+ ViewContent content = workbench.InternalViewContentCollection[oldPlacement];
workbench.InternalViewContentCollection.RemoveAt (oldPlacement);
workbench.InternalViewContentCollection.Insert (newPlacement, content);
@@ -1158,12 +1164,6 @@ namespace MonoDevelop.Ide.Gui
documents.RemoveAt (oldPlacement);
documents.Insert (newPlacement, doc);
}
-
- internal void ResetToolbars ()
- {
- workbench.ResetToolbars ();
- }
-
internal void LockActiveWindowChangeEvent ()
{
@@ -1264,9 +1264,7 @@ namespace MonoDevelop.Ide.Gui
void OnDocumentOpened (DocumentEventArgs e)
{
try {
- EventHandler<DocumentEventArgs> handler = this.DocumentOpened;
- if (handler != null)
- handler (this, e);
+ DocumentOpened?.Invoke (this, e);
} catch (Exception ex) {
LoggingService.LogError ("Exception while opening documents", ex);
}
@@ -1276,9 +1274,7 @@ namespace MonoDevelop.Ide.Gui
{
try {
var e = new DocumentEventArgs (doc);
- EventHandler<DocumentEventArgs> handler = this.DocumentClosed;
- if (handler != null)
- handler (this, e);
+ DocumentClosed?.Invoke (this, e);
} catch (Exception ex) {
LoggingService.LogError ("Exception while closing documents", ex);
}
@@ -1288,9 +1284,7 @@ namespace MonoDevelop.Ide.Gui
{
try {
var e = new DocumentEventArgs (doc);
- EventHandler<DocumentEventArgs> handler = this.DocumentClosing;
- if (handler != null)
- handler (this, e);
+ DocumentClosing?.Invoke (this, e);
} catch (Exception ex) {
LoggingService.LogError ("Exception before closing documents", ex);
}
@@ -1347,6 +1341,7 @@ namespace MonoDevelop.Ide.Gui
}
public OpenDocumentOptions Options { get; set; }
+
int offset = -1;
public int Offset {
get {
@@ -1359,7 +1354,7 @@ namespace MonoDevelop.Ide.Gui
public int Line { get; set; }
public int Column { get; set; }
public IViewDisplayBinding DisplayBinding { get; set; }
- public IViewContent NewContent { get; set; }
+ public ViewContent NewContent { get; set; }
public Encoding Encoding { get; set; }
public Project Project { get; set; }
@@ -1446,7 +1441,7 @@ namespace MonoDevelop.Ide.Gui
FileOpenInformation fileInfo;
DefaultWorkbench workbench;
ProgressMonitor monitor;
- IViewContent newContent;
+ ViewContent newContent;
public LoadFileWrapper (ProgressMonitor monitor, DefaultWorkbench workbench, IViewDisplayBinding binding, FileOpenInformation fileInfo)
{
@@ -1462,7 +1457,7 @@ namespace MonoDevelop.Ide.Gui
this.project = project;
}
- public void Invoke (string fileName)
+ public async Task<bool> Invoke (string fileName)
{
try {
Counters.OpenDocumentTimer.Trace ("Creating content");
@@ -1474,7 +1469,7 @@ namespace MonoDevelop.Ide.Gui
}
if (newContent == null) {
monitor.ReportError (GettextCatalog.GetString ("The file '{0}' could not be opened.", fileName), null);
- return;
+ return false;
}
if (project != null)
@@ -1483,24 +1478,24 @@ namespace MonoDevelop.Ide.Gui
Counters.OpenDocumentTimer.Trace ("Loading file");
try {
- newContent.Load (fileInfo);
+ await newContent.Load (fileInfo);
} catch (InvalidEncodingException iex) {
monitor.ReportError (GettextCatalog.GetString ("The file '{0}' could not opened. {1}", fileName, iex.Message), null);
- return;
+ return false;
} catch (OverflowException) {
monitor.ReportError (GettextCatalog.GetString ("The file '{0}' could not opened. File too large.", fileName), null);
- return;
+ return false;
}
} catch (Exception ex) {
monitor.ReportError (GettextCatalog.GetString ("The file '{0}' could not be opened.", fileName), ex);
- return;
+ return false;
}
// content got re-used
if (newContent.WorkbenchWindow != null) {
newContent.WorkbenchWindow.SelectWindow ();
fileInfo.NewContent = newContent;
- return;
+ return true;
}
Counters.OpenDocumentTimer.Trace ("Showing view");
@@ -1517,6 +1512,7 @@ namespace MonoDevelop.Ide.Gui
}
fileInfo.NewContent = newContent;
+ return true;
}
void JumpToLine ()
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui/WorkbenchMemento.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui/WorkbenchMemento.cs
index 8203e8ef94..d70c432c54 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui/WorkbenchMemento.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui/WorkbenchMemento.cs
@@ -34,7 +34,6 @@ using System.Xml;
using MonoDevelop.Core;
using MonoDevelop.Core.Serialization;
-using MonoDevelop.Components.DockToolbars;
namespace MonoDevelop.Ide.Gui
{
@@ -88,15 +87,6 @@ namespace MonoDevelop.Ide.Gui
}
}
- public DockToolbarFrameStatus ToolbarStatus {
- get {
- return properties.Get ("toolbarStatus", new DockToolbarFrameStatus ());
- }
- set {
- properties.Set ("toolbarStatus", value);
- }
- }
-
/// <summary>
/// Creates a new instance of the <code>MdiWorkspaceMemento</code>.
/// </summary>
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui/WorkbenchWindow.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui/WorkbenchWindow.cs
index 06098c686c..92309d38ba 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui/WorkbenchWindow.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui/WorkbenchWindow.cs
@@ -30,7 +30,7 @@ using MonoDevelop.Components;
namespace MonoDevelop.Ide.Gui
{
- public class WorkbenchWindow: Gtk.Window
+ class WorkbenchWindow: Gtk.Window
{
List<TopLevelChild> topLevels = new List<TopLevelChild> ();
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Navigation/DocumentNavigationPoint.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Navigation/DocumentNavigationPoint.cs
index d0f82bfe1e..37939b918b 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Navigation/DocumentNavigationPoint.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Navigation/DocumentNavigationPoint.cs
@@ -28,6 +28,7 @@
//
using System;
+using System.Threading.Tasks;
using MonoDevelop.Core;
using MonoDevelop.Ide.Gui;
@@ -77,12 +78,12 @@ namespace MonoDevelop.Ide.Navigation
get { return doc != null? doc.FileName : fileName; }
}
- public override Document ShowDocument ()
+ public override Task<Document> ShowDocument ()
{
return DoShow ();
}
- protected virtual Document DoShow ()
+ protected virtual async Task<Document> DoShow ()
{
if (doc != null) {
doc.Select ();
@@ -95,7 +96,7 @@ namespace MonoDevelop.Ide.Navigation
break;
}
}
- return IdeApp.Workbench.OpenDocument (new FileOpenInformation (fileName, p, true));
+ return await IdeApp.Workbench.OpenDocument (new FileOpenInformation (fileName, p, true));
}
public override string DisplayName {
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Navigation/NavigationHistoryService.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Navigation/NavigationHistoryService.cs
index d9a964024c..be001978cb 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Navigation/NavigationHistoryService.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Navigation/NavigationHistoryService.cs
@@ -224,10 +224,10 @@ namespace MonoDevelop.Ide.Navigation
get { return closedHistory.Count != 0; }
}
- public static void OpenLastClosedDocument () {
+ public static async void OpenLastClosedDocument () {
if (HasClosedDocuments) {
var tuple = closedHistory.Pop ();
- var doc = tuple.Item1.ShowDocument ();
+ var doc = await tuple.Item1.ShowDocument ();
IdeApp.Workbench.ReorderTab (IdeApp.Workbench.Documents.IndexOf (doc), tuple.Item2);
}
}
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Navigation/NavigationPoint.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Navigation/NavigationPoint.cs
index 7455083ace..a45eb04d53 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Navigation/NavigationPoint.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Navigation/NavigationPoint.cs
@@ -26,6 +26,7 @@
// THE SOFTWARE.
using System;
+using System.Threading.Tasks;
using MonoDevelop.Ide.Gui;
namespace MonoDevelop.Ide.Navigation
@@ -35,9 +36,9 @@ namespace MonoDevelop.Ide.Navigation
public abstract string DisplayName { get; }
//public abstract string Tooltip { get; }
- public virtual Document ShowDocument ()
+ public virtual Task<Document> ShowDocument ()
{
- return null;
+ return Task.FromResult<Document> (null);
}
// used for fuzzy matching to decide whether to replace an existing nav point
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Navigation/TextFileNavigationPoint.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Navigation/TextFileNavigationPoint.cs
index d17c03e0c9..9fc346329d 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Navigation/TextFileNavigationPoint.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Navigation/TextFileNavigationPoint.cs
@@ -32,6 +32,7 @@ using MonoDevelop.Ide.Gui.Content;
using MonoDevelop.Core;
using MonoDevelop.Ide.Gui;
using MonoDevelop.Ide.Editor;
+using System.Threading.Tasks;
namespace MonoDevelop.Ide.Navigation
{
@@ -78,9 +79,9 @@ namespace MonoDevelop.Ide.Navigation
}
}
- protected override Document DoShow ()
+ protected override async Task<Document> DoShow ()
{
- Document doc = base.DoShow ();
+ Document doc = await base.DoShow ();
if (doc != null) {
var buf = doc.Editor;
if (buf != null) {
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Projects.OptionPanels/BaseDirectoryPanel.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Projects.OptionPanels/BaseDirectoryPanel.cs
index 7b487bab59..8da492a529 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Projects.OptionPanels/BaseDirectoryPanel.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Projects.OptionPanels/BaseDirectoryPanel.cs
@@ -26,6 +26,7 @@
//
using System;
+using MonoDevelop.Components;
using MonoDevelop.Core;
using MonoDevelop.Ide.Gui.Dialogs;
using MonoDevelop.Projects;
@@ -46,7 +47,7 @@ namespace MonoDevelop.Ide.Projects.OptionPanels
obj = dataObject as WorkspaceObject;
}
- public Gtk.Widget CreatePanelWidget ()
+ public Control CreatePanelWidget ()
{
widget = new BaseDirectoryPanelWidget ();
widget.BaseDirectory = System.IO.Path.GetFullPath (obj.BaseDirectory);
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Projects.OptionPanels/BaseDirectoryPanelWidget.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Projects.OptionPanels/BaseDirectoryPanelWidget.cs
index e0d65e589f..520fc66781 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Projects.OptionPanels/BaseDirectoryPanelWidget.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Projects.OptionPanels/BaseDirectoryPanelWidget.cs
@@ -33,7 +33,7 @@ namespace MonoDevelop.Ide.Projects.OptionPanels
[System.ComponentModel.Category("MonoDevelop.Projects.Gui")]
[System.ComponentModel.ToolboxItem(true)]
- public partial class BaseDirectoryPanelWidget : Gtk.Bin
+ partial class BaseDirectoryPanelWidget : Gtk.Bin
{
public BaseDirectoryPanelWidget()
{
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Projects.OptionPanels/CodeAnalysisPanel.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Projects.OptionPanels/CodeAnalysisPanel.cs
index 1e76b57d79..d8c2ad6c9a 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Projects.OptionPanels/CodeAnalysisPanel.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Projects.OptionPanels/CodeAnalysisPanel.cs
@@ -26,13 +26,14 @@
using System;
using System.Collections.Generic;
using Gtk;
+using MonoDevelop.Components;
using MonoDevelop.Ide.Gui.Dialogs;
using MonoDevelop.Projects;
using MonoDevelop.Core;
namespace MonoDevelop.Ide.Projects.OptionPanels
{
- public class CodeAnalysisPanel : MultiConfigItemOptionsPanel
+ class CodeAnalysisPanel : MultiConfigItemOptionsPanel
{
CodeAnalysisPanelWidget widget;
@@ -46,7 +47,7 @@ namespace MonoDevelop.Ide.Projects.OptionPanels
return ConfiguredProject is DotNetProject;
}
- public override Widget CreatePanelWidget ()
+ public override Control CreatePanelWidget ()
{
return (widget = new CodeAnalysisPanelWidget ());
}
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Projects.OptionPanels/CodeFormattingPanel.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Projects.OptionPanels/CodeFormattingPanel.cs
index 97059258ac..d5a093d6ab 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Projects.OptionPanels/CodeFormattingPanel.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Projects.OptionPanels/CodeFormattingPanel.cs
@@ -186,7 +186,7 @@ namespace MonoDevelop.Ide.Projects.OptionPanels
data.UseParentPolicy = useParentPolicy;
}
- public override Gtk.Widget CreatePanelWidget ()
+ public override Control CreatePanelWidget ()
{
return widget = new CodeFormattingPanelWidget (this, ParentDialog);
}
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Projects.OptionPanels/CombineBuildOptions.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Projects.OptionPanels/CombineBuildOptions.cs
index 9814002d5a..9cf84eca7b 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Projects.OptionPanels/CombineBuildOptions.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Projects.OptionPanels/CombineBuildOptions.cs
@@ -24,6 +24,7 @@
// THE SOFTWARE.
using System;
+using MonoDevelop.Components;
using MonoDevelop.Ide.Gui.Dialogs;
using MonoDevelop.Projects;
@@ -33,7 +34,7 @@ namespace MonoDevelop.Ide.Projects.OptionPanels
{
CombineBuildOptionsWidget widget;
- public override Gtk.Widget CreatePanelWidget()
+ public override Control CreatePanelWidget()
{
return widget = new CombineBuildOptionsWidget (ConfiguredSolution);
}
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Projects.OptionPanels/CombineConfigurationPanel.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Projects.OptionPanels/CombineConfigurationPanel.cs
index c250af9a4f..646ba7b6be 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Projects.OptionPanels/CombineConfigurationPanel.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Projects.OptionPanels/CombineConfigurationPanel.cs
@@ -41,7 +41,7 @@ namespace MonoDevelop.Ide.Projects.OptionPanels
{
CombineConfigurationPanelWidget widget;
- public override Widget CreatePanelWidget()
+ public override Control CreatePanelWidget()
{
return widget = new CombineConfigurationPanelWidget ((MultiConfigItemOptionsDialog) ParentDialog, ConfiguredSolution);
}
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Projects.OptionPanels/CombineInformationPanel.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Projects.OptionPanels/CombineInformationPanel.cs
index 190e1740f2..766f937ea7 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Projects.OptionPanels/CombineInformationPanel.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Projects.OptionPanels/CombineInformationPanel.cs
@@ -41,7 +41,7 @@ namespace MonoDevelop.Ide.Projects.OptionPanels
{
CombineInformationWidget widget;
- public override Widget CreatePanelWidget()
+ public override Control CreatePanelWidget()
{
return widget = new CombineInformationWidget (ConfiguredSolution);
}
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Projects.OptionPanels/CombineMSBuildOptions.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Projects.OptionPanels/CombineMSBuildOptions.cs
index 3f393ce1cb..f07659dd82 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Projects.OptionPanels/CombineMSBuildOptions.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Projects.OptionPanels/CombineMSBuildOptions.cs
@@ -35,7 +35,7 @@ namespace MonoDevelop.Ide.Projects.OptionPanels
{
Xwt.CheckBox checkMSBuild;
- public override Gtk.Widget CreatePanelWidget ()
+ public override Control CreatePanelWidget ()
{
bool byDefault, require;
MSBuildProjectService.CheckHandlerUsesMSBuildEngine (ConfiguredProject, out byDefault, out require);
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Projects.OptionPanels/CommonAssemblySigningPreferences.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Projects.OptionPanels/CommonAssemblySigningPreferences.cs
index fa7b64f949..c0a509bfc6 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Projects.OptionPanels/CommonAssemblySigningPreferences.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Projects.OptionPanels/CommonAssemblySigningPreferences.cs
@@ -28,6 +28,7 @@
using System;
using System.Collections.Generic;
+using MonoDevelop.Components;
using MonoDevelop.Ide.Gui.Dialogs;
using MonoDevelop.Projects;
using MonoDevelop.Core;
@@ -121,7 +122,7 @@ namespace MonoDevelop.Ide.Projects.OptionPanels
}
- public override Gtk.Widget CreatePanelWidget ()
+ public override Control CreatePanelWidget ()
{
AllowMixedConfigurations = true;
return (widget = new CommonAssemblySigningPreferences ());
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Projects.OptionPanels/CustomCommandPanel.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Projects.OptionPanels/CustomCommandPanel.cs
index 36b031897f..dbe81867ec 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Projects.OptionPanels/CustomCommandPanel.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Projects.OptionPanels/CustomCommandPanel.cs
@@ -28,6 +28,7 @@
using System;
using System.Collections.Generic;
+using MonoDevelop.Components;
using MonoDevelop.Ide.Gui.Dialogs;
using MonoDevelop.Projects;
using MonoDevelop.Core;
@@ -44,7 +45,7 @@ namespace MonoDevelop.Ide.Projects.OptionPanels
this.supportedTypes = supportedTypes;
}
- public override Gtk.Widget CreatePanelWidget ()
+ public override Control CreatePanelWidget ()
{
return (widget = new CustomCommandPanelWidget ());
}
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Projects.OptionPanels/GeneralProjectOptions.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Projects.OptionPanels/GeneralProjectOptions.cs
index 5176e25e51..c50c616ec6 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Projects.OptionPanels/GeneralProjectOptions.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Projects.OptionPanels/GeneralProjectOptions.cs
@@ -26,7 +26,7 @@
using System;
using MonoDevelop.Ide.Gui.Dialogs;
-using Gtk;
+using MonoDevelop.Components;
using MonoDevelop.Projects;
using MonoDevelop.Projects.SharedAssetsProjects;
@@ -36,7 +36,7 @@ namespace MonoDevelop.Ide.Projects.OptionPanels
{
GeneralProjectOptionsWidget widget;
- public override Widget CreatePanelWidget()
+ public override Control CreatePanelWidget()
{
return widget = new GeneralProjectOptionsWidget (ConfiguredProject, ParentDialog);
}
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Projects.OptionPanels/NamespaceSynchronisationPanel.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Projects.OptionPanels/NamespaceSynchronisationPanel.cs
index d339d9b3d0..a8e296f91d 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Projects.OptionPanels/NamespaceSynchronisationPanel.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Projects.OptionPanels/NamespaceSynchronisationPanel.cs
@@ -56,7 +56,7 @@ namespace MonoDevelop.Ide.Projects.OptionPanels
return !(item is WorkspaceObject);
}
- public override Widget CreatePanelWidget ()
+ public override Control CreatePanelWidget ()
{
widget = new NamespaceSynchronisationPanelWidget (this);
widget.Show ();
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Projects.OptionPanels/OutputOptionsPanel.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Projects.OptionPanels/OutputOptionsPanel.cs
index 12e9ba637f..c25deb35ef 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Projects.OptionPanels/OutputOptionsPanel.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Projects.OptionPanels/OutputOptionsPanel.cs
@@ -27,6 +27,7 @@ using System;
using System.Collections;
using System.Collections.Generic;
using Gtk;
+using MonoDevelop.Components;
using MonoDevelop.Core;
using MonoDevelop.Ide.Gui.Dialogs;
using MonoDevelop.Projects;
@@ -47,7 +48,7 @@ namespace MonoDevelop.Ide.Projects.OptionPanels
return ConfiguredProject is DotNetProject;
}
- public override Widget CreatePanelWidget()
+ public override Control CreatePanelWidget()
{
return (widget = new OutputOptionsPanelWidget ());
}
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Projects.OptionPanels/PortableRuntimeOptionsPanel.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Projects.OptionPanels/PortableRuntimeOptionsPanel.cs
index e2387eeaad..f8ec40c5fe 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Projects.OptionPanels/PortableRuntimeOptionsPanel.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Projects.OptionPanels/PortableRuntimeOptionsPanel.cs
@@ -28,6 +28,7 @@ using System.Text;
using System.Linq;
using System.Collections.Generic;
+using MonoDevelop.Components;
using MonoDevelop.Projects;
using MonoDevelop.Core;
using MonoDevelop.Core.Assemblies;
@@ -42,7 +43,7 @@ namespace MonoDevelop.Ide.Projects.OptionPanels
{
PortableRuntimeOptionsPanelWidget widget;
- public override Widget CreatePanelWidget ()
+ public override Control CreatePanelWidget ()
{
return (widget = new PortableRuntimeOptionsPanelWidget ((DotNetProject) ConfiguredProject, ItemConfigurations));
}
@@ -54,7 +55,7 @@ namespace MonoDevelop.Ide.Projects.OptionPanels
}
[System.ComponentModel.ToolboxItem(true)]
- public partial class PortableRuntimeOptionsPanelWidget : Gtk.Bin
+ partial class PortableRuntimeOptionsPanelWidget : Gtk.Bin
{
readonly TargetFramework missingFramework;
readonly List<TargetFramework> targetFrameworks;
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Projects.OptionPanels/RunOptionsPanel.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Projects.OptionPanels/RunOptionsPanel.cs
index 67a285815a..8a79156c3b 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Projects.OptionPanels/RunOptionsPanel.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Projects.OptionPanels/RunOptionsPanel.cs
@@ -42,7 +42,7 @@ namespace MonoDevelop.Ide.Projects.OptionPanels
{
RunOptionsPanelWidget widget;
- public override Widget CreatePanelWidget()
+ public override Control CreatePanelWidget()
{
return (widget = new RunOptionsPanelWidget ());
}
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Projects.OptionPanels/RuntimeOptionsPanel.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Projects.OptionPanels/RuntimeOptionsPanel.cs
index 0aa2fdeb6d..b635d4de5b 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Projects.OptionPanels/RuntimeOptionsPanel.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Projects.OptionPanels/RuntimeOptionsPanel.cs
@@ -47,7 +47,7 @@ namespace MonoDevelop.Ide.Projects.OptionPanels
{
RuntimeOptionsPanelWidget widget;
- public override Widget CreatePanelWidget()
+ public override Control CreatePanelWidget()
{
return (widget = new RuntimeOptionsPanelWidget ((DotNetProject)ConfiguredProject, ItemConfigurations));
}
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Projects.OptionPanels/SolutionItemConfigurationsPanel.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Projects.OptionPanels/SolutionItemConfigurationsPanel.cs
index 6ae8eb9397..20a39d965e 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Projects.OptionPanels/SolutionItemConfigurationsPanel.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Projects.OptionPanels/SolutionItemConfigurationsPanel.cs
@@ -43,7 +43,7 @@ namespace MonoDevelop.Ide.Projects.OptionPanels
{
CombineEntryConfigurationsPanelWidget widget;
- public override Widget CreatePanelWidget ()
+ public override Control CreatePanelWidget ()
{
MultiConfigItemOptionsDialog dlg = (MultiConfigItemOptionsDialog) ParentDialog;
return (widget = new CombineEntryConfigurationsPanelWidget (dlg));
@@ -163,9 +163,10 @@ namespace MonoDevelop.Ide.Projects.OptionPanels
try {
bool done = false;
do {
- if (MessageService.RunCustomDialog (dlg, Toplevel as Window) == (int) Gtk.ResponseType.Ok) {
- configData.RenameConfiguration (cc.Id, dlg.ConfigName, dlg.RenameChildren);
- store.SetValue (iter, 1, cc.Id);
+ if (MessageService.RunCustomDialog (dlg, Toplevel as Gtk.Window) == (int) Gtk.ResponseType.Ok) {
+ var newConf = configData.RenameConfiguration (cc.Id, dlg.ConfigName, dlg.RenameChildren);
+ store.SetValue (iter, 0, newConf);
+ store.SetValue (iter, 1, newConf.Id);
done = true;
} else
done = true;
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Projects.OptionPanels/StartupOptionsPanel.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Projects.OptionPanels/StartupOptionsPanel.cs
index 8686b5be7f..aa31d91c46 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Projects.OptionPanels/StartupOptionsPanel.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Projects.OptionPanels/StartupOptionsPanel.cs
@@ -28,6 +28,7 @@
using System;
using System.Collections.Generic;
using Gtk;
+using MonoDevelop.Components;
using MonoDevelop.Projects;
using MonoDevelop.Core;
using MonoDevelop.Core.Execution;
@@ -192,7 +193,7 @@ namespace MonoDevelop.Ide.Projects.OptionPanels
{
StartupOptionsPanelWidget widget;
- public override Widget CreatePanelWidget ()
+ public override Control CreatePanelWidget ()
{
return widget = new StartupOptionsPanelWidget (ConfiguredSolution);
}
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Projects/CombineOptionsDialog.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Projects/CombineOptionsDialog.cs
index 9218b96190..3d68902157 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Projects/CombineOptionsDialog.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Projects/CombineOptionsDialog.cs
@@ -32,6 +32,7 @@ using System.Collections.Generic;
using System.ComponentModel;
using Mono.Addins;
+using MonoDevelop.Components;
using MonoDevelop.Core;
using MonoDevelop.Projects;
using MonoDevelop.Ide.Gui.Dialogs;
@@ -40,7 +41,7 @@ namespace MonoDevelop.Ide.Projects
{
public class CombineOptionsDialog : MultiConfigItemOptionsDialog
{
- public CombineOptionsDialog (Gtk.Window parentWindow, Solution solution) : base (parentWindow, solution)
+ public CombineOptionsDialog (Window parentWindow, Solution solution) : base (parentWindow, solution)
{
this.Title = GettextCatalog.GetString ("Solution Options") + " - " + solution.Name;
}
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Projects/DefaultPolicyOptionsDialog.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Projects/DefaultPolicyOptionsDialog.cs
index 5e8db8812a..02523169e7 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Projects/DefaultPolicyOptionsDialog.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Projects/DefaultPolicyOptionsDialog.cs
@@ -53,7 +53,7 @@ namespace MonoDevelop.Ide.Projects
PolicySet currentSet;
bool loading;
- public DefaultPolicyOptionsDialog (Gtk.Window parentWindow)
+ public DefaultPolicyOptionsDialog (MonoDevelop.Components.Window parentWindow)
: base (parentWindow, new PolicySet (),
"/MonoDevelop/ProjectModel/Gui/DefaultPolicyPanels")
{
@@ -329,9 +329,10 @@ namespace MonoDevelop.Ide.Projects
void UpdateStatus ()
{
+ Gtk.Widget mainBox = MainBox;
if (sets.Count == 0) {
deleteButton.Sensitive = exportButton.Sensitive = false;
- MainBox.Sensitive = false;
+ mainBox.Sensitive = false;
((ListStore)policiesCombo.Model).Clear ();
policiesCombo.Sensitive = false;
policiesCombo.AppendText (GettextCatalog.GetString ("No Selection"));
@@ -339,7 +340,7 @@ namespace MonoDevelop.Ide.Projects
}
else {
deleteButton.Sensitive = exportButton.Sensitive = true;
- MainBox.Sensitive = true;
+ mainBox.Sensitive = true;
policiesCombo.Sensitive = true;
}
}
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Projects/GtkProjectConfigurationWidget.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Projects/GtkProjectConfigurationWidget.cs
index 6cc8a06f6f..a69502c279 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Projects/GtkProjectConfigurationWidget.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Projects/GtkProjectConfigurationWidget.cs
@@ -179,7 +179,7 @@ namespace MonoDevelop.Ide.Projects
if (startingFolder != null)
dialog.CurrentFolder = startingFolder;
- dialog.TransientFor = Toplevel as Window;
+ dialog.TransientFor = Toplevel as Gtk.Window;
if (dialog.Run ())
return dialog.SelectedFile;
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Projects/NewFileDialog.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Projects/NewFileDialog.cs
index 1fb55bb7c3..6aa31e3068 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Projects/NewFileDialog.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Projects/NewFileDialog.cs
@@ -44,7 +44,7 @@ namespace MonoDevelop.Ide.Projects
/// <summary>
/// This class is for creating a new "empty" file
/// </summary>
- internal partial class NewFileDialog : Dialog
+ internal partial class NewFileDialog : Gtk.Dialog
{
List<TemplateItem> alltemplates = new List<TemplateItem> ();
List<Category> categories = new List<Category> ();
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Projects/ProjectOptionsDialog.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Projects/ProjectOptionsDialog.cs
index 9ca48b8940..56fb56a48a 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Projects/ProjectOptionsDialog.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Projects/ProjectOptionsDialog.cs
@@ -33,6 +33,7 @@ using System.ComponentModel;
using Mono.Addins;
using MonoDevelop.Core;
using MonoDevelop.Projects;
+using MonoDevelop.Components;
using MonoDevelop.Components.Commands;
using MonoDevelop.Ide.Gui.Dialogs;
@@ -43,7 +44,7 @@ namespace MonoDevelop.Ide.Projects
/// </summary>
public class ProjectOptionsDialog : MultiConfigItemOptionsDialog
{
- public ProjectOptionsDialog (Gtk.Window parentWindow, SolutionItem project) : base (parentWindow, project)
+ public ProjectOptionsDialog (Window parentWindow, SolutionItem project) : base (parentWindow, project)
{
this.Title = GettextCatalog.GetString ("Project Options") + " - " + project.Name;
this.DefaultWidth = 960;
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.StandardHeader/StandardHeaderPolicyPanel.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.StandardHeader/StandardHeaderPolicyPanel.cs
index 34967fc29f..3bcfbdb9cc 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.StandardHeader/StandardHeaderPolicyPanel.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.StandardHeader/StandardHeaderPolicyPanel.cs
@@ -27,7 +27,7 @@
//
using System;
-using Gtk;
+using MonoDevelop.Components;
using MonoDevelop.Core;
using MonoDevelop.Core.Serialization;
using MonoDevelop.Projects.Policies;
@@ -45,7 +45,7 @@ namespace MonoDevelop.Ide.StandardHeader
get { return GettextCatalog.GetString ("Standard _Header"); }
}
- public override Widget CreatePanelWidget ()
+ public override Control CreatePanelWidget ()
{
panel = new StandardHeaderPolicyPanelWidget (this);
panel.ShowAll ();
@@ -66,7 +66,7 @@ namespace MonoDevelop.Ide.StandardHeader
partial class StandardHeaderPolicyPanelWidget : Gtk.Bin
{
StandardHeaderPolicyPanel parent;
- TreeStore store = new Gtk.TreeStore (typeof (string));
+ Gtk.TreeStore store = new Gtk.TreeStore (typeof (string));
static readonly string [] templates = {
"FileName",
@@ -92,7 +92,7 @@ namespace MonoDevelop.Ide.StandardHeader
this.Build ();
headerText.Buffer.Changed += NotifyChanged;
includeAutoCheck.Toggled += NotifyChanged;
- this.treeviewTemplates.AppendColumn (GettextCatalog.GetString ("Templates"), new CellRendererText (), "text", 0);
+ this.treeviewTemplates.AppendColumn (GettextCatalog.GetString ("Templates"), new Gtk.CellRendererText (), "text", 0);
foreach (var template in templates) {
store.AppendValues ("${"+template+"}");
}
@@ -104,9 +104,9 @@ namespace MonoDevelop.Ide.StandardHeader
treeviewTemplates.QueueResize ();
}
- void TreeviewTemplates_RowActivated (object o, RowActivatedArgs args)
+ void TreeviewTemplates_RowActivated (object o, Gtk.RowActivatedArgs args)
{
- TreeIter iter;
+ Gtk.TreeIter iter;
store.GetIter (out iter, args.Path);
headerText.Buffer.InsertAtCursor ((string)store.GetValue (iter, 0));
}
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Tasks/CommentTasksView.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Tasks/CommentTasksView.cs
index 72e458996c..9df4ad07eb 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Tasks/CommentTasksView.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Tasks/CommentTasksView.cs
@@ -32,6 +32,7 @@ using System.Collections;
using System.Collections.Generic;
using Gtk;
+using MonoDevelop.Components;
using MonoDevelop.Core;
using MonoDevelop.Projects;
using MonoDevelop.Ide;
@@ -543,11 +544,11 @@ namespace MonoDevelop.Ide.Tasks
OnGenTaskJumpto (null, null);
}
- void OnGenTaskDelete (object o, EventArgs args)
+ async void OnGenTaskDelete (object o, EventArgs args)
{
TaskListEntry task = SelectedTask;
if (task != null && ! String.IsNullOrEmpty (task.FileName)) {
- var doc = IdeApp.Workbench.OpenDocument (task.FileName, null, Math.Max (1, task.Line), Math.Max (1, task.Column));
+ var doc = await IdeApp.Workbench.OpenDocument (task.FileName, null, Math.Max (1, task.Line), Math.Max (1, task.Column));
if (doc != null && doc.HasProject && doc.Project is DotNetProject) {
string[] commentTags = doc.CommentTags;
if (commentTags != null && commentTags.Length == 1) {
@@ -629,14 +630,14 @@ namespace MonoDevelop.Ide.Tasks
}
#region ITaskListView members
- TreeView ITaskListView.Content {
+ Control ITaskListView.Content {
get {
CreateView ();
return view;
}
}
- Widget[] ITaskListView.ToolBarItems {
+ Control[] ITaskListView.ToolBarItems {
get { return null; }
}
#endregion
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Tasks/ITaskListView.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Tasks/ITaskListView.cs
index 89b3fd5f1f..8506888425 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Tasks/ITaskListView.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Tasks/ITaskListView.cs
@@ -27,13 +27,13 @@
//
using System;
-using Gtk;
+using MonoDevelop.Components;
namespace MonoDevelop.Ide.Tasks
{
public interface ITaskListView
{
- TreeView Content { get; }
- Widget[] ToolBarItems { get; }
+ Control Content { get; }
+ Control[] ToolBarItems { get; }
}
}
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Tasks/TaskStore.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Tasks/TaskStore.cs
index 7db2b7aef8..d2c9276df1 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Tasks/TaskStore.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Tasks/TaskStore.cs
@@ -43,6 +43,7 @@ using MonoDevelop.Ide.Gui.Content;
using MonoDevelop.Ide.Navigation;
using MonoDevelop.Ide.TextEditing;
using MonoDevelop.Ide.Desktop;
+using System.Threading.Tasks;
namespace MonoDevelop.Ide.Tasks
{
@@ -387,9 +388,9 @@ namespace MonoDevelop.Ide.Tasks
this.task = task;
}
- protected override Document DoShow ()
+ protected override async Task<Document> DoShow ()
{
- Document result = base.DoShow ();
+ Document result = await base.DoShow ();
TaskService.InformJumpToTask (task);
return result;
}
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Tasks/UserTasksView.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Tasks/UserTasksView.cs
index 579951f667..d0e32fffcf 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Tasks/UserTasksView.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Tasks/UserTasksView.cs
@@ -350,8 +350,8 @@ namespace MonoDevelop.Ide.Tasks
}
#region ITaskListView members
- TreeView ITaskListView.Content { get { return view; } }
- Widget[] ITaskListView.ToolBarItems { get { return new Widget[] { newButton, delButton, copyButton }; } }
+ Control ITaskListView.Content { get { return view; } }
+ Control[] ITaskListView.ToolBarItems { get { return new Control[] { newButton, delButton, copyButton }; } }
#endregion
}
}
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Templates/PropertyDescriptionTemplate.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Templates/PropertyDescriptionTemplate.cs
index 98b1079c0a..75aa833cb9 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Templates/PropertyDescriptionTemplate.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Templates/PropertyDescriptionTemplate.cs
@@ -31,7 +31,7 @@ using MonoDevelop.Projects;
namespace MonoDevelop.Ide.Templates
{
- public class PropertyDescriptionTemplate : FileDescriptionTemplate
+ class PropertyDescriptionTemplate : FileDescriptionTemplate
{
XmlAttribute typeAtt;
string propertyInnerText;
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.TextEditing/TopLevelWidgetExtension.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.TextEditing/TopLevelWidgetExtension.cs
index 6ce7988b5b..1165bf2957 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.TextEditing/TopLevelWidgetExtension.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.TextEditing/TopLevelWidgetExtension.cs
@@ -25,6 +25,7 @@
// THE SOFTWARE.
using System;
+using MonoDevelop.Components;
namespace MonoDevelop.Ide.TextEditing
{
@@ -36,7 +37,7 @@ namespace MonoDevelop.Ide.TextEditing
public int OffsetY { get; set; }
public bool AllowMove { get; set; }
- public abstract Gtk.Widget CreateWidget ();
+ public abstract Control CreateWidget ();
protected TopLevelWidgetExtension ()
{
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.TypeSystem/MonoDevelopSourceTextContainer.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.TypeSystem/MonoDevelopSourceTextContainer.cs
index 3c4cf75b5a..a8eed4fad2 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.TypeSystem/MonoDevelopSourceTextContainer.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.TypeSystem/MonoDevelopSourceTextContainer.cs
@@ -171,6 +171,7 @@ namespace MonoDevelop.Ide.TypeSystem
if (isDisposed)
return;
document.TextChanging -= HandleTextReplacing;
+ document.TextChanged -= Document_TextChanged;;
isDisposed = true;
}
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.TypeSystem/MonoDevelopTextLoader.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.TypeSystem/MonoDevelopTextLoader.cs
index 15b8a5e363..a4e873fdbe 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.TypeSystem/MonoDevelopTextLoader.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.TypeSystem/MonoDevelopTextLoader.cs
@@ -42,10 +42,13 @@ namespace MonoDevelop.Ide.TypeSystem
}
#region implemented abstract members of TextLoader
- TextAndVersion GetTextAndVersion (Workspace workspace, DocumentId documentId)
+ async Task<TextAndVersion> GetTextAndVersion (Workspace workspace, DocumentId documentId, CancellationToken cancellationToken)
{
if (!File.Exists (fileName)) {
- return TextAndVersion.Create (((MonoDevelopWorkspace)workspace).GetDocument (documentId).GetTextAsync ().Result, VersionStamp.Create ());
+ var document = ((MonoDevelopWorkspace)workspace).GetDocument (documentId);
+ if (document == null)
+ return null;
+ return TextAndVersion.Create (await document.GetTextAsync (cancellationToken), VersionStamp.Create ());
}
SourceText text;
if (workspace.IsDocumentOpen (documentId)) {
@@ -57,9 +60,9 @@ namespace MonoDevelop.Ide.TypeSystem
return TextAndVersion.Create (text, VersionStamp.Create ());
}
- public override Task<TextAndVersion> LoadTextAndVersionAsync (Workspace workspace, DocumentId documentId, CancellationToken cancellationToken)
+ public override async Task<TextAndVersion> LoadTextAndVersionAsync (Workspace workspace, DocumentId documentId, CancellationToken cancellationToken)
{
- return Task.FromResult (GetTextAndVersion (workspace, documentId));
+ return await GetTextAndVersion (workspace, documentId, cancellationToken);
}
#endregion
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.TypeSystem/MonoDevelopWorkspace.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.TypeSystem/MonoDevelopWorkspace.cs
index cc3a1ee1e8..1db2eeae77 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.TypeSystem/MonoDevelopWorkspace.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.TypeSystem/MonoDevelopWorkspace.cs
@@ -189,7 +189,7 @@ namespace MonoDevelop.Ide.TypeSystem
async Task<SolutionInfo> CreateSolutionInfo (MonoDevelop.Projects.Solution solution, CancellationToken token)
{
var projects = new ConcurrentBag<ProjectInfo> ();
- var mdProjects = solution.GetAllProjects ();
+ var mdProjects = solution.GetAllProjects ().OfType<MonoDevelop.Projects.DotNetProject> ();
projectionList.Clear ();
solutionData = new SolutionData ();
@@ -379,7 +379,7 @@ namespace MonoDevelop.Ide.TypeSystem
project.Modified -= OnProjectModified;
}
- Task<ProjectInfo> LoadProject (MonoDevelop.Projects.Project p, CancellationToken token)
+ Task<ProjectInfo> LoadProject (MonoDevelop.Projects.DotNetProject p, CancellationToken token)
{
if (!projectIdMap.ContainsKey (p)) {
p.FileAddedToProject += OnFileAdded;
@@ -519,13 +519,9 @@ namespace MonoDevelop.Ide.TypeSystem
}
}
- static async Task<List<MetadataReference>> CreateMetadataReferences (MonoDevelop.Projects.Project p, ProjectId projectId, CancellationToken token)
+ static async Task<List<MetadataReference>> CreateMetadataReferences (MonoDevelop.Projects.DotNetProject netProject, ProjectId projectId, CancellationToken token)
{
List<MetadataReference> result = new List<MetadataReference> ();
-
- var netProject = p as MonoDevelop.Projects.DotNetProject;
- if (netProject == null)
- return result;
var configurationSelector = IdeApp.Workspace?.ActiveConfiguration ?? MonoDevelop.Projects.ConfigurationSelector.Default;
var hashSet = new HashSet<string> (FilePath.PathComparer);
@@ -566,7 +562,7 @@ namespace MonoDevelop.Ide.TypeSystem
}
}
- foreach (var pr in p.GetReferencedItems (configurationSelector)) {
+ foreach (var pr in netProject.GetReferencedItems (configurationSelector)) {
if (token.IsCancellationRequested)
return result;
var referencedProject = pr as MonoDevelop.Projects.DotNetProject;
@@ -582,14 +578,11 @@ namespace MonoDevelop.Ide.TypeSystem
return result;
}
- IEnumerable<ProjectReference> CreateProjectReferences (MonoDevelop.Projects.Project p, CancellationToken token)
+ IEnumerable<ProjectReference> CreateProjectReferences (MonoDevelop.Projects.DotNetProject p, CancellationToken token)
{
- foreach (var pr in p.GetReferencedItems (MonoDevelop.Projects.ConfigurationSelector.Default)) {
+ foreach (var referencedProject in p.GetReferencedAssemblyProjects (IdeApp.Workspace?.ActiveConfiguration ?? MonoDevelop.Projects.ConfigurationSelector.Default)) {
if (token.IsCancellationRequested)
yield break;
- var referencedProject = pr as MonoDevelop.Projects.DotNetProject;
- if (referencedProject == null)
- continue;
if (TypeSystemService.IsOutputTrackedProject (referencedProject))
continue;
yield return new ProjectReference (GetOrCreateProjectId (referencedProject));
@@ -703,16 +696,20 @@ namespace MonoDevelop.Ide.TypeSystem
return;
bool isOpen;
var filePath = document.FilePath;
+ var data = TextFileProvider.Instance.GetTextEditorData (filePath, out isOpen);
// Guard against already done changes in linked files.
// This shouldn't happen but the roslyn merging seems not to be working correctly in all cases :/
+ if (document.GetLinkedDocumentIds ().Length > 0 && isOpen && !(text.GetType ().FullName == "Microsoft.CodeAnalysis.Text.ChangedText")) {
+ return;
+ }
SourceText formerText;
if (changedFiles.TryGetValue (filePath, out formerText)) {
if (formerText.Length == text.Length && formerText.ToString () == text.ToString ())
return;
}
changedFiles [filePath] = text;
-
+
Projection projection = null;
foreach (var entry in ProjectionList) {
var p = entry.Projections.FirstOrDefault (proj => FilePath.PathComparer.Equals (proj.Document.FileName, filePath));
@@ -722,11 +719,13 @@ namespace MonoDevelop.Ide.TypeSystem
break;
}
}
-
- var data = TextFileProvider.Instance.GetTextEditorData (filePath, out isOpen);
- var oldFile = isOpen ? document.GetTextAsync ().Result : new MonoDevelopSourceText (data);
+ SourceText oldFile;
+ if (!isOpen || !document.TryGetText (out oldFile)) {
+ oldFile = new MonoDevelopSourceText (data);
+ }
var changes = text.GetTextChanges (oldFile).OrderByDescending (c => c.Span.Start).ToList ();
int delta = 0;
+
if (!isOpen) {
delta = ApplyChanges (projection, data, changes);
var formatter = CodeFormatterService.GetFormatter (data.MimeType);
@@ -765,7 +764,6 @@ namespace MonoDevelop.Ide.TypeSystem
foreach (var change in changes) {
delta -= change.Span.Length - change.NewText.Length;
var startOffset = change.Span.Start - delta;
-
if (projection != null) {
int originalOffset;
if (projection.TryConvertFromProjectionToOriginal (startOffset, out originalOffset))
@@ -994,7 +992,9 @@ namespace MonoDevelop.Ide.TypeSystem
return;
if (!args.Any (x => x.Hint == "TargetFramework" || x.Hint == "References"))
return;
- var project = (MonoDevelop.Projects.Project)sender;
+ var project = sender as MonoDevelop.Projects.DotNetProject;
+ if (project == null)
+ return;
var projectId = GetProjectId (project);
if (CurrentSolution.ContainsProject (projectId)) {
OnProjectReloaded (await LoadProject (project, default(CancellationToken)).ConfigureAwait (false));
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.WelcomePage/DefaultWelcomePage.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.WelcomePage/DefaultWelcomePage.cs
index 7966655f10..5d37b2d7d2 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.WelcomePage/DefaultWelcomePage.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.WelcomePage/DefaultWelcomePage.cs
@@ -29,7 +29,7 @@ using Gtk;
namespace MonoDevelop.Ide.WelcomePage
{
- public class DefaultWelcomePage: WelcomePageWidget
+ class DefaultWelcomePage: WelcomePageWidget
{
protected override void BuildContent (Container parent)
{
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.WelcomePage/IWelcomePageProvider.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.WelcomePage/IWelcomePageProvider.cs
index 5ac8884424..541b690441 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.WelcomePage/IWelcomePageProvider.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.WelcomePage/IWelcomePageProvider.cs
@@ -25,13 +25,14 @@
// THE SOFTWARE.
using System;
using Mono.Addins;
+using MonoDevelop.Components;
namespace MonoDevelop.Ide.WelcomePage
{
[TypeExtensionPoint]
public interface IWelcomePageProvider
{
- Gtk.Widget CreateWidget ();
+ Control CreateWidget ();
}
}
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.WelcomePage/WelcomePageOptionPanel.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.WelcomePage/WelcomePageOptionPanel.cs
index 26a87546f1..9640eda8d9 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.WelcomePage/WelcomePageOptionPanel.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.WelcomePage/WelcomePageOptionPanel.cs
@@ -27,18 +27,19 @@
using Gtk;
+using MonoDevelop.Components;
using MonoDevelop.Core;
using MonoDevelop.Ide.Gui.Dialogs;
namespace MonoDevelop.Ide.WelcomePage
{
- public class WelcomePageOptionPanel : OptionsPanel
+ class WelcomePageOptionPanel : OptionsPanel
{
CheckButton showOnStartCheckButton = new CheckButton ();
CheckButton internetUpdateCheckButton = new CheckButton ();
CheckButton closeOnOpenSlnCheckButton = new CheckButton ();
- public override Widget CreatePanelWidget ()
+ public override Control CreatePanelWidget ()
{
VBox vbox = new VBox();
showOnStartCheckButton.Label = GettextCatalog.GetString ("Show welcome page on startup");
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.csproj b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.csproj
index 947c97bb3d..490c4f8bf1 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.csproj
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.csproj
@@ -6436,12 +6436,9 @@
<Compile Include="MonoDevelop.Ide.Templates\SingleFileDescriptionTemplate.cs" />
<Compile Include="MonoDevelop.Ide.Templates\SolutionDescriptor.cs" />
<Compile Include="MonoDevelop.Ide.Templates\ResourceFileDescriptionTemplate.cs" />
- <Compile Include="MonoDevelop.Ide.Gui\AbstractBaseViewContent.cs" />
- <Compile Include="MonoDevelop.Ide.Gui\AbstractPadContent.cs" />
- <Compile Include="MonoDevelop.Ide.Gui\AbstractViewContent.cs" />
- <Compile Include="MonoDevelop.Ide.Gui\IBaseViewContent.cs" />
+ <Compile Include="MonoDevelop.Ide.Gui\BaseViewContent.cs" />
+ <Compile Include="MonoDevelop.Ide.Gui\ViewContent.cs" />
<Compile Include="MonoDevelop.Ide.Gui\PadContent.cs" />
- <Compile Include="MonoDevelop.Ide.Gui\IViewContent.cs" />
<Compile Include="MonoDevelop.Ide.Gui\IWorkbenchWindow.cs" />
<Compile Include="MonoDevelop.Ide.Gui\ViewCommandHandlers.cs" />
<Compile Include="MonoDevelop.Ide.Gui.Content\IBookmarkBuffer.cs" />
@@ -6605,8 +6602,6 @@
<Compile Include="MonoDevelop.Ide.FindInFiles\SearchResultWidget.cs" />
<Compile Include="MonoDevelop.Ide.FindInFiles\ISearchProgressMonitor.cs" />
<Compile Include="MonoDevelop.Ide.FindInFiles\SearchProgressMonitor.cs" />
- <Compile Include="MonoDevelop.Ide.Gui\IAttachableViewContent.cs" />
- <Compile Include="MonoDevelop.Ide.Gui\AbstractAttachableViewContent.cs" />
<Compile Include="MonoDevelop.Ide.CodeFormatting\CodeFormattingCommands.cs" />
<Compile Include="MonoDevelop.Ide.Execution\ParameterizedExecutionHandler.cs" />
<Compile Include="MonoDevelop.Ide.Execution\ExecutionModeCommandService.cs" />
@@ -6626,7 +6621,6 @@
<Compile Include="MonoDevelop.Ide.Tasks\TaskStore.cs" />
<Compile Include="MonoDevelop.Ide.Gui.OptionPanels\AssemblyFoldersPanel.cs" />
<Compile Include="gtk-gui\MonoDevelop.Ide.Gui.OptionPanels.AssemblyFoldersPanelWidget.cs" />
- <Compile Include="MonoDevelop.Ide.Gui.Content\ISupportsProjectReload.cs" />
<Compile Include="MonoDevelop.Ide.Gui.OptionPanels\BuildMessagePanel.cs" />
<Compile Include="gtk-gui\MonoDevelop.Ide.Gui.OptionPanels.BuildMessagePanelWidget.cs" />
<Compile Include="MonoDevelop.Ide.Gui\HiddenWorkbenchWindow.cs" />
@@ -6697,7 +6691,6 @@
<Compile Include="MonoDevelop.Components.Commands\CommandMenuItem.cs" />
<Compile Include="MonoDevelop.Components.Commands\CommandSystemCommands.cs" />
<Compile Include="MonoDevelop.Components.Commands\CommandToggleToolButton.cs" />
- <Compile Include="MonoDevelop.Components.Commands\CommandToolbar.cs" />
<Compile Include="MonoDevelop.Components.Commands\CommandToolButton.cs" />
<Compile Include="MonoDevelop.Components.Commands\CustomCommand.cs" />
<Compile Include="MonoDevelop.Components.Commands\CustomMenuItem.cs" />
@@ -6727,21 +6720,6 @@
<Compile Include="MonoDevelop.Components.Commands.ExtensionNodes\SeparatorItemCodon.cs" />
<Compile Include="MonoDevelop.Components.Commands.ExtensionNodes\LocalCommandItemCodon.cs" />
<Compile Include="MonoDevelop.Components.Commands.ExtensionNodes\SchemeExtensionNode.cs" />
- <Compile Include="MonoDevelop.Components.DockToolbars\ArrowWindow.cs" />
- <Compile Include="MonoDevelop.Components.DockToolbars\DockedPosition.cs" />
- <Compile Include="MonoDevelop.Components.DockToolbars\DockGrip.cs" />
- <Compile Include="MonoDevelop.Components.DockToolbars\DockToolbar.cs" />
- <Compile Include="MonoDevelop.Components.DockToolbars\DockToolbarFrame.cs" />
- <Compile Include="MonoDevelop.Components.DockToolbars\DockToolbarFrameLayout.cs" />
- <Compile Include="MonoDevelop.Components.DockToolbars\DockToolbarFrameStatus.cs" />
- <Compile Include="MonoDevelop.Components.DockToolbars\DockToolbarPanel.cs" />
- <Compile Include="MonoDevelop.Components.DockToolbars\DockToolbarPosition.cs" />
- <Compile Include="MonoDevelop.Components.DockToolbars\DockToolbarStatus.cs" />
- <Compile Include="MonoDevelop.Components.DockToolbars\FixedPanel.cs" />
- <Compile Include="MonoDevelop.Components.DockToolbars\FloatingDock.cs" />
- <Compile Include="MonoDevelop.Components.DockToolbars\FloatingPosition.cs" />
- <Compile Include="MonoDevelop.Components.DockToolbars\IDockBar.cs" />
- <Compile Include="MonoDevelop.Components.DockToolbars\PlaceholderWindow.cs" />
<Compile Include="MonoDevelop.Components.Extensions\PlatformDialog.cs" />
<Compile Include="MonoDevelop.Components.Extensions\ISelectFileDialog.cs" />
<Compile Include="MonoDevelop.Components.PropertyGrid\DefaultPropertyTab.cs" />
@@ -7370,6 +7348,7 @@
<Compile Include="MonoDevelop.Components.AutoTest.Operations\SelectedOperation.cs" />
<Compile Include="MonoDevelop.Components\Windows\GtkWPFWidget.cs" />
<Compile Include="MonoDevelop.Components\Windows\GtkWin32Interop.cs" />
+ <Compile Include="MonoDevelop.Ide.Editor.Extension\AbstractNavigationExtension.cs" />
<Compile Include="MonoDevelop.Components\FileChooserAction.cs" />
<Compile Include="MonoDevelop.Components\IdeDialog.cs" />
<Compile Include="MonoDevelop.Components\IdeWindow.cs" />
@@ -7377,6 +7356,10 @@
<Compile Include="MonoDevelop.Ide.Templates\PropertyDescriptionTemplate.cs" />
<Compile Include="MonoDevelop.Ide.Templates\FileTemplateTagsModifier.cs" />
<Compile Include="MonoDevelop.Ide.Templates\CombinedTagModel.cs" />
+ <Compile Include="MonoDevelop.Components.Docking\DockPositionType.cs" />
+ <Compile Include="MonoDevelop.Components\ButtonEvent.cs" />
+ <Compile Include="MonoDevelop.Components\Window.cs" />
+ <Compile Include="MonoDevelop.Components\Dialog.cs" />
</ItemGroup>
<ItemGroup>
<None Include="Makefile.am" />
@@ -7443,4 +7426,4 @@
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
</ItemGroup>
-</Project> \ No newline at end of file
+</Project>
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide/DesktopService.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide/DesktopService.cs
index 8455c21735..3a48180f21 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide/DesktopService.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide/DesktopService.cs
@@ -246,10 +246,10 @@ namespace MonoDevelop.Ide
{
PlatformService.SetFileAttributes (fileName, attributes);
}
-
- public static Gdk.Rectangle GetUsableMonitorGeometry (Gdk.Screen screen, int monitor)
+
+ public static Xwt.Rectangle GetUsableMonitorGeometry (int screenNumber, int monitorNumber)
{
- return PlatformService.GetUsableMonitorGeometry (screen, monitor);
+ return PlatformService.GetUsableMonitorGeometry (screenNumber, monitorNumber);
}
public static bool CanOpenTerminal {
@@ -319,13 +319,13 @@ namespace MonoDevelop.Ide
PlatformService.GrabDesktopFocus (window);
}
- public static void RemoveWindowShadow (Gtk.Window window)
+ public static void RemoveWindowShadow (Window window)
{
PlatformService.RemoveWindowShadow (window);
}
- public static void SetMainWindowDecorations (Gtk.Window window)
+ public static void SetMainWindowDecorations (Window window)
{
PlatformService.SetMainWindowDecorations (window);
}
@@ -341,12 +341,12 @@ namespace MonoDevelop.Ide
toolbar.Initialize ();
}
- public static bool GetIsFullscreen (Gtk.Window window)
+ public static bool GetIsFullscreen (Window window)
{
return PlatformService.GetIsFullscreen (window);
}
- public static void SetIsFullscreen (Gtk.Window window, bool isFullscreen)
+ public static void SetIsFullscreen (Window window, bool isFullscreen)
{
PlatformService.SetIsFullscreen (window, isFullscreen);
}
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide/Ide.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide/Ide.cs
index 62d2e4ee7c..3a49d07326 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide/Ide.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide/Ide.cs
@@ -410,7 +410,6 @@ namespace MonoDevelop.Ide
static void OnInitialRun ()
{
- Workbench.ResetToolbars ();
SetInitialLayout ();
}
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide/MessageService.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide/MessageService.cs
index 013906bf1f..e19ee14d2f 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide/MessageService.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide/MessageService.cs
@@ -31,7 +31,6 @@ using System.Collections.Generic;
using System.Linq;
using System.Threading;
using MonoDevelop.Components;
-using Gtk;
using MonoDevelop.Core;
using MonoDevelop.Components.Extensions;
using MonoDevelop.Ide.Gui;
@@ -331,13 +330,13 @@ namespace MonoDevelop.Ide
return ShowCustomDialog (dialog, null);
}
- public static int ShowCustomDialog (Dialog dialog, Window parent)
+ public static int ShowCustomDialog (Dialog dlg, Window parent)
{
+ Gtk.Dialog dialog = dlg;
try {
- return RunCustomDialog (dialog, parent);
+ return RunCustomDialog (dlg, parent);
} finally {
- if (dialog != null)
- dialog.Destroy ();
+ dialog?.Destroy ();
}
}
@@ -349,9 +348,10 @@ namespace MonoDevelop.Ide
/// <summary>
/// Places and runs a transient dialog. Does not destroy it, so values can be retrieved from its widgets.
/// </summary>
- public static int RunCustomDialog (Dialog dialog, Window parent)
+ public static int RunCustomDialog (Dialog dlg, Window parent)
{
// if dialog is modal, make sure it's parented on any existing modal dialog
+ Gtk.Dialog dialog = dlg;
if (dialog.Modal) {
parent = GetDefaultModalParent ();
}
@@ -405,26 +405,27 @@ namespace MonoDevelop.Ide
/// </summary>
public static Window GetDefaultModalParent ()
{
- foreach (Window w in Window.ListToplevels ())
+ foreach (Gtk.Window w in Gtk.Window.ListToplevels ())
if (w.Visible && w.HasToplevelFocus && w.Modal)
return w;
return GetFocusedToplevel ();
}
- static Window GetFocusedToplevel ()
+ static Gtk.Window GetFocusedToplevel ()
{
- return Window.ListToplevels ().FirstOrDefault (w => w.HasToplevelFocus) ?? RootWindow;
+ return Gtk.Window.ListToplevels ().FirstOrDefault (w => w.HasToplevelFocus) ?? RootWindow;
}
/// <summary>
/// Positions a dialog relative to its parent on platforms where default placement is known to be poor.
/// </summary>
- public static void PlaceDialog (Window child, Window parent)
+ public static void PlaceDialog (Window childControl, Window parent)
{
//HACK: this is a workaround for broken automatic window placement on Mac
if (!Platform.IsMac)
return;
+ Gtk.Window child = childControl;
//modal windows should always be placed o top of existing modal windows
if (child.Modal)
parent = GetDefaultModalParent ();
@@ -438,8 +439,10 @@ namespace MonoDevelop.Ide
}
/// <summary>Centers a window relative to its parent.</summary>
- static void CenterWindow (Window child, Window parent)
+ static void CenterWindow (Window childControl, Window parentControl)
{
+ Gtk.Window child = childControl;
+ Gtk.Window parent = parentControl;
child.Child.Show ();
int w, h, winw, winh, x, y, winx, winy;
child.GetSize (out w, out h);
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide/ProjectOperations.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide/ProjectOperations.cs
index dd459f6e83..053c485bb2 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide/ProjectOperations.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide/ProjectOperations.cs
@@ -56,7 +56,6 @@ using MonoDevelop.Projects.MSBuild;
using System.Collections.Immutable;
using MonoDevelop.Ide.Editor;
using MonoDevelop.Core.Text;
-using ICSharpCode.NRefactory.TypeSystem;
using MonoDevelop.Components.Extensions;
namespace MonoDevelop.Ide
@@ -277,7 +276,7 @@ namespace MonoDevelop.Ide
}
if (fileName == null)
return;
- var doc = IdeApp.Workbench.OpenDocument (new FileOpenInformation (fileName, project));
+ var doc = await IdeApp.Workbench.OpenDocument (new FileOpenInformation (fileName, project));
if (doc != null) {
doc.RunWhenLoaded (delegate {
@@ -299,7 +298,7 @@ namespace MonoDevelop.Ide
offset = projectedOffset;
}
}
- IdeApp.Workbench.OpenDocument (new FileOpenInformation (filePath, project) {
+ await IdeApp.Workbench.OpenDocument (new FileOpenInformation (filePath, project) {
Offset = offset
});
}
@@ -340,7 +339,7 @@ namespace MonoDevelop.Ide
}
if (fileName == null || !File.Exists (fileName))
return;
- var doc = IdeApp.Workbench.OpenDocument (new FileOpenInformation (fileName));
+ var doc = await IdeApp.Workbench.OpenDocument (new FileOpenInformation (fileName));
if (doc != null) {
doc.RunWhenLoaded (delegate {
var handler = doc.PrimaryView.GetContent<MonoDevelop.Ide.Gui.Content.IOpenNamedElementHandler> ();
@@ -1198,7 +1197,7 @@ namespace MonoDevelop.Ide
}
//saves open documents since it may dirty the "needs building" check
- var r = DoBeforeCompileAction ();
+ var r = await DoBeforeCompileAction ();
if (r.Failed)
return false;
@@ -1353,7 +1352,7 @@ namespace MonoDevelop.Ide
try {
if (!skipPrebuildCheck) {
tt.Trace ("Pre-build operations");
- result = DoBeforeCompileAction ();
+ result = await DoBeforeCompileAction ();
}
//wait for any custom tools that were triggered by the save, since the build may depend on them
@@ -1380,7 +1379,7 @@ namespace MonoDevelop.Ide
}
// Note: This must run in the main thread
- void PromptForSave (BuildResult result)
+ async Task PromptForSave (BuildResult result)
{
var couldNotSaveError = "The build has been aborted as the file '{0}' could not be saved";
@@ -1390,7 +1389,7 @@ namespace MonoDevelop.Ide
GettextCatalog.GetString ("Some of the open documents have unsaved changes."),
AlertButton.BuildWithoutSave, AlertButton.Save) == AlertButton.Save) {
MarkFileDirty (doc.FileName);
- doc.Save ();
+ await doc.Save ();
if (doc.IsDirty)
result.AddError (string.Format (couldNotSaveError, Path.GetFileName (doc.FileName)), doc.FileName);
} else
@@ -1400,13 +1399,13 @@ namespace MonoDevelop.Ide
}
// Note: This must run in the main thread
- void SaveAllFiles (BuildResult result)
+ async Task SaveAllFiles (BuildResult result)
{
var couldNotSaveError = "The build has been aborted as the file '{0}' could not be saved";
foreach (var doc in new List<MonoDevelop.Ide.Gui.Document> (IdeApp.Workbench.Documents)) {
if (doc.IsDirty && doc.Project != null) {
- doc.Save ();
+ await doc.Save ();
if (doc.IsDirty) {
doc.Select ();
result.AddError (string.Format (couldNotSaveError, Path.GetFileName (doc.FileName)), doc.FileName);
@@ -1415,15 +1414,15 @@ namespace MonoDevelop.Ide
}
}
- BuildResult DoBeforeCompileAction ()
+ async Task<BuildResult> DoBeforeCompileAction ()
{
BeforeCompileAction action = IdeApp.Preferences.BeforeBuildSaveAction;
var result = new BuildResult ();
switch (action) {
case BeforeCompileAction.Nothing: break;
- case BeforeCompileAction.PromptForSave: PromptForSave (result); break;
- case BeforeCompileAction.SaveAllFiles: SaveAllFiles (result); break;
+ case BeforeCompileAction.PromptForSave: await PromptForSave (result); break;
+ case BeforeCompileAction.SaveAllFiles: await SaveAllFiles (result); break;
default: System.Diagnostics.Debug.Assert (false); break;
}
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide/RootWorkspace.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide/RootWorkspace.cs
index c8f952933e..f9cddfacc5 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide/RootWorkspace.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide/RootWorkspace.cs
@@ -819,14 +819,9 @@ namespace MonoDevelop.Ide
hasUnsaved = true;
if (!doc.IsFile)
hasNoFiles = true;
- ISupportsProjectReload pr = doc.GetContent<ISupportsProjectReload> ();
- if (pr != null) {
- ProjectReloadCapability c = pr.ProjectReloadCapability;
- if ((int) c < (int) prc)
- prc = c;
- }
- else
- prc = ProjectReloadCapability.None;
+ var c = doc.ProjectReloadCapability;
+ if ((int) c < (int) prc)
+ prc = c;
}
string msg = null;
@@ -857,8 +852,7 @@ namespace MonoDevelop.Ide
foreach (Document doc in docs) {
if (doc.IsDirty)
hasUnsaved = true;
- ISupportsProjectReload pr = doc.GetContent<ISupportsProjectReload> ();
- if (pr != null)
+ if (doc.ProjectReloadCapability != ProjectReloadCapability.None)
doc.SetProject (null);
else {
FilePath file = doc.IsFile ? doc.FileName : FilePath.Null;
diff --git a/main/src/core/MonoDevelop.Ide/gtk-gui/MonoDevelop.Ide.Gui.Dialogs.SelectFileFormatDialog.cs b/main/src/core/MonoDevelop.Ide/gtk-gui/MonoDevelop.Ide.Gui.Dialogs.SelectFileFormatDialog.cs
index 68c61a296f..6ecb4fa2b4 100644
--- a/main/src/core/MonoDevelop.Ide/gtk-gui/MonoDevelop.Ide.Gui.Dialogs.SelectFileFormatDialog.cs
+++ b/main/src/core/MonoDevelop.Ide/gtk-gui/MonoDevelop.Ide.Gui.Dialogs.SelectFileFormatDialog.cs
@@ -2,7 +2,7 @@
// This file has been generated by the GUI designer. Do not modify.
namespace MonoDevelop.Ide.Gui.Dialogs
{
- public partial class SelectFileFormatDialog
+ partial class SelectFileFormatDialog
{
private global::Gtk.HBox hbox1;
diff --git a/main/src/core/MonoDevelop.Ide/gtk-gui/MonoDevelop.Ide.Gui.OptionPanels.IDEStyleOptionsPanelWidget.cs b/main/src/core/MonoDevelop.Ide/gtk-gui/MonoDevelop.Ide.Gui.OptionPanels.IDEStyleOptionsPanelWidget.cs
index cb945ba4ae..f12e3d37b7 100644
--- a/main/src/core/MonoDevelop.Ide/gtk-gui/MonoDevelop.Ide.Gui.OptionPanels.IDEStyleOptionsPanelWidget.cs
+++ b/main/src/core/MonoDevelop.Ide/gtk-gui/MonoDevelop.Ide.Gui.OptionPanels.IDEStyleOptionsPanelWidget.cs
@@ -2,7 +2,7 @@
// This file has been generated by the GUI designer. Do not modify.
namespace MonoDevelop.Ide.Gui.OptionPanels
{
- public partial class IDEStyleOptionsPanelWidget
+ partial class IDEStyleOptionsPanelWidget
{
private global::Gtk.VBox vbox13;
private global::Gtk.Table table1;
diff --git a/main/src/core/MonoDevelop.Ide/gtk-gui/gui.stetic b/main/src/core/MonoDevelop.Ide/gtk-gui/gui.stetic
index 3b45155c95..ace9f139ae 100644
--- a/main/src/core/MonoDevelop.Ide/gtk-gui/gui.stetic
+++ b/main/src/core/MonoDevelop.Ide/gtk-gui/gui.stetic
@@ -3099,6 +3099,7 @@ Diagnostic</property>
</child>
</widget>
<widget class="Gtk.Bin" id="MonoDevelop.Ide.Gui.OptionPanels.IDEStyleOptionsPanelWidget" design-size="315 285">
+ <property name="GeneratePublic">False</property>
<property name="MemberName" />
<child>
<widget class="Gtk.VBox" id="vbox13">
@@ -5886,6 +5887,7 @@ All solutions</property>
<widget class="Gtk.Dialog" id="MonoDevelop.Ide.Gui.Dialogs.SelectFileFormatDialog" design-size="638 246">
<property name="MemberName" />
<property name="Visible">False</property>
+ <property name="GeneratePublic">False</property>
<property name="Title" translatable="yes">Select File Format</property>
<property name="WindowPosition">CenterOnParent</property>
<property name="Buttons">2</property>
@@ -8371,6 +8373,7 @@ All solutions</property>
<widget class="Gtk.Bin" id="MonoDevelop.Ide.Projects.OptionPanels.BaseDirectoryPanelWidget" design-size="463 44">
<property name="MemberName" />
<property name="Visible">False</property>
+ <property name="GeneratePublic">False</property>
<child>
<widget class="Gtk.VBox" id="vbox2">
<property name="MemberName" />
@@ -11324,6 +11327,7 @@ Visual Studio generates a default ID for embedded resources, instead of simply u
<widget class="Gtk.Bin" id="MonoDevelop.Ide.Projects.OptionPanels.PortableRuntimeOptionsPanelWidget" design-size="300 300">
<property name="MemberName" />
<property name="Visible">False</property>
+ <property name="GeneratePublic">False</property>
<child>
<widget class="Gtk.VBox" id="vbox1">
<property name="MemberName" />
diff --git a/main/src/tools/mdmonitor/InstrumenationChartView.cs b/main/src/tools/mdmonitor/InstrumentationChartView.cs
index 0aab4edea5..f5c2b4485b 100644
--- a/main/src/tools/mdmonitor/InstrumenationChartView.cs
+++ b/main/src/tools/mdmonitor/InstrumentationChartView.cs
@@ -1,21 +1,21 @@
-//
+//
// InstrumenationChartView.cs
-//
+//
// Author:
// Lluis Sanchez Gual <lluis@novell.com>
-//
+//
// Copyright (c) 2010 Novell, Inc (http://www.novell.com)
-//
+//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
-//
+//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
-//
+//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
@@ -35,46 +35,46 @@ using System.Globalization;
namespace Mono.Instrumentation.Monitor
{
[System.ComponentModel.ToolboxItem(true)]
- internal partial class InstrumenationChartView : Gtk.Bin
+ internal partial class InstrumentationChartView : Gtk.Bin
{
InstrumentationViewerDialog parent;
ListStore seriesStore;
ChartView view = new ChartView ();
ChartView originalView;
-
+
ListStore listViewStore;
TreeView listView;
ScrolledWindow listViewScrolled;
-
+
BasicChart countChart;
BasicChart timeChart;
DateTime startTime;
DateTime endTime;
-
+
DateTimeAxis countAxisX;
IntegerAxis countAxisY;
DateTimeAxis timeAxisX;
IntegerAxis timeAxisY;
-
+
TimeSpan visibleTime = TimeSpan.FromMinutes (5);
-
+
List<Serie> currentSeries = new List<Serie> ();
-
- public InstrumenationChartView (InstrumentationViewerDialog parent)
+
+ public InstrumentationChartView (InstrumentationViewerDialog parent)
{
Build ();
-
+
this.parent = parent;
-
+
// The list for the List Mode
-
+
listViewStore = new ListStore (typeof(ListViewValueInfo), typeof(Gdk.Pixbuf), typeof (string), typeof(string), typeof(string), typeof (string), typeof (string));
listView = new TreeView ();
listView.Model = listViewStore;
-
+
CellRendererText crx = new CellRendererText ();
listView.AppendColumn ("Timestamp", crx, "text", 3);
-
+
TreeViewColumn col = new TreeViewColumn ();
col.Title = "Counter";
CellRendererPixbuf crp = new CellRendererPixbuf ();
@@ -83,13 +83,13 @@ namespace Mono.Instrumentation.Monitor
col.PackStart (crx, true);
col.AddAttribute (crx, "text", 2);
listView.AppendColumn (col);
-
+
listView.AppendColumn ("Count", crx, "text", 4);
listView.AppendColumn ("Total Count", crx, "text", 5);
listView.AppendColumn ("Time", crx, "text", 6);
-
+
listView.RowActivated += HandleListViewRowActivated;
-
+
listViewScrolled = new ScrolledWindow ();
listViewScrolled.Add (listView);
listViewScrolled.ShadowType = ShadowType.In;
@@ -97,33 +97,33 @@ namespace Mono.Instrumentation.Monitor
listViewScrolled.VscrollbarPolicy = PolicyType.Automatic;
listViewScrolled.ShowAll ();
boxCharts.PackStart (listViewScrolled, true, true, 0);
-
+
// The series list
-
+
seriesStore = new ListStore (typeof(bool), typeof(Gdk.Pixbuf), typeof (string), typeof(ChartSerieInfo), typeof(String), typeof(String), typeof (String));
listSeries.Model = seriesStore;
-
+
col = new TreeViewColumn ();
col.Title = "Counter";
CellRendererToggle crt = new CellRendererToggle ();
col.PackStart (crt, false);
col.AddAttribute (crt, "active", 0);
-
+
crp = new CellRendererPixbuf ();
col.PackStart (crp, false);
col.AddAttribute (crp, "pixbuf", 1);
-
+
crx = new CellRendererText ();
col.PackStart (crx, true);
col.AddAttribute (crx, "text", 2);
listSeries.AppendColumn (col);
-
+
listSeries.AppendColumn ("Last", crx, "text", 4);
listSeries.AppendColumn ("Sel", crx, "text", 5);
listSeries.AppendColumn ("Diff", crx, "text", 6);
-
+
crt.Toggled += SerieToggled;
-
+
countChart = new BasicChart ();
countAxisY = new IntegerAxis (true);
countAxisX = new DateTimeAxis (true);
@@ -137,7 +137,7 @@ namespace Mono.Instrumentation.Monitor
countChart.SelectionStart.LabelAxis = countAxisX;
countChart.SelectionEnd.LabelAxis = countAxisX;
countChart.SelectionChanged += CountChartSelectionChanged;
-
+
timeChart = new BasicChart ();
timeAxisY = new IntegerAxis (true);
timeAxisX = new DateTimeAxis (true);
@@ -150,11 +150,11 @@ namespace Mono.Instrumentation.Monitor
// timeChart.SetAutoScale (AxisDimension.Y, true, true);
timeChart.SelectionStart.LabelAxis = timeAxisX;
timeChart.SelectionEnd.LabelAxis = timeAxisX;
-
+
frameCharts.PackStart (countChart, true, true, 0);
frameCharts.PackStart (timeChart, true, true, 0);
frameCharts.ShowAll ();
-
+
if (App.FromFile) {
if (visibleTime > App.Service.EndTime - App.Service.StartTime)
visibleTime = App.Service.EndTime - App.Service.StartTime;
@@ -165,31 +165,31 @@ namespace Mono.Instrumentation.Monitor
endTime = DateTime.Now;
startTime = endTime - visibleTime;
}
-
+
DateTime st = App.Service.StartTime;
if (st > startTime) st = startTime;
-
+
chartScroller.Adjustment.Lower = st.Ticks;
-
+
UpdateCharts ();
chartScroller.Value = chartScroller.Adjustment.Upper;
-
+
if (!App.FromFile)
StartAutoscroll ();
-
+
toggleTimeView.Active = true;
}
-
+
public void ShowAllTimers ()
{
hboxChartBar.Visible = hboxSeriesBar.Visible = false;
-
+
view = new ChartView ();
foreach (Counter c in App.Service.GetCounters ()) {
if (c is TimerCounter)
view.Add (c);
}
-
+
FillSelectedSeries ();
toggleListView.Active = true;
}
@@ -205,12 +205,12 @@ namespace Mono.Instrumentation.Monitor
win.Show ();
}
}
-
+
void CountChartSelectionChanged (object sender, EventArgs e)
{
UpdateListValues ();
}
-
+
void FillSelectedSeries ()
{
seriesStore.Clear ();
@@ -233,34 +233,35 @@ namespace Mono.Instrumentation.Monitor
}
}
}
-
+
void UpdateButtonStatus ()
{
parent.EnableSave (view.Modified);
}
-
+
void UpdateCharts ()
{
listViewScrolled.Visible = !toggleTimeView.Active;
frameCharts.Visible = toggleTimeView.Active;
-
+
if (frameCharts.Visible) {
- timeChart.Visible = false;
- countChart.Visible = true;
-
+ var timeWidget = timeChart.GetNativeWidget<Widget> ();
+ timeWidget.Visible = false;
+ var countWidget = countChart.GetNativeWidget<Widget> ();
+ countWidget.Visible = true;
foreach (Serie s in currentSeries) {
countChart.RemoveSerie (s);
timeChart.RemoveSerie (s);
}
-
+
UpdateCharView ();
-
+
foreach (ChartSerieInfo si in view.Series) {
si.UpdateSerie ();
countChart.AddSerie (si.Serie);
currentSeries.Add (si.Serie);
}
-
+
DateTime t = DateTime.Now;
chartScroller.Adjustment.Upper = t.Ticks;
UpdatePageSize ();
@@ -269,28 +270,28 @@ namespace Mono.Instrumentation.Monitor
FillValuesList ();
}
}
-
+
void FillValuesList ()
{
listViewStore.Clear ();
List<ListViewValueInfo> values = new List<ListViewValueInfo> ();
-
+
foreach (var serie in view.Series.Where (s => s.Visible)) {
foreach (CounterValue val in serie.Counter.GetValues ())
values.Add (new ListViewValueInfo () { Serie=serie, Value=val });
}
-
+
values.Sort (delegate (ListViewValueInfo v1, ListViewValueInfo v2) {
return v1.Value.TimeStamp.CompareTo (v2.Value.TimeStamp);
});
-
+
foreach (ListViewValueInfo vinfo in values) {
CounterValue val = vinfo.Value;
string time = val.TimeStamp.ToLongTimeString ();
listViewStore.AppendValues (vinfo, vinfo.Serie.ColorIcon, vinfo.Serie.Counter.Name, time, val.Value.ToString (), val.TotalCount.ToString (), val.HasTimerTraces ? val.Duration.TotalMilliseconds.ToString () : "");
}
}
-
+
void UpdateCharView ()
{
countChart.StartX = startTime.Ticks;
@@ -300,14 +301,14 @@ namespace Mono.Instrumentation.Monitor
countChart.OriginX = countChart.StartX;
timeChart.OriginX = timeChart.StartX;
}
-
+
uint scrollFunc;
-
+
void StartAutoscroll ()
{
scrollFunc = GLib.Timeout.Add (1000, ScrollCharts);
}
-
+
void StopAutoscroll ()
{
if (scrollFunc != 0) {
@@ -315,13 +316,13 @@ namespace Mono.Instrumentation.Monitor
scrollFunc = 0;
}
}
-
+
bool IsShowingLatest {
get {
return (chartScroller.Value == chartScroller.Adjustment.Upper - chartScroller.Adjustment.PageSize);
}
}
-
+
bool ScrollCharts ()
{
double ticks = DateTime.Now.Ticks;
@@ -330,7 +331,7 @@ namespace Mono.Instrumentation.Monitor
chartScroller.Value = chartScroller.Adjustment.Upper - chartScroller.Adjustment.PageSize;
} else
chartScroller.Adjustment.Upper = ticks;
-
+
// If any of the counters has been disposed, update it
foreach (ChartSerieInfo info in view.Series) {
if (info.UpdateCounter ()) {
@@ -342,7 +343,7 @@ namespace Mono.Instrumentation.Monitor
view.UpdateSeries ();
return true;
}
-
+
void UpdateListValues ()
{
TreeIter it;
@@ -353,21 +354,21 @@ namespace Mono.Instrumentation.Monitor
continue;
CounterValue val = ci.Counter.LastValue;
seriesStore.SetValue (it, 4, val.Value.ToString ());
-
+
if (countChart.ActiveCursor != null) {
val = ci.Counter.GetValueAt (new DateTime ((long)countChart.ActiveCursor.Value));
seriesStore.SetValue (it, 5, val.Value.ToString ());
}
-
+
val = ci.Counter.GetValueAt (new DateTime ((long)countChart.SelectionStart.Value));
CounterValue val2 = ci.Counter.GetValueAt (new DateTime ((long)countChart.SelectionEnd.Value));
-
+
seriesStore.SetValue (it, 6, (val2.Value - val.Value).ToString ());
}
while (seriesStore.IterNext (ref it));
}
}
-
+
protected override void OnDestroyed ()
{
StopAutoscroll ();
@@ -391,7 +392,7 @@ namespace Mono.Instrumentation.Monitor
endTime = startTime + visibleTime;
UpdateCharView ();
}
-
+
void UpdatePageSize ()
{
chartScroller.Adjustment.PageSize = visibleTime.Ticks;
@@ -448,7 +449,7 @@ namespace Mono.Instrumentation.Monitor
{
originalView = v;
view = new ChartView ();
-
+
if (v.EditedView != null)
view = v.EditedView;
else {
@@ -461,7 +462,7 @@ namespace Mono.Instrumentation.Monitor
}
bool uppdatingToggles;
-
+
protected virtual void OnToggleListViewToggled (object sender, System.EventArgs e)
{
if (uppdatingToggles)
@@ -474,8 +475,8 @@ namespace Mono.Instrumentation.Monitor
uppdatingToggles = false;
UpdateCharts ();
}
-
-
+
+
protected virtual void OnToggleTimeViewToggled (object sender, System.EventArgs e)
{
if (uppdatingToggles)
@@ -488,7 +489,7 @@ namespace Mono.Instrumentation.Monitor
uppdatingToggles = false;
UpdateCharts ();
}
-
+
public void Save ()
{
originalView.CopyFrom (view);
@@ -522,7 +523,7 @@ namespace Mono.Instrumentation.Monitor
}
FillSelectedSeries ();
}
-
+
protected virtual void OnButtonAddCounterClicked (object sender, System.EventArgs e)
{
CounterSelectorDialog dlg = new CounterSelectorDialog ();
@@ -536,12 +537,10 @@ namespace Mono.Instrumentation.Monitor
dlg.Destroy ();
}
}
-
+
class ListViewValueInfo
{
public CounterValue Value;
public ChartSerieInfo Serie;
}
}
-
-
diff --git a/main/src/tools/mdmonitor/InstrumentationViewerDialog.cs b/main/src/tools/mdmonitor/InstrumentationViewerDialog.cs
index f1e16c50e5..ecf5101a59 100644
--- a/main/src/tools/mdmonitor/InstrumentationViewerDialog.cs
+++ b/main/src/tools/mdmonitor/InstrumentationViewerDialog.cs
@@ -47,8 +47,8 @@ namespace Mono.Instrumentation.Monitor
// TreeIter iterStart;
TreeIter iterTimers;
TreeIter iterTimerStats;
- Dictionary<ChartView,InstrumenationChartView> chartWidgets = new Dictionary<ChartView, InstrumenationChartView> ();
- InstrumenationChartView timersWidget;
+ Dictionary<ChartView,InstrumentationChartView> chartWidgets = new Dictionary<ChartView, InstrumentationChartView> ();
+ InstrumentationChartView timersWidget;
public InstrumentationViewerDialog (): base ("Instrumentation Monitor")
{
@@ -194,7 +194,7 @@ namespace Mono.Instrumentation.Monitor
if (store.GetPath (it).Equals (store.GetPath (iterTimers))) {
if (timersWidget == null) {
- timersWidget = new InstrumenationChartView (this);
+ timersWidget = new InstrumentationChartView (this);
timersWidget.ShowAllTimers ();
}
SetView (timersWidget, "Timers", false);
@@ -208,9 +208,9 @@ namespace Mono.Instrumentation.Monitor
else {
ChartView v = (ChartView) store.GetValue (it, 1);
if (v != null) {
- InstrumenationChartView cv;
+ InstrumentationChartView cv;
if (!chartWidgets.TryGetValue (v, out cv)) {
- cv = new InstrumenationChartView (this);
+ cv = new InstrumentationChartView (this);
chartWidgets [v] = cv;
cv.SetView (v);
}
@@ -258,17 +258,17 @@ namespace Mono.Instrumentation.Monitor
protected virtual void OnButtonSaveClicked (object sender, System.EventArgs e)
{
- ((InstrumenationChartView)viewBox.Child).Save ();
+ ((InstrumentationChartView)viewBox.Child).Save ();
}
protected virtual void OnButtonSaveAsClicked (object sender, System.EventArgs e)
{
- ((InstrumenationChartView)viewBox.Child).SaveAs ();
+ ((InstrumentationChartView)viewBox.Child).SaveAs ();
}
protected virtual void OnButtonDeleteClicked (object sender, System.EventArgs e)
{
- ((InstrumenationChartView)viewBox.Child).Delete ();
+ ((InstrumentationChartView)viewBox.Child).Delete ();
}
protected virtual void OnFlushMemoryActionActivated (object sender, System.EventArgs e)
diff --git a/main/src/tools/mdmonitor/gtk-gui/Mono.Instrumentation.Monitor.InstrumenationChartView.cs b/main/src/tools/mdmonitor/gtk-gui/Mono.Instrumentation.Monitor.InstrumentationChartView.cs
index 05dd0d25aa..288c1812fa 100644
--- a/main/src/tools/mdmonitor/gtk-gui/Mono.Instrumentation.Monitor.InstrumenationChartView.cs
+++ b/main/src/tools/mdmonitor/gtk-gui/Mono.Instrumentation.Monitor.InstrumentationChartView.cs
@@ -2,7 +2,7 @@
// This file has been generated by the GUI designer. Do not modify.
namespace Mono.Instrumentation.Monitor
{
- internal partial class InstrumenationChartView
+ internal partial class InstrumentationChartView
{
private global::Gtk.VBox vbox3;
private global::Gtk.HPaned hpaned2;
diff --git a/main/src/tools/mdmonitor/gtk-gui/gui.stetic b/main/src/tools/mdmonitor/gtk-gui/gui.stetic
index 3016971d49..49446c7ee4 100644
--- a/main/src/tools/mdmonitor/gtk-gui/gui.stetic
+++ b/main/src/tools/mdmonitor/gtk-gui/gui.stetic
@@ -9,7 +9,7 @@
<widget-library name="../../../../build/bin/MonoDevelop.Ide.dll" />
<widget-library name="../../../../build/bin/mdmonitor.exe" internal="true" />
</import>
- <widget class="Gtk.Bin" id="Mono.Instrumentation.Monitor.InstrumenationChartView" design-size="632 482">
+ <widget class="Gtk.Bin" id="Mono.Instrumentation.Monitor.InstrumentationChartView" design-size="632 482">
<property name="MemberName" />
<property name="Visible">False</property>
<property name="GeneratePublic">False</property>
@@ -1000,4 +1000,241 @@
</widget>
</child>
</widget>
+ <widget class="Gtk.Bin" id="Mono.Instrumentation.Monitor.InstrumentationChartView" design-size="632 482">
+ <property name="MemberName" />
+ <property name="Visible">False</property>
+ <property name="GeneratePublic">False</property>
+ <child>
+ <widget class="Gtk.VBox" id="vbox3">
+ <property name="MemberName" />
+ <property name="Spacing">6</property>
+ <child>
+ <widget class="Gtk.HPaned" id="hpaned2">
+ <property name="MemberName" />
+ <property name="CanFocus">True</property>
+ <property name="Position">471</property>
+ <child>
+ <widget class="Gtk.HBox" id="hbox4">
+ <property name="MemberName" />
+ <property name="Spacing">6</property>
+ <child>
+ <widget class="Gtk.VBox" id="boxCharts">
+ <property name="MemberName" />
+ <property name="Spacing">6</property>
+ <child>
+ <widget class="Gtk.HBox" id="hboxChartBar">
+ <property name="MemberName" />
+ <property name="Spacing">6</property>
+ <child>
+ <widget class="Gtk.ToggleButton" id="toggleTimeView">
+ <property name="MemberName" />
+ <property name="CanFocus">True</property>
+ <property name="Type">TextOnly</property>
+ <property name="Label" translatable="yes">Time View</property>
+ <property name="UseUnderline">True</property>
+ <property name="Relief">None</property>
+ <signal name="Toggled" handler="OnToggleTimeViewToggled" />
+ </widget>
+ <packing>
+ <property name="Position">0</property>
+ <property name="AutoSize">True</property>
+ <property name="Expand">False</property>
+ <property name="Fill">False</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="Gtk.ToggleButton" id="toggleListView">
+ <property name="MemberName" />
+ <property name="CanFocus">True</property>
+ <property name="Type">TextOnly</property>
+ <property name="Label" translatable="yes">List View</property>
+ <property name="UseUnderline">True</property>
+ <property name="Relief">None</property>
+ <signal name="Toggled" handler="OnToggleListViewToggled" />
+ </widget>
+ <packing>
+ <property name="Position">1</property>
+ <property name="AutoSize">True</property>
+ <property name="Expand">False</property>
+ <property name="Fill">False</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="Gtk.Button" id="buttonZoomOut">
+ <property name="MemberName" />
+ <property name="CanFocus">True</property>
+ <property name="Type">TextAndIcon</property>
+ <property name="Icon">stock:gtk-zoom-out Menu</property>
+ <property name="Label" translatable="yes" />
+ <property name="UseUnderline">True</property>
+ <property name="Relief">None</property>
+ <signal name="Clicked" handler="OnButtonZoomOutClicked" />
+ </widget>
+ <packing>
+ <property name="PackType">End</property>
+ <property name="Position">2</property>
+ <property name="AutoSize">True</property>
+ <property name="Expand">False</property>
+ <property name="Fill">False</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="Gtk.Button" id="buttonZoomIn">
+ <property name="MemberName" />
+ <property name="CanFocus">True</property>
+ <property name="Type">TextAndIcon</property>
+ <property name="Icon">stock:gtk-zoom-in Menu</property>
+ <property name="Label" translatable="yes" />
+ <property name="UseUnderline">True</property>
+ <property name="Relief">None</property>
+ <signal name="Clicked" handler="OnButtonZoomInClicked" />
+ </widget>
+ <packing>
+ <property name="PackType">End</property>
+ <property name="Position">3</property>
+ <property name="AutoSize">True</property>
+ <property name="Expand">False</property>
+ <property name="Fill">False</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="Position">0</property>
+ <property name="AutoSize">True</property>
+ <property name="Expand">False</property>
+ <property name="Fill">False</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="Gtk.VBox" id="frameCharts">
+ <property name="MemberName" />
+ <property name="Spacing">6</property>
+ <child>
+ <placeholder />
+ </child>
+ <child>
+ <placeholder />
+ </child>
+ <child>
+ <widget class="Gtk.HScrollbar" id="chartScroller">
+ <property name="MemberName" />
+ <property name="Upper">100</property>
+ <property name="PageIncrement">10</property>
+ <property name="PageSize">10</property>
+ <property name="StepIncrement">1</property>
+ <signal name="ValueChanged" handler="OnChartScrollerValueChanged" />
+ </widget>
+ <packing>
+ <property name="PackType">End</property>
+ <property name="Position">2</property>
+ <property name="AutoSize">True</property>
+ <property name="Expand">False</property>
+ <property name="Fill">False</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="Position">1</property>
+ <property name="AutoSize">True</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="Position">0</property>
+ <property name="AutoSize">False</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="Resize">False</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="Gtk.VBox" id="vbox5">
+ <property name="MemberName" />
+ <property name="Spacing">6</property>
+ <child>
+ <widget class="Gtk.HBox" id="hboxSeriesBar">
+ <property name="MemberName" />
+ <property name="Spacing">6</property>
+ <child>
+ <widget class="Gtk.Button" id="buttonRemoveCounter">
+ <property name="MemberName" />
+ <property name="CanFocus">True</property>
+ <property name="UseStock">True</property>
+ <property name="Type">StockItem</property>
+ <property name="StockId">gtk-remove</property>
+ <property name="Relief">None</property>
+ <signal name="Clicked" handler="OnButtonRemoveCounterClicked" />
+ <property name="label">gtk-remove</property>
+ </widget>
+ <packing>
+ <property name="PackType">End</property>
+ <property name="Position">0</property>
+ <property name="AutoSize">True</property>
+ <property name="Expand">False</property>
+ <property name="Fill">False</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="Gtk.Button" id="buttonAddCounter">
+ <property name="MemberName" />
+ <property name="CanFocus">True</property>
+ <property name="UseStock">True</property>
+ <property name="Type">StockItem</property>
+ <property name="StockId">gtk-add</property>
+ <property name="Relief">None</property>
+ <signal name="Clicked" handler="OnButtonAddCounterClicked" />
+ <property name="label">gtk-add</property>
+ </widget>
+ <packing>
+ <property name="PackType">End</property>
+ <property name="Position">1</property>
+ <property name="AutoSize">True</property>
+ <property name="Expand">False</property>
+ <property name="Fill">False</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="Position">0</property>
+ <property name="AutoSize">True</property>
+ <property name="Expand">False</property>
+ <property name="Fill">False</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="Gtk.ScrolledWindow" id="GtkScrolledWindow1">
+ <property name="MemberName" />
+ <property name="ShadowType">In</property>
+ <child>
+ <widget class="Gtk.TreeView" id="listSeries">
+ <property name="MemberName" />
+ <property name="WidthRequest">100</property>
+ <property name="CanFocus">True</property>
+ <property name="ShowScrollbars">True</property>
+ <property name="HeadersVisible">False</property>
+ </widget>
+ </child>
+ </widget>
+ <packing>
+ <property name="Position">1</property>
+ <property name="AutoSize">True</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="Resize">False</property>
+ <property name="Shrink">False</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="Position">0</property>
+ <property name="AutoSize">True</property>
+ </packing>
+ </child>
+ </widget>
+ </child>
+ </widget>
</stetic-interface> \ No newline at end of file
diff --git a/main/src/tools/mdmonitor/mdmonitor.csproj b/main/src/tools/mdmonitor/mdmonitor.csproj
index ca74e1052c..586b5538fd 100644
--- a/main/src/tools/mdmonitor/mdmonitor.csproj
+++ b/main/src/tools/mdmonitor/mdmonitor.csproj
@@ -54,13 +54,11 @@
<Compile Include="Main.cs" />
<Compile Include="AssemblyInfo.cs" />
<Compile Include="CounterSelectorDialog.cs" />
- <Compile Include="InstrumenationChartView.cs" />
<Compile Include="InstrumentationViewerDialog.cs" />
<Compile Include="TimeLineView.cs" />
<Compile Include="TimeLineViewWindow.cs" />
<Compile Include="NewProfile.cs" />
<Compile Include="gtk-gui\Mono.Instrumentation.Monitor.InstrumentationViewerDialog.cs" />
- <Compile Include="gtk-gui\Mono.Instrumentation.Monitor.InstrumenationChartView.cs" />
<Compile Include="gtk-gui\Mono.Instrumentation.Monitor.NewProfile.cs" />
<Compile Include="gtk-gui\Mono.Instrumentation.Monitor.CounterSelectorDialog.cs" />
<Compile Include="gtk-gui\Mono.Instrumentation.Monitor.TimeLineViewWindow.cs" />
@@ -81,6 +79,8 @@
<Compile Include="..\..\addins\MacPlatform\MacInterop\CoreFoundation.cs">
<Link>MacIntegration\CoreFoundation.cs</Link>
</Compile>
+ <Compile Include="InstrumentationChartView.cs" />
+ <Compile Include="gtk-gui\Mono.Instrumentation.Monitor.InstrumentationChartView.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\core\MonoDevelop.Core\MonoDevelop.Core.csproj">
diff --git a/main/tests/MonoDevelop.CSharpBinding.Tests/Features/CodeCompletion/NR5/CodeCompletionBugTests.cs b/main/tests/MonoDevelop.CSharpBinding.Tests/Features/CodeCompletion/NR5/CodeCompletionBugTests.cs
index ede2db4a0e..57f72a29be 100644
--- a/main/tests/MonoDevelop.CSharpBinding.Tests/Features/CodeCompletion/NR5/CodeCompletionBugTests.cs
+++ b/main/tests/MonoDevelop.CSharpBinding.Tests/Features/CodeCompletion/NR5/CodeCompletionBugTests.cs
@@ -90,7 +90,7 @@ namespace ICSharpCode.NRefactory6.CSharp.CodeCompletion
CompletionData ICompletionDataFactory.CreateFormatItemCompletionData (ICompletionDataKeyHandler keyHandler, string format, string description, object example)
{
- return new CompletionData (format + " - " + description +":" + example);
+ return new CompletionData (format);
}
CompletionData ICompletionDataFactory.CreateXmlDocCompletionData(ICompletionDataKeyHandler keyHandler, string tag, string description, string tagInsertionText)
diff --git a/main/tests/MonoDevelop.CSharpBinding.Tests/Features/CodeCompletion/NR5/CompletionDataList.cs b/main/tests/MonoDevelop.CSharpBinding.Tests/Features/CodeCompletion/NR5/CompletionDataList.cs
index 85124a5c74..8b436c4b98 100644
--- a/main/tests/MonoDevelop.CSharpBinding.Tests/Features/CodeCompletion/NR5/CompletionDataList.cs
+++ b/main/tests/MonoDevelop.CSharpBinding.Tests/Features/CodeCompletion/NR5/CompletionDataList.cs
@@ -35,7 +35,7 @@ namespace ICSharpCode.NRefactory6.CSharp.CodeCompletion
{
public static CompletionData Find (this CompletionResult result, string name, bool includeImportData = false)
{
- return result.FirstOrDefault (d => /*(!(d is CodeCompletionBugTests.TestFactory.ImportCompletionData) || includeImportData) &&*/ d.DisplayText == name);
+ return result.FirstOrDefault (d => /*(!(d is CodeCompletionBugTests.TestFactory.ImportCompletionData) || includeImportData) &&*/ d.CompletionText == name);
}
}
}
diff --git a/main/tests/MonoDevelop.CSharpBinding.Tests/Features/CodeCompletion/NR6/MiscTests.cs b/main/tests/MonoDevelop.CSharpBinding.Tests/Features/CodeCompletion/NR6/MiscTests.cs
index ef253271ff..67b479e03b 100644
--- a/main/tests/MonoDevelop.CSharpBinding.Tests/Features/CodeCompletion/NR6/MiscTests.cs
+++ b/main/tests/MonoDevelop.CSharpBinding.Tests/Features/CodeCompletion/NR6/MiscTests.cs
@@ -108,5 +108,37 @@ public class MyClass
Assert.IsNotNull (provider, "provider was not created.");
Assert.AreEqual (false, provider.AutoSelect);
}
+
+ /// <summary>
+ /// Bug 37573 - [roslyn] Excessive namespace prefix inserted by code completion
+ /// </summary>
+ [Test]
+ public void TestBug37573 ()
+ {
+ var provider = CreateProvider (
+ @"
+using System;
+
+namespace TestProject
+{
+ class TestClass
+ {
+ public enum FooBar { Foo, Bar }
+ }
+
+ class MainClass
+ {
+ void Test ()
+ {
+ TestClass.FooBar fb;
+ $if (fb == $
+ }
+ }
+}
+");
+ Assert.IsNotNull (provider, "provider was not created.");
+ Assert.IsNull (provider.Find ("TestProject.TestClass.FooBar.Bar"));
+ Assert.IsNotNull (provider.Find ("TestClass.FooBar.Bar"));
+ }
}
} \ No newline at end of file
diff --git a/main/tests/MonoDevelop.CSharpBinding.Tests/Features/CodeCompletion/NR6/RegexContextHandlerTests.cs b/main/tests/MonoDevelop.CSharpBinding.Tests/Features/CodeCompletion/NR6/RegexContextHandlerTests.cs
new file mode 100644
index 0000000000..c267906c3e
--- /dev/null
+++ b/main/tests/MonoDevelop.CSharpBinding.Tests/Features/CodeCompletion/NR6/RegexContextHandlerTests.cs
@@ -0,0 +1,147 @@
+//
+// RegexContextHandlerTests.cs
+//
+// Author:
+// Mike Krüger <mkrueger@xamarin.com>
+//
+// Copyright (c) 2016 Xamarin Inc. (http://xamarin.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+
+using System;
+using NUnit.Framework;
+using ICSharpCode.NRefactory6.CSharp.Completion;
+using ICSharpCode.NRefactory6.CSharp.CodeCompletion.Roslyn;
+using System.Text.RegularExpressions;
+
+namespace ICSharpCode.NRefactory6.CSharp.CodeCompletion.NR6
+{
+ [TestFixture]
+ public class RegexContextHandlerTests : CompletionTestBase
+ {
+ [Test]
+ public void Constructor_SimpleStringTest ()
+ {
+ var text = @"using System;
+using System.Text.RegularExpressions;
+
+namespace ConsoleApplication1
+{
+ class Class1
+ {
+ void Test ()
+ {
+ var reg = new Regex(""test\$$me"");
+ }
+
+ }
+}
+";
+ VerifyItemExists (text, "\\W", usePreviousCharAsTrigger: true);
+ }
+
+ [Test]
+ public void Constructor_VerbatimStringTest ()
+ {
+ var text = @"using System;
+using System.Text.RegularExpressions;
+
+namespace ConsoleApplication1
+{
+ class Class1
+ {
+ void Test ()
+ {
+ var reg = new Regex(@""test\$$me"");
+ }
+
+ }
+}
+";
+ VerifyItemExists (text, "W", usePreviousCharAsTrigger: true);
+ }
+
+ [Test]
+ public void RegexMatch_SimpleStringTest ()
+ {
+ var text = @"using System;
+using System.Text.RegularExpressions;
+
+namespace ConsoleApplication1
+{
+ class Class1
+ {
+ void Test ()
+ {
+ var match = Regex.Match(""input"", ""test\$$me"");
+ }
+
+ }
+}
+";
+ VerifyItemExists (text, "\\W", usePreviousCharAsTrigger: true);
+ }
+
+ [Test]
+ public void TestGroupCompletion_DirectMatch ()
+ {
+ var text = @"using System;
+using System.Text.RegularExpressions;
+
+namespace ConsoleApplication1
+{
+ class Class1
+ {
+ void Test ()
+ {
+ var match = Regex.Match(""input"", ""(?<testgroup>test)me"");
+ match.$$
+ }
+
+ }
+}
+";
+ VerifyItemExists (text, "Groups[\"testgroup\"]", usePreviousCharAsTrigger: true);
+ }
+
+ [Test]
+ public void TestGroupCompletion_InDirectMatch ()
+ {
+ var text = @"using System;
+using System.Text.RegularExpressions;
+
+namespace ConsoleApplication1
+{
+ class Class1
+ {
+ void Test ()
+ {
+ var regex = new Regex (""(?<testgroup>test)me"");
+ var match = regex.Match(""input"");
+ match.$$
+ }
+
+ }
+}
+";
+ VerifyItemExists (text, "Groups[\"testgroup\"]", usePreviousCharAsTrigger: true);
+ }
+ }
+}
+
diff --git a/main/tests/MonoDevelop.CSharpBinding.Tests/Features/CodeCompletion/PortedRoslynTests/CompletionTestBase.cs b/main/tests/MonoDevelop.CSharpBinding.Tests/Features/CodeCompletion/PortedRoslynTests/CompletionTestBase.cs
index 256a93dcb0..27bcb39f5b 100644
--- a/main/tests/MonoDevelop.CSharpBinding.Tests/Features/CodeCompletion/PortedRoslynTests/CompletionTestBase.cs
+++ b/main/tests/MonoDevelop.CSharpBinding.Tests/Features/CodeCompletion/PortedRoslynTests/CompletionTestBase.cs
@@ -35,6 +35,12 @@ namespace ICSharpCode.NRefactory6.CSharp.CodeCompletion.Roslyn
{
public class CompletionTestBase
{
+ [TestFixtureSetUp]
+ public void Setup ()
+ {
+ Xwt.Application.Initialize ();
+ Gtk.Application.Init ();
+ }
internal virtual CompletionContextHandler CreateContextHandler()
{
diff --git a/main/tests/MonoDevelop.CSharpBinding.Tests/Features/InspectionActionTestBase.cs b/main/tests/MonoDevelop.CSharpBinding.Tests/Features/InspectionActionTestBase.cs
index e40c8fd14e..30930d3a53 100644
--- a/main/tests/MonoDevelop.CSharpBinding.Tests/Features/InspectionActionTestBase.cs
+++ b/main/tests/MonoDevelop.CSharpBinding.Tests/Features/InspectionActionTestBase.cs
@@ -45,7 +45,7 @@ namespace ICSharpCode.NRefactory6
public class InspectionActionTestBase
{
static MetadataReference mscorlib;
-// static MetadataReference systemAssembly;
+ static MetadataReference systemAssembly;
// static MetadataReference systemXmlLinq;
static MetadataReference systemCore;
@@ -57,12 +57,12 @@ namespace ICSharpCode.NRefactory6
{
try {
mscorlib = MetadataReference.CreateFromFile (typeof(Console).Assembly.Location);
- //systemAssembly = MetadataReference.CreateFromFile (typeof(System.ComponentModel.BrowsableAttribute).Assembly.Location);
+ systemAssembly = MetadataReference.CreateFromFile (typeof(System.Text.RegularExpressions.Regex).Assembly.Location);
//systemXmlLinq = MetadataReference.CreateFromFile (typeof(System.Xml.Linq.XElement).Assembly.Location);
systemCore = MetadataReference.CreateFromFile (typeof(Enumerable).Assembly.Location);
DefaultMetadataReferences = new [] {
mscorlib,
- //systemAssembly,
+ systemAssembly,
systemCore,
//systemXmlLinq
};
diff --git a/main/tests/MonoDevelop.CSharpBinding.Tests/MonoDevelop.CSharpBinding.Tests.csproj b/main/tests/MonoDevelop.CSharpBinding.Tests/MonoDevelop.CSharpBinding.Tests.csproj
index 8abeae4c19..bdf433e62d 100644
--- a/main/tests/MonoDevelop.CSharpBinding.Tests/MonoDevelop.CSharpBinding.Tests.csproj
+++ b/main/tests/MonoDevelop.CSharpBinding.Tests/MonoDevelop.CSharpBinding.Tests.csproj
@@ -29,7 +29,6 @@
<ConsolePause>false</ConsolePause>
</PropertyGroup>
<ItemGroup>
- <Reference Include="System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
<Reference Include="Microsoft.CodeAnalysis.CSharp">
<HintPath>..\..\external\roslyn\Binaries\Release\Microsoft.CodeAnalysis.CSharp.dll</HintPath>
</Reference>
@@ -58,6 +57,10 @@
<HintPath>..\..\external\roslyn\Binaries\Release\Microsoft.CodeAnalysis.dll</HintPath>
</Reference>
<Reference Include="System.Xml" />
+ <Reference Include="gtk-sharp, Version=2.12.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f">
+ <SpecificVersion>False</SpecificVersion>
+ </Reference>
+ <Reference Include="System" />
</ItemGroup>
<ItemGroup>
<Compile Include="Features\CodeCompletion\NR5\BrowsableAttributeTests.cs" />
@@ -115,6 +118,7 @@
<Compile Include="Features\IndentationTests\PreProcessorTests.cs" />
<Compile Include="Features\IndentationTests\StringTests.cs" />
<Compile Include="Features\IndentationTests\TextPasteIndentEngineTests.cs" />
+ <Compile Include="Features\CodeCompletion\NR6\RegexContextHandlerTests.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\src\addins\CSharpBinding\CSharpBinding.csproj">
@@ -129,6 +133,10 @@
<Project>{D12F0F7B-8DE3-43EC-BA49-41052D065A9B}</Project>
<Name>GuiUnit_NET_4_5</Name>
</ProjectReference>
+ <ProjectReference Include="..\..\external\xwt\Xwt\Xwt.csproj">
+ <Project>{92494904-35FA-4DC9-BDE9-3A3E87AC49D3}</Project>
+ <Name>Xwt</Name>
+ </ProjectReference>
</ItemGroup>
<ItemGroup>
<Folder Include="Features\IndentEngine\" />
diff --git a/main/tests/UnitTests/MonoDevelop.CSharpBinding/MonodevelopWorkspaceTests.cs b/main/tests/UnitTests/MonoDevelop.CSharpBinding/MonodevelopWorkspaceTests.cs
new file mode 100644
index 0000000000..a7fba2c80d
--- /dev/null
+++ b/main/tests/UnitTests/MonoDevelop.CSharpBinding/MonodevelopWorkspaceTests.cs
@@ -0,0 +1,60 @@
+//
+// MonodevelopWorkspaceTests.cs
+//
+// Author:
+// David Karlaš <david.karlas@xamarin.com>
+//
+// Copyright (c) 2016 Xamarin, Inc (http://www.xamarin.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+using System;
+using System.Threading.Tasks;
+using MonoDevelop.Projects;
+using NUnit.Framework;
+using UnitTests;
+using MonoDevelop.Ide.TypeSystem;
+using System.Linq;
+using Microsoft.CodeAnalysis;
+
+namespace MonoDevelop.CSharpBinding
+{
+ [TestFixture]
+ public class MonodevelopWorkspaceTests : TestBase
+ {
+ [Test]
+ public async Task TestLoadingSolution()
+ {
+ string solFile = Util.GetSampleProject ("console-project", "ConsoleProject.sln");
+ var sol = (Projects.Solution) await Services.ProjectService.ReadWorkspaceItem (Util.GetMonitor (), solFile);
+ await TypeSystemServiceTestExtensions.LoadSolution (sol);
+ var compilation = await TypeSystemService.GetCompilationAsync (sol.GetAllProjects ().First());
+ var programType = compilation.GetTypeByMetadataName ("ConsoleProject.Program");
+ Assert.IsNotNull (programType);
+ }
+
+ [Test]
+ public async Task TestLoadingSolutionWithUnsupportedType()
+ {
+ string solFile = Util.GetSampleProject ("unsupported-project-roundtrip", "TestApp.WinPhone.sln");
+ var sol = (Projects.Solution) await Services.ProjectService.ReadWorkspaceItem (Util.GetMonitor (), solFile);
+ await TypeSystemServiceTestExtensions.LoadSolution (sol);
+ }
+ }
+}
+
diff --git a/main/tests/UnitTests/MonoDevelop.CSharpBinding/TestViewContent.cs b/main/tests/UnitTests/MonoDevelop.CSharpBinding/TestViewContent.cs
index ab82503708..3295f3e0e5 100644
--- a/main/tests/UnitTests/MonoDevelop.CSharpBinding/TestViewContent.cs
+++ b/main/tests/UnitTests/MonoDevelop.CSharpBinding/TestViewContent.cs
@@ -1,4 +1,4 @@
-//
+//
// TestViewContent.cs
//
// Author:
@@ -29,19 +29,20 @@
using System;
using System.Linq;
using System.Collections.Generic;
+using MonoDevelop.Components;
using MonoDevelop.Core;
using MonoDevelop.Ide.Gui;
-using MonoDevelop.Ide.Gui.Content;
using MonoDevelop.Ide.Editor;
using MonoDevelop.Core.Text;
+using System.Threading.Tasks;
namespace MonoDevelop.CSharpBinding.Tests
{
- public class TestViewContent : AbstractViewContent
+ public class TestViewContent : ViewContent
{
TextEditor data;
- public override Gtk.Widget Control {
+ public override Control Control {
get {
return null;
}
@@ -65,19 +66,11 @@ namespace MonoDevelop.CSharpBinding.Tests
Contents.Add (data);
Name = "";
}
-
- public override void Load(FileOpenInformation fileOpenInformation)
- {
- }
- public override string ContentName {
- get {
- return base.ContentName;
- }
- set {
- base.ContentName = value;
- Name = value;
- }
+ protected override void OnContentNameChanged ()
+ {
+ base.OnContentNameChanged ();
+ Name = ContentName;
}
FilePath name;
@@ -212,14 +205,9 @@ namespace MonoDevelop.CSharpBinding.Tests
public List<object> Contents = new List<object> ();
- public override object GetContent (Type type)
- {
- return Contents.FirstOrDefault (type.IsInstanceOfType) ?? base.GetContent (type);
- }
-
- public override IEnumerable<T> GetContents<T> ()
- {
- return Contents.OfType<T> ();
+ protected override IEnumerable<object> OnGetContents (Type type)
+ {
+ return base.OnGetContents(type).Concat (Contents.Where (c => type.IsInstanceOfType (c)));
}
public IDisposable OpenUndoGroup ()
diff --git a/main/tests/UnitTests/MonoDevelop.CSharpBinding/TestWorkbenchWindow.cs b/main/tests/UnitTests/MonoDevelop.CSharpBinding/TestWorkbenchWindow.cs
index 720120e7f4..4758dfdfc5 100644
--- a/main/tests/UnitTests/MonoDevelop.CSharpBinding/TestWorkbenchWindow.cs
+++ b/main/tests/UnitTests/MonoDevelop.CSharpBinding/TestWorkbenchWindow.cs
@@ -62,8 +62,8 @@ namespace MonoDevelop.CSharpBinding
set {}
}
- IViewContent viewContent;
- public IViewContent ViewContent {
+ ViewContent viewContent;
+ public ViewContent ViewContent {
get { return viewContent; }
set { viewContent = value; }
}
@@ -72,9 +72,9 @@ namespace MonoDevelop.CSharpBinding
get { return AddinManager.AddinEngine; }
}
- public IEnumerable<IAttachableViewContent> SubViewContents { get { return new IAttachableViewContent[0]; } }
+ public IEnumerable<BaseViewContent> SubViewContents { get { return new BaseViewContent[0]; } }
- public IBaseViewContent ActiveViewContent {
+ public BaseViewContent ActiveViewContent {
get { return ViewContent;}
set {}
}
@@ -91,7 +91,7 @@ namespace MonoDevelop.CSharpBinding
public void SwitchView (int viewNumber)
{
}
- public void SwitchView (IAttachableViewContent view)
+ public void SwitchView (BaseViewContent view)
{
}
@@ -104,17 +104,17 @@ namespace MonoDevelop.CSharpBinding
return -1;
}
- public void AttachViewContent (IAttachableViewContent subViewContent)
+ public void AttachViewContent (BaseViewContent subViewContent)
{
}
- public void InsertViewContent (int index, IAttachableViewContent subViewContent)
+ public void InsertViewContent (int index, BaseViewContent subViewContent)
{
}
- public DocumentToolbar GetToolbar (IBaseViewContent targetView)
+ public DocumentToolbar GetToolbar (BaseViewContent targetView)
{
throw new NotImplementedException ();
}
@@ -125,7 +125,7 @@ namespace MonoDevelop.CSharpBinding
public event ActiveViewContentEventHandler ActiveViewContentChanged;
public event EventHandler ViewsChanged;
- DocumentToolbar IWorkbenchWindow.GetToolbar (IBaseViewContent targetView)
+ DocumentToolbar IWorkbenchWindow.GetToolbar (BaseViewContent targetView)
{
throw new System.NotImplementedException ();
}
diff --git a/main/tests/UnitTests/MonoDevelop.Ide.Templates/TestableWizardPage.cs b/main/tests/UnitTests/MonoDevelop.Ide.Templates/TestableWizardPage.cs
index ee368d6dbe..76ed0b3155 100644
--- a/main/tests/UnitTests/MonoDevelop.Ide.Templates/TestableWizardPage.cs
+++ b/main/tests/UnitTests/MonoDevelop.Ide.Templates/TestableWizardPage.cs
@@ -32,7 +32,7 @@ namespace MonoDevelop.Ide.Templates
{
protected override object CreateNativeWidget ()
{
- return new Control (new Gtk.EventBox ());
+ return new Gtk.EventBox ();
}
public int PageNumber;
diff --git a/main/tests/UnitTests/MonoDevelop.Projects/MSBuildProjectTests.cs b/main/tests/UnitTests/MonoDevelop.Projects/MSBuildProjectTests.cs
index a881a10cf1..a328581806 100644
--- a/main/tests/UnitTests/MonoDevelop.Projects/MSBuildProjectTests.cs
+++ b/main/tests/UnitTests/MonoDevelop.Projects/MSBuildProjectTests.cs
@@ -28,6 +28,7 @@ using NUnit.Framework;
using UnitTests;
using MonoDevelop.Projects.MSBuild;
using System.Linq;
+using ValueSet = MonoDevelop.Projects.ConditionedPropertyCollection.ValueSet;
namespace MonoDevelop.Projects
{
@@ -272,17 +273,47 @@ namespace MonoDevelop.Projects
p.Load (projectFile);
p.Evaluate ();
- Assert.That (new string [] { "cond1", "cond2", "cond9", "cond10", "cond13"}, Is.EquivalentTo (p.ConditionedProperties.Keys.ToArray ()));
+ Assert.That (new string [] { "cond1", "cond2", "cond9", "cond10", "cond13" }, Is.EquivalentTo (p.ConditionedProperties.GetAllProperties ().ToArray ()));
- Assert.That (new string [] { "val1"}, Is.EquivalentTo (p.ConditionedProperties["cond1"].ToArray ()));
+ Assert.That (new string [] { "val1", "val14_1", "val14_4", "val14_5" }, Is.EquivalentTo (p.ConditionedProperties.GetAllPropertyValues ("cond1").ToArray ()));
- Assert.That (new string [] { "val2_0", "val2_7"}, Is.EquivalentTo (p.ConditionedProperties["cond2"].ToArray ()));
+ Assert.That (new string [] { "val2_0", "val2_7", "val14_2", "val14_3", "val14_6" }, Is.EquivalentTo (p.ConditionedProperties.GetAllPropertyValues ("cond2").ToArray ()));
- Assert.That (new string [] { "val9"}, Is.EquivalentTo (p.ConditionedProperties["cond9"].ToArray ()));
+ Assert.That (new string [] { "val9" }, Is.EquivalentTo (p.ConditionedProperties.GetAllPropertyValues ("cond9").ToArray ()));
- Assert.That (new string [] { "val10_1", "val10_2"}, Is.EquivalentTo (p.ConditionedProperties["cond10"].ToArray ()));
+ Assert.That (new string [] { "val10_1", "val10_2" }, Is.EquivalentTo (p.ConditionedProperties.GetAllPropertyValues ("cond10").ToArray ()));
- Assert.That (new string [] { "val13_4"}, Is.EquivalentTo (p.ConditionedProperties["cond13"].ToArray ()));
+ Assert.That (new string [] { "val13_4" }, Is.EquivalentTo (p.ConditionedProperties.GetAllPropertyValues ("cond13").ToArray ()));
+
+ // Combined values
+
+ Assert.That (new [] {
+ new ValueSet (new [] { "cond1" }, new [] { "val1" })
+ }, Is.EquivalentTo (p.ConditionedProperties.GetCombinedPropertyValues ("cond1").ToArray ()));
+
+ Assert.That (new [] {
+ new ValueSet (new [] { "cond2" }, new [] { "val2_0" }),
+ new ValueSet (new [] { "cond2" }, new [] { "val2_7" }),
+ }, Is.EquivalentTo (p.ConditionedProperties.GetCombinedPropertyValues ("cond2").ToArray ()));
+
+ Assert.That (new [] {
+ new ValueSet (new [] { "cond9" }, new [] { "val9" }),
+ }, Is.EquivalentTo (p.ConditionedProperties.GetCombinedPropertyValues ("cond9").ToArray ()));
+
+ Assert.That (new [] {
+ new ValueSet (new [] { "cond10" }, new [] { "val10_1" }),
+ new ValueSet (new [] { "cond10" }, new [] { "val10_2" }),
+ }, Is.EquivalentTo (p.ConditionedProperties.GetCombinedPropertyValues ("cond10").ToArray ()));
+
+ Assert.That (new [] {
+ new ValueSet (new [] { "cond13" }, new [] { "val13_4" }),
+ }, Is.EquivalentTo (p.ConditionedProperties.GetCombinedPropertyValues ("cond13").ToArray ()));
+
+ Assert.That (new [] {
+ new ValueSet (new [] { "cond1", "cond2" }, new [] { "val14_1", "val14_2" }),
+ new ValueSet (new [] { "cond1", "cond2" }, new [] { "val14_4", "val14_3" }),
+ new ValueSet (new [] { "cond1", "cond2" }, new [] { "val14_5", "val14_6" }),
+ }, Is.EquivalentTo (p.ConditionedProperties.GetCombinedPropertyValues ("cond1", "cond2").ToArray ()));
}
}
}
diff --git a/main/tests/UnitTests/MonoDevelop.Projects/MSBuildTests.cs b/main/tests/UnitTests/MonoDevelop.Projects/MSBuildTests.cs
index 16ef3155f6..60aac3a4a0 100644
--- a/main/tests/UnitTests/MonoDevelop.Projects/MSBuildTests.cs
+++ b/main/tests/UnitTests/MonoDevelop.Projects/MSBuildTests.cs
@@ -79,10 +79,17 @@ namespace MonoDevelop.Projects
// Ensure the project is buildable
var result = await sol.Build (Util.GetMonitor (), "Debug");
Assert.AreEqual (0, result.ErrorCount, "#1");
+ }
+
+ [Test]
+ public async Task BuildConsoleProjectAfterRename ()
+ {
+ Solution sol = TestProjectsChecks.CreateConsoleSolution ("console-project-msbuild");
+ await sol.SaveAsync (Util.GetMonitor ());
// Ensure the project is still buildable with xbuild after a rename
ProjectOptionsDialog.RenameItem (sol.GetAllProjects ().First (), "Test");
- result = await sol.Build (Util.GetMonitor (), "Release");
+ var result = await sol.Build (Util.GetMonitor (), "Release");
Assert.AreEqual (0, result.ErrorCount, "#2");
}
@@ -117,6 +124,7 @@ namespace MonoDevelop.Projects
Solution sol = TestProjectsChecks.CreateConsoleSolution ("console-project-msbuild");
sol.ConvertToFormat (MSBuildFileFormat.VS2010);
Project p = sol.Items [0] as Project;
+ await p.WriteProjectAsync (Util.GetMonitor ());
p.ProjectProperties.SetValue ("TestProperty", "TestValue");
await sol.SaveAsync (Util.GetMonitor ());
@@ -212,12 +220,12 @@ namespace MonoDevelop.Projects
Assert.IsNotNull (p.Configurations ["Debug|x86"]);
Assert.IsNotNull (p.Configurations ["Debug|x86-64"]);
- Assert.IsNotNull (p.Configurations ["Debug|Other"]);
-
Assert.IsNotNull (p.Configurations ["Release|x86"]);
Assert.IsNotNull (p.Configurations ["Release|x86-64"]);
Assert.IsNotNull (p.Configurations ["Release|Other"]);
-
+ Assert.IsNotNull (p.Configurations ["Test|More"]);
+ Assert.AreEqual (6, p.Configurations.Count);
+
string originalContent = File.ReadAllText (p.FileName);
await p.SaveAsync (Util.GetMonitor ());
@@ -1173,8 +1181,7 @@ namespace MonoDevelop.Projects
savedXml = File.ReadAllText (projFile);
Assert.AreEqual (refXml, savedXml);
- c = p.Configurations.FirstOrDefault<SolutionItemConfiguration> (co => co.Id == "Debug");
- p.Configurations.Remove (c);
+ p.Configurations.RemoveRange (p.Configurations.Where<SolutionItemConfiguration> (co => co.Name == "Debug"));
await p.SaveAsync (Util.GetMonitor ());
@@ -1250,8 +1257,10 @@ namespace MonoDevelop.Projects
var p = (Project) sol.Items [0];
var conf = p.Configurations.OfType<ProjectConfiguration> ().FirstOrDefault (c => c.Name == "Debug");
- conf.Name = "Test";
- conf.IntermediateOutputDirectory = p.BaseDirectory.Combine ("obj","Test");
+ var newConf = p.CreateConfiguration ("Test");
+ newConf.CopyFrom (conf);
+ p.Configurations [p.Configurations.IndexOf (conf)] = newConf;
+ newConf.IntermediateOutputDirectory = p.BaseDirectory.Combine ("obj","Test");
await p.SaveAsync (Util.GetMonitor ());
@@ -1473,6 +1482,50 @@ namespace MonoDevelop.Projects
Assert.AreEqual (sol.ItemDirectory.ToString (), p.MSBuildProject.EvaluatedProperties.GetValue ("SolutionDir"));
}
+ [Test]
+ public async Task RenameConfiguration ()
+ {
+ // When renaming a configuration, paths that use the configuration name should also be renamed
+
+ string solFile = Util.GetSampleProject ("console-project", "ConsoleProject.sln");
+ Solution sol = (Solution) await Services.ProjectService.ReadWorkspaceItem (Util.GetMonitor (), solFile);
+
+ var p = (DotNetProject) sol.Items [0];
+ var c = p.GetConfiguration (new ItemConfigurationSelector ("Release"));
+ var renamed = p.CreateConfiguration ("Test");
+ renamed.CopyFrom (c, true);
+ p.Configurations.Remove (c);
+ p.Configurations.Add (renamed);
+ await p.SaveAsync (Util.GetMonitor ());
+
+ var savedXml = File.ReadAllText (p.FileName);
+ var compXml = Util.ToSystemEndings (File.ReadAllText (p.FileName.ChangeName ("ConsoleProject-conf-renamed")));
+ Assert.AreEqual (compXml, savedXml);
+ }
+
+ [Test]
+ public async Task ProjectWithDuplicateConfigGroup ()
+ {
+ // The project has two property groups with Debug|AnyCPU. This has to result in a single
+ // Debug configuration. If a change is done in the configuration, it has to be applied
+ // to the last group.
+
+ string projFile = Util.GetSampleProject ("msbuild-tests", "project-with-duplicated-conf.csproj");
+ var p = (Project)await Services.ProjectService.ReadSolutionItem (Util.GetMonitor (), projFile);
+
+ Assert.AreEqual (2, p.Configurations.Count);
+
+ var c = p.GetConfiguration (new ItemConfigurationSelector ("Debug")) as DotNetProjectConfiguration;
+ Assert.IsNotNull (c);
+ Assert.IsTrue (c.DebugSymbols);
+
+ c.Properties.SetValue ("Test","foo");
+ await p.SaveAsync (Util.GetMonitor ());
+
+ var savedXml = File.ReadAllText (p.FileName);
+ var refXml = File.ReadAllText (p.FileName.ChangeName ("project-with-duplicated-conf-saved"));
+ Assert.AreEqual (refXml, savedXml);
+ }
}
class MyProjectTypeNode: ProjectTypeNode
diff --git a/main/tests/UnitTests/UnitTests.csproj b/main/tests/UnitTests/UnitTests.csproj
index 8a4c465951..a869b4755b 100644
--- a/main/tests/UnitTests/UnitTests.csproj
+++ b/main/tests/UnitTests/UnitTests.csproj
@@ -288,6 +288,7 @@
<Compile Include="MonoDevelop.Projects\PropertyBagTests.cs" />
<Compile Include="MonoDevelop.Projects\TextFileTests.cs" />
<Compile Include="MonoDevelop.Projects\GetSourceFilesAsyncTests.cs" />
+ <Compile Include="MonoDevelop.CSharpBinding\MonodevelopWorkspaceTests.cs" />
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<Import Project="..\..\md.targets" />
diff --git a/main/tests/test-projects/console-project/ConsoleProject/ConsoleProject-conf-renamed.csproj b/main/tests/test-projects/console-project/ConsoleProject/ConsoleProject-conf-renamed.csproj
new file mode 100755
index 0000000000..8f4453c5ed
--- /dev/null
+++ b/main/tests/test-projects/console-project/ConsoleProject/ConsoleProject-conf-renamed.csproj
@@ -0,0 +1,48 @@
+<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <PropertyGroup>
+ <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+ <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+ <ProductVersion>8.0.50727</ProductVersion>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{4A9E3523-48F0-4BDF-A0F4-49DAD4431FAB}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <RootNamespace>ConsoleProject</RootNamespace>
+ <AssemblyName>ConsoleProject</AssemblyName>
+ <TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ <DebugSymbols>True</DebugSymbols>
+ <DebugType>full</DebugType>
+ <Optimize>False</Optimize>
+ <OutputPath>bin\Debug\</OutputPath>
+ <DefineConstants>DEBUG;TRACE</DefineConstants>
+ <ErrorReport>prompt</ErrorReport>
+ <WarningLevel>4</WarningLevel>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Test|AnyCPU' ">
+ <DebugType>pdbonly</DebugType>
+ <Optimize>True</Optimize>
+ <OutputPath>bin\Test</OutputPath>
+ <DefineConstants>TRACE</DefineConstants>
+ <ErrorReport>prompt</ErrorReport>
+ <WarningLevel>4</WarningLevel>
+ </PropertyGroup>
+ <ItemGroup>
+ <Reference Include="System" />
+ <Reference Include="System.Data" />
+ <Reference Include="System.Xml" />
+ </ItemGroup>
+ <ItemGroup>
+ <Compile Include="Program.cs" />
+ <Compile Include="Properties\AssemblyInfo.cs" />
+ </ItemGroup>
+ <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
+ <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
+ Other similar extension points exist, see Microsoft.Common.targets.
+ <Target Name="BeforeBuild">
+ </Target>
+ <Target Name="AfterBuild">
+ </Target>
+ -->
+</Project>
diff --git a/main/tests/test-projects/msbuild-tests/conditioned-properties.csproj b/main/tests/test-projects/msbuild-tests/conditioned-properties.csproj
index 1430c4f30c..297516959c 100755
--- a/main/tests/test-projects/msbuild-tests/conditioned-properties.csproj
+++ b/main/tests/test-projects/msbuild-tests/conditioned-properties.csproj
@@ -4,6 +4,8 @@
<PropertyGroup>
<Test1 Condition="$(cond2) == val2_0">One</Test1>
<Test2 Condition="$(cond2) == val2_0">One</Test2>
+ <Test3 Condition="'$(cond1)|$(cond2)' == 'val14_1|val14_2'">One</Test3>
+ <Test3 Condition="'$(cond2)|$(cond1)' == 'val14_3|val14_4'">One</Test3>
</PropertyGroup>
<PropertyGroup Condition="$(cond1) == 'val1'">
diff --git a/main/tests/test-projects/msbuild-tests/conditioned-properties1.targets b/main/tests/test-projects/msbuild-tests/conditioned-properties1.targets
index faa924f131..576b35f7a8 100755
--- a/main/tests/test-projects/msbuild-tests/conditioned-properties1.targets
+++ b/main/tests/test-projects/msbuild-tests/conditioned-properties1.targets
@@ -3,4 +3,6 @@
<PropertyGroup Condition="$(cond2) == val2_7">
<Test1>One</Test1>
</PropertyGroup>
+ <PropertyGroup Condition="'$(cond1)|$(cond2)' == 'val14_5|val14_6'">
+ </PropertyGroup>
</Project>
diff --git a/main/tests/test-projects/msbuild-tests/project-with-duplicated-conf-saved.csproj b/main/tests/test-projects/msbuild-tests/project-with-duplicated-conf-saved.csproj
new file mode 100755
index 0000000000..6f1d226a2a
--- /dev/null
+++ b/main/tests/test-projects/msbuild-tests/project-with-duplicated-conf-saved.csproj
@@ -0,0 +1,44 @@
+<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <PropertyGroup>
+ <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+ <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+ <ProductVersion>8.0.50727</ProductVersion>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{4A9E3523-48F0-4BDF-A0F4-49DAD4431FAB}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <RootNamespace>ConsoleProject</RootNamespace>
+ <AssemblyName>ConsoleProject</AssemblyName>
+ <TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ <DebugSymbols>True</DebugSymbols>
+ <DebugType>full</DebugType>
+ <Optimize>False</Optimize>
+ <OutputPath>bin\Debug\</OutputPath>
+ <DefineConstants>DEBUG;TRACE</DefineConstants>
+ <ErrorReport>prompt</ErrorReport>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ <WarningLevel>4</WarningLevel>
+ <Test>foo</Test>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ <DebugType>pdbonly</DebugType>
+ <Optimize>True</Optimize>
+ <OutputPath>bin\Release\</OutputPath>
+ <DefineConstants>TRACE</DefineConstants>
+ <ErrorReport>prompt</ErrorReport>
+ <WarningLevel>4</WarningLevel>
+ </PropertyGroup>
+ <ItemGroup>
+ <Reference Include="System" />
+ <Reference Include="System.Data" />
+ <Reference Include="System.Xml" />
+ </ItemGroup>
+ <ItemGroup>
+ <Compile Include="Program.cs" />
+ <Compile Include="Properties\AssemblyInfo.cs" />
+ </ItemGroup>
+ <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
+</Project>
diff --git a/main/tests/test-projects/msbuild-tests/project-with-duplicated-conf.csproj b/main/tests/test-projects/msbuild-tests/project-with-duplicated-conf.csproj
new file mode 100755
index 0000000000..3a08656a4e
--- /dev/null
+++ b/main/tests/test-projects/msbuild-tests/project-with-duplicated-conf.csproj
@@ -0,0 +1,43 @@
+<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <PropertyGroup>
+ <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+ <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+ <ProductVersion>8.0.50727</ProductVersion>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{4A9E3523-48F0-4BDF-A0F4-49DAD4431FAB}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <RootNamespace>ConsoleProject</RootNamespace>
+ <AssemblyName>ConsoleProject</AssemblyName>
+ <TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ <DebugSymbols>True</DebugSymbols>
+ <DebugType>full</DebugType>
+ <Optimize>False</Optimize>
+ <OutputPath>bin\Debug\</OutputPath>
+ <DefineConstants>DEBUG;TRACE</DefineConstants>
+ <ErrorReport>prompt</ErrorReport>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ <WarningLevel>4</WarningLevel>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ <DebugType>pdbonly</DebugType>
+ <Optimize>True</Optimize>
+ <OutputPath>bin\Release\</OutputPath>
+ <DefineConstants>TRACE</DefineConstants>
+ <ErrorReport>prompt</ErrorReport>
+ <WarningLevel>4</WarningLevel>
+ </PropertyGroup>
+ <ItemGroup>
+ <Reference Include="System" />
+ <Reference Include="System.Data" />
+ <Reference Include="System.Xml" />
+ </ItemGroup>
+ <ItemGroup>
+ <Compile Include="Program.cs" />
+ <Compile Include="Properties\AssemblyInfo.cs" />
+ </ItemGroup>
+ <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
+</Project>
diff --git a/main/tests/test-projects/test-configuration-merging/TestConfigurationMerging2.csproj b/main/tests/test-projects/test-configuration-merging/TestConfigurationMerging2.csproj
index 7e81786576..18a0caf2d8 100644
--- a/main/tests/test-projects/test-configuration-merging/TestConfigurationMerging2.csproj
+++ b/main/tests/test-projects/test-configuration-merging/TestConfigurationMerging2.csproj
@@ -29,5 +29,8 @@
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|Other' ">
<AllowUnsafeBlocks>True</AllowUnsafeBlocks>
</PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Test|More' ">
+ <AllowUnsafeBlocks>True</AllowUnsafeBlocks>
+ </PropertyGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
</Project>