private boolean singleTab = false;
public TabbedArea(Composite parent, int style) {
- super(parent, style);
+ super(parent, SWT.NONE);
CmsUiUtils.style(parent, bodyStyle);
setLayout(CmsUiUtils.noSpaceGridLayout());
title.setLayoutData(CmsUiUtils.fillWidth());
title.addSelectionListener((Selected) (e) -> showTab(tabIndex(section.getNode())));
Node node = section.getNode();
- title.setText(Jcr.getTitle(node));
+ String titleStr = Jcr.getTitle(node);
+ // TODO internationalize
+ title.setText(titleStr);
if (!singleTab) {
ToolBar toolBar = new ToolBar(sectionHeader, SWT.NONE);
ToolItem closeItem = new ToolItem(toolBar, SWT.FLAT);
refreshTabHeaders();
showTab(nextIndex);
}
+
+ public void closeAllTabs() {
+ for(Section section:sections) {
+ section.dispose();
+ }
+ sections.clear();
+ emptyState();
+ refreshTabHeaders();
+ layout(true, true);
+ }
protected void emptyState() {
new Section(body, SWT.NONE, null);
}
protected Section getCurrentSection() {
- return (Section) body.getChildren()[0];
+ return (Section) stackLayout.topControl;
+ }
+
+ public Node getCurrentContext() {
+ Section section = getCurrentSection();
+ if (section != null) {
+ return section.getNode();
+ } else {
+ return null;
+ }
}
public void setTabStyle(String tabStyle) {