`

PerspectiveBar是可以更新的,改变text。

 
阅读更多
private void updatePerspectiveBarText() {
    IWorkbenchWindow activeWorkbenchWindow = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
    
    PerspectiveBarManager barManager = ((WorkbenchWindow)activeWorkbenchWindow).getPerspectiveBar();
    
    if(barManager != null) {
        barManager.removeAll();

        String id = GlblConst.STANDARD_PERSPECTIVE_ID;
        IPerspectiveDescriptor perspectiveDescriptro = WorkbenchPlugin.getDefault().getPerspectiveRegistry().findPerspectiveWithId(id);
        PerspectiveDescriptor newOne = new PerspectiveDescriptor(id, TextResource.get("view_ID10"), (PerspectiveDescriptor)perspectiveDescriptro);
        PerspectiveBarContributionItem item=new PerspectiveBarContributionItem(newOne, activeWorkbenchWindow.getActivePage());
        
        barManager.add(item);
        
        perspectiveDescriptro = WorkbenchPlugin.getDefault().getPerspectiveRegistry().findPerspectiveWithId(GlblConst.CLASSIC_PERSPECTIVE_ID);
        newOne = new PerspectiveDescriptor(GlblConst.CLASSIC_PERSPECTIVE_ID, TextResource.get("view_ID9"), (PerspectiveDescriptor)perspectiveDescriptro);
        item = new PerspectiveBarContributionItem(newOne, activeWorkbenchWindow.getActivePage());
        
        barManager.add(item);
        
        barManager.update(true);
    }
}

 

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics