Search in sources :

Example 61 with AdapterFactoryLabelProvider

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

the class ActorPropertiesEditionPartImpl method createSuperActorFlatComboViewer.

/**
 * @param parent the parent composite
 */
protected Composite createSuperActorFlatComboViewer(Composite parent) {
    createDescription(parent, GraalViewsRepository.Actor.Properties.superActor, GraalMessages.ActorPropertiesEditionPart_SuperActorLabel);
    superActor = new EObjectFlatComboViewer(parent, !propertiesEditionComponent.isRequired(GraalViewsRepository.Actor.Properties.superActor, GraalViewsRepository.SWT_KIND));
    superActor.setLabelProvider(new AdapterFactoryLabelProvider(adapterFactory));
    superActor.addSelectionChangedListener(new ISelectionChangedListener() {

        public void selectionChanged(SelectionChangedEvent event) {
            propertiesEditionComponent.firePropertiesChanged(new PropertiesEditionEvent(ActorPropertiesEditionPartImpl.this, GraalViewsRepository.Actor.Properties.superActor, PropertiesEditionEvent.CHANGE, PropertiesEditionEvent.SET, null, getSuperActor()));
        }
    });
    GridData superActorData = new GridData(GridData.FILL_HORIZONTAL);
    superActor.setLayoutData(superActorData);
    superActor.setID(GraalViewsRepository.Actor.Properties.superActor);
    // $NON-NLS-1$
    SWTUtils.createHelpButton(parent, propertiesEditionComponent.getHelpContent(GraalViewsRepository.Actor.Properties.superActor, 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 62 with AdapterFactoryLabelProvider

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

the class OperatorPropertiesEditionPartForm method createKindEMFComboViewer.

protected Composite createKindEMFComboViewer(FormToolkit widgetFactory, 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(OperatorPropertiesEditionPartForm.this, GraalViewsRepository.Operator.Properties.kind, PropertiesEditionEvent.COMMIT, PropertiesEditionEvent.SET, null, getKind()));
        }
    });
    kind.setID(GraalViewsRepository.Operator.Properties.kind);
    // $NON-NLS-1$
    FormUtils.createHelpButton(widgetFactory, parent, propertiesEditionComponent.getHelpContent(GraalViewsRepository.Operator.Properties.kind, GraalViewsRepository.FORM_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 63 with AdapterFactoryLabelProvider

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

the class CreateUseRelationshipDialog method createDialogArea.

/**
 * Create contents of the dialog.
 * @param parent
 */
@Override
protected Control createDialogArea(Composite parent) {
    Composite container = (Composite) super.createDialogArea(parent);
    container.setLayout(new GridLayout(2, false));
    Label lblSource = new Label(container, SWT.NONE);
    lblSource.setText("Source :");
    Label lblTarget = new Label(container, SWT.NONE);
    lblTarget.setText("Target :");
    treeSourceViewer = new TreeViewer(container, SWT.BORDER | SWT.MULTI);
    treeSourceViewer.setContentProvider(new TasksContentProvider());
    treeSourceViewer.setLabelProvider(new AdapterFactoryLabelProvider(adapterFactory));
    treeSourceViewer.addSelectionChangedListener(new ISelectionChangedListener() {

        @SuppressWarnings("rawtypes")
        public void selectionChanged(SelectionChangedEvent event) {
            if (event.getSelection().isEmpty()) {
                selectedTasksAsSource.clear();
            } else if (event.getSelection() instanceof IStructuredSelection) {
                selectedTasksAsSource.clear();
                IStructuredSelection selection = (IStructuredSelection) event.getSelection();
                for (Iterator iterator = selection.iterator(); iterator.hasNext(); ) {
                    Object domain = (Object) iterator.next();
                    if (domain instanceof Task) {
                        selectedTasksAsSource.add((Task) domain);
                    }
                }
            }
            computeOkButtonState();
        }
    });
    treeSourceViewer.setInput(new RootElement(this.source));
    treeSourceViewer.setSelection(new StructuredSelection(this.source), true);
    Tree treeSource = treeSourceViewer.getTree();
    treeSource.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1));
    treeTargetViewer = new TreeViewer(container, SWT.BORDER | SWT.MULTI);
    treeTargetViewer.setContentProvider(new TasksContentProvider());
    treeTargetViewer.setLabelProvider(new AdapterFactoryLabelProvider(adapterFactory));
    treeTargetViewer.addSelectionChangedListener(new ISelectionChangedListener() {

        @SuppressWarnings("rawtypes")
        public void selectionChanged(SelectionChangedEvent event) {
            if (event.getSelection().isEmpty()) {
                selectedTasksAsTarget.clear();
            } else if (event.getSelection() instanceof IStructuredSelection) {
                selectedTasksAsTarget.clear();
                IStructuredSelection selection = (IStructuredSelection) event.getSelection();
                for (Iterator iterator = selection.iterator(); iterator.hasNext(); ) {
                    Object domain = (Object) iterator.next();
                    if (domain instanceof Task) {
                        selectedTasksAsTarget.add((Task) domain);
                    }
                }
            }
            computeOkButtonState();
        }
    });
    treeTargetViewer.setInput(new RootElement(this.target));
    treeTargetViewer.setSelection(new StructuredSelection(this.target), true);
    Tree treeTarget = treeTargetViewer.getTree();
    treeTarget.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1));
    return container;
}
Also used : Task(org.obeonetwork.graal.Task) Composite(org.eclipse.swt.widgets.Composite) TreeViewer(org.eclipse.jface.viewers.TreeViewer) ISelectionChangedListener(org.eclipse.jface.viewers.ISelectionChangedListener) Label(org.eclipse.swt.widgets.Label) StructuredSelection(org.eclipse.jface.viewers.StructuredSelection) IStructuredSelection(org.eclipse.jface.viewers.IStructuredSelection) AdapterFactoryLabelProvider(org.eclipse.emf.edit.ui.provider.AdapterFactoryLabelProvider) SelectionChangedEvent(org.eclipse.jface.viewers.SelectionChangedEvent) IStructuredSelection(org.eclipse.jface.viewers.IStructuredSelection) GridLayout(org.eclipse.swt.layout.GridLayout) RootElement(org.obeonetwork.graal.design.ui.providers.RootElement) Iterator(java.util.Iterator) GridData(org.eclipse.swt.layout.GridData) TasksContentProvider(org.obeonetwork.graal.design.ui.providers.TasksContentProvider) Tree(org.eclipse.swt.widgets.Tree) EObject(org.eclipse.emf.ecore.EObject)

