Search in sources :

Example 1 with TabFolderReorder

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);
}
Also used : FormLayout(org.eclipse.swt.layout.FormLayout) FormData(org.eclipse.swt.layout.FormData) EmptyHopFileTypeHandler(org.apache.hop.ui.hopgui.file.empty.EmptyHopFileTypeHandler) IHopPerspective(org.apache.hop.ui.hopgui.perspective.IHopPerspective) Arrays(java.util.Arrays) HopPipelineFileType(org.apache.hop.ui.hopgui.file.pipeline.HopPipelineFileType) Props(org.apache.hop.core.Props) ISearchable(org.apache.hop.core.search.ISearchable) HopException(org.apache.hop.core.exception.HopException) WorkflowMeta(org.apache.hop.workflow.WorkflowMeta) IHopFileTypeHandler(org.apache.hop.ui.hopgui.file.IHopFileTypeHandler) HopGui(org.apache.hop.ui.hopgui.HopGui) GuiPlugin(org.apache.hop.core.gui.plugin.GuiPlugin) TabItemHandler(org.apache.hop.ui.hopgui.perspective.TabItemHandler) GuiKeyboardShortcut(org.apache.hop.core.gui.plugin.key.GuiKeyboardShortcut) Stack(java.util.Stack) ArrayList(java.util.ArrayList) HopGuiPipelineGraph(org.apache.hop.ui.hopgui.file.pipeline.HopGuiPipelineGraph) HopWorkflowFileType(org.apache.hop.ui.hopgui.file.workflow.HopWorkflowFileType) PipelineMeta(org.apache.hop.pipeline.PipelineMeta) ExtensionPointHandler(org.apache.hop.core.extension.ExtensionPointHandler) BaseMessages(org.apache.hop.i18n.BaseMessages) GuiResource(org.apache.hop.ui.core.gui.GuiResource) CTabFolder(org.eclipse.swt.custom.CTabFolder) FormLayout(org.eclipse.swt.layout.FormLayout) HopGuiWorkflowGraph(org.apache.hop.ui.hopgui.file.workflow.HopGuiWorkflowGraph) FormData(org.eclipse.swt.layout.FormData) TabFolderReorder(org.apache.hop.ui.core.widget.TabFolderReorder) CTabFolder2Adapter(org.eclipse.swt.custom.CTabFolder2Adapter) org.eclipse.swt.widgets(org.eclipse.swt.widgets) IGuiContextHandler(org.apache.hop.ui.hopgui.context.IGuiContextHandler) CTabFolderEvent(org.eclipse.swt.custom.CTabFolderEvent) FormAttachment(org.eclipse.swt.layout.FormAttachment) Const(org.apache.hop.core.Const) PropsUi(org.apache.hop.ui.core.PropsUi) HopPerspectivePlugin(org.apache.hop.ui.hopgui.perspective.HopPerspectivePlugin) CTabItem(org.eclipse.swt.custom.CTabItem) ISearchableCallback(org.apache.hop.core.search.ISearchableCallback) HopGuiKeyHandler(org.apache.hop.ui.hopgui.HopGuiKeyHandler) List(java.util.List) GuiOsxKeyboardShortcut(org.apache.hop.core.gui.plugin.key.GuiOsxKeyboardShortcut) SWT(org.eclipse.swt.SWT) IHopFileType(org.apache.hop.ui.hopgui.file.IHopFileType) EmptyFileType(org.apache.hop.ui.hopgui.file.empty.EmptyFileType) HopExtensionPoint(org.apache.hop.core.extension.HopExtensionPoint) CopyOnWriteArrayList(java.util.concurrent.CopyOnWriteArrayList) CTabFolder(org.eclipse.swt.custom.CTabFolder) CTabFolder2Adapter(org.eclipse.swt.custom.CTabFolder2Adapter) TabFolderReorder(org.apache.hop.ui.core.widget.TabFolderReorder) CTabFolderEvent(org.eclipse.swt.custom.CTabFolderEvent) TabItemHandler(org.apache.hop.ui.hopgui.perspective.TabItemHandler) PropsUi(org.apache.hop.ui.core.PropsUi) FormAttachment(org.eclipse.swt.layout.FormAttachment)

Example 2 with TabFolderReorder

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);
}
Also used : TabFolderReorder(org.apache.hop.ui.core.widget.TabFolderReorder) PropsUi(org.apache.hop.ui.core.PropsUi)

Example 3 with TabFolderReorder

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);
}
Also used : TabFolderReorder(org.apache.hop.ui.core.widget.TabFolderReorder) PropsUi(org.apache.hop.ui.core.PropsUi)

Aggregations

PropsUi (org.apache.hop.ui.core.PropsUi)3 TabFolderReorder (org.apache.hop.ui.core.widget.TabFolderReorder)3 ArrayList (java.util.ArrayList)1 Arrays (java.util.Arrays)1 List (java.util.List)1 Stack (java.util.Stack)1 CopyOnWriteArrayList (java.util.concurrent.CopyOnWriteArrayList)1 Const (org.apache.hop.core.Const)1 Props (org.apache.hop.core.Props)1 HopException (org.apache.hop.core.exception.HopException)1 ExtensionPointHandler (org.apache.hop.core.extension.ExtensionPointHandler)1 HopExtensionPoint (org.apache.hop.core.extension.HopExtensionPoint)1 GuiPlugin (org.apache.hop.core.gui.plugin.GuiPlugin)1 GuiKeyboardShortcut (org.apache.hop.core.gui.plugin.key.GuiKeyboardShortcut)1 GuiOsxKeyboardShortcut (org.apache.hop.core.gui.plugin.key.GuiOsxKeyboardShortcut)1 ISearchable (org.apache.hop.core.search.ISearchable)1 ISearchableCallback (org.apache.hop.core.search.ISearchableCallback)1 BaseMessages (org.apache.hop.i18n.BaseMessages)1 PipelineMeta (org.apache.hop.pipeline.PipelineMeta)1 GuiResource (org.apache.hop.ui.core.gui.GuiResource)1