Search in sources :

Example 41 with ControlEvent

use of org.eclipse.swt.events.ControlEvent in project tdi-studio-se by Talend.

the class StyledTextHandler method addListeners.

/**
     * DOC amaumont Comment method "addListeners".
     */
private void addListeners() {
    styledText.addFocusListener(new FocusListener() {

        public void focusGained(FocusEvent e) {
            refreshProposalSize();
        }

        public void focusLost(FocusEvent e) {
        }
    });
    styledText.addControlListener(new ControlListener() {

        public void controlMoved(ControlEvent e) {
        }

        public void controlResized(ControlEvent e) {
            refreshProposalSize();
        }
    });
    styledText.addExtendedModifyListener(new ExtendedModifyListener() {

        public void modifyText(ExtendedModifyEvent event) {
            // System.out.println("ExtendedModifyListener modify text");
            updateCellExpression();
        }
    });
    styledText.getContent().addTextChangeListener(new TextChangeListener() {

        public void textChanged(TextChangedEvent event) {
            highlightLineOfCursorPosition(styledText.getSelection());
        }

        public void textChanging(TextChangingEvent event) {
        // System.out.println("textChanging");
        }

        public void textSet(TextChangedEvent event) {
        // System.out.println("textSet");
        }
    });
    styledText.addModifyListener(new ModifyListener() {

        public void modifyText(ModifyEvent e) {
            highlightLineOfCursorPosition(styledText.getSelection());
        }
    });
    styledText.addKeyListener(new KeyListener() {

        public void keyPressed(KeyEvent e) {
            highlightLineOfCursorPosition(styledText.getSelection());
        }

        public void keyReleased(KeyEvent e) {
        // TODO Auto-generated method stub
        }
    });
    styledText.addVerifyKeyListener(new VerifyKeyListener() {

        public void verifyKey(VerifyEvent verifyEvent) {
            if (verifyEvent.character == '\r' && contentProposalAdapter != null && contentProposalAdapter.isProposalOpened()) {
                verifyEvent.doit = false;
            } else {
                verifyEvent.doit = true;
            }
        }
    });
    styledText.addMouseListener(new MouseListener() {

        public void mouseDoubleClick(MouseEvent e) {
            highlightLineOfCursorPosition(styledText.getSelection());
        }

        public void mouseDown(MouseEvent e) {
            mapperManager.fireCurrentDirectEditApply();
            highlightLineOfCursorPosition(styledText.getSelection());
        }

        public void mouseUp(MouseEvent e) {
        }
    });
}
Also used : ExtendedModifyEvent(org.eclipse.swt.custom.ExtendedModifyEvent) MouseEvent(org.eclipse.swt.events.MouseEvent) ExtendedModifyListener(org.eclipse.swt.custom.ExtendedModifyListener) ModifyListener(org.eclipse.swt.events.ModifyListener) ExtendedModifyListener(org.eclipse.swt.custom.ExtendedModifyListener) VerifyKeyListener(org.eclipse.swt.custom.VerifyKeyListener) TextChangingEvent(org.eclipse.swt.custom.TextChangingEvent) FocusEvent(org.eclipse.swt.events.FocusEvent) TextChangedEvent(org.eclipse.swt.custom.TextChangedEvent) KeyEvent(org.eclipse.swt.events.KeyEvent) ModifyEvent(org.eclipse.swt.events.ModifyEvent) ExtendedModifyEvent(org.eclipse.swt.custom.ExtendedModifyEvent) MouseListener(org.eclipse.swt.events.MouseListener) ControlListener(org.eclipse.swt.events.ControlListener) VerifyKeyListener(org.eclipse.swt.custom.VerifyKeyListener) KeyListener(org.eclipse.swt.events.KeyListener) ControlEvent(org.eclipse.swt.events.ControlEvent) TextChangeListener(org.eclipse.swt.custom.TextChangeListener) FocusListener(org.eclipse.swt.events.FocusListener) VerifyEvent(org.eclipse.swt.events.VerifyEvent)

Example 42 with ControlEvent

use of org.eclipse.swt.events.ControlEvent in project tdi-studio-se by Talend.

the class RowGenMain method createUI.

/**
     * qzhang Comment method "createUI".
     * 
     * @param display
     * @return
     */
