私はSWTアプリケーション(シェル)をいくつかのコンポジットで持っています:メニューバーはコンポジット内にあり、さまざまな要素を持つ2番目のコンポジットもあります。
メニュー バーのアクション リスナーから、2 番目のコンポジットの要素にアクセスしたいと思います。
現在、これを行うことでコンポジットを見つけています。より良い/より簡単な方法はありますか?
Control[] appComposites;
appComposites = parent.getChildren();
Composite remoteFile;
for(int i=0; i<appComposites.length;i++){
if(appComposites[i].toString().compareTo("RemoteFile {}") == 0){
remoteFile = (Composite) appComposites[i];
}
}
//Now I must make another loop inside remoteFile to find the element that I need ...