在某些情况下,我必须在单个状态栏上显示更多状态。当我尝试阅读消息并合并新消息(附加)时,无法使用IStatusLineManager获取现有消息。
答案 0 :(得分:0)
IStatusLineManager statusline=w.getStatusLineManager();
statusline.update(true);
StatusLineContributionItem geographicalStatusLineItem = null;
for (IContributionItem item : statusline.getItems()) {
if (item instanceof StatusLineContributionItem) {
geographicalStatusLineItem = (StatusLineContributionItem) item;
}
}
// create the status line
if (geographicalStatusLineItem == null) {
geographicalStatusLineItem = new StatusLineContributionItem("SelfTimeContributionItem");
geographicalStatusLineItem.setText("Test");
statusline.add(geographicalStatusLineItem);
}
geographicalStatusLineItem.setText("Test");