public Shell createUI(Display display) {
    Shell shell = new Shell(display, SWT.APPLICATION_MODAL | SWT.BORDER | SWT.RESIZE | SWT.CLOSE | SWT.MIN | SWT.MAX | SWT.TITLE);
    IComponent component = connector.getComponent();
    shell.setImage(CoreImageProvider.getComponentIcon(component, ICON_SIZE.ICON_32));
    IBrandingService brandingService = (IBrandingService) GlobalServiceRegister.getDefault().getService(IBrandingService.class);
    String productName = brandingService.getFullProductName();
    //$NON-NLS-1$
    shell.setText(Messages.getString("RowGenMain.ShellTitle", productName, connector.getUniqueName()));
    Rectangle boundsRG = ExternalRowGeneratorUiProperties.getBoundsRowGen();
    if (ExternalRowGeneratorUiProperties.isShellMaximized()) {
        shell.setMaximized(ExternalRowGeneratorUiProperties.isShellMaximized());
    } else {
        boundsRG = ExternalRowGeneratorUiProperties.getBoundsRowGen();
        if (boundsRG.x < 0) {
            boundsRG.x = 0;
        }
        if (boundsRG.y < 0) {
            boundsRG.y = 0;
        }
        shell.setBounds(boundsRG);
    }
    createUI(shell, false);
    updateComponentsSize();
    updateTableTitleColumn();
    shell.open();
    shell.addControlListener(new ControlListener() {

        public void controlMoved(ControlEvent e) {
            generatorUI.getDataTableView().attachLabelPosition();
        }

        public void controlResized(ControlEvent e) {
            generatorUI.getDataTableView().attachLabelPosition();
            generatorUI.getDataTableView().fixedLabelSize();
        }
    });
    addAllControlForKeyListener(shell);
    // shell.moveAbove(null);
    generatorUI.getDataTableView().updateHeader(ExternalRowGeneratorUiProperties.getShowColumnsList());
    return shell;
}
Also used : Shell(org.eclipse.swt.widgets.Shell) IComponent(org.talend.core.model.components.IComponent) Rectangle(org.eclipse.swt.graphics.Rectangle) ControlListener(org.eclipse.swt.events.ControlListener) IBrandingService(org.talend.core.ui.branding.IBrandingService) ControlEvent(org.eclipse.swt.events.ControlEvent)

Example 43 with ControlEvent

use of org.eclipse.swt.events.ControlEvent in project tdi-studio-se by Talend.

the class MapperUI method createOutputZoneWithTables.

private void createOutputZoneWithTables(MapperModel mapperModel, final UIManager uiManager, final Display display) {
    Control previousControl;
    outputsZone = new OutputsZone(datasFlowViewSashForm, SWT.NONE, mapperManager);
    outputsZone.createHeaderZoneComponents();
    // this.dropTargetOperationListener.addControl(outputsZone);
    sc3 = new ScrolledComposite(outputsZone, getBorder() | SWT.H_SCROLL | SWT.V_SCROLL);
    // this.dropTargetOperationListener.addControl(sc3);
    GridData sc3GridData = new GridData(GridData.FILL_BOTH);
    sc3.setLayoutData(sc3GridData);
    sc3.setBackgroundMode(SWT.INHERIT_DEFAULT);
    sc3.addControlListener(new ControlListener() {

        public void controlMoved(ControlEvent e) {
        // System.out.println("sc3 controlMoved");
        }

        public void controlResized(ControlEvent e) {
            // System.out.println("sc3 controlResized");
            onSashResized(display);
        }
    });
    outputTablesZoneView = new OutputTablesZoneView(sc3, getBorder(), mapperManager);
    // this.dropTargetOperationListener.addControl(outputTablesZoneView);
    outputTablesZoneView.setBackgroundMode(SWT.INHERIT_DEFAULT);
    sc3.setExpandHorizontal(true);
    sc3.setContent(outputTablesZoneView);
    sc3MSListener = new MouseScrolledListener(mapperManager.getUiManager(), sc3);
    outputTablesZoneView.initInsertionIndicator();
    previousControl = null;
    List<OutputTable> tables = mapperModel.getOutputDataMapTables();
    Boolean minimizeStateOfTables = getMinimizedButtonState(tables);
    if (minimizeStateOfTables != null) {
        outputsZone.getToolbar().setMinimizeButtonState(minimizeStateOfTables.booleanValue());
    }
    for (IDataMapTable abstractDataMapTable : tables) {
        OutputDataMapTableView dataMapTableView = uiManager.createNewOutputTableView(previousControl, abstractDataMapTable, outputTablesZoneView);
        previousControl = dataMapTableView;
    }
    outputTablesZoneView.setSize(outputTablesZoneView.computeSize(SWT.DEFAULT, SWT.DEFAULT));
}
Also used : IDataMapTable(org.talend.designer.abstractmap.model.table.IDataMapTable) OutputsZone(org.talend.designer.dbmap.ui.visualmap.zone.OutputsZone) OutputTablesZoneView(org.talend.designer.dbmap.ui.visualmap.zone.scrollable.OutputTablesZoneView) MouseScrolledListener(org.talend.designer.abstractmap.ui.listener.MouseScrolledListener) OutputTable(org.talend.designer.dbmap.model.table.OutputTable) Control(org.eclipse.swt.widgets.Control) GridData(org.eclipse.swt.layout.GridData) ScrolledComposite(org.eclipse.swt.custom.ScrolledComposite) ControlListener(org.eclipse.swt.events.ControlListener) ControlEvent(org.eclipse.swt.events.ControlEvent) OutputDataMapTableView(org.talend.designer.dbmap.ui.visualmap.table.OutputDataMapTableView)

Example 44 with ControlEvent

use of org.eclipse.swt.events.ControlEvent in project tdi-studio-se by Talend.

the class MetadataTableEditorViewExt method addTableColumnsListener.

