Skip to main content



      Home
Home » Language IDEs » Java Development Tools (JDT) » Call "Open type" dialog from own plugin, Open class in workspace-editor in own p
Call "Open type" dialog from own plugin, Open class in workspace-editor in own p [message #258567] Tue, 10 February 2009 07:56 Go to next message
Eclipse UserFriend
Hi to everyone,

I am completely new to Eclipse plugin-development and have two different
problems to solve:

1. I want to call the "open type" dialog from my own plugin, where I have
a textfield to edit a classname.
The user should get the opportunity to search the class in the eclipse
given way.....

2. I want to easily navigate from my own plugin (it's an editor-plugin) to
the sourcecode of an class.
That means, if already opened in the editor, this one editor must be
opened. If the source-file is not yet opened in any editor a new editor
with this file should open.


Can you help me solving my problems?
Waiting for your solutions....

Bye Markus
Re: Call "Open type" dialog from own plugin, Open class in workspace-editor in own p [message #258571 is a reply to message #258567] Tue, 10 February 2009 08:29 Go to previous messageGo to next message
Eclipse UserFriend
Markus Oley wrote:
> Hi to everyone,
>
> I am completely new to Eclipse plugin-development and have two
> different problems to solve:
>
> 1. I want to call the "open type" dialog from my own plugin, where I
> have a textfield to edit a classname.
> The user should get the opportunity to search the class in the eclipse
> given way.....
See org.eclipse.jdt.ui.JavaUI.createTypeDialog(*)
>
>
> 2. I want to easily navigate from my own plugin (it's an
> editor-plugin) to the sourcecode of an class.
> That means, if already opened in the editor, this one editor must be
> opened. If the source-file is not yet opened in any editor a new
> editor with this file should open.
See org.eclipse.ui.ide.IDE.openEditor(*)

Dani
>
>
> Can you help me solving my problems?
> Waiting for your solutions....
>
> Bye Markus
>
Re: Call "Open type" dialog from own plugin, Open class in workspace-editor in own p [message #258575 is a reply to message #258571] Tue, 10 February 2009 09:28 Go to previous messageGo to next message
Eclipse UserFriend
Hello Dani,

zu 1: JavaUI wird mir nicht angeboten, muss ich da irgendwelche Jars noch
in den Klassenpfad einbinden?

zu 2: See org.eclipse.ui.ide.IDE.openEditor(*)... wie bekomme ich da ein
IFile an die Hand?
Ich habe den Klassennamen incl. Package in der Form xyz.ui.core.Klasse.

Vielen Dank
für Deine Hilfe
Re: Call "Open type" dialog from own plugin, Open class in workspace-editor in own p [message #258591 is a reply to message #258575] Tue, 10 February 2009 11:38 Go to previous messageGo to next message
Eclipse UserFriend
Markus Oley wrote:
> Hello Dani,
> zu 1: JavaUI wird mir nicht angeboten, muss ich da irgendwelche Jars
> noch in den Klassenpfad einbinden?
You need to require the org.eclipse.jdt.ui bundle.
> zu 2: See org.eclipse.ui.ide.IDE.openEditor(*)... wie bekomme ich da
> ein IFile an die Hand? Ich habe den Klassennamen incl. Package in der
> Form xyz.ui.core.Klasse.
I hope you use org.eclipse.jdt.core. If so your class should be an
ITypeRoot and you simple call getResource() on the ITypeRoot. Otherwise
you need to do a Java search to find the type root first.

Dani
> Vielen Dank
> für Deine Hilfe
>
Re: Call "Open type" dialog from own plugin, Open class in workspace-editor in own p [message #258597 is a reply to message #258591] Tue, 10 February 2009 14:08 Go to previous messageGo to next message
Eclipse UserFriend
Hi,


>>You need to require the org.eclipse.jdt.ui bundle.
Sorry, I'm completely new to PDE, is there somewhere a documentation or an
example, I can see what to do?

>I hope you use org.eclipse.jdt.core. If so your class should be an ITypeRoot
and you simple call >getResource() on the ITypeRoot. Otherwise you need to do
a Java search to find the type root first.
The problem is, that the file I need to open is not the file I edit in the
editor.
I want to open a classfile, I only have the classname from like
x.y.z.Class as String.
So I have to make a Java search? What do I have to call?

Thank you for your help, Markus
Re: Call "Open type" dialog from own plugin, Open class in workspace-editor in own p [message #258620 is a reply to message #258597] Wed, 11 February 2009 03:19 Go to previous messageGo to next message
Eclipse UserFriend
Markus Oley wrote:
> Hi,
>
>>> You need to require the org.eclipse.jdt.ui bundle.
> Sorry, I'm completely new to PDE, is there somewhere a documentation
> or an example, I can see what to do?
>
>> I hope you use org.eclipse.jdt.core. If so your class should be an
>> ITypeRoot
> and you simple call >getResource() on the ITypeRoot. Otherwise you
> need to do a Java search to find the type root first.
> The problem is, that the file I need to open is not the file I edit in
> the editor. I want to open a classfile, I only have the classname from
> like x.y.z.Class as String. So I have to make a Java search? What do I
> have to call?
I suggest you first go and read Help > Help Contents > JDT Plug-in
Developer's Guide.

Dani
>
> Thank you for your help, Markus
>
Re: Call "Open type" dialog from own plugin, Open class in workspace-editor in own p [message #258624 is a reply to message #258620] Wed, 11 February 2009 09:42 Go to previous messageGo to next message
Eclipse UserFriend
Hello again,


thank you, that's exactly what I was looking for......

I try it, perhaps I'll call back or it works...

Greetings
Markus
Re: Call "Open type" dialog from own plugin, Open class in workspace-editor in own p [message #258693 is a reply to message #258620] Fri, 13 February 2009 08:26 Go to previous messageGo to next message
Eclipse UserFriend
Hi again,

I tried to get a IFile from SearchEngine, but didn't get.....
Seems it doesn't work in this way.....

I have a Classname org.irgendwas.xyz.Class as String and want to find a
IFile which I can open in editor.
But the SearchEngine has no methods to get a IFile, I guess.

Do you have another suggestion?

Greetings
Markus
Re: Call "Open type" dialog from own plugin, Open class in workspace-editor in own p [message #258866 is a reply to message #258693] Tue, 24 February 2009 07:59 Go to previous message
Eclipse UserFriend
Hello,

OK, I found a solution.... it's much easier.......

IJavaProject javaproject = JavaCore.create(project);
try {
IType findType = javaproject.findType(classname);
JavaUI.openInEditor(findType);
} catch (JavaModelException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
} catch (PartInitException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}

Thanx by the way
Markus
Previous Topic:Preferences vs. IPreferenceStore
Next Topic:How to generate a serialVersionUID field and add to AST
Goto Forum:
  


Current Time: Fri Apr 18 09:25:53 EDT 2025

Powered by FUDForum. Page generated in 0.03130 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top