Search in sources :

Example 1 with IExtendedButtonListener

use of org.talend.commons.ui.swt.extended.table.IExtendedButtonListener in project tdi-studio-se by Talend.

the class TabFolderEditors method addListenersToOutputButtons.

/**
     * DOC amaumont Comment method "addListenersToInputButtons".
     */
private void addListenersToOutputButtons() {
    MetadataToolbarEditorView toolBar = outputMetaEditor.getToolBar();
    outputToolBarButtons = toolBar.getButtons();
    beforeCommandListenerForOutputButtons = new IExtendedButtonListener() {

        @Override
        public void handleEvent(ExtendedButtonEvent event) {
        // TableViewerCreator tableViewerCreator =
        // mapperManager.getUiManager().getCurrentSelectedOutputTableView()
        // .getTableViewerCreatorForColumns();
        // if (tableViewerCreator != null) {
        // tableViewerCreator.applyActivatedCellEditor();
        // }
        }
    };
    for (ExtendedPushButton extendedPushButton : outputToolBarButtons) {
        extendedPushButton.addListener(beforeCommandListenerForOutputButtons, true);
        if (extendedPushButton instanceof RemovePushButton) {
            removeButton = (RemovePushButtonForExtendedTable) extendedPushButton;
        }
    }
    if (removeButton != null) {
        final TableViewerCreator tableViewerCreator = removeButton.getExtendedTableViewer().getTableViewerCreator();
        tableViewerCreator.getSelectionHelper().addAfterSelectionListener(new ILineSelectionListener() {

            @Override
            public void handle(LineSelectionEvent e) {
                for (TableItem item : tableViewerCreator.getTable().getSelection()) {
                    if (item.getData() instanceof MetadataColumn) {
                        MetadataColumn column = (MetadataColumn) item.getData();
                        removeButton.getButton().setEnabled(!column.isCustom());
                        break;
                    }
                }
            }
        });
    }
    this.addDisposeListener(new DisposeListener() {

        /*
             * (non-Javadoc)
             * 
             * @see org.eclipse.swt.events.DisposeListener#widgetDisposed(org.eclipse.swt.events.DisposeEvent)
             */
        @Override
        public void widgetDisposed(DisposeEvent e) {
            for (ExtendedPushButton extendedPushButton : outputToolBarButtons) {
                extendedPushButton.removeListener(beforeCommandListenerForOutputButtons, true);
            }
        }
    });
}
Also used : DisposeListener(org.eclipse.swt.events.DisposeListener) TableViewerCreator(org.talend.commons.ui.swt.tableviewer.TableViewerCreator) RemovePushButton(org.talend.commons.ui.swt.advanced.dataeditor.button.RemovePushButton) TableItem(org.eclipse.swt.widgets.TableItem) IExtendedButtonListener(org.talend.commons.ui.swt.extended.table.IExtendedButtonListener) ILineSelectionListener(org.talend.commons.ui.runtime.swt.tableviewer.selection.ILineSelectionListener) DisposeEvent(org.eclipse.swt.events.DisposeEvent) MetadataColumn(org.talend.core.model.metadata.MetadataColumn) LineSelectionEvent(org.talend.commons.ui.runtime.swt.tableviewer.selection.LineSelectionEvent) ExtendedPushButton(org.talend.commons.ui.swt.advanced.dataeditor.control.ExtendedPushButton) MetadataToolbarEditorView(org.talend.core.ui.metadata.editor.MetadataToolbarEditorView) ExtendedButtonEvent(org.talend.commons.ui.swt.extended.table.ExtendedButtonEvent)

Example 2 with IExtendedButtonListener

use of org.talend.commons.ui.swt.extended.table.IExtendedButtonListener in project tdi-studio-se by Talend.

the class TabFolderEditors method addListenersToOutputButtons.

/**
     * DOC amaumont Comment method "addListenersToInputButtons".
     */
