Bug 125597 - [Progress] ampersand character interpreted incorrectly (mnemonic) in Job's dialog (at least not consistent)
Summary: [Progress] ampersand character interpreted incorrectly (mnemonic) in Job's di...
Status: NEW
Alias: None
Product: Platform
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 3.1.1   Edit
Hardware: PC Windows XP
: P5 normal (vote)
Target Milestone: ---   Edit
Assignee: Platform UI Triaged CLA
QA Contact:
URL:
Whiteboard:
Keywords: helpwanted
Depends on:
Blocks:
 
Reported: 2006-01-27 20:08 EST by BJ Jeong CLA
Modified: 2019-09-06 16:18 EDT (History)
0 users

See Also:


Attachments
double ampersands (9.82 KB, image/png)
2006-01-27 20:16 EST, BJ Jeong CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description BJ Jeong CLA 2006-01-27 20:08:24 EST
ampersand character interpreted incorrectly in Job's dialog (at least not consistent)

If a job name contains an ampersand, it shows up fine in the job progress dialog title bar (even though it's kind of ugly looking), but it is interpreted as a mnemonic in the main message area. Having double ampersands does the trick in the main message area, but then the title bar area is not happy. Please see the attachment "double ampersands".
Comment 1 BJ Jeong CLA 2006-01-27 20:16:52 EST
Created attachment 33750 [details]
double ampersands

The job name is set as "R&&e\&t&rieving Hosts to Host View" in this dialog.
Notice that the double ampersands are interpreted differently between the title bar and the message area. The escaped ampersand is also interpretted differently. A plain looking ampersand is also interpreted differently. Only consistency seems to be not being consistent.
Comment 2 Steve Northover CLA 2006-01-31 19:45:59 EST
S
Comment 3 Steve Northover CLA 2006-01-31 19:47:53 EST
I realize that this is inconsistent but no mnemonics are not supported in the title bar on any platform that I know about.  Applications need to know that they are setting text in a title bar.
Comment 4 BJ Jeong CLA 2006-01-31 20:00:13 EST
I should have posed the problem more clearly.
I am not saying mnemonics are needed in the title bar or in the message area.
What I am struggling with is why ampersand is not taken literally in the message area. I don't see any purpose of supporting mnemonics in a plan text control (it's not like a menu item or command button).

The inconsistency was just raised to point out that there is no good way of overcoming the problem; I want to display an ampersand character in the plan text area - double ampersands do the trick in the message area, but they mess up the title bar text. I set the job name once and the job name is displayed in the message area and the title bar automatically. I am not setting two texts differently.

I think this is clearly a bug in my opinion. Please reconsider. Thanks.


Comment 5 Steve Northover CLA 2006-02-01 10:32:42 EST
Sorry to keep WONTFIX'ing you.  An ampersand in a Label control (the thing you call "plan text control"), causes focus to go to the following control.  You can try this out on XP in the Properties dialog.  Invoke it from the desktop menu, give focus to the OK button (by stroking it) and try typing Alt+T.  Focus will go to the combo box that is below the 'Theme:' label widget.
Comment 6 BJ Jeong CLA 2006-02-21 16:21:02 EST
I follow the explanation in comment #5.
But the problem is still there, and I tried to come up with a workaround.
It turned out that it's simply not easy if not possible.

The job name is internally used in the title bar as well as in the initial task message (that is, until a job monitor updates it). Even if I escape '&' with "&& " in the task message in the monitor.beginTask("..&&...", ...), the problem still exists because the main UI thread constructs the jobs dialog and shows the initial task message constructed from the job name. This is the case, until the job run method executes beingTask method (which happens to run in a worker thread, therefore, thread contention with the task message update).
 
I paste some code I visited below (I used C++ notation to show the class namespace).

protected void ProgressMonitorJobsDialog::configureShell(Shell shell) {
 super.configureShell(shell);
 shell.setText(job.getName());    <=== job dialog title bar is set here
}

protected Control ProgressMonitorJobsDialog::createDialogArea(Composite parent){
 Control area = super.createDialogArea(parent);
 //Give the job info as the initial details
 getProgressMonitor().setTaskName(      <==== task name is set here
  ProgressManager.getInstance().getJobInfo(this.job).getDisplayString());
 return area;
}

String TaskInfo::getDisplayString() {
if (totalWork == IProgressMonitor.UNKNOWN)
 return unknownProgress();
if (taskName == null) {
 return getDisplayStringWithoutTask();
} else {
 String[] messageValues = new String[3];
 messageValues[0] = String.valueOf(getPercentDone());
 messageValues[1] = jobInfo.getJob().getName();
 messageValues[2] = taskName;
 return NLS.bind(ProgressMessages.JobInfo_DoneMessage, messageValues); 
}

private String TaskInfo::unknownProgress() {
 if (taskName == null) {
  return jobInfo.getJob().getName();
 } else {
  String[] messageValues = new String[2];
  messageValues[0] = jobInfo.getJob().getName();
  messageValues[1] = taskName;
  return NLS.bind(ProgressMessages.JobInfo_UnknownProgress, messageValues);
 }
}

I tried to override the job monitor or the job dialog, and it appears to be not possible to do it. Is there any way of providing (extending from the ones Ecipse implemented) custom job monitor or job dialog?

My thought is that the task message in Job's dialog should be implemented not with Label control, but perhaps with more generic text or form controls. After all, the task message is not really a label, but a rather descriptive message. Is this something Ecipse guys can consider in the future releases? At the moment, there seems no good way of overcoming the problem.
Comment 7 Steve Northover CLA 2006-02-21 16:50:24 EST
Reopening for investigation by Job owners.
Comment 8 Eric Moffatt CLA 2006-02-27 10:09:17 EST
Over to you Tod...
Comment 9 Susan McCourt CLA 2009-07-09 19:37:22 EDT
As per http://wiki.eclipse.org/Platform_UI/Bug_Triage_Change_2009
Comment 10 Eclipse Webmaster CLA 2019-09-06 16:18:15 EDT
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet.

If you have further information on the current state of the bug, please add it. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant.