Search in sources :

Example 11 with SelectionChangedEvent

use of org.eclipse.jface.viewers.SelectionChangedEvent in project tdi-studio-se by Talend.

the class ConfigureChartDialog method createAttributesViewer.

/**
     * Creates the attributes viewer.
     * 
     * @param parent The parent composite
     * @return The attribute viewer
     */
private TreeViewer createAttributesViewer(Composite parent) {
    TreeViewer viewer = new TreeViewer(parent, SWT.BORDER | SWT.FULL_SELECTION);
    viewer.getTree().setLayoutData(new GridData(GridData.FILL_BOTH));
    viewer.setContentProvider(new MBeanAttributeContentProvider());
    viewer.setLabelProvider(new MBeanAttributeLabelProvider(viewer));
    viewer.addSelectionChangedListener(new ISelectionChangedListener() {

        @Override
        public void selectionChanged(SelectionChangedEvent event) {
            viewerSlectionChanged((IStructuredSelection) event.getSelection());
        }
    });
    configureTree(viewer.getTree());
    viewer.setInput(attributes.toArray(new MBeanAttribute[attributes.size()]));
    return viewer;
}
Also used : TreeViewer(org.eclipse.jface.viewers.TreeViewer) ISelectionChangedListener(org.eclipse.jface.viewers.ISelectionChangedListener) GridData(org.eclipse.swt.layout.GridData) SelectionChangedEvent(org.eclipse.jface.viewers.SelectionChangedEvent) IStructuredSelection(org.eclipse.jface.viewers.IStructuredSelection)

Example 12 with SelectionChangedEvent

use of org.eclipse.jface.viewers.SelectionChangedEvent in project tdi-studio-se by Talend.

the class LoadChartSetDialog method createChartSetViewer.

/**
     * Creates the chart set viewer.
     * 
     * @param parent The parent composite
     * @return The chart set viewer
     */
private TableViewer createChartSetViewer(Composite parent) {
    final TableViewer viewer = new TableViewer(parent, SWT.BORDER | SWT.FULL_SELECTION);
    GridData gridData = new GridData(GridData.FILL_BOTH);
    gridData.heightHint = 300;
    viewer.getTable().setLayoutData(gridData);
    viewer.setContentProvider(new ArrayContentProvider());
    viewer.setLabelProvider(new LabelProvider() {

        @Override
        public String getText(Object element) {
            if (element.equals(defaultChartSet)) {
                return NLS.bind(Messages.defaultChartSet, defaultChartSet);
            }
            return super.getText(element);
        }
    });
    viewer.setInput(chartSets.toArray(new String[chartSets.size()]));
    viewer.addSelectionChangedListener(new ISelectionChangedListener() {

        @Override
        public void selectionChanged(SelectionChangedEvent event) {
            ISelection selection = event.getSelection();
            Object element = ((StructuredSelection) selection).getFirstElement();
            if (deleteButton != null) {
                deleteButton.setEnabled(!selection.isEmpty() && !predefinedChartSets.contains(element));
            }
            if (element != null) {
                chartSet = element.toString();
            } else {
                viewer.setSelection(new StructuredSelection(chartSet));
            }
        }
    });
    viewer.setSelection(new StructuredSelection(defaultChartSet));
    return viewer;
}
Also used : ISelectionChangedListener(org.eclipse.jface.viewers.ISelectionChangedListener) GridData(org.eclipse.swt.layout.GridData) ArrayContentProvider(org.eclipse.jface.viewers.ArrayContentProvider) ISelection(org.eclipse.jface.viewers.ISelection) StructuredSelection(org.eclipse.jface.viewers.StructuredSelection) IStructuredSelection(org.eclipse.jface.viewers.IStructuredSelection) SelectionChangedEvent(org.eclipse.jface.viewers.SelectionChangedEvent) TableViewer(org.eclipse.jface.viewers.TableViewer) LabelProvider(org.eclipse.jface.viewers.LabelProvider)

Example 13 with SelectionChangedEvent

use of org.eclipse.jface.viewers.SelectionChangedEvent in project tdi-studio-se by Talend.

the class SWTResourcesPage method createSashFormControls.

/*
     * @see AbstractSashForm#createSashFormControls(SashForm, IActionBars)
     */
@Override
protected void createSashFormControls(SashForm sashForm, IActionBars actionBars) {
    resourceFilteredTree = new SWTResourceFilteredTree(sashForm, actionBars);
    TreeViewer resourceViewer = resourceFilteredTree.getViewer();
    resourceViewer.setContentProvider(new SWTResourceContentProvider(resourceViewer));
    resourceViewer.setLabelProvider(new SWTResourceLabelProvider());
    resourceViewer.addSelectionChangedListener(new ISelectionChangedListener() {

        @Override
        public void selectionChanged(SelectionChangedEvent event) {
            ISelection selection = event.getSelection();
            if (selection.isEmpty()) {
                selection = null;
            }
            stackTraceViewer.setInput(selection);
        }
    });
    stackTraceViewer = new StackTraceViewer(sashForm, actionBars);
}
Also used : StackTraceViewer(org.talend.designer.runtime.visualization.internal.ui.properties.StackTraceViewer) TreeViewer(org.eclipse.jface.viewers.TreeViewer) ISelectionChangedListener(org.eclipse.jface.viewers.ISelectionChangedListener) ISelection(org.eclipse.jface.viewers.ISelection) SelectionChangedEvent(org.eclipse.jface.viewers.SelectionChangedEvent)

Example 14 with SelectionChangedEvent

use of org.eclipse.jface.viewers.SelectionChangedEvent in project tdi-studio-se by Talend.

the class ComponentSettingsView method createPartControl.

