2009-05-01 8 views
0

私はプラグインの開発に使用する裸の骨のアプリを作成しようとしています。私はワークベンチは必要ありません。asyncExecイベントはいつ開始されますか?

以下はtitle1ダイアログが表示されますが、title2は決して表示されません。

2番目のものを表示するには何が必要ですか?

public class BareBonesApp extends AbstractApplication 
{ 
    public Object start(IApplicationContext context) throws Exception 
    { 
     Display display = PlatformUI.createDisplay(); 

     MessageDialog.openWarning(null, "title1", "message1"); 

     display.asyncExec(new Runnable() 
     { 
      public void run() 
      { 
       MessageDialog.openWarning(null, "title2", "message2"); 
      } 
     }); 

     return null; 
    } 
} 

答えて

3

ディスプレイには、sync、async、または特定の時間(Display.timerExec)で実行するランナブルのキューがあります。 Display.readAndDispatchがすべてのイベントをディスパッチすると、まずsync-queueの実行可能ファイルが実行され、async-queueが空になり、その後、due timerExecの実行可能ファイルが実行されます。

Display.syncExecとDisplay.asyncExecの唯一の違いは、syncExecメソッドがDisplayスレッドによって実行される実行可能ファイルを待つことです。 Display.asyncExecは単純に実行可能ファイルをキューに入れ、処理を続けます。だから、

「TITLE2は、」私はあなたのアプリケーションが表示ループを実行していないasume、表示されません場合:

Display display = new Display(); // this thread should be the only one that creates a display instance 
while (someCondition) { 
    if (!display.readAndDispatch()) 
    display.sleep(); 
} 
関連する問題