Search in sources :

Example 56 with SelectionAdapter

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

the class SetupProcessDependenciesRoutinesDialog method createTabFolderField.

private void createTabFolderField(Composite parent) {
    // tab
    folder = new CTabFolder(parent, SWT.NONE);
    folder.setLayoutData(new GridData(GridData.FILL_BOTH));
    folder.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            updateButtons();
        }
    });
    userTabItem = new CTabItem(folder, SWT.NONE);
    //$NON-NLS-1$
    userTabItem.setText(Messages.getString("SetupProcessDependenciesRoutinesDialog.userRoutineLabel"));
    systemTabItem = new CTabItem(folder, SWT.NONE);
    //$NON-NLS-1$
    systemTabItem.setText(Messages.getString("SetupProcessDependenciesRoutinesDialog.systemRoutineLabel"));
    folder.setSelection(userTabItem);
    folder.setSimple(false);
    ISelectionChangedListener listListener = new ISelectionChangedListener() {

        @Override
        public void selectionChanged(SelectionChangedEvent event) {
            updateButtons();
        }
    };
    // user
    Composite userComposite = new Composite(folder, SWT.NONE);
    userComposite.setLayout(new GridLayout());
    userComposite.setLayoutData(new GridData(GridData.FILL_BOTH));
    userViewer = new ListViewer(userComposite, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER);
    userViewer.setLabelProvider(new RoutineRecordLabelProvider());
    userViewer.setContentProvider(ArrayContentProvider.getInstance());
    userViewer.setInput(userRoutines);
    userViewer.getList().setLayoutData(new GridData(GridData.FILL_BOTH));
    userViewer.addSelectionChangedListener(listListener);
    userTabItem.setControl(userComposite);
    // system
    Composite systemComposite = new Composite(folder, SWT.NONE);
    systemComposite.setLayout(new GridLayout());
    systemComposite.setLayoutData(new GridData(GridData.FILL_BOTH));
    systemViewer = new ListViewer(systemComposite, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER);
    systemViewer.setLabelProvider(new RoutineRecordLabelProvider());
    systemViewer.setContentProvider(ArrayContentProvider.getInstance());
    systemViewer.setInput(systemRoutines);
    systemViewer.getList().setLayoutData(new GridData(GridData.FILL_BOTH));
    systemViewer.addSelectionChangedListener(listListener);
    systemTabItem.setControl(systemComposite);
}
Also used : ListViewer(org.eclipse.jface.viewers.ListViewer) GridLayout(org.eclipse.swt.layout.GridLayout) CTabFolder(org.eclipse.swt.custom.CTabFolder) Composite(org.eclipse.swt.widgets.Composite) SelectionAdapter(org.eclipse.swt.events.SelectionAdapter) ISelectionChangedListener(org.eclipse.jface.viewers.ISelectionChangedListener) GridData(org.eclipse.swt.layout.GridData) SelectionEvent(org.eclipse.swt.events.SelectionEvent) SelectionChangedEvent(org.eclipse.jface.viewers.SelectionChangedEvent) CTabItem(org.eclipse.swt.custom.CTabItem)

Example 57 with SelectionAdapter

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

the class SetupProcessDependenciesRoutinesDialog method createButtonField.

