Skip to main content



      Home
Home » Eclipse Projects » Eclipse Platform » How to get project information in a plugin!
How to get project information in a plugin! [message #166710] Sat, 06 December 2003 00:42 Go to next message
Eclipse UserFriend
Originally posted by: duan-yonghong.sjtu.edu.cn

Hi,everyone:
Recently, I am busying develope a eclipse plugin. I am trying to realize
a function as follow: When you click a project name in Package explore, I
should get the information about which project user has clicked. I am
wondering how
to get the IProject object. What should I do?
Thank you!

Duanyh
SJTU
Re: How to get project information in a plugin! [message #166737 is a reply to message #166710] Sat, 06 December 2003 04:21 Go to previous messageGo to next message
Eclipse UserFriend
Hi Duanyh,

1) register an ISelectionListener to catch the clicks
2) check the type of the clicked object
(for example: IResource or IJavaElement)
3) call appropriate method on the object
(for example: IResource.getProject()
or
IJavaElement.getJavaProject().getProject())



duanyh schrieb:

> Hi,everyone:
> Recently, I am busying develope a eclipse plugin. I am trying to realize
> a function as follow: When you click a project name in Package explore, I
> should get the information about which project user has clicked. I am
> wondering how
> to get the IProject object. What should I do?
> Thank you!
>
> Duanyh
> SJTU
>
>
>
Re: How to get project information in a plugin! [message #167007 is a reply to message #166737] Sun, 07 December 2003 21:25 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: duan-yonghong.sjtu.edu.cn

Hi Christian Koppen,
Thank you for your suggestion!
But could you tell me where I can find a simple example process about
what you said?
Thanks again.

Duanyh

"Christian Koppen" <koppen@fmi.uni-passau.de>
??????:bqs6tg$eil$1@eclipse.org...
> Hi Duanyh,
>
> 1) register an ISelectionListener to catch the clicks
> 2) check the type of the clicked object
> (for example: IResource or IJavaElement)
> 3) call appropriate method on the object
> (for example: IResource.getProject()
> or
> IJavaElement.getJavaProject().getProject())
>
>
>
> duanyh schrieb:
>
> > Hi,everyone:
> > Recently, I am busying develope a eclipse plugin. I am trying to
realize
> > a function as follow: When you click a project name in Package explore,
I
> > should get the information about which project user has clicked. I am
> > wondering how
> > to get the IProject object. What should I do?
> > Thank you!
> >
> > Duanyh
> > SJTU
> >
> >
> >
>
Re: How to get project information in a plugin! [message #167025 is a reply to message #166737] Sun, 07 December 2003 22:32 Go to previous message
Eclipse UserFriend
Originally posted by: duan-yonghong.sjtu.edu.cn

Hi, Chiristian Koppen,
After I went through org.eclipse.ui(Eclipse Platform API Specification)
, I
noticed that I should get an ISelectionService object to regist
ISelectionListener
objects. And I find out that ISelectionListener can be gotten by coding as
follow:
IWorkbench workbench = PlatformUI.getWorkbench();
IWorkbenchWindow workbenchWindow =
workbench.getActiveWorkbenchWindow();
ISelectionService selectionServiece =
workbenchWindow.getSelectionService() ;

But I don't know how to associate the workbenchWindow with package
explorer view.
How can I know the current active window is package explorer ? And how can
I get
the package explorer view's IWorkbenchWindow object? Is this necessary?

Thank you!

Duanyh
SJTU





"Christian Koppen" <koppen@fmi.uni-passau.de>
??????:bqs6tg$eil$1@eclipse.org...
> Hi Duanyh,
>
> 1) register an ISelectionListener to catch the clicks
> 2) check the type of the clicked object
> (for example: IResource or IJavaElement)
> 3) call appropriate method on the object
> (for example: IResource.getProject()
> or
> IJavaElement.getJavaProject().getProject())
>
>
>
> duanyh schrieb:
>
> > Hi,everyone:
> > Recently, I am busying develope a eclipse plugin. I am trying to
realize
> > a function as follow: When you click a project name in Package explore,
I
> > should get the information about which project user has clicked. I am
> > wondering how
> > to get the IProject object. What should I do?
> > Thank you!
> >
> > Duanyh
> > SJTU
> >
> >
> >
>
Previous Topic:CheckboxTreeViewer and standard behavior
Next Topic:Custom Install Handler
Goto Forum:
  


Current Time: Mon May 12 01:01:31 EDT 2025

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

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

Back to the top