-
Notifications
You must be signed in to change notification settings - Fork 354
Change the command to raise when adding new project from existing code #396
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
7ecde12
98c81c1
190c079
9f97d72
1fb97ac
a3235be
4023121
f7039bd
1e5a088
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -19,12 +19,14 @@ | |
| using System.IO; | ||
| using System.Windows.Forms; | ||
| using EnvDTE; | ||
| using Microsoft.VisualStudio; | ||
| using Microsoft.VisualStudio.Shell; | ||
| using Microsoft.VisualStudio.Shell.Interop; | ||
| using Microsoft.VisualStudio.TemplateWizard; | ||
|
|
||
| using Microsoft.VisualStudio.TemplateWizard; | ||
| namespace Microsoft.NodejsTools.ProjectWizard { | ||
| public sealed class NewProjectFromExistingWizard : IWizard { | ||
| public static Boolean IsAddNewProjectCmd { get; set; } | ||
| public void BeforeOpeningFile(EnvDTE.ProjectItem projectItem) { } | ||
| public void ProjectFinishedGenerating(EnvDTE.Project project) { } | ||
| public void ProjectItemFinishedGenerating(EnvDTE.ProjectItem projectItem) { } | ||
|
|
@@ -45,6 +47,8 @@ public void RunStarted(object automationObject, Dictionary<string, string> repla | |
| dte = new ServiceProvider(provider).GetService(typeof(DTE)) as DTE; | ||
| } | ||
| } | ||
|
|
||
| bool addingNewProject = false; | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What's this for? Shouldn't we be using AddingNewProject here?
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is to record the
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It only gets reset after WizardCancelledException.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You're also not actually recording or using the value of AddingNewProject anywhere.
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. No I used it at line 79. It captures value of
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
| if (dte == null) { | ||
| MessageBox.Show("Unable to start wizard: no automation object available.", "Node.js Tools for Visual Studio"); | ||
| } else { | ||
|
|
@@ -73,10 +77,14 @@ out package | |
| directory = Path.GetDirectoryName(Path.GetDirectoryName(replacementsDictionary["$destinationdirectory$"])); | ||
| } | ||
|
|
||
| object inObj = projName + "|" + directory, outObj = null; | ||
| var context = addingNewProject ? | ||
| (int)VSConstants.VSStd97CmdID.AddExistingProject : | ||
| (int)VSConstants.VSStd97CmdID.OpenProject; | ||
| object inObj = projName + "|" + directory + "|" + context, outObj = null; | ||
| dte.Commands.Raise(Guids.NodejsCmdSet.ToString("B"), (int)PkgCmdId.cmdidImportWizard, ref inObj, ref outObj); | ||
| }); | ||
| } | ||
| addingNewProject = IsAddNewProjectCmd; | ||
| throw new WizardCancelledException(); | ||
| } | ||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
worth splitting this logic out into a private method,
SubscribeToVsCommandEvents