private void addListenersToOutputButtons() {
    MetadataToolbarEditorView toolBar = outputMetaEditor.getToolBar();
    outputToolBarButtons = toolBar.getButtons();
    beforeCommandListenerForOutputButtons = new IExtendedButtonListener() {

        public void handleEvent(ExtendedButtonEvent event) {
            TableViewerCreator tableViewerCreator = mapperManager.getUiManager().getCurrentSelectedOutputTableView().getTableViewerCreatorForColumns();
            if (tableViewerCreator != null) {
                tableViewerCreator.applyActivatedCellEditor();
            }
        }
    };
    for (ExtendedPushButton extendedPushButton : outputToolBarButtons) {
        extendedPushButton.addListener(beforeCommandListenerForOutputButtons, true);
        if (extendedPushButton instanceof RemovePushButton && !mapperManager.componentIsReadOnly()) {
            removeButton = (RemovePushButtonForExtendedTable) extendedPushButton;
        }
    }
    if (removeButton != null) {
        final TableViewerCreator tableViewerCreator = removeButton.getExtendedTableViewer().getTableViewerCreator();
        tableViewerCreator.getSelectionHelper().addAfterSelectionListener(new ILineSelectionListener() {

            public void handle(LineSelectionEvent e) {
                for (TableItem item : tableViewerCreator.getTable().getSelection()) {
                    if (item.getData() instanceof MetadataColumn) {
                        MetadataColumn column = (MetadataColumn) item.getData();
                        removeButton.getButton().setEnabled(!column.isCustom());
                        break;
                    }
                }
            }
        });
    }
    this.addDisposeListener(new DisposeListener() {

        /*
             * (non-Javadoc)
             * 
             * @see org.eclipse.swt.events.DisposeListener#widgetDisposed(org.eclipse.swt.events.DisposeEvent)
             */
        public void widgetDisposed(DisposeEvent e) {
            for (ExtendedPushButton extendedPushButton : outputToolBarButtons) {
                extendedPushButton.removeListener(beforeCommandListenerForOutputButtons, true);
            }
        }
    });
}
Also used : MetadataColumn(org.talend.core.model.metadata.MetadataColumn) DisposeListener(org.eclipse.swt.events.DisposeListener) LineSelectionEvent(org.talend.commons.ui.runtime.swt.tableviewer.selection.LineSelectionEvent) TableViewerCreator(org.talend.commons.ui.swt.tableviewer.TableViewerCreator) RemovePushButton(org.talend.commons.ui.swt.advanced.dataeditor.button.RemovePushButton) ExtendedPushButton(org.talend.commons.ui.swt.advanced.dataeditor.control.ExtendedPushButton) TableItem(org.eclipse.swt.widgets.TableItem) MetadataToolbarEditorView(org.talend.core.ui.metadata.editor.MetadataToolbarEditorView) IExtendedButtonListener(org.talend.commons.ui.swt.extended.table.IExtendedButtonListener) ILineSelectionListener(org.talend.commons.ui.runtime.swt.tableviewer.selection.ILineSelectionListener) DisposeEvent(org.eclipse.swt.events.DisposeEvent) ExtendedButtonEvent(org.talend.commons.ui.swt.extended.table.ExtendedButtonEvent)

Example 3 with IExtendedButtonListener

use of org.talend.commons.ui.swt.extended.table.IExtendedButtonListener in project tdi-studio-se by Talend.

the class TabFolderEditors method addListenersToInputButtons.

/**
     * DOC amaumont Comment method "addListenersToInputButtons".
     */
private void addListenersToInputButtons() {
    MetadataToolbarEditorView toolBar = inputMetaEditor.getToolBar();
    inputToolBarButtons = toolBar.getButtons();
    beforeCommandListenerForInputButtons = new IExtendedButtonListener() {

        public void handleEvent(ExtendedButtonEvent event) {
            TableViewerCreator tableViewerCreator = mapperManager.getUiManager().getCurrentSelectedInputTableView().getTableViewerCreatorForColumns();
            if (tableViewerCreator != null) {
                tableViewerCreator.applyActivatedCellEditor();
            }
        }
    };
    for (ExtendedPushButton extendedPushButton : inputToolBarButtons) {
        extendedPushButton.addListener(beforeCommandListenerForInputButtons, true);
    }
    this.addDisposeListener(new DisposeListener() {

        /*
             * (non-Javadoc)
             * 
             * @see org.eclipse.swt.events.DisposeListener#widgetDisposed(org.eclipse.swt.events.DisposeEvent)
             */
        public void widgetDisposed(DisposeEvent e) {
            for (ExtendedPushButton extendedPushButton : inputToolBarButtons) {
                extendedPushButton.removeListener(beforeCommandListenerForInputButtons, true);
            }
        }
    });
}
Also used : DisposeListener(org.eclipse.swt.events.DisposeListener) TableViewerCreator(org.talend.commons.ui.swt.tableviewer.TableViewerCreator) ExtendedPushButton(org.talend.commons.ui.swt.advanced.dataeditor.control.ExtendedPushButton) MetadataToolbarEditorView(org.talend.core.ui.metadata.editor.MetadataToolbarEditorView) IExtendedButtonListener(org.talend.commons.ui.swt.extended.table.IExtendedButtonListener) DisposeEvent(org.eclipse.swt.events.DisposeEvent) ExtendedButtonEvent(org.talend.commons.ui.swt.extended.table.ExtendedButtonEvent)

