exactly for that. In 2.x you can use VS's automation API from ReSharper plugin as follows (note that you will have to add a reference to EnvDTE assembly to your project):
_DTE dte = VSShell.Instance.ApplicationObject; dte.ItemOperations.OpenFile(fileName, Constants.vsViewKindTextView); // get ReShaper's project item IProjectFile projectFile = SolutionManager.Instance.CurrentSolution.FindProjectItemByLocation(new FileSystemPath(fileName)) as IProjectFile;
exactly for that. In 2.x you can use VS's automation API from ReSharper plugin as follows (note that you will have to add a reference to EnvDTE assembly to your project): _DTE dte = VSShell.Instance.ApplicationObject; dte.ItemOperations.OpenFile(fileName, Constants.vsViewKindTextView); // get ReShaper's project item IProjectFile projectFile = SolutionManager.Instance.CurrentSolution.FindProjectItemByLocation(new FileSystemPath(fileName)) as IProjectFile; Dmitry Shaporenkov JetBrains, Inc http://www.jetbrains.com "Develop with pleasure!"
>> Hi >> >> I have a string containing a file name, e.g. "c:\temp\myfile.txt". It >> is not part of the current project. >> >> How do I open this file in the text editor? >> >> Thanks >> --Jakob
Hello Jakob,
in 3.0 we've added an overloaded method
EditorManager.OpenProjectFile(string fileName, bool activate)
exactly for that. In 2.x you can use VS's automation API from ReSharper plugin
as follows (note that you will have to
add a reference to EnvDTE assembly to your project):
_DTE dte = VSShell.Instance.ApplicationObject;
dte.ItemOperations.OpenFile(fileName, Constants.vsViewKindTextView);
// get ReShaper's project item
IProjectFile projectFile = SolutionManager.Instance.CurrentSolution.FindProjectItemByLocation(new
FileSystemPath(fileName)) as IProjectFile;
Dmitry Shaporenkov
JetBrains, Inc
http://www.jetbrains.com
"Develop with pleasure!"
Hello Dmitry,
It works - great!
Thanks
--Jakob
>> Hi
>>
>> I have a string containing a file name, e.g. "c:\temp\myfile.txt". It
>> is not part of the current project.
>>
>> How do I open this file in the text editor?
>>
>> Thanks
>> --Jakob