Bug 549820 - Programmatically set keyboard focus on View Title
Summary: Programmatically set keyboard focus on View Title
Status: NEW
Alias: None
Product: Platform
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 3.8.2   Edit
Hardware: PC Windows 10
: P3 enhancement with 1 vote (vote)
Target Milestone: ---   Edit
Assignee: Platform-UI-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords: helpwanted
Depends on:
Blocks:
 
Reported: 2019-08-06 12:34 EDT by Naveenchandra Patil CLA
Modified: 2020-02-27 05:18 EST (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Naveenchandra Patil CLA 2019-08-06 12:34:42 EDT
Hi,

We need a way to set the focus on a view title programmatically. This discussion is the continuation of https://bugs.eclipse.org/bugs/show_bug.cgi?id=5684 where I had requested a way to handle CTRL + F7 feature.

I was suggested to ask this question in https://accounts.eclipse.org/mailing-list/platform-dev but I got a response stating bugzilla should be the better to get the answer (see https://www.eclipse.org/forums/index.php/m/1810142/?srch=set+focus+view+title#msg_1810142)

So here is what I need. Whenever user press CTRL + F7 or any other means of short cut to switch the view, I should be able to programmatically set the keyboard focus on the selected view title.

We tried called PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActivePart().setFocus().

But this seems to call the setFocus method of the respective ViewPart class and allows the user to set focus on desired child control. 

I want focus to be on the view title itself.

Thanks,
Naveen
Comment 1 Naveenchandra Patil CLA 2019-08-14 03:29:05 EDT
Hi Team,

This is one of the highly required implementation for us. Can you please take some time and let us know if we can set the focus on view title programmatically ?

I believe we should have a way to set the focus on title as the title receives focus from Keyboard when we press tab from its previous focused control.
Comment 2 Andrey Loskutov CLA 2019-08-14 03:33:16 EDT
@Naveen: this is not a bug, but question (or enhancement at most), and usually one should ask on the forum / mailing list, and do not use bugzilla for asking questions.

(In reply to Naveen Rocks from comment #1)
> let us know if we can set the focus on view title
> programmatically ?

You can use low level SWT code to do whatever you want, but I guess you want some API to do that. If this is true, there is no API doing this at the moment.
Comment 3 Naveenchandra Patil CLA 2019-08-14 03:38:43 EDT
(In reply to Andrey Loskutov from comment #2)
> @Naveen: this is not a bug, but question (or enhancement at most), and
> usually one should ask on the forum / mailing list, and do not use bugzilla
> for asking questions.
> 
> (In reply to Naveen Rocks from comment #1)
> > let us know if we can set the focus on view title
> > programmatically ?
> 
> You can use low level SWT code to do whatever you want, but I guess you want
> some API to do that. If this is true, there is no API doing this at the
> moment.

Thank You for the response.

As I had mentioned in description I first reached to mailing list, but was directed to bugzilla again (sorry for raising concern here)

2 questions:

1. Do we have any plans to provide a API if we dont have one ? 
2. What will be the impact on the application if we use write platform level code to achieve this ?
Comment 4 Naveenchandra Patil CLA 2019-12-31 06:24:27 EST
(In reply to Andrey Loskutov from comment #2)
> @Naveen: this is not a bug, but question (or enhancement at most), and
> usually one should ask on the forum / mailing list, and do not use bugzilla
> for asking questions.
> 
> (In reply to Naveen Rocks from comment #1)
> > let us know if we can set the focus on view title
> > programmatically ?
> 
> You can use low level SWT code to do whatever you want, but I guess you want
> some API to do that. If this is true, there is no API doing this at the
> moment.

Hi Andrey,

Can you please provide me some code snippet (low level SWT code) which I could to set the focus on View title ?
Comment 5 Naveenchandra Patil CLA 2020-02-27 03:45:41 EST
Any help here? Setting the keyboard focus on the title bar programmatically is a must and should feature for us.
Comment 6 Andrey Loskutov CLA 2020-02-27 04:43:50 EST
(In reply to Naveen Rocks from comment #5)
> Any help here? Setting the keyboard focus on the title bar programmatically
> is a must and should feature for us.

If this is the case, consider to contribute a patch. This is probably the fastest way you can solve your problem, nobody else seem to be interested in this feature. See https://wiki.eclipse.org/Platform/How_to_Contribute
Comment 7 Naveenchandra Patil CLA 2020-02-27 05:08:07 EST
(In reply to Andrey Loskutov from comment #6)
> (In reply to Naveen Rocks from comment #5)
> > Any help here? Setting the keyboard focus on the title bar programmatically
> > is a must and should feature for us.
> 
> If this is the case, consider to contribute a patch. This is probably the
> fastest way you can solve your problem, nobody else seem to be interested in
> this feature. See https://wiki.eclipse.org/Platform/How_to_Contribute

Thanks for the suggestion. This might be the only solution. To start with, can you please point me to the code projects where I can make the changes if you already know.
Comment 8 Andrey Loskutov CLA 2020-02-27 05:18:26 EST
(In reply to Naveen Rocks from comment #7)
> To start with,
> can you please point me to the code projects where I can make the changes if
> you already know.

Clone the repo from here
https://git.eclipse.org/r/platform/eclipse.platform.ui
and choose the projects you plan to change - you will see which do you really need only after some debugging work. Of course you can import all of them if you like.