Search in sources :

Example 46 with AdapterFactoryLabelProvider

use of org.eclipse.emf.edit.ui.provider.AdapterFactoryLabelProvider in project InformationSystem by ObeoNetwork.

the class TransitionPropertiesEditionPartImpl method createSourceFlatComboViewer.

/**
 * @param parent the parent composite
 */
protected Composite createSourceFlatComboViewer(Composite parent) {
    createDescription(parent, GraalViewsRepository.Transition.Properties.source, GraalMessages.TransitionPropertiesEditionPart_SourceLabel);
    source = new EObjectFlatComboViewer(parent, !propertiesEditionComponent.isRequired(GraalViewsRepository.Transition.Properties.source, GraalViewsRepository.SWT_KIND));
    source.setLabelProvider(new AdapterFactoryLabelProvider(adapterFactory));
    source.addSelectionChangedListener(new ISelectionChangedListener() {

        public void selectionChanged(SelectionChangedEvent event) {
            propertiesEditionComponent.firePropertiesChanged(new PropertiesEditionEvent(TransitionPropertiesEditionPartImpl.this, GraalViewsRepository.Transition.Properties.source, PropertiesEditionEvent.CHANGE, PropertiesEditionEvent.SET, null, getSource()));
        }
    });
    GridData sourceData = new GridData(GridData.FILL_HORIZONTAL);
    source.setLayoutData(sourceData);
    source.setID(GraalViewsRepository.Transition.Properties.source);
    // $NON-NLS-1$
    SWTUtils.createHelpButton(parent, propertiesEditionComponent.getHelpContent(GraalViewsRepository.Transition.Properties.source, GraalViewsRepository.SWT_KIND), null);
    // End of user code
    return parent;
}
Also used : EObjectFlatComboViewer(org.eclipse.emf.eef.runtime.ui.widgets.EObjectFlatComboViewer) ISelectionChangedListener(org.eclipse.jface.viewers.ISelectionChangedListener) GridData(org.eclipse.swt.layout.GridData) AdapterFactoryLabelProvider(org.eclipse.emf.edit.ui.provider.AdapterFactoryLabelProvider) SelectionChangedEvent(org.eclipse.jface.viewers.SelectionChangedEvent) IPropertiesEditionEvent(org.eclipse.emf.eef.runtime.api.notify.IPropertiesEditionEvent) PropertiesEditionEvent(org.eclipse.emf.eef.runtime.impl.notify.PropertiesEditionEvent)

Example 47 with AdapterFactoryLabelProvider

use of org.eclipse.emf.edit.ui.provider.AdapterFactoryLabelProvider in project InformationSystem by ObeoNetwork.

the class OperatorPropertiesEditionPartImpl method createKindEMFComboViewer.

protected Composite createKindEMFComboViewer(Composite parent) {
    createDescription(parent, GraalViewsRepository.Operator.Properties.kind, GraalMessages.OperatorPropertiesEditionPart_KindLabel);
    kind = new EMFComboViewer(parent);
    kind.setContentProvider(new ArrayContentProvider());
    kind.setLabelProvider(new AdapterFactoryLabelProvider(EEFRuntimePlugin.getDefault().getAdapterFactory()));
    GridData kindData = new GridData(GridData.FILL_HORIZONTAL);
    kind.getCombo().setLayoutData(kindData);
    kind.addSelectionChangedListener(new ISelectionChangedListener() {

        /**
         * {@inheritDoc}
         *
         * @see org.eclipse.jface.viewers.ISelectionChangedListener#selectionChanged(org.eclipse.jface.viewers.SelectionChangedEvent)
         */
        public void selectionChanged(SelectionChangedEvent event) {
            if (propertiesEditionComponent != null)
                propertiesEditionComponent.firePropertiesChanged(new PropertiesEditionEvent(OperatorPropertiesEditionPartImpl.this, GraalViewsRepository.Operator.Properties.kind, PropertiesEditionEvent.COMMIT, PropertiesEditionEvent.SET, null, getKind()));
        }
    });
    kind.setID(GraalViewsRepository.Operator.Properties.kind);
    // $NON-NLS-1$
    SWTUtils.createHelpButton(parent, propertiesEditionComponent.getHelpContent(GraalViewsRepository.Operator.Properties.kind, GraalViewsRepository.SWT_KIND), null);
    // End of user code
    return parent;
}
Also used : ISelectionChangedListener(org.eclipse.jface.viewers.ISelectionChangedListener) ArrayContentProvider(org.eclipse.jface.viewers.ArrayContentProvider) GridData(org.eclipse.swt.layout.GridData) AdapterFactoryLabelProvider(org.eclipse.emf.edit.ui.provider.AdapterFactoryLabelProvider) EMFComboViewer(org.eclipse.emf.eef.runtime.ui.widgets.EMFComboViewer) SelectionChangedEvent(org.eclipse.jface.viewers.SelectionChangedEvent) IPropertiesEditionEvent(org.eclipse.emf.eef.runtime.api.notify.IPropertiesEditionEvent) PropertiesEditionEvent(org.eclipse.emf.eef.runtime.impl.notify.PropertiesEditionEvent)

