all groups > visual studio .net ide > january 2007 >
You're in the

visual studio .net ide

group:

Addin for Server Explorer


Addin for Server Explorer JF
1/22/2007 1:59:04 PM
visual studio .net ide: I want to add a new command to the server explorer after creating a new
connection and selecting the Table Item.

I do this:


try
{
// Create a Command with name SolnExplContextMenuCS
and then add it to the "Item" menubar for the SolutionExplorer
command =
_applicationObject.Commands.AddNamedCommand(_addInInstance,
"SolnExplContextMenuCS", "My CS Command", "Executes My command 1",
true, 59, ref contextGUIDS,
(int)vsCommandStatus.vsCommandStatusSupported +
(int)vsCommandStatus.vsCommandStatusEnabled);

itemCmdBar =
((CommandBars)_applicationObject.CommandBars)["Table"];

if (itemCmdBar == null)
{
System.Windows.Forms.MessageBox.Show("Cannot
get the Item menubar", "Error",
System.Windows.Forms.MessageBoxButtons.OK,
System.Windows.Forms.MessageBoxIcon.Error);
}
else
{
command.AddControl(itemCmdBar, 1);
}


But the QueryStatus is never called and the item does not appear on the
context menu..

Any ideas?
tx
Re: Addin for Server Explorer Carlos J. Quintero [VB MVP]
1/23/2007 2:53:32 PM
The QueryStatus should be called.

See:

HOWTO: Adding buttons, commandbars and toolbars to Visual Studio .NET from
an add-in.
http://www.mztools.com/resources_vsnet_addins.htm

If that doesn't help, post the whole code of the OnConnection and
QueryStatus methods


--

Best regards,

Carlos J. Quintero

MZ-Tools: Productivity add-ins for Visual Studio
You can code, design and document much faster:
http://www.mztools.com


"JF" <cyberpunkpor@yahoo.com> escribió en el mensaje
news:1169503144.381004.286680@38g2000cwa.googlegroups.com...
[quoted text, click to view]

Re: Addin for Server Explorer JF
1/24/2007 3:43:25 AM
hi.
ge
tx for the site. I am not able to put the item on the table... Besides
that, i would have huge problem if I wanted to get the selected
object. Besides that, i am only changing the template that Microsoft
has "Microsoft Visual Studio 2005 Automation Samples" named
"CodeWinContextMenu"

My goal is to produce a tool for our dev. team in which developer can
select a table and the generate some type of code.

My first try was selecting it from the Server Explorer, but it seems
poorly documented and almost impossible... because after than i want a
connection string or able to get the metadata from the selected object.

Now i move to other option, there is, to popup the OLEDB connection
dialog and then select a connection string. after that, i would connect
via OLEDB and get the tables of database.

The problem is that whenever i do a Open in my connection object it
simple stops executing the Addin, without any exception or error.

Do you have any ideas why this is happening?

tx

Jo=E3o


On 23 jan, 13:53, "Carlos J. Quintero [VB MVP]"
[quoted text, click to view]
AddThis Social Bookmark Button