Hello Dmitry, :) yeah you are right :) but i meant using resharper openapi. if in my plugin code i have derived a name eg. for a myusercontrol.cs i want to switch to designer code (myusercontrol.designer.cs) using a plugin. using this i can easily have a plugin to toggle between the two. Can you help on that. Regards Irfan
Hello Irfan,
you can use Go To Type feature (ReSharper|Go To|Type or Ctrl-N keyboard shortcut) for that.
1) You have to obtain ITypeElement for that given class name PsiManager manager = PsiManager.GetInstance(solution); IDeclarationsCache cache = manager.GetDeclarationsCache(DeclarationsCacheScope.SolutionScope(solution, true));
oops, sorry, I didn't pay attention to the newsgroup you post has appeared in. Eugene has answered you in another post. You also may want to inspect the IDeclarations of ITypeElement (ITypeElement.Declarations) and choose the ony that resides in the designer file (IDeclaration.GetContainingFile().ProjectItem gives you the IProjectItem where the declaration is located).
Hello Dmitry, :) yeah you are right :) but i meant using resharper openapi. if in my plugin code i have derived a name eg. for a myusercontrol.cs i want to switch to designer code (myusercontrol.designer.cs) using a plugin. using this i can easily have a plugin to toggle between the two. Can you help on that. Regards Irfan
>> Hello Irfan, >> >> you can use Go To Type feature (ReSharper|Go To|Type or Ctrl-N >> keyboard shortcut) for that. >> >> Regards, >> Dmitry Shaporenkov >> JetBrains, Inc >> http://www.jetbrains.com >> "Develop with pleasure!" >>> Hi All, >>> How do i go to class if i have the name of the class as a string >>> cheers, >>> Irfan
Hello Irfan,
you can use Go To Type feature (ReSharper|Go To|Type or Ctrl-N keyboard shortcut)
for that.
Regards,
Dmitry Shaporenkov
JetBrains, Inc
http://www.jetbrains.com
"Develop with pleasure!"
Hello Dmitry,
I guess since the question is asked in openapi newsgroup it's about programmatic
way to achieve this functionality :)
Regards,
Maxim
Hello Dmitry,
:) yeah you are right :)
but i meant using resharper openapi.
if in my plugin code i have derived a name eg. for a myusercontrol.cs i
want to switch to designer code (myusercontrol.designer.cs) using a plugin.
using this i can easily have a plugin to toggle between the two.
Can you help on that.
Regards
Irfan
>> Hi All,
>> How do i go to class if i have the name of the class as a string
>> cheers,
>> Irfan
1) You have to obtain ITypeElement for that given class name
PsiManager manager = PsiManager.GetInstance(solution);
IDeclarationsCache cache =
manager.GetDeclarationsCache(DeclarationsCacheScope.SolutionScope(solution,
true));
ITypeElement typeElement = cache.GetTypeElementByCLRName("System.Object");
2) Navigate to that element
Navigator.Navigate (typeElement, true);
--
Eugene Pasynkov
Developer
JetBrains, Inc
http://www.jetbrains.com
"Develop with pleasure!"
"Irfan Shah" <mail.urfi@gmail.com> wrote in message
news:596f23123e8c84ba09bd7603f@jetbrains.net...
>
Hello Irfan,
oops, sorry, I didn't pay attention to the newsgroup you post has appeared
in. Eugene has answered you in
another post. You also may want to inspect the IDeclarations of ITypeElement
(ITypeElement.Declarations)
and choose the ony that resides in the designer file (IDeclaration.GetContainingFile().ProjectItem
gives you
the IProjectItem where the declaration is located).
Regards,
Dmitry Shaporenkov
JetBrains, Inc
http://www.jetbrains.com
"Develop with pleasure!"
>> Hello Irfan,
>>
>> you can use Go To Type feature (ReSharper|Go To|Type or Ctrl-N
>> keyboard shortcut) for that.
>>
>> Regards,
>> Dmitry Shaporenkov
>> JetBrains, Inc
>> http://www.jetbrains.com
>> "Develop with pleasure!"
>>> Hi All,
>>> How do i go to class if i have the name of the class as a string
>>> cheers,
>>> Irfan