Example 48 with AdapterFactoryLabelProvider

use of org.eclipse.emf.edit.ui.provider.AdapterFactoryLabelProvider in project InformationSystem by ObeoNetwork.

the class ClassDiagramConfigurationEditor 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 AdapterFactoryLabelProvider

use of org.eclipse.emf.edit.ui.provider.AdapterFactoryLabelProvider in project InformationSystem by ObeoNetwork.

the class ViewEditor method createPages.

/**
 * This is the method used by the framework to install your own controls.
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated NOT
 */
@Override
public void createPages() {
    // Creates the model from the editor input
    // 
    createModel();
    // 
    if (!getEditingDomain().getResourceSet().getResources().isEmpty()) {
        // Create a page for the selection tree view.
        // 
        Tree tree = new Tree(getContainer(), SWT.MULTI);
        selectionViewer = new TreeViewer(tree);
        setCurrentViewer(selectionViewer);
        selectionViewer.setContentProvider(new AdapterFactoryContentProvider(adapterFactory));
        selectionViewer.setLabelProvider(new AdapterFactoryLabelProvider(adapterFactory));
        selectionViewer.setInput(editingDomain.getResourceSet());
        selectionViewer.setSelection(new StructuredSelection(editingDomain.getResourceSet().getResources().get(0)), true);
        new AdapterFactoryTreeEditor(selectionViewer.getTree(), adapterFactory);
        getEditingDomain().getCommandStack().addCommandStackListener(new CommandStackListener() {

            public void commandStackChanged(EventObject event) {
                selectionViewer.refresh();
            }
        });
        createContextMenuFor(selectionViewer);
        int pageIndex = addPage(tree);
        setPageText(pageIndex, getString("_UI_SelectionPage_label"));
        getSite().getShell().getDisplay().asyncExec(new Runnable() {

            public void run() {
                setActivePage(0);
            }
        });
    }
    // Ensures that this editor will only display the page's tab
    // area if there are more than one page
    // 
    getContainer().addControlListener(new ControlAdapter() {

        boolean guard = false;

        @Override
        public void controlResized(ControlEvent event) {
            if (!guard) {
                guard = true;
                hideTabs();
                guard = false;
            }
        }
    });
    getSite().getShell().getDisplay().asyncExec(new Runnable() {

        public void run() {
            updateProblemIndication();
        }
    });
}
Also used : AdapterFactoryTreeEditor(org.eclipse.emf.edit.ui.celleditor.AdapterFactoryTreeEditor) CommandStackListener(org.eclipse.emf.common.command.CommandStackListener) ControlAdapter(org.eclipse.swt.events.ControlAdapter) TreeViewer(org.eclipse.jface.viewers.TreeViewer) 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) EventObject(java.util.EventObject) Point(org.eclipse.swt.graphics.Point) Tree(org.eclipse.swt.widgets.Tree) ControlEvent(org.eclipse.swt.events.ControlEvent)

Example 50 with AdapterFactoryLabelProvider

use of org.eclipse.emf.edit.ui.provider.AdapterFactoryLabelProvider in project InformationSystem by ObeoNetwork.

the class CinematicEditor method createPages.

/**
 * This is the method used by the framework to install your own controls.
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated NOT
 */
