Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » JFace » Displaying Special Characters in JFace Error Dialog
Displaying Special Characters in JFace Error Dialog [message #551994] Tue, 10 August 2010 13:07 Go to next message
Aravindhan Annamalai is currently offline Aravindhan Annamalai
Messages: 89
Registered: July 2009
Location: Chennai
Member
Hi,

I am not able to display the "&" in the error dialog.

MessageDialog.openError(this.getShell(), "TITLE", "&");

When I try to execute,

MessageDialog.openError(this.getShell(), "TITLE", "&&&&");

It is displaying two characters in the dialog.

Is there any valid reason?

Regards, Aravind
Re: Displaying Special Characters in JFace Error Dialog [message #552139 is a reply to message #551994] Wed, 11 August 2010 04:36 Go to previous messageGo to next message
Prakash G.R. is currently offline Prakash G.R.
Messages: 621
Registered: July 2009
Senior Member
On 10/08/10 6:37 PM, Aravindhan.A wrote:
> Hi,
>
> I am not able to display the "&" in the error dialog.
>
> MessageDialog.openError(this.getShell(), "TITLE", "&");
>
> When I try to execute,
>
> MessageDialog.openError(this.getShell(), "TITLE", "&&&&");
>
> It is displaying two characters in the dialog.
>
> Is there any valid reason?

The message is displayed using a Label, which accepts mnemonic chars.
See Javadoc of Label.setText() for more details.

--
- Prakash
Platform UI Team, IBM

www.eclipse-tips.com
Re: Displaying Special Characters in JFace Error Dialog [message #552142 is a reply to message #551994] Wed, 11 August 2010 04:36 Go to previous messageGo to next message
Prakash G.R. is currently offline Prakash G.R.
Messages: 621
Registered: July 2009
Senior Member
On 10/08/10 6:37 PM, Aravindhan.A wrote:
> Hi,
>
> I am not able to display the "&" in the error dialog.
>
> MessageDialog.openError(this.getShell(), "TITLE", "&");
>
> When I try to execute,
>
> MessageDialog.openError(this.getShell(), "TITLE", "&&&&");
>
> It is displaying two characters in the dialog.
>
> Is there any valid reason?

The message is displayed using a Label, which accepts mnemonic chars.
See Javadoc of Label.setText() for more details.

--
- Prakash
Platform UI Team, IBM

www.eclipse-tips.com
Re: Displaying Special Characters in JFace Error Dialog [message #552146 is a reply to message #552142] Wed, 11 August 2010 05:28 Go to previous messageGo to next message
Aravindhan Annamalai is currently offline Aravindhan Annamalai
Messages: 89
Registered: July 2009
Location: Chennai
Member
Hi Prakash,

I forgot tht, the & character is used for mnemonics (shortcuts) when we use it in labels, and internally MessageDialog class uses.. Label.setText() to display it.

Instead they should have used a Text or TextArea to display it ... Smile

Thanks Prakash

Regards, Aravind
Re: Displaying Special Characters in JFace Error Dialog [message #931616 is a reply to message #552146] Wed, 03 October 2012 11:04 Go to previous message
Jitendra Pandey is currently offline Jitendra Pandey
Messages: 1
Registered: October 2012
Junior Member
Hi Prakash, Arvind,

Special character "&" can be displayed in label using unicode value of "&" as

Label.setText("\u0026\u0026");

Don't use Label.setText("\u0026") as it will accept it as mnemonic character.

Thanks & Regards,
Jitendra Pandey
Previous Topic:Reevaluate syntax highlighting for entire document
Next Topic:Simple export in SVG ?
Goto Forum:
  


Current Time: Tue Oct 21 04:03:25 GMT 2014

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

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