2014-01-08 49 views
0

我正在使用ProgressMonitorDialog來顯示長時間運行過程的進度對話框。如何設置ProgressMonitorDialog的標題

Shell shell = HandlerUtil.getActiveWorkbenchWindow(event).getShell(); 
shell.setText("HTML result loading"); 
shell.update(); 
ProgressMonitorDialog dialog = new ProgressMonitorDialog(shell); 
dialog.setCancelable(true); 
dialog.run(true, true, new IRunnableWithProgress() { 
    @Override 
    public void run(IProgressMonitor monitor) throws InterruptedException { 
     monitor.beginTask(ResourceAssistant.getString(ViewAsHTML.class, "loadingHTMLResults"), //$NON-NLS-1$ 
       IProgressMonitor.UNKNOWN); 
     while (!thread.getState().equals(Thread.State.TERMINATED)) { 
      if (monitor.isCanceled()) { 
       setCanceled(true); 
       break; 
      } 
     } 
     monitor.done(); 
    } 
}); 

我想更改進度對話框的標題。默認情況下它顯示爲「進度信息」。我該如何改變這一點。有什麼想法嗎。

回答

5

標題在configureShell方法設置,您可以覆蓋:

protected void configureShell(final Shell shell) 
{ 
    super.configureShell(shell); 

    shell.setText("your title"); 
}