IDEA 8.0 API change
My IDEA 7.0.3 plugin is using
psiManager.findClass(String className, GlobalSearchScope scope)
as well as
new OpenFileDescriptor(PsiMethod)
Both methods aren't available anymore in IDEA 8.0 and I can't find any
documentation about what to use instead...
The source of the plugin can be found here:
http://lilith.svn.sourceforge.net/viewvc/lilith/trunk/lilith-idea-plugin/
Please help!
Joern.
Please sign in to leave a comment.
Hello Joern,
See here for the plugin migration guide:
http://www.jetbrains.net/confluence/display/IDEADEV/DianaPluginMigration+Guide
"new OpenFileDescriptor(PsiMethod)" shouldn't be necessary at all because
PsiMethod itself implements Navigatable, so you can call the navigation methods
on the PsiMethod directly.
--
Dmitry Jemerov
Development Lead
JetBrains, Inc.
http://www.jetbrains.com/
"Develop with Pleasure!"
Dmitry Jemerov wrote:
>> My IDEA 7.0.3 plugin is using
>> psiManager.findClass(String className, GlobalSearchScope scope)
>> as well as
>> new OpenFileDescriptor(PsiMethod)
>> Both methods aren't available anymore in IDEA 8.0 and I can't find any
>> documentation about what to use instead...
First of all, thank you for your quick response!
I fixed the PsiManager part, the link is very useful indeed.
I don't really understand your second suggestion, though.
My plugin is doing something quite simple: it opens the code
corresponding to a given StackTraceElement. I check all open Projects to
see if one of it contains the relevant sourcecode. Otherwise I just
stick with the binary one (i.e. class file).
In any case, I open the editor using
Editor editor = fileEditorManager.openTextEditor(fileDescriptor, true);
so I need the filedescriptor for a given PsiMethod, right?
Perhaps I'm just doing something horribly wrong ;) but this worked as
expected in 7.0.3...
What is the new way to get a filedescriptor for a given method?
Regards,
Joern.
Hello Joern,
=> My plugin is doing something quite simple: it opens the code
No. You can simply call:
psiMethod.navigate(true);
--
Dmitry Jemerov
Development Lead
JetBrains, Inc.
http://www.jetbrains.com/
"Develop with Pleasure!"
Dmitry Jemerov wrote:
>> corresponding to a given StackTraceElement. I check all open Projects
>> to
>> see if one of it contains the relevant sourcecode. Otherwise I just
>> stick with the binary one (i.e. class file).
>> In any case, I open the editor using
>> Editor editor = fileEditorManager.openTextEditor(fileDescriptor,
>> true);
>> so I need the filedescriptor for a given PsiMethod, right?
But I need the editor to execute the following code:
Editor editor = fileEditorManager.openTextEditor(fileDescriptor, true);
//System.out.println("editor: "+editor);
fileDescriptor.navigate(true);
if(editor!=null)
{
JComponent component = editor.getComponent();
// now I'll just do my best to focus the correct IDEA frame...
JFrame frame=resolveFrame(component);
if(frame!=null)
{
if((frame.getState() & Frame.ICONIFIED) != 0)
{
frame.setState(Frame.NORMAL);
}
frame.toFront();
}
component.requestFocusInWindow();
}
private JFrame resolveFrame(JComponent component)
{
Container c=component.getParent();
while(c!=null)
{
if(c instanceof JFrame)
{
return (JFrame) c;
}
c=c.getParent();
}
return null;
}
Simply calling (in my case) fileDescriptor.navigate(true); didn't do the
trick.
The reason for the above code is that I want to focus the correct IDEA
frame that's containing the code in question. I try to somewhat
remote-control idea with my plugin.
Regards, Joern.
That's what I'm doing in a similar situation:
Method method = ...;
method.navigate(true);
WindowManager.getInstance().suggestParentWindow(project).toFront();
Joern Huxhorn wrote:
>> Hello Joern,
>>
>> => My plugin is doing something quite simple: it opens the code
>>> corresponding to a given StackTraceElement. I check all open Projects
>>> to
>>> see if one of it contains the relevant sourcecode. Otherwise I just
>>> stick with the binary one (i.e. class file).
>>> In any case, I open the editor using
>>> Editor editor = fileEditorManager.openTextEditor(fileDescriptor,
>>> true);
>>> so I need the filedescriptor for a given PsiMethod, right?
>> No. You can simply call:
>> psiMethod.navigate(true);
>>
--
Martin Fuhrer
Fuhrer Engineering AG
http://www.fuhrer.com
Martin Fuhrer wrote:
Thank you very much, I'll try that!
Joern.