Whole Tomato Software Forums
Whole Tomato Software Forums
Main Site | Profile | Register | Active Topics | Members | Search | FAQ
User name:
Password:
Save Password
Forgot your password?

 All Forums
 Visual Assist
 Feature Requests
 Event Refactoring
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

MiddleTommy
Junior Member

14 Posts

Posted - Jan 16 2008 :  11:00:26 AM  Show Profile  Reply with Quote
I couldn't find this anywhere so an Idea would be a simple event refactoring tool.
Like encapsulate field. but with an event that would give you a common

private void OnEventName()
{
if(EventName!=null)
EventName();
}

it may not always be what you want, but it is easily changeable.
I am using C#

Edited by - MiddleTommy on Jan 16 2008 11:01:07 AM

feline
Whole Tomato Software

United Kingdom
18943 Posts

Posted - Jan 17 2008 :  3:09:03 PM  Show Profile  Reply with Quote
You can do this with a VA snippet. Add a new snippet with this text:

private void On$EventName$()
{
    if($EventName$ != null)
        $EventName$();
}


make sure you give it a name, and then tell VA you want to insert this snippet. You will be prompted for "EventName" and when you provide this, you answer is inserted into the snippet text, giving you the code

zen is the art of being at one with the two'ness
Go to Top of Page

MiddleTommy
Junior Member

14 Posts

Posted - Jan 21 2008 :  2:33:07 PM  Show Profile  Reply with Quote
Yes that is a help thank you
But an automatic refactor would still be better.
Go to Top of Page

feline
Whole Tomato Software

United Kingdom
18943 Posts

Posted - Jan 21 2008 :  4:35:59 PM  Show Profile  Reply with Quote
How would an automatic refactoring be easier / better? You would still have to deal with a dialog to specify the event name.

zen is the art of being at one with the two'ness
Go to Top of Page

MiddleTommy
Junior Member

14 Posts

Posted - Jan 22 2008 :  3:28:54 PM  Show Profile  Reply with Quote
Yes that is true unless you Made the tool automatically name the method
On[EventName]

Just like the Encapsulate Field tool Automatically names the property
(though I guess it still asks you if that is the name you want)

And it is easier because when you have alot of snippets you have to remember the snippet name

perhaps a better solution that would fit just about anything like this would be similar to the surround with tool
except you have your code snippet and it places what ever you right clicked on in all occurrences of the first variable (i.e. $VarName$) then the rest of the variables (ie $VarName2-N$) fields you would have to hand enter like a normal snippet.
Now if you only have one variable name in a snippet it would be all automatic with no typing.
I.E.
Right Click a variable/word/etc then goto Populate Snippet then a list of all your snippets comes up. very similar to Surround With except you dont deal with the selection you deal with only one symbol.

Do you understand the concept?

Edited by - MiddleTommy on Jan 22 2008 3:49:28 PM
Go to Top of Page

feline
Whole Tomato Software

United Kingdom
18943 Posts

Posted - Jan 22 2008 :  7:57:34 PM  Show Profile  Reply with Quote
It sounds like you simply want to use $selected$ in your snippets. Notice that VA lists these in a seperate group, to make them easier to pick out, when you press the "Insert Snippet" toolbar button.

http://www.wholetomato.com/products/features/vasnippets.asp

zen is the art of being at one with the two'ness
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
© 2023 Whole Tomato Software, LLC Go To Top Of Page
Snitz Forums 2000