~ubuntu-branches/ubuntu/trusty/monodevelop/trusty-proposed

« back to all changes in this revision

Viewing changes to src/core/MonoDevelop.Ide/MonoDevelop.Ide.Commands/ProjectCommands.cs

  • Committer: Package Import Robot
  • Author(s): Jo Shields
  • Date: 2013-05-12 09:46:03 UTC
  • mto: This revision was merged to the branch mainline in revision 29.
  • Revision ID: package-import@ubuntu.com-20130512094603-mad323bzcxvmcam0
Tags: upstream-4.0.5+dfsg
ImportĀ upstreamĀ versionĀ 4.0.5+dfsg

Show diffs side-by-side

added added

removed removed

Lines of Context:
262
262
                        info.Enabled = CanRun (Runtime.ProcessService.DefaultExecutionHandler);
263
263
                }
264
264
                
 
265
                static IBuildTarget GetRunTarget ()
 
266
                {
 
267
                        return IdeApp.ProjectOperations.CurrentSelectedSolution != null && IdeApp.ProjectOperations.CurrentSelectedSolution.StartupItem != null ? 
 
268
                                IdeApp.ProjectOperations.CurrentSelectedSolution.StartupItem : 
 
269
                                        IdeApp.ProjectOperations.CurrentSelectedBuildTarget;
 
270
                }
 
271
                
265
272
                public static bool CanRun (IExecutionHandler executionHandler)
266
273
                {
267
 
            if (IdeApp.Workspace.IsOpen)
268
 
                return IdeApp.ProjectOperations.CurrentSelectedSolution != null && IdeApp.ProjectOperations.CanExecute (IdeApp.ProjectOperations.CurrentSelectedSolution, executionHandler);
 
274
            if (IdeApp.Workspace.IsOpen) {
 
275
                                var target = GetRunTarget ();
 
276
                                return target != null && IdeApp.ProjectOperations.CanExecute (target, executionHandler);
 
277
                        }
269
278
            else
270
279
                return (IdeApp.Workbench.ActiveDocument != null) && (IdeApp.Workbench.ActiveDocument.CanRun (executionHandler));
271
280
                }
291
300
                }
292
301
            }
293
302
            else {
 
303
                                var target = GetRunTarget ();
294
304
                if (!IdeApp.Preferences.BuildBeforeExecuting)
295
 
                    IdeApp.ProjectOperations.Execute (IdeApp.ProjectOperations.CurrentSelectedSolution, executionHandler);
 
305
                                        IdeApp.ProjectOperations.Execute (target, executionHandler);
296
306
                else {
297
 
                                        Solution sol = IdeApp.ProjectOperations.CurrentSelectedSolution;
298
 
                    IAsyncOperation asyncOperation = IdeApp.ProjectOperations.Build (sol);
 
307
                    IAsyncOperation asyncOperation = IdeApp.ProjectOperations.Build (target);
299
308
                    asyncOperation.Completed += delegate {
300
309
                        if ((asyncOperation.Success) || (IdeApp.Preferences.RunWithWarnings && asyncOperation.SuccessWithWarnings))
301
 
                            IdeApp.ProjectOperations.Execute (sol, executionHandler);
 
310
                            IdeApp.ProjectOperations.Execute (target, executionHandler);
302
311
                    };
303
312
                }
304
313