visual studio extension tool window opens every time visual studio opens up - visual-studio-2019

I added a tool window to VSIX extension using these steps https://learn.microsoft.com/en-us/visualstudio/extensibility/creating-an-extension-with-a-tool-window?view=vs-2019
When the extension is installed the tool window must open once
But the tool window opens up every time the Visual studio opens.
How to open tool window only when it is required?
These are the attributes am using,
[ProvideToolWindow(typeof(MyWindow), Orientation = ToolWindowOrientation.Left, DocumentLikeTool = true, Style = Microsoft.VisualStudio.Shell.VsDockStyle.Tabbed)]
[ProvideToolWindowVisibility(typeof(MyWindow), VSConstants.UICONTEXT.SolutionExists_string, Name = "Extension Overview")]

Deepak,
By using VSConstants.UIContext.SolutionExists_string, you are registering the toolwindow to display whenever a solution exists in the VS IDE. If you don't want this behavior, remove the attribute.
Note, Toolwindows are almost always associated with a particular scenario or IDE state (like during debugging, building, or coding). This is typically where you would leverage the ProvideToolWindowVisibility attribute. To associate your toolwindow to a specific activity or state. However, if the user manually closes the toolwindow while in that UI state, the IDE will try to remember that. So that it no longer appear by default while (debugging, building, or coding, etc.). This is what is meant, when the toolwindow layout is described as being "sticky".
If you are curious as to what UI Contexts are currently active in the IDE (to figure out which you'd like your toolwindow to be visible with), I highly recommend using the Component Diagnostics extension, to monitor what UI Contexts are active, during the scenario(s) you want your toolwindow to show up under.

Related

How to access and add/modify controls in MainWindowTitleBar

I'm writing extension for Visual Studio 2019 and I want do add or modify some controls that are in MainWindowTitleBar (compact menu option is enabled). How can I do that? Is there a service for that?
All sources about extensions focus on adding new toolboxes or menu items or use specialized services/interfaces to do certain thing but none of them talk about modifying existing interface.
You can use System.Windows.Media.VisualTreeHelper to find desired Visual Studio controls and then manipulate them as regular WPF controls.

Delphi 10 Seattle do NOT open last used project on start

I'm new to Delphi, coming from Visual Studio it's a simple question (I guess): how do I prevent Delphi 10 Seattle to open last use project(group) when I start the IDE?
I've found some information about the .dsk file and what it does:
The .dsk file records your current settings for:
Desktop layout
Breakpoints
Watch items
Files currently open in the IDE
When you reopen the project later, the .dsk file is read, and your
desktop layout, your breakpoints, and your watches are all restored.
Also, all files that were opened when the project was closed are
opened again, regardless of whether they are used by the project.
I'm fine with that when I open a project. But please do not open it when I start the IDE. Mostly I want to start or open another project than the last one I was working on.
I've searched the options and the internet, but couldn't find a solution. Anyone?
Disable "Project desktop" in the IDE Autosave options (Tools\Options\Envinroment options).
But please do not open it when I start the IDE. Mostly I want to start or open another project than the last one
Granted, I do no have Seattle at hands, I settled in XE2.
But try changing the shortcut.
-np: No welcome page. Does not display the welcome page after starting the IDE. np also stands for No Project. Independently of Environment Options Project desktop the last opened project will not be opened
http://docwiki.embarcadero.com/RADStudio/Tokyo/en/IDE_Command_Line_Switches_and_Options
saving the layout and position of the tool windows like Refactorings,
That is what the "Layout" combo-box on the "Desktop" toolbar does. Unless you want different layouts in different projects. R-click over your IDE's tool buttons or go View|Toolbars menu to turn "Desktop" bar on. Alternatively use View|Desktops menu.

How to automatically save IDE layout in Delphi XE2?

We are having an issue in Delphi XE2 with the automated saving of the desktop layout. Under environment options I do have the Autosave options - Project Desktop checked. However, changes to the layout of the desktop are not being saved and restored each time the IDE is launched.
The workaround we have in place is to use a custom destkop layout under View | Desktops. This requires us to manually save this layout each time we make a change.
Is there another setting that needs to be enabled in order for the desktop layout (window size, position, toolbar settings, etc) to persist from session to session without requiring the developer to manually save this layout?
The way to do this is to configure a custom desktop, and then save it. You can have multiple desktops (eg., normal and debug, among others) and easily switch between them using the "Desktop SpeedSetting" combobox (and associated toolbuttons) in the main menu/toolbar of the IDE. Saving is as easy as clicking the Save button and either accepting the current name or providing a new name, and switching is choosing a named desktop from the combobox.
"Autosave project desktop" saves the open files in the code editor, and whether you're on the design or code page for each form. It also saves the build configuration (debug or release). It will save which of the selected stored desktop layout you've chosen, but not any changes to that desktop layout.

Turn off context menu for Component applied by CnPack (design time)

After I installed cnPack, right clicking on a component in my form seems to have taken away any specific items that the component itself may have applied.
eg, right clicking on any Dev Express component will usually bring up version details. Now I get a bunch of other context menu items and the Dev Express ones have disappeared.
Is there a wizard or some other option I can disable to stop this? I can't find one anywhere.
Thanks
EDIT
Restarting Delphi fixed it in the short term - but has come back again so I'd still like to find a resolution to this....
Right-click menus are controlled by component editors, and AFAIK there can only be one component editor registered to a particular class type at a time. If CnPack's design-time package is loaded after DevExpress's design-time package, then CnPack's component editor will be the last one registered and take priority.

How to detect if file in IDE is being edited using Open Tools API

I made a small IDE plug-in using Open Tools API that accesses ClearCase. It has menu items "Check In", "Check Out", etc. It works OK but I want it to check out a read-only file automatically if I start typing in IDE editor or if I attempt to save the file. Do you think this is possible?
I tried a few things but gave up eventually. IOTAEditorServices.KeyboardServices has AddKeyboardBinding method which looked promising. Using it I added a notifier with binding type btPartial (and later tried btComplete) and the plug-in started detecting some shortcut key presses but not all keyboard events, far from it... Any ideas would be much appreciated!
I think a "cleaner" way is to hook up a IOTAEditorNotifier to each editor and have your IOTAEditor.Modified method called by the IDE whenever the contents of the editor is modified, whether by keyboard, mouse or programmatically from another plugin.
Here's an example which registers an IOTAIDENotifier to be notified of files being opened in the IDE so it can register its IOTAEditorNotifier instances.
I must be possible somehow: we use SourceConexion (http://www.epocalipse.com/scx.htm) here, which auto checks-out the file before you edit the source or change the form.
JVCS has IDE integration support, it is open source, maybe they have implemented this too:
http://jedivcs.sourceforge.net/

Resources