use of org.apache.hop.ui.core.widget.TabFolderReorder in project hop by apache.
the class HopDataOrchestrationPerspective method initialize.
@Override
public void initialize(HopGui hopGui, Composite parent) {
this.hopGui = hopGui;
this.parent = parent;
PropsUi props = PropsUi.getInstance();
composite = new Composite(parent, SWT.NONE);
FormLayout layout = new FormLayout();
layout.marginRight = props.getMargin();
layout.marginBottom = props.getMargin();
composite.setLayout(layout);
FormData formData = new FormData();
formData.left = new FormAttachment(0, 0);
formData.top = new FormAttachment(0, 0);
formData.right = new FormAttachment(100, 0);
formData.bottom = new FormAttachment(100, 0);
composite.setLayoutData(formData);
// A tab folder covers the complete area...
//
tabFolder = new CTabFolder(composite, SWT.MULTI | SWT.BORDER);
props.setLook(tabFolder, Props.WIDGET_STYLE_TAB);
FormData fdLabel = new FormData();
fdLabel.left = new FormAttachment(0, 0);
fdLabel.right = new FormAttachment(100, 0);
fdLabel.top = new FormAttachment(0, 0);
fdLabel.bottom = new FormAttachment(100, 0);
tabFolder.setLayoutData(fdLabel);
tabFolder.addCTabFolder2Listener(new CTabFolder2Adapter() {
@Override
public void close(CTabFolderEvent event) {
handleTabCloseEvent(event);
}
});
tabFolder.addListener(SWT.Selection, event -> handleTabSelectionEvent(event));
// Create tab item context menu
Menu menu = new Menu(tabFolder);
tabFolder.setMenu(menu);
tabFolder.addListener(SWT.MenuDetect, event -> handleTabMenuDetectEvent(event));
// Create menu item
MenuItem miClose = new MenuItem(menu, SWT.NONE);
miClose.setText(BaseMessages.getString(PKG, "DataOrchestrationPerspective.Close.Button.Text"));
miClose.addListener(SWT.Selection, event -> {
if (activeItem != null) {
activeItem.getTypeHandler().close();
}
});
MenuItem miCloseOthers = new MenuItem(menu, SWT.NONE);
miCloseOthers.setText(BaseMessages.getString(PKG, "DataOrchestrationPerspective.CloseOther.Button.Text"));
miCloseOthers.addListener(SWT.Selection, event -> {
TabItemHandler currentItem = activeItem;
items.forEach(item -> {
if (!item.equals(currentItem)) {
// FIXME: Works only if you activate the item
activeItem = item;
item.getTypeHandler().close();
}
});
});
MenuItem miCloseAll = new MenuItem(menu, SWT.NONE);
miCloseAll.setText(BaseMessages.getString(PKG, "DataOrchestrationPerspective.CloseAll.Button.Text"));
miCloseAll.addListener(SWT.Selection, event -> items.forEach(item -> {
// FIXME: Works only if you activate the item
activeItem = item;
item.getTypeHandler().close();
}));
// Support reorder tab item
new TabFolderReorder(tabFolder);
HopGuiKeyHandler.getInstance().addParentObjectToHandle(this);
}
use of org.apache.hop.ui.core.widget.TabFolderReorder in project hop by apache.
the class ExplorerPerspective method createTabFolder.
protected void createTabFolder(Composite parent) {
PropsUi props = PropsUi.getInstance();
tabFolder = new CTabFolder(parent, SWT.MULTI | SWT.BORDER);
tabFolder.addCTabFolder2Listener(new CTabFolder2Adapter() {
@Override
public void close(CTabFolderEvent event) {
onTabClose(event);
}
});
tabFolder.addListener(SWT.Selection, this::handleTabSelectionEvent);
props.setLook(tabFolder, Props.WIDGET_STYLE_TAB);
// Show/Hide tree
//
ToolBar toolBar = new ToolBar(tabFolder, SWT.FLAT);
final ToolItem item = new ToolItem(toolBar, SWT.PUSH);
item.setImage(GuiResource.getInstance().getImageMinimizePanel());
item.addListener(SWT.Selection, e -> {
if (sash.getMaximizedControl() == null) {
sash.setMaximizedControl(tabFolder);
item.setImage(GuiResource.getInstance().getImageMaximizePanel());
} else {
sash.setMaximizedControl(null);
item.setImage(GuiResource.getInstance().getImageMinimizePanel());
}
});
tabFolder.setTopRight(toolBar, SWT.RIGHT);
// Support reorder tab item
//
new TabFolderReorder(tabFolder);
}
use of org.apache.hop.ui.core.widget.TabFolderReorder in project hop by apache.
the class MetadataPerspective method createTabFolder.
protected void createTabFolder(Composite parent) {
PropsUi props = PropsUi.getInstance();
tabFolder = new CTabFolder(parent, SWT.MULTI | SWT.BORDER);
tabFolder.addCTabFolder2Listener(new CTabFolder2Adapter() {
@Override
public void close(CTabFolderEvent event) {
onTabClose(event);
}
});
props.setLook(tabFolder, Props.WIDGET_STYLE_TAB);
// Show/Hide tree
//
ToolBar toolBar = new ToolBar(tabFolder, SWT.FLAT);
final ToolItem item = new ToolItem(toolBar, SWT.PUSH);
item.setImage(GuiResource.getInstance().getImageMinimizePanel());
item.addListener(SWT.Selection, e -> {
if (sash.getMaximizedControl() == null) {
sash.setMaximizedControl(tabFolder);
item.setImage(GuiResource.getInstance().getImageMaximizePanel());
} else {
sash.setMaximizedControl(null);
item.setImage(GuiResource.getInstance().getImageMinimizePanel());
}
});
tabFolder.setTopRight(toolBar, SWT.RIGHT);
// Support reorder tab item
//
new TabFolderReorder(tabFolder);
}
Aggregations