/*
     * (non-Javadoc)
     * 
     * @see org.eclipse.ui.part.WorkbenchPart#createPartControl(org.eclipse.swt.widgets.Composite)
     */
@Override
public void createPartControl(Composite parent) {
    this.parent = parent;
    tabFactory.initComposite(parent, true);
    tabFactory.addSelectionChangedListener(new ISelectionChangedListener() {

        @Override
        public void selectionChanged(SelectionChangedEvent event) {
            IStructuredSelection selection = (IStructuredSelection) event.getSelection();
            TalendPropertyTabDescriptor descriptor = (TalendPropertyTabDescriptor) selection.getFirstElement();
            if (descriptor == null) {
                return;
            }
            if (currentSelectedTab != null && (!currentSelectedTab.getData().equals(descriptor.getData()) || currentSelectedTab.getCategory() != descriptor.getCategory())) {
                for (Control curControl : tabFactory.getTabComposite().getChildren()) {
                    curControl.dispose();
                }
            }
            if (element == null || !element.equals(descriptor.getData()) || currentSelectedTab == null || currentSelectedTab.getCategory() != descriptor.getCategory() || selectedPrimary) {
                element = (Element) descriptor.getData();
                currentSelectedTab = descriptor;
                if (descriptor.getData() instanceof ConnectionLabel) {
                    createDynamicComposite(tabFactory.getTabComposite(), ((ConnectionLabel) descriptor.getData()).getConnection(), descriptor.getCategory());
                } else {
                    createDynamicComposite(tabFactory.getTabComposite(), (Element) descriptor.getData(), descriptor.getCategory());
                }
                selectedPrimary = false;
            }
        }
    });
}
Also used : Control(org.eclipse.swt.widgets.Control) ISelectionChangedListener(org.eclipse.jface.viewers.ISelectionChangedListener) Element(org.talend.core.model.process.Element) IElement(org.talend.core.model.process.IElement) SelectionChangedEvent(org.eclipse.jface.viewers.SelectionChangedEvent) IStructuredSelection(org.eclipse.jface.viewers.IStructuredSelection) TalendPropertyTabDescriptor(org.talend.core.ui.properties.tab.TalendPropertyTabDescriptor) ConnectionLabel(org.talend.designer.core.ui.editor.connections.ConnectionLabel)

Example 15 with SelectionChangedEvent

use of org.eclipse.jface.viewers.SelectionChangedEvent in project tdi-studio-se by Talend.

the class MemoryRuntimeComposite method initContextInput.

@SuppressWarnings("unchecked")
private void initContextInput() {
    List<IContext> contextList = (List<IContext>) viewPart.getContextComposite().getContextComboInput();
    if (contextList != null) {
        contextCombo.setSelection(new StructuredSelection(contextList.get(0)));
        contextCombo.setInput(contextList);
        ComboViewer processContextComboViewer = viewPart.getContextComposite().getContextComboViewer();
        IContext selectedContext = (IContext) ((IStructuredSelection) processContextComboViewer.getSelection()).getFirstElement();
        for (int i = 0; i < contextList.size(); i++) {
            if (contextList.get(i).getName().equals(selectedContext.getName())) {
                contextCombo.getCombo().select(i);
            }
        }
        contextCombo.addSelectionChangedListener(new ISelectionChangedListener() {

            @Override
            public void selectionChanged(SelectionChangedEvent event) {
                viewPart.getContextComposite().runSelectionChange(event);
            }
        });
    } else {
        contextCombo.getCombo().setEnabled(false);
    }
}
Also used : IContext(org.talend.core.model.process.IContext) ComboViewer(org.eclipse.jface.viewers.ComboViewer) ISelectionChangedListener(org.eclipse.jface.viewers.ISelectionChangedListener) IStructuredSelection(org.eclipse.jface.viewers.IStructuredSelection) StructuredSelection(org.eclipse.jface.viewers.StructuredSelection) List(java.util.List) ArrayList(java.util.ArrayList) SelectionChangedEvent(org.eclipse.jface.viewers.SelectionChangedEvent) Point(org.eclipse.swt.graphics.Point)

Aggregations

SelectionChangedEvent (org.eclipse.jface.viewers.SelectionChangedEvent)802 ISelectionChangedListener (org.eclipse.jface.viewers.ISelectionChangedListener)754 GridData (org.eclipse.swt.layout.GridData)417 Composite (org.eclipse.swt.widgets.Composite)332 IStructuredSelection (org.eclipse.jface.viewers.IStructuredSelection)303 GridLayout (org.eclipse.swt.layout.GridLayout)245 SelectionEvent (org.eclipse.swt.events.SelectionEvent)187 Label (org.eclipse.swt.widgets.Label)158 TableViewer (org.eclipse.jface.viewers.TableViewer)153 AdapterFactoryLabelProvider (org.eclipse.emf.edit.ui.provider.AdapterFactoryLabelProvider)147 ArrayContentProvider (org.eclipse.jface.viewers.ArrayContentProvider)140 Button (org.eclipse.swt.widgets.Button)140 StructuredSelection (org.eclipse.jface.viewers.StructuredSelection)126 IDoubleClickListener (org.eclipse.jface.viewers.IDoubleClickListener)121 DoubleClickEvent (org.eclipse.jface.viewers.DoubleClickEvent)120 IPropertiesEditionEvent (org.eclipse.emf.eef.runtime.api.notify.IPropertiesEditionEvent)116 PropertiesEditionEvent (org.eclipse.emf.eef.runtime.impl.notify.PropertiesEditionEvent)116 SelectionAdapter (org.eclipse.swt.events.SelectionAdapter)116 Table (org.eclipse.swt.widgets.Table)93 ISelection (org.eclipse.jface.viewers.ISelection)84