Search in sources :

Example 46 with ISelectionChangedListener

use of org.eclipse.jface.viewers.ISelectionChangedListener in project Malai by arnobl.

the class EventEditor method setCurrentViewer.

/**
 * This makes sure that one content viewer, either for the current page or the outline view, if it has focus,
 * is the current one.
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
public void setCurrentViewer(Viewer viewer) {
    // 
    if (currentViewer != viewer) {
        if (selectionChangedListener == null) {
            // Create the listener on demand.
            // 
            selectionChangedListener = new ISelectionChangedListener() {

                // This just notifies those things that are affected by the section.
                // 
                public void selectionChanged(SelectionChangedEvent selectionChangedEvent) {
                    setSelection(selectionChangedEvent.getSelection());
                }
            };
        }
        // 
        if (currentViewer != null) {
            currentViewer.removeSelectionChangedListener(selectionChangedListener);
        }
        // 
        if (viewer != null) {
            viewer.addSelectionChangedListener(selectionChangedListener);
        }
        // Remember it.
        // 
        currentViewer = viewer;
        // Set the editors selection based on the current viewer's selection.
        // 
        setSelection(currentViewer == null ? StructuredSelection.EMPTY : currentViewer.getSelection());
    }
}
Also used : ISelectionChangedListener(org.eclipse.jface.viewers.ISelectionChangedListener) SelectionChangedEvent(org.eclipse.jface.viewers.SelectionChangedEvent)

Example 47 with ISelectionChangedListener

use of org.eclipse.jface.viewers.ISelectionChangedListener in project Malai by arnobl.

the class InstrumentEditor method setSelection.

/**
 * This implements {@link org.eclipse.jface.viewers.ISelectionProvider} to set this editor's overall selection.
 * Calling this result will notify the listeners.
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
public void setSelection(ISelection selection) {
    editorSelection = selection;
    for (ISelectionChangedListener listener : selectionChangedListeners) {
        listener.selectionChanged(new SelectionChangedEvent(this, selection));
    }
    setStatusLineManager(selection);
}
Also used : ISelectionChangedListener(org.eclipse.jface.viewers.ISelectionChangedListener) SelectionChangedEvent(org.eclipse.jface.viewers.SelectionChangedEvent)

Example 48 with ISelectionChangedListener

use of org.eclipse.jface.viewers.ISelectionChangedListener in project Malai by arnobl.

the class InstrumentEditor method getContentOutlinePage.

/**
 * This accesses a cached version of the content outliner.
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
public IContentOutlinePage getContentOutlinePage() {
    if (contentOutlinePage == null) {
        // 
        class MyContentOutlinePage extends ContentOutlinePage {

            @Override
            public void createControl(Composite parent) {
                super.createControl(parent);
                contentOutlineViewer = getTreeViewer();
                contentOutlineViewer.addSelectionChangedListener(this);
                // Set up the tree viewer.
                // 
                contentOutlineViewer.setContentProvider(new AdapterFactoryContentProvider(adapterFactory));
                contentOutlineViewer.setLabelProvider(new AdapterFactoryLabelProvider(adapterFactory));
                contentOutlineViewer.setInput(editingDomain.getResourceSet());
                // Make sure our popups work.
                // 
                createContextMenuFor(contentOutlineViewer);
                if (!editingDomain.getResourceSet().getResources().isEmpty()) {
                    // Select the root object in the view.
                    // 
                    contentOutlineViewer.setSelection(new StructuredSelection(editingDomain.getResourceSet().getResources().get(0)), true);
                }
            }

            @Override
            public void makeContributions(IMenuManager menuManager, IToolBarManager toolBarManager, IStatusLineManager statusLineManager) {
                super.makeContributions(menuManager, toolBarManager, statusLineManager);
                contentOutlineStatusLineManager = statusLineManager;
            }

            @Override
            public void setActionBars(IActionBars actionBars) {
                super.setActionBars(actionBars);
                getActionBarContributor().shareGlobalActions(this, actionBars);
            }
        }
        contentOutlinePage = new MyContentOutlinePage();
        // Listen to selection so that we can handle it is a special way.
        // 
        contentOutlinePage.addSelectionChangedListener(new ISelectionChangedListener() {

            // This ensures that we handle selections correctly.
            // 
            public void selectionChanged(SelectionChangedEvent event) {
                handleContentOutlineSelection(event.getSelection());
            }
        });
    }
    return contentOutlinePage;
}
Also used : ContentOutlinePage(org.eclipse.ui.views.contentoutline.ContentOutlinePage) IContentOutlinePage(org.eclipse.ui.views.contentoutline.IContentOutlinePage) Composite(org.eclipse.swt.widgets.Composite) IToolBarManager(org.eclipse.jface.action.IToolBarManager) IStatusLineManager(org.eclipse.jface.action.IStatusLineManager) ISelectionChangedListener(org.eclipse.jface.viewers.ISelectionChangedListener) StructuredSelection(org.eclipse.jface.viewers.StructuredSelection) IStructuredSelection(org.eclipse.jface.viewers.IStructuredSelection) AdapterFactoryContentProvider(org.eclipse.emf.edit.ui.provider.AdapterFactoryContentProvider) AdapterFactoryLabelProvider(org.eclipse.emf.edit.ui.provider.AdapterFactoryLabelProvider) SelectionChangedEvent(org.eclipse.jface.viewers.SelectionChangedEvent) IMenuManager(org.eclipse.jface.action.IMenuManager) IActionBars(org.eclipse.ui.IActionBars)

Example 49 with ISelectionChangedListener

use of org.eclipse.jface.viewers.ISelectionChangedListener in project Malai by arnobl.

the class InteractionEditor method setCurrentViewer.

/**
 * This makes sure that one content viewer, either for the current page or the outline view, if it has focus,
 * is the current one.
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
public void setCurrentViewer(Viewer viewer) {
    // 
    if (currentViewer != viewer) {
        if (selectionChangedListener == null) {
            // Create the listener on demand.
            // 
            selectionChangedListener = new ISelectionChangedListener() {

                // This just notifies those things that are affected by the section.
                // 
                public void selectionChanged(SelectionChangedEvent selectionChangedEvent) {
                    setSelection(selectionChangedEvent.getSelection());
                }
            };
        }
        // 
        if (currentViewer != null) {
            currentViewer.removeSelectionChangedListener(selectionChangedListener);
        }
        // 
        if (viewer != null) {
            viewer.addSelectionChangedListener(selectionChangedListener);
        }
        // Remember it.
        // 
        currentViewer = viewer;
        // Set the editors selection based on the current viewer's selection.
        // 
        setSelection(currentViewer == null ? StructuredSelection.EMPTY : currentViewer.getSelection());
    }
}
Also used : ISelectionChangedListener(org.eclipse.jface.viewers.ISelectionChangedListener) SelectionChangedEvent(org.eclipse.jface.viewers.SelectionChangedEvent)

Example 50 with ISelectionChangedListener

use of org.eclipse.jface.viewers.ISelectionChangedListener in project Malai by arnobl.

the class InteractionEditor method setSelection.

/**
 * This implements {@link org.eclipse.jface.viewers.ISelectionProvider} to set this editor's overall selection.
 * Calling this result will notify the listeners.
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
public void setSelection(ISelection selection) {
    editorSelection = selection;
    for (ISelectionChangedListener listener : selectionChangedListeners) {
        listener.selectionChanged(new SelectionChangedEvent(this, selection));
    }
    setStatusLineManager(selection);
}
Also used : ISelectionChangedListener(org.eclipse.jface.viewers.ISelectionChangedListener) SelectionChangedEvent(org.eclipse.jface.viewers.SelectionChangedEvent)

Aggregations

ISelectionChangedListener (org.eclipse.jface.viewers.ISelectionChangedListener)774 SelectionChangedEvent (org.eclipse.jface.viewers.SelectionChangedEvent)755 GridData (org.eclipse.swt.layout.GridData)419 Composite (org.eclipse.swt.widgets.Composite)333 IStructuredSelection (org.eclipse.jface.viewers.IStructuredSelection)302 GridLayout (org.eclipse.swt.layout.GridLayout)247 SelectionEvent (org.eclipse.swt.events.SelectionEvent)187 Label (org.eclipse.swt.widgets.Label)157 TableViewer (org.eclipse.jface.viewers.TableViewer)151 AdapterFactoryLabelProvider (org.eclipse.emf.edit.ui.provider.AdapterFactoryLabelProvider)147 Button (org.eclipse.swt.widgets.Button)141 ArrayContentProvider (org.eclipse.jface.viewers.ArrayContentProvider)139 StructuredSelection (org.eclipse.jface.viewers.StructuredSelection)131 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)87