@Override
public void createPages() {
    // Creates the model from the editor input
    // 
    createModel();
    // 
    if (!getEditingDomain().getResourceSet().getResources().isEmpty()) {
        // Create a page for the selection tree view.
        // 
        Tree tree = new Tree(getContainer(), SWT.MULTI);
        selectionViewer = new TreeViewer(tree);
        setCurrentViewer(selectionViewer);
        selectionViewer.setContentProvider(new AdapterFactoryContentProvider(adapterFactory));
        selectionViewer.setLabelProvider(new AdapterFactoryLabelProvider(adapterFactory));
        selectionViewer.setInput(editingDomain.getResourceSet());
        selectionViewer.setSelection(new StructuredSelection(editingDomain.getResourceSet().getResources().get(0)), true);
        new AdapterFactoryTreeEditor(selectionViewer.getTree(), adapterFactory);
        getEditingDomain().getCommandStack().addCommandStackListener(new CommandStackListener() {

            public void commandStackChanged(EventObject event) {
                selectionViewer.refresh();
            }
        });
        createContextMenuFor(selectionViewer);
        int pageIndex = addPage(tree);
        setPageText(pageIndex, getString("_UI_SelectionPage_label"));
        getSite().getShell().getDisplay().asyncExec(new Runnable() {

            public void run() {
                setActivePage(0);
            }
        });
    }
    // Ensures that this editor will only display the page's tab
    // area if there are more than one page
    // 
    getContainer().addControlListener(new ControlAdapter() {

        boolean guard = false;

        @Override
        public void controlResized(ControlEvent event) {
            if (!guard) {
                guard = true;
                hideTabs();
                guard = false;
            }
        }
    });
    getSite().getShell().getDisplay().asyncExec(new Runnable() {

        public void run() {
            updateProblemIndication();
        }
    });
}
Also used : AdapterFactoryTreeEditor(org.eclipse.emf.edit.ui.celleditor.AdapterFactoryTreeEditor) CommandStackListener(org.eclipse.emf.common.command.CommandStackListener) ControlAdapter(org.eclipse.swt.events.ControlAdapter) TreeViewer(org.eclipse.jface.viewers.TreeViewer) 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) EventObject(java.util.EventObject) Point(org.eclipse.swt.graphics.Point) Tree(org.eclipse.swt.widgets.Tree) ControlEvent(org.eclipse.swt.events.ControlEvent)

Aggregations

AdapterFactoryLabelProvider (org.eclipse.emf.edit.ui.provider.AdapterFactoryLabelProvider)208 ISelectionChangedListener (org.eclipse.jface.viewers.ISelectionChangedListener)147 SelectionChangedEvent (org.eclipse.jface.viewers.SelectionChangedEvent)147 GridData (org.eclipse.swt.layout.GridData)136 IPropertiesEditionEvent (org.eclipse.emf.eef.runtime.api.notify.IPropertiesEditionEvent)134 PropertiesEditionEvent (org.eclipse.emf.eef.runtime.impl.notify.PropertiesEditionEvent)134 StructuredSelection (org.eclipse.jface.viewers.StructuredSelection)66 AdapterFactoryContentProvider (org.eclipse.emf.edit.ui.provider.AdapterFactoryContentProvider)65 IStructuredSelection (org.eclipse.jface.viewers.IStructuredSelection)62 EObjectFlatComboViewer (org.eclipse.emf.eef.runtime.ui.widgets.EObjectFlatComboViewer)60 Composite (org.eclipse.swt.widgets.Composite)52 EMFComboViewer (org.eclipse.emf.eef.runtime.ui.widgets.EMFComboViewer)50 ArrayContentProvider (org.eclipse.jface.viewers.ArrayContentProvider)35 TreeViewer (org.eclipse.jface.viewers.TreeViewer)32 Tree (org.eclipse.swt.widgets.Tree)32 AdapterFactoryTreeEditor (org.eclipse.emf.edit.ui.celleditor.AdapterFactoryTreeEditor)31 IMenuManager (org.eclipse.jface.action.IMenuManager)30 IStatusLineManager (org.eclipse.jface.action.IStatusLineManager)30 IToolBarManager (org.eclipse.jface.action.IToolBarManager)30 ControlAdapter (org.eclipse.swt.events.ControlAdapter)30