Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Rich Client Platform (RCP) » How to set title in RCP application's View?(Invalid behaviour when using setPartName to change the View name displayed in an Eclipse-RCP applicaiton.)
How to set title in RCP application's View? [message #506635] Fri, 08 January 2010 07:55 Go to next message
Tanuj  is currently offline Tanuj
Messages: 1
Registered: January 2010
Junior Member
I am developing an RCP application based on Eclipse and use i18n to load message resources. My requirement is that I need to change the View title based on locale/i18n. I am using setPartName to do that.

It does change it, but the issue is that it shows the title-changes only after the view has been clicked. So, in a way, it first displays the previously used title for the view [I am using WorkbenchPlugin.getDefault().getDataLocation() to use/set workspace settings].

Use cases:

- English user opens the application and sees the View titles in English. On close of the application, his settings are saved including the views that were opened.

- Japanese user (changed Locale) now opens the application, and application uses same workspace settings as for the English user, so opens the same views as opened previously by the English user. But he initially sees the View titles in English. Only after he clicks on the View titles, does he sees them in Japanese.=>ERROR (Expected: a click should not have been necessary to see the title in Japanese)

Please suggest a solution!!

Thanks
Re: How to set title in RCP application's View? [message #526047 is a reply to message #506635] Thu, 08 April 2010 11:13 Go to previous messageGo to next message
lalitha Missing name is currently offline lalitha Missing name
Messages: 29
Registered: July 2009
Junior Member
I am having the same issue. Did you ever get a solution for this issue.

Appreciate your help.

Thanks,
Re: How to set title in RCP application's View? [message #526067 is a reply to message #526047] Thu, 08 April 2010 11:35 Go to previous messageGo to next message
Paul Webster is currently offline Paul Webster
Messages: 6859
Registered: July 2009
Location: Ottawa
Senior Member

lalitha wrote:
> I am having the same issue. Did you ever get a solution for this issue.

AFAIK the best you can do is reset your perspective in your
postStartup() method. There are open bugs for this like

https://bugs.eclipse.org/bugs/show_bug.cgi?id=191037
https://bugs.eclipse.org/bugs/show_bug.cgi?id=202172


PW

--
Paul Webster
http://wiki.eclipse.org/Platform_Command_Framework
http://wiki.eclipse.org/Command_Core_Expressions
http://wiki.eclipse.org/Menu_Contributions
http://wiki.eclipse.org/Menus_Extension_Mapping
http://help.eclipse.org/galileo/index.jsp?topic=/org.eclipse .platform.doc.isv/guide/workbench.htm


Re: How to set title in RCP application's View? [message #538512 is a reply to message #526067] Mon, 07 June 2010 15:43 Go to previous message
lalitha Missing name is currently offline lalitha Missing name
Messages: 29
Registered: July 2009
Junior Member
Thanks for the help. I used your suggestion of resetting the perspective and did a little more.

I got hold of all the perspective and reset them. I also had saved the views before resetting them and then displayed the views again after resetting the perspective.
Here is my code:

public void postStartup(){
super.postStartup();
if (UserLocale.hasLocaleChangedForClient()){
IViewReference [] viewRefs = getCurrentViews();

IPerspectiveDescriptor originalPd = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActi vePage().getPerspective();

IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActi vePage();
IPerspectiveDescriptor[] pds = page.getOpenPerspectives();
for (IPerspectiveDescriptor pd : pds ){
if (page != null){
page.setPerspective(PlatformUI.getWorkbench().getPerspective Registry().findPerspectiveWithId(pd.getId()));
page.resetPerspective();
}
}
page.setPerspective(originalPd);
showViews(viewRefs);
}
}

private IViewReference[] getCurrentViews() {
IViewReference[] viewRefs = PlatformUI.getWorkbench().
getActiveWorkbenchWindow().getActivePage().getViewReferences ();
return viewRefs;
}

private void showViews(IViewReference[] viewRefs) {
for (IViewReference viewRef : viewRefs) {
String id = viewRef.getId();
String sid = viewRef.getSecondaryId();
try {

PlatformUI.getWorkbench().getActiveWorkbenchWindow()
.getActivePage().showView(id, sid,
IWorkbenchPage.VIEW_VISIBLE);
} catch (PartInitException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
Previous Topic:size of WorkbenchWindowControlContribution
Next Topic:RCP + Java Web Start crash when open some dialogs
Goto Forum:
  


Current Time: Wed Aug 27 23:32:51 EDT 2014

Powered by FUDForum. Page generated in 0.02355 seconds