private void createButtonField(Composite parent) {
    Composite btnComposite = new Composite(parent, SWT.NONE);
    btnComposite.setLayout(new GridLayout());
    GridData layoutData = new GridData(GridData.FILL_VERTICAL);
    layoutData.verticalAlignment = SWT.CENTER;
    btnComposite.setLayoutData(layoutData);
    addBtn = new Button(btnComposite, SWT.PUSH);
    addBtn.setImage(ImageProvider.getImage(EImage.ADD_ICON));
    addBtn.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            ListViewer currentViewer = getCurrentViewer();
            if (currentViewer == null) {
                return;
            }
            boolean system = (currentViewer == systemViewer);
            List<RoutineItemRecord> currentRecords = getCurrentRecords();
            ShowRoutineItemsDialog dialog = new ShowRoutineItemsDialog(getShell(), allRoutineItems, currentRecords, system);
            if (dialog.open() == Window.OK) {
                Property[] selectedItems = dialog.getSelectedItems();
                List<Property> needAddedItems = new ArrayList<Property>();
                // filter
                for (Property p : selectedItems) {
                    boolean found = false;
                    for (RoutineItemRecord record : currentRecords) {
                        if (system) {
                            found = p.getLabel().equals(record.getLabel());
                        } else {
                            found = p.getId().equals(record.getId());
                        }
                    }
                    if (!found) {
                        needAddedItems.add(p);
                    }
                }
                // create
                for (Property p : needAddedItems) {
                    RoutineItemRecord newOne = new RoutineItemRecord();
                    newOne.setId(p.getId());
                    newOne.setLabel(p.getLabel());
                    newOne.setName(p.getLabel());
                    newOne.setVersion(p.getVersion());
                    currentRecords.add(newOne);
                }
                //
                currentViewer.setInput(currentRecords);
                currentViewer.refresh();
                updateButtons();
            }
        }
    });
    delBtn = new Button(btnComposite, SWT.PUSH);
    delBtn.setImage(ImageProvider.getImage(EImage.DELETE_ICON));
    delBtn.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            ListViewer currentViewer = getCurrentViewer();
            List<RoutineItemRecord> currentRecords = getCurrentRecords();
            if (currentViewer != null && !((IStructuredSelection) currentViewer.getSelection()).isEmpty()) {
                Iterator iterator = ((IStructuredSelection) currentViewer.getSelection()).iterator();
                int index = 0;
                while (iterator.hasNext()) {
                    Object selectedRecord = iterator.next();
                    if (currentRecords != null && selectedRecord != null) {
                        index = currentRecords.indexOf(selectedRecord);
                        currentRecords.remove(selectedRecord);
                        if (index > currentRecords.size() - 1) {
                            index = currentRecords.size() - 1;
                        } else if (index < 0) {
                            index = 0;
                        }
                    }
                }
                currentViewer.setInput(currentRecords);
                currentViewer.getList().select(index);
                currentViewer.refresh();
            }
            updateButtons();
        }
    });
    upBtn = new Button(btnComposite, SWT.PUSH);
    upBtn.setImage(ImageProvider.getImage(EImage.UP_ICON));
    upBtn.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            moveDatas(true);
        }
    });
    downBtn = new Button(btnComposite, SWT.PUSH);
    downBtn.setImage(ImageProvider.getImage(EImage.DOWN_ICON));
    downBtn.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            moveDatas(false);
        }
    });
}
Also used : ListViewer(org.eclipse.jface.viewers.ListViewer) Composite(org.eclipse.swt.widgets.Composite) SelectionAdapter(org.eclipse.swt.events.SelectionAdapter) GridLayout(org.eclipse.swt.layout.GridLayout) Button(org.eclipse.swt.widgets.Button) GridData(org.eclipse.swt.layout.GridData) SelectionEvent(org.eclipse.swt.events.SelectionEvent) Iterator(java.util.Iterator) ArrayList(java.util.ArrayList) List(java.util.List) IRepositoryViewObject(org.talend.core.model.repository.IRepositoryViewObject) Property(org.talend.core.model.properties.Property)

Example 58 with SelectionAdapter

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

the class MapperUI method configureZoneScrollBars.

private void configureZoneScrollBars(final Display display) {
    vBar1 = sc1.getVerticalBar();
    vBar2 = sc2.getVerticalBar();
    vBar3 = sc3.getVerticalBar();
    vBar1.setIncrement(INCREMENT_VERTICAL_SCROLLBAR_ZONE);
    vBar2.setIncrement(INCREMENT_VERTICAL_SCROLLBAR_ZONE);
    vBar3.setIncrement(INCREMENT_VERTICAL_SCROLLBAR_ZONE);
    vBar1.setPageIncrement(INCREMENT_VERTICAL_SCROLLBAR_ZONE);
    vBar2.setPageIncrement(INCREMENT_VERTICAL_SCROLLBAR_ZONE);
    vBar3.setPageIncrement(INCREMENT_VERTICAL_SCROLLBAR_ZONE);
    SelectionListener scrollListener = new SelectionAdapter() {

        public void widgetSelected(SelectionEvent event) {
            if (event.detail == SWT.NONE) {
                mouseMoveScrollZoneHelper.mouseDownOnScroll = false;
                mouseMoveScrollZoneHelper.scrolling = false;
                updateBackground(false, true);
            } else {
                mouseMoveScrollZoneHelper.mouseDownOnScroll = true;
                mouseMoveScrollZoneHelper.scrolling = true;
                backgroundRefreshLimiter.setTimeBeforeNewExecution(backgroundRefreshTimeForScrolling);
                display.asyncExec(new Runnable() {

                    public void run() {
                        backgroundRefreshLimiter.startIfExecutable();
                    }
                });
            }
        }
    };
    vBar1.addSelectionListener(scrollListener);
    vBar2.addSelectionListener(scrollListener);
    vBar3.addSelectionListener(scrollListener);
}
Also used : SelectionAdapter(org.eclipse.swt.events.SelectionAdapter) SelectionEvent(org.eclipse.swt.events.SelectionEvent) SelectionListener(org.eclipse.swt.events.SelectionListener)

