How to add custom menu command to VSIX Error Context Menu - visual-studio-2022

I looked at the MS docs on the VS menu list, and I can't find which menu ID to use. What I want to do is write a VSIX extension that gives me a menu pick when I right click on an Error message, and it will be able to obtain the contents of the selected error message.
Does anyone know if there is a way to customize that contextual menu?

Pick a menu command like "Previous Error" from the context menu, search the various .vsct files under "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VSSDK\VisualStudioIntegration\Common\Inc", and you should get a hit in the ShellCmdDef.vsct file.
<Button Condition="!Defined(VSE)" guid="CLSID_VsTaskListPackage" id="cmdidErrorListPrevError" priority="0x0000" type="Button">
<CommandFlag>AllowClientRole</CommandFlag>
<CommandFlag>DefaultDisabled</CommandFlag>
<CommandFlag>CommandWellOnly</CommandFlag>
<Strings>
<ButtonText>P&revious Error</ButtonText>
<CommandName>Previous Error</CommandName>
</Strings>
</Button>
Now you know the ID of the command (cmdidErrorListPrevError), so you can search for that, to find where/how it's placed.
You should get a hit in the ShellCmdPlace.vsct:
<CommandPlacement guid="CLSID_VsTaskListPackage" id="cmdidErrorListPrevError" priority="0x0200">
<Parent guid="guidSHLMainMenu" id="IDG_VS_ERRORLIST_NEXTPREV_ERR"/>
</CommandPlacement>
Now search on that ID to find the menu that groupID is parented to, which will also take us to ShellCmdPlace.vsct and you can identify the actual context menu:
<Group guid="guidSHLMainMenu" id="IDG_VS_ERRORLIST_NEXTPREV_ERR" priority="0x0400">
<Parent guid="guidSHLMainMenu" id="IDM_VS_CTXT_ERRORLIST"/>
</Group>
So now, you should define your own custom menu group parented off the same, with your commands parented to your custom menu group.
Caveat: This doesn't always work as there are a LOT of commands and menus that are not defined in the files included in the VSSDK. But for standard stuff like this, the technique "usually" works :-).
Sincerely,

Related

Using file templates in IntelliJ

I'm quite confused when it comes to file templates in IntelliJ. Basically, when I right click anything and hover my mouse over to New, I can see the usual file templates like Java Class, HTML File and so on. I downloaded Scala plugin and I can see Scala templates (Scala Class, Scala Object, etc.) if I go to Edit File Templates, but I can't actually use/see them in the New menu. Is there a way to modify what I see in the New menu? I'd like to be able to create Scala classes.
Go to Settings -> Menus and Toolbars
There you will see many type of menus. You need edit the menu you want the files to be displayed. Most Probably "Project View Popup Menu".
Click on "Add After" button on right. There you choose the file form plug-ins or other category to be displayed.
I added "Show Bytecode" to meny well it does not make sense here. You can add files from scala plugin like that.
You can restore to Defaults if you mess up easily by clicking on
"Restore All Defaults" button.

How to access system right click menus?

My Project: Instant web searching tool
Problem: I want users to be able to search the web for selected text via a right click. An appropriate example would be WinRar. When we right click a file, the right click menu has an option to Archive that particular file. I want to add that type of option.
Is there any way?

Word 2010: how to create a drop-down menu in qat (quick access toolbox)

