.NET Forum / Visual Studio.NET / Extensibility / May 2006
Catch the event of item content change
|
|
Thread rating:  |
Shai - 12 May 2006 11:19 GMT We're working in vs.net 2003 to integrate it with internal SCM system. We catch all open , save, change item selection events. But when we try to catch the event of the first try to change any item content in any editor.(Text editor, Winform Editor ,WebForm Editor ,Resource Editor, etc. ) we couldn't find a way to catch/raise this event. We where able to catch (Move char right, left, delete char in text editor but not the actual first (or any) character typed in the editor)
We looked at the event watcher sample in the (Automation samples) with no luck.
Is there a way to catch this event ? TIA Shai
"Gary Chang[MSFT]" - 15 May 2006 07:27 GMT Hi Shai,
Thank you posting!
>But when we try to catch the event of the first try to change >any item content in any editor.(Text editor, Winform Editor , >WebForm Editor ,Resource Editor, etc. ) >we couldn't find a way to catch/raise this event. I am afraid I am not very clear about the meaning of the first try to change any item content in any VS2003 editor. Would you please give us an example to illustrate such a scenario?
Thanks for your understanding.
Best regards,
Gary Chang Microsoft Online Community Support ================================================== When responding to posts, please "Reply to Group" via your newsreader so that others may learn and benefit from your issue. ================================================== This posting is provided "AS IS" with no warranties, and confers no rights.
Shai - 15 May 2006 12:09 GMT Hi Gary ! What we are trying to accomplish is in essence a lock on all Visual Studio 2003 project items. We want to catch the first time a user attempts to modify any file and confirm with the user the change should be allowed. For instance, to detect when a user is attempting to modify a source code file all we are able to catch the “LineChanged” event via the following method: public void LineChanged(EnvDTE.TextPoint startPoint, EnvDTE.TextPoint endPoint, int hint) We need an event that can be captured as soon as the user attempts any modification, such as KeyPress. As mentioned above, we also need to capture any other modification to a project item, such as a change in the Winform, Webform, or Resource editors or XML Editor etc.
TIA Shai
> Hi Shai, > [quoted text clipped - 20 lines] > ================================================== > This posting is provided "AS IS" with no warranties, and confers no rights. "Gary Chang[MSFT]" - 16 May 2006 09:49 GMT Hi Shai,
Based on my experience, there isn't such a general event to catch in this scenario. I am afraid you need to catch those events which you are interested one by one. To catch the Winform editor's event, I suggest you can refer to the following newsgroup thread:
http://groups.google.com/group/microsoft.public.vstudio.extensibility/browse _frm/thread/cecf997db2874548/3ff117d372a887cf?lnk=st&q=%22Carlos+J.+Quintero %22+control+added&rnum=1&hl=en#3ff117d372a887cf
By the way, some events may not be existed in Visual Studio 2003's extension model.
Thanks for your understanding.
Best regards,
Gary Chang Microsoft Online Community Support ================================================== When responding to posts, please "Reply to Group" via your newsreader so that others may learn and benefit from your issue. ================================================== This posting is provided "AS IS" with no warranties, and confers no rights.
Shai - 18 May 2006 07:49 GMT Hi Gary !
This sound not good. When working with VSS this is a basic service you get when trying to change checkedin item , so how come I can't get this event ?
Shai
> Hi Shai, > [quoted text clipped - 21 lines] > ================================================== > This posting is provided "AS IS" with no warranties, and confers no rights. "Gary Chang[MSFT]" - 19 May 2006 06:51 GMT Hi Shai,
I have already forwarded this issue to our product team, they will reply you as soon as possible.
Thanks!
Best regards,
Gary Chang Microsoft Online Community Support ================================================== When responding to posts, please "Reply to Group" via your newsreader so that others may learn and benefit from your issue. ================================================== This posting is provided "AS IS" with no warranties, and confers no rights.
"Ed Dore [MSFT]" - 19 May 2006 21:12 GMT Hi Shai,
Gary is correct. There is no access to this event, because no such event actually exists.
It's the responsibility of each editor and designer to call IVsQueryEditQuerySave::QueryEditFiles, to ensure the underlying file is checked out before allowing it to be edited. Aside from calling this specific method on the SVsQueryEditQuerySave service, there is no requirement to fire some standard event before allowing modification of the docdata object representing the underlying file.
Also, not all editor's use the IDE's stock VsTextBuffer object. Editors are free to implement their own docdata objects representing anything from a source file on disk, to a record in a database. So we can't really intercept pending edits at the docdata level in some standard fashion.
As an aside, the reason we didn't expose the ability to intercept keyboard messages from the VS2003 IDE's VsCodeWindow was due to a very valid concern that if enough people hooked such an event, the IDE would slow to a crawl. But because of feedback from customers, we did expose an event for keyboard messages in VS 2005. Note however, this event wouldn't help in a scenario where you attempted to drop a control on a form, as no keyboard messages are involved there.
The way the system is designed, the above mentioned IVsQueryEditQuerySave::QueryEditFiles implementation calls into the currently active SCC provider to determine if a file is locked, or should remain locked. It seems like the feature you are trying to implement is very reminicent of an SCC provider, and you might want to consider implementing an SCC provider to provide this type of functionality.
In the VS2003 SDK (with the VSIP Extras installed), the SCC Provider docs are located under a topic entitled "Source Code Control SDK". The VS 2005 SDK though has this documented under a "Source Control" topic, and contains some additional managed (C#) samples.
Sincerely, Ed Dore [MSFT]
This post is 'AS IS' with no warranties, and confers no rights.
Free MagazinesGet these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...
|
|
|