Need selected items in Project view

Hi,

I need to know which files are selected in the Project view. I tried
implementing SelectionChangeListener in a class that extends AnAction but
this does not help.
SelectionEvent, SelectionListener,SelectionModel are used for selection
changes on editor.
Any idea what I should be using in case of Project view to get the selected
items?

~Priya


2 comments

Hello Priya,

P> I need to know which files are selected in the Project view. I tried
P> implementing SelectionChangeListener in a class that extends AnAction
P> but
P> this does not help.
P> SelectionEvent, SelectionListener,SelectionModel are used for
P> selection
P> changes on editor.
P> Any idea what I should be using in case of Project view to get the
P> selected
P> items?

Use the following code in your action class:
VirtualFile[] selectedFiles = (VirtualFile[]) e.getDataContext().getData(DataConstants.VIRTUAL_FILE_ARRAY)

--
Dmitry Jemerov
Software Developer
JetBrains, Inc.
http://www.jetbrains.com
"Develop with pleasure!"


0

thanks a lot...it works :)

"Dmitry Jemerov (JetBrains)" <yole@jetbrains.com> wrote in message
news:83ca25fd2629548c7ff77647512a0@news.intellij.net...

Hello Priya,

>

P> I need to know which files are selected in the Project view. I tried
P> implementing SelectionChangeListener in a class that extends AnAction
P> but
P> this does not help.
P> SelectionEvent, SelectionListener,SelectionModel are used for
P> selection
P> changes on editor.
P> Any idea what I should be using in case of Project view to get the
P> selected
P> items?

>

Use the following code in your action class:
VirtualFile[] selectedFiles = (VirtualFile[])

e.getDataContext().getData(DataConstants.VIRTUAL_FILE_ARRAY)
>

--
Dmitry Jemerov
Software Developer
JetBrains, Inc.
http://www.jetbrains.com
"Develop with pleasure!"

>
>


0

Please sign in to leave a comment.