SHORT:
I would like to add a drop-down menu to the quick access toolbar of any instance of Word 2010 via placing a customized .dotm-file in Word's startup folder. I fail in creating this customized .dotm-file.
LONG:
I've been writing a little "add-in" for Word 2010, first with VSTO, then figured out problems with the deployment, now with VBA. The add-in should simplify adding my company's logo and legal notice to documents (different combinations of logos & legal notices exist).
In order to allow selection of wished logo and legal notice with as few clicks as possible, I thought about automatically adding a drop-down menu to the quick access toolbar (qat). I want to do this by placing a .dotm-file containing the code for this qat-extension & the logic for the header/footer-setting in the user's Word startup-folder.
I have already succeded in adding such a drop-down menu to the Add-Ins-Ribbon using CustomUI, everything works fine on the code side. Via the menu the user can choose from all presets supplied and headers and footers are added successfully.
Furthermore, I have seen and played with examples that successfully add controls directly to the qat.
If placed in my startup-folder, these examples do a perfect job and the controls defined therein appear on any instance of Word. The way to go is to create a new folder "userCustomization" in the .dotm-document and then create the customUI.xml-file with several restrictions (no custom icons allowed e.g.).
Unfortunately, I was not able to figure out how to implement a drop-down-menu control in the qat. All the examples I found only used "simple" (button) controls and no matter how many times whatsoever I tried wrapping buttons in a tag, i never got it working.
I can on the other hand manually add my ribbon via "qat => add controls" to the qat and .. voilà .. it's there, working exactly as wanted, so i suppose it must be possible. But what I need is to automate this so that our users don't have to do any configuration of the qat.
Help would be very much appreciated! Best regards from Germany,
Kurt
This is how the drop-down menu is added to the Add-Ins-tab:
<ribbon>
<tabs>
<tab idMso="TabAddIns">
<group id="MyGroup" label="WordDesigner" visible="false">
<menu id="myMenu" label="Design einfügen" size="large" image="menulogo">
<menu id="mySubMenu" label="Rechnungswesen" image="icon2">
<button id="MahnUndKlage" label="Mahn- und Klage" image="icon3" onAction="DesignAnwenden"/>
<button id="Buchhaltung" label="Buchhaltung" image="icon3" onAction="DesignAnwenden"/>
</menu>
<button id="Personalabteilung" label="Personalabteilung" image="icon3" onAction="DesignAnwenden"/>
<button id="Verkauf" label="Verkauf" image="icon4" onAction="DesignAnwenden"/>
<button id="clearHeaderAndFooter" label="Gestaltung entfernen" image="icon5" onAction="DesignAnwenden"/>
</menu>
</group>
</tab>
</tabs>
</ribbon>
</customUI>
Usefull information I found included:
Greg Maxey on modifying icons in the qat
in german, part 18 of an introduction to
RibbonX
Alright, some more research has led to some more information ( ... ) and in case anybody else might ever search for a similar question, I'll try to conclude what i got..
1) According to this MS page on the QAT, only Button,
ToggleButton and CheckBox are valid items for the QAT in Win7 (Win8
allows some more controls).
Since you can manually add drop-down-menus as well, I thought there had to be some way to do that automatically as well as with buttons, checkboxes and togglebuttons
I could for the life of me not figure out a way to auto-add a
drop-down to the QAT by modifying the customUI.xml-file in the userCustomization-Folder of a .dotm-file in startup folder.
There is one other possibility to achieve that goal: Office 2010 uses
a file of the type ".officeUI" where it stores each users elements
from the QAT (e.g. Word.officeUI). In there, adding the following xml-Element will make sure that, if you have placed the .dotm-file containing your menu in
Word's startup folder, it is on load displayed as a drop-down in the
QAT:
<mso:control idQ="x1:myMenu" visible="true"/>
Unfortunatly, enthusiastically adding this xml-Element to the customUI.xml in userCustomization results in .. poof .. no user defined extra icons in the QAT at all (customUI.xml is corrupt).
Furthermore, a great ressource I stumbled upon yesterday is Andy Pope's Visual Ribbon Editor. You can easily tweak the Ribbon and QAT.
I know I'm late to the game, but I found this post via Google and figured you'd appreciate an answer.
You can create the appearance of a menu through Word's QAT with a little VBA trickery. Basically, create a custom command bar with each "Control" representing a slot on your desired menu. You can use ".BeginGroup" to create a divider line to separate items if you wish. Your menu can go at least a couple levels down, but for complexity's sake, I wouldn't recommend going too deep.
When your command bar is perfect, create a macro that only displays your command bar as a popup when run:
Application.CommandBars("My Command Bar").ShowPopup
Add a shortcut to that macro to the QAT. When you click that shortcut, your command bar will appear as a popup menu at your cursor, which is the desired effect.
Enjoy!

How to Run Ada Code in GPS

In GNAT Programming Studio, how do you run the program? I see it compiled successfully, but I do not see where my program has started running. I would like to test it.
First, you have to select your Main procedure in the project properties (see the "main files" tab). You can actually choose multiple files for multiple executables.
Next, you have to build it - either by pressing F4 for the first Main File in the list, or by choosing it in the Build->Project submenu, or by choosing "build all" in the Build->Project submenu (or use the toolbar for the menu entries).
Last, you can choose, which of your Main Files to run by choosing it in the Build->Run menu, or by pressing shift+F2 for the first file in the list. Enter the parameters in the dialog and press OK.
There should be a new Tab next to the Messages panel, where all output is placed, and you can use it for input, too. You could choose to use an external terminal in the run dialog.
If you want to debug it, have a look at the Debug menu. Read the documentation for more information.
Last, you can choose, which of your Main Files to run by choosing it in the Build->Run menu, or by pressing shift+F2 for the first file in the list. Enter the parameters in the dialog and press OK.
Whatever I enter here, e.g. either the name of the project, Primes_Count or the name of what I see to be the 'executable', Primes_Count.o, it just does not run.
And I get this message output on the Messages window :
Could not locate executable on path: Primes_Count.o
I don't see why Ada is making such a big deal out of the Run step.
If there is another stage between making the .o file and a finished Ada executable, then surely it is something that the GPS system can take care of itself . . .
December.
OK now, sorted. The GPS panel governing this [ Project menu > Edit Proj Props > Main Files tab ] setting was blacked out until clicked.
Running available now and working well.
it is Project->Properties-> Main Files add your file to run. This will sort out the issue.

Adding an entry in a submenu of a popup

I'm building a plugin, and adding an entry to the context menu (right-click on a folder in the project tree).
So far it works, following this tutorial:
http://www.eclipse.org/articles/article.php?file=Article-JFaceWizards/index.html
The problem is that it's adding my entry in the root of the context menu. Since my entry refers to a "New XXX" wizard, I want it to go to the "New" submenu.
It seems like I would have to set the correct locationURI or menuPath in my plugin.xml. However I can't find the locationURI or menuPath corresponding to that submenu. How can I find that?
The new contributions are menu ID based, not menu path based. So it should be something like:
<menuContribution
locationURI="menu:file?after=additions" />
See this SO answer for an example of locationUri.
See Menu Extension for more. The exact id is either:
found in the existing plugin.xml from the menu or
determined with plugin Spy
See "How to add items in popup menu?" (from justinmreina) for more on adding an entry to a menu.
If you've created a plugin for a 'New XXX' wizard, you can add it inside the 'New' menu that you see when you right-click inside the Navigator by customizing the perspective.
Go to Window -> Customize Perspective and click on the Shortcuts tab. You should see 'New XXX'. Select it and you're good to go.