Example 64 with AdapterFactoryLabelProvider

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

the class PersistencePropertiesEditionPartForm method createInheritanceKindEMFComboViewer.

protected Composite createInheritanceKindEMFComboViewer(FormToolkit widgetFactory, Composite parent) {
    createDescription(parent, EntityViewsRepository.Persistence.Properties.inheritanceKind, EntityMessages.PersistencePropertiesEditionPart_InheritanceKindLabel);
    inheritanceKind = new EMFComboViewer(parent);
    inheritanceKind.setContentProvider(new ArrayContentProvider());
    inheritanceKind.setLabelProvider(new AdapterFactoryLabelProvider(EEFRuntimePlugin.getDefault().getAdapterFactory()));
    GridData inheritanceKindData = new GridData(GridData.FILL_HORIZONTAL);
    inheritanceKind.getCombo().setLayoutData(inheritanceKindData);
    inheritanceKind.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(PersistencePropertiesEditionPartForm.this, EntityViewsRepository.Persistence.Properties.inheritanceKind, PropertiesEditionEvent.COMMIT, PropertiesEditionEvent.SET, null, getInheritanceKind()));
        }
    });
    inheritanceKind.setID(EntityViewsRepository.Persistence.Properties.inheritanceKind);
    // $NON-NLS-1$
    FormUtils.createHelpButton(widgetFactory, parent, propertiesEditionComponent.getHelpContent(EntityViewsRepository.Persistence.Properties.inheritanceKind, EntityViewsRepository.FORM_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 65 with AdapterFactoryLabelProvider

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

the class PersistencePropertiesEditionPartImpl method createInheritanceKindEMFComboViewer.

protected Composite createInheritanceKindEMFComboViewer(Composite parent) {
    createDescription(parent, EntityViewsRepository.Persistence.Properties.inheritanceKind, EntityMessages.PersistencePropertiesEditionPart_InheritanceKindLabel);
    inheritanceKind = new EMFComboViewer(parent);
    inheritanceKind.setContentProvider(new ArrayContentProvider());
    inheritanceKind.setLabelProvider(new AdapterFactoryLabelProvider(EEFRuntimePlugin.getDefault().getAdapterFactory()));
    GridData inheritanceKindData = new GridData(GridData.FILL_HORIZONTAL);
    inheritanceKind.getCombo().setLayoutData(inheritanceKindData);
    inheritanceKind.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(PersistencePropertiesEditionPartImpl.this, EntityViewsRepository.Persistence.Properties.inheritanceKind, PropertiesEditionEvent.COMMIT, PropertiesEditionEvent.SET, null, getInheritanceKind()));
        }
    });
    inheritanceKind.setID(EntityViewsRepository.Persistence.Properties.inheritanceKind);
    // $NON-NLS-1$
    SWTUtils.createHelpButton(parent, propertiesEditionComponent.getHelpContent(EntityViewsRepository.Persistence.Properties.inheritanceKind, EntityViewsRepository.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)

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