private void addTableColumnsListener() {
    ControlListener controlListener = new ControlListener() {

        @Override
        public void controlMoved(ControlEvent e) {
            MetadataTableEditorViewExt.this.attachLabelPosition(getTable().getHorizontalBar().getSelection());
        }

        @Override
        public void controlResized(ControlEvent e) {
            MetadataTableEditorViewExt.this.attachLabelPosition(getTable().getHorizontalBar().getSelection());
        }
    };
    for (Object element2 : getTableViewerCreator().getColumns()) {
        TableViewerCreatorColumnNotModifiable element = (TableViewerCreatorColumnNotModifiable) element2;
        element.getTableColumn().addControlListener(controlListener);
    }
}
Also used : TableViewerCreatorColumnNotModifiable(org.talend.commons.ui.runtime.swt.tableviewer.TableViewerCreatorColumnNotModifiable) ControlListener(org.eclipse.swt.events.ControlListener) ControlEvent(org.eclipse.swt.events.ControlEvent)

Example 45 with ControlEvent

use of org.eclipse.swt.events.ControlEvent in project tdi-studio-se by Talend.

the class MapperUI method addParentListeners.

private void addParentListeners(final UIManager uiManager, final ExternalMapperUiProperties uiProperties) {
    mapperUIParent.addDisposeListener(new DisposeListener() {

        public void widgetDisposed(DisposeEvent e) {
            release();
        }
    });
    mapperUIParent.addListener(SWT.Close, new Listener() {

        public void handleEvent(Event event) {
            if (uiManager.getMapperResponse() == SWT.NONE) {
                uiManager.setMapperResponse(SWT.CANCEL);
            }
        }
    });
    mapperUIParent.addFocusListener(new FocusListener() {

        public void focusGained(FocusEvent e) {
            updateBackground(false, true);
        }

        public void focusLost(FocusEvent e) {
        }
    });
    // store size if not maximized
    if (mapperUIParent instanceof Shell) {
        ((Shell) mapperUIParent).addControlListener(new ControlListener() {

            public void controlMoved(ControlEvent e) {
            }

            public void controlResized(ControlEvent e) {
                if (!((Shell) e.getSource()).getMaximized()) {
                    uiProperties.setBoundsMapper(((Shell) e.getSource()).getBounds());
                }
            }
        });
    }
}
Also used : DisposeListener(org.eclipse.swt.events.DisposeListener) Shell(org.eclipse.swt.widgets.Shell) DisposeListener(org.eclipse.swt.events.DisposeListener) DropTargetOperationListener(org.talend.designer.abstractmap.ui.listener.DropTargetOperationListener) SelectionListener(org.eclipse.swt.events.SelectionListener) ControlListener(org.eclipse.swt.events.ControlListener) FocusListener(org.eclipse.swt.events.FocusListener) Listener(org.eclipse.swt.widgets.Listener) ShellListener(org.eclipse.swt.events.ShellListener) MouseScrolledListener(org.talend.designer.abstractmap.ui.listener.MouseScrolledListener) DisposeEvent(org.eclipse.swt.events.DisposeEvent) FocusEvent(org.eclipse.swt.events.FocusEvent) Event(org.eclipse.swt.widgets.Event) ControlEvent(org.eclipse.swt.events.ControlEvent) ShellEvent(org.eclipse.swt.events.ShellEvent) SelectionEvent(org.eclipse.swt.events.SelectionEvent) ControlListener(org.eclipse.swt.events.ControlListener) DisposeEvent(org.eclipse.swt.events.DisposeEvent) ControlEvent(org.eclipse.swt.events.ControlEvent) FocusListener(org.eclipse.swt.events.FocusListener) FocusEvent(org.eclipse.swt.events.FocusEvent)

Aggregations

ControlEvent (org.eclipse.swt.events.ControlEvent)62 ControlListener (org.eclipse.swt.events.ControlListener)34 ControlAdapter (org.eclipse.swt.events.ControlAdapter)28 SelectionEvent (org.eclipse.swt.events.SelectionEvent)20 GridData (org.eclipse.swt.layout.GridData)20 Composite (org.eclipse.swt.widgets.Composite)20 GridLayout (org.eclipse.swt.layout.GridLayout)15 Point (org.eclipse.swt.graphics.Point)14 DisposeEvent (org.eclipse.swt.events.DisposeEvent)11 FocusEvent (org.eclipse.swt.events.FocusEvent)11 Control (org.eclipse.swt.widgets.Control)11 Event (org.eclipse.swt.widgets.Event)11 ScrolledComposite (org.eclipse.swt.custom.ScrolledComposite)10 DisposeListener (org.eclipse.swt.events.DisposeListener)10 ModifyEvent (org.eclipse.swt.events.ModifyEvent)10 MouseEvent (org.eclipse.swt.events.MouseEvent)10 Listener (org.eclipse.swt.widgets.Listener)10 Shell (org.eclipse.swt.widgets.Shell)10 TableColumn (org.eclipse.swt.widgets.TableColumn)10 TableViewerColumn (org.eclipse.jface.viewers.TableViewerColumn)9