~ubuntu-branches/ubuntu/oneiric/monodevelop/oneiric

« back to all changes in this revision

Viewing changes to src/core/MonoDevelop.Ide/MonoDevelop.Ide.Projects.OptionPanels/RunOptionsPanel.cs

  • Committer: Bazaar Package Importer
  • Author(s): Jo Shields
  • Date: 2010-07-05 13:00:05 UTC
  • mfrom: (1.2.8 upstream) (1.3.9 experimental)
  • Revision ID: james.westby@ubuntu.com-20100705130005-d6hp4k5gcn1xkj8c
Tags: 2.4+dfsg-1ubuntu1
* debian/patches/remove_support_for_moonlight.patch,
  debian/patches/dont_add_moonlight_to_core_addins.patch,
  debian/control:
  + Enable support for Moonlight
* debian/rules:
  + Ensure Moonlight addin isn't shipped in main MonoDevelop package by
    mistake

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
// RunOptionsPanel.cs
 
2
//
 
3
// Author:
 
4
//   Lluis Sanchez Gual <lluis@novell.com>
 
5
//
 
6
// Copyright (c) 2008 Novell, Inc (http://www.novell.com)
 
7
//
 
8
// Permission is hereby granted, free of charge, to any person obtaining a copy
 
9
// of this software and associated documentation files (the "Software"), to deal
 
10
// in the Software without restriction, including without limitation the rights
 
11
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 
12
// copies of the Software, and to permit persons to whom the Software is
 
13
// furnished to do so, subject to the following conditions:
 
14
//
 
15
// The above copyright notice and this permission notice shall be included in
 
16
// all copies or substantial portions of the Software.
 
17
//
 
18
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 
19
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 
20
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 
21
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 
22
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 
23
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 
24
// THE SOFTWARE.
 
25
//
 
26
//
 
27
 
 
28
using System;
 
29
using System.IO;
 
30
 
 
31
using MonoDevelop.Projects;
 
32
using MonoDevelop.Ide.Gui.Dialogs;
 
33
using MonoDevelop.Components;
 
34
using MonoDevelop.Core;
 
35
 
 
36
using Gtk;
 
37
 
 
38
 
 
39
namespace MonoDevelop.Ide.Projects.OptionPanels
 
40
{
 
41
        internal class RunOptionsPanel : MultiConfigItemOptionsPanel
 
42
        {
 
43
                RunOptionsPanelWidget  widget;
 
44
                
 
45
                public override Widget CreatePanelWidget()
 
46
                {
 
47
                        return (widget = new RunOptionsPanelWidget ());
 
48
                }
 
49
                
 
50
                public override bool ValidateChanges ()
 
51
                {
 
52
                        return widget.ValidateChanges ();
 
53
                }
 
54
                
 
55
                public override void LoadConfigData ()
 
56
                {
 
57
                        widget.Load (ConfiguredProject, (ProjectConfiguration) CurrentConfiguration);
 
58
                }
 
59
 
 
60
                
 
61
                public override void ApplyChanges()
 
62
                {
 
63
                        widget.Store ();
 
64
                }
 
65
        }       
 
66
        
 
67
        public partial class RunOptionsPanelWidget : Gtk.Bin
 
68
        {
 
69
                ProjectConfiguration configuration;
 
70
 
 
71
                public RunOptionsPanelWidget()
 
72
                {
 
73
                        this.Build();
 
74
                        externalConsoleCheckButton.Toggled += new EventHandler (ExternalConsoleToggle);
 
75
                }
 
76
                
 
77
                public void Load (Project project, ProjectConfiguration config)
 
78
                {       
 
79
                        this.configuration = config;
 
80
                        
 
81
                        parametersEntry.Text = configuration.CommandLineParameters;
 
82
                        externalConsoleCheckButton.Active = configuration.ExternalConsole;
 
83
                        pauseConsoleOutputCheckButton.Active = configuration.PauseConsoleOutput;
 
84
                        pauseConsoleOutputCheckButton.Sensitive = externalConsoleCheckButton.Active;
 
85
                        
 
86
                        envVarList.LoadValues (configuration.EnvironmentVariables);
 
87
                }
 
88
 
 
89
                public bool ValidateChanges ()
 
90
                {
 
91
                        return true;
 
92
                }
 
93
                
 
94
                public void Store ()
 
95
                {       
 
96
                        if (configuration == null)
 
97
                                return;
 
98
                        
 
99
                        configuration.CommandLineParameters = parametersEntry.Text;
 
100
                        configuration.ExternalConsole = externalConsoleCheckButton.Active;
 
101
                        configuration.PauseConsoleOutput = pauseConsoleOutputCheckButton.Active;
 
102
                        
 
103
                        configuration.EnvironmentVariables.Clear ();
 
104
                        envVarList.StoreValues (configuration.EnvironmentVariables);
 
105
                }
 
106
                
 
107
                void ExternalConsoleToggle (object sender, EventArgs e)
 
108
                {
 
109
                        if (externalConsoleCheckButton.Active) {
 
110
                                pauseConsoleOutputCheckButton.Sensitive = true;
 
111
                                pauseConsoleOutputCheckButton.Active = true;
 
112
                        } else {
 
113
                                pauseConsoleOutputCheckButton.Sensitive = false;
 
114
                                pauseConsoleOutputCheckButton.Active = false;
 
115
                        }
 
116
                }               
 
117
        }
 
118
}