Example 4 with IExtendedButtonListener

use of org.talend.commons.ui.swt.extended.table.IExtendedButtonListener in project tdi-studio-se by Talend.

the class TabFolderEditors method addListenersToInputButtons.

/**
     * DOC amaumont Comment method "addListenersToInputButtons".
     */
private void addListenersToInputButtons() {
    MetadataToolbarEditorView toolBar = inputMetaEditor.getToolBar();
    inputToolBarButtons = toolBar.getButtons();
    beforeCommandListenerForInputButtons = new IExtendedButtonListener() {

        @Override
        public void handleEvent(ExtendedButtonEvent event) {
        // TableViewerCreator tableViewerCreator =
        // mapperManager.getUiManager().getCurrentSelectedInputTableView()
        // .getTableViewerCreatorForColumns();
        // if (tableViewerCreator != null) {
        // tableViewerCreator.applyActivatedCellEditor();
        // }
        }
    };
    for (ExtendedPushButton extendedPushButton : inputToolBarButtons) {
        extendedPushButton.addListener(beforeCommandListenerForInputButtons, true);
    }
    this.addDisposeListener(new DisposeListener() {

        /*
             * (non-Javadoc)
             * 
             * @see org.eclipse.swt.events.DisposeListener#widgetDisposed(org.eclipse.swt.events.DisposeEvent)
             */
        @Override
        public void widgetDisposed(DisposeEvent e) {
            for (ExtendedPushButton extendedPushButton : inputToolBarButtons) {
                extendedPushButton.removeListener(beforeCommandListenerForInputButtons, true);
            }
        }
    });
}
Also used : DisposeListener(org.eclipse.swt.events.DisposeListener) ExtendedPushButton(org.talend.commons.ui.swt.advanced.dataeditor.control.ExtendedPushButton) MetadataToolbarEditorView(org.talend.core.ui.metadata.editor.MetadataToolbarEditorView) IExtendedButtonListener(org.talend.commons.ui.swt.extended.table.IExtendedButtonListener) DisposeEvent(org.eclipse.swt.events.DisposeEvent) ExtendedButtonEvent(org.talend.commons.ui.swt.extended.table.ExtendedButtonEvent)

Aggregations

DisposeEvent (org.eclipse.swt.events.DisposeEvent)4 DisposeListener (org.eclipse.swt.events.DisposeListener)4 ExtendedPushButton (org.talend.commons.ui.swt.advanced.dataeditor.control.ExtendedPushButton)4 ExtendedButtonEvent (org.talend.commons.ui.swt.extended.table.ExtendedButtonEvent)4 IExtendedButtonListener (org.talend.commons.ui.swt.extended.table.IExtendedButtonListener)4 MetadataToolbarEditorView (org.talend.core.ui.metadata.editor.MetadataToolbarEditorView)4 TableViewerCreator (org.talend.commons.ui.swt.tableviewer.TableViewerCreator)3 TableItem (org.eclipse.swt.widgets.TableItem)2 ILineSelectionListener (org.talend.commons.ui.runtime.swt.tableviewer.selection.ILineSelectionListener)2 LineSelectionEvent (org.talend.commons.ui.runtime.swt.tableviewer.selection.LineSelectionEvent)2 RemovePushButton (org.talend.commons.ui.swt.advanced.dataeditor.button.RemovePushButton)2 MetadataColumn (org.talend.core.model.metadata.MetadataColumn)2