Example 59 with SelectionAdapter

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

the class HL7MultiSchemaUI method createCombo.

@Override
protected void createCombo(Composite parent) {
    createLabel(parent);
    metaTableViewer = new ComboViewer(parent, SWT.NONE);
    metaTableViewer.setContentProvider(new ArrayContentProvider());
    metaTableViewer.setLabelProvider(new LabelProvider() {

        @Override
        public String getText(Object element) {
            if (element instanceof SegmentModel) {
                return ((SegmentModel) element).getSeg().getName();
            }
            return super.getText(element);
        }
    });
    final Combo combo = metaTableViewer.getCombo();
    GridData data = new GridData();
    data.widthHint = 60;
    combo.setLayoutData(data);
    combo.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(SelectionEvent e) {
            updateCurrentMetadataTable();
            linker.removeAllLinks();
            linker.getMainui().redrawLinkers();
            linker.getBackgroundRefresher().refreshBackground();
        }
    });
}
Also used : ComboViewer(org.eclipse.jface.viewers.ComboViewer) SelectionAdapter(org.eclipse.swt.events.SelectionAdapter) ArrayContentProvider(org.eclipse.jface.viewers.ArrayContentProvider) GridData(org.eclipse.swt.layout.GridData) SelectionEvent(org.eclipse.swt.events.SelectionEvent) Combo(org.eclipse.swt.widgets.Combo) SegmentModel(org.talend.designer.hl7.model.SegmentModel) LabelProvider(org.eclipse.jface.viewers.LabelProvider)

Example 60 with SelectionAdapter

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

the class ConfigurationDialog method createProfilerTypeSelection.

/**
     * Creates the profiler type selection.
     * 
     * @param parent The parent composite
     */
private void createProfilerTypeSelection(Composite parent) {
    Group group = new Group(parent, SWT.NONE);
    group.setText(Messages.profilerTypeGroupLabel);
    group.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    group.setLayout(new GridLayout(1, false));
    Button samplingButton = new Button(group, SWT.RADIO);
    samplingButton.setText(Messages.samplingButtonLabel);
    samplingButton.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            profilerType = ProfilerType.SAMPLING;
            samplingPeriodLabel.setEnabled(true);
            samplingPeriodText.setEnabled(true);
        }
    });
    createSamplingPeriodText(group);
    bciButton = new Button(group, SWT.RADIO);
    bciButton.setText(Messages.bciButtonLabel);
    bciButton.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            profilerType = ProfilerType.BCI;
            samplingPeriodLabel.setEnabled(false);
            samplingPeriodText.setEnabled(false);
        }
    });
    boolean isBCI = profilerType == ProfilerType.BCI;
    samplingButton.setSelection(!isBCI);
    bciButton.setSelection(isBCI);
    bciButton.setEnabled(profilerState != ProfilerState.AGENT_NOT_LOADED);
    samplingPeriodLabel.setEnabled(!isBCI);
    samplingPeriodText.setEnabled(!isBCI);
}
Also used : Group(org.eclipse.swt.widgets.Group) GridLayout(org.eclipse.swt.layout.GridLayout) Button(org.eclipse.swt.widgets.Button) SelectionAdapter(org.eclipse.swt.events.SelectionAdapter) GridData(org.eclipse.swt.layout.GridData) SelectionEvent(org.eclipse.swt.events.SelectionEvent)

Aggregations

SelectionAdapter (org.eclipse.swt.events.SelectionAdapter)3041 SelectionEvent (org.eclipse.swt.events.SelectionEvent)3036 GridData (org.eclipse.swt.layout.GridData)1608 Button (org.eclipse.swt.widgets.Button)1600 Composite (org.eclipse.swt.widgets.Composite)1220 Label (org.eclipse.swt.widgets.Label)1106 GridLayout (org.eclipse.swt.layout.GridLayout)1095 Text (org.eclipse.swt.widgets.Text)773 ModifyListener (org.eclipse.swt.events.ModifyListener)638 ModifyEvent (org.eclipse.swt.events.ModifyEvent)630 Group (org.eclipse.swt.widgets.Group)459 FormAttachment (org.eclipse.swt.layout.FormAttachment)428 FormData (org.eclipse.swt.layout.FormData)428 Shell (org.eclipse.swt.widgets.Shell)407 FormLayout (org.eclipse.swt.layout.FormLayout)406 Event (org.eclipse.swt.widgets.Event)384 Listener (org.eclipse.swt.widgets.Listener)378 Display (org.eclipse.swt.widgets.Display)353 ShellEvent (org.eclipse.swt.events.ShellEvent)323 ShellAdapter (org.eclipse.swt.events.ShellAdapter)321