/** * Generated with Acceleo */ package com.github.lbroudoux.dsl.eip.parts.impl; // Start of user code for imports import java.util.ArrayList; import java.util.Iterator; import java.util.List; import org.eclipse.emf.common.util.Enumerator; import org.eclipse.emf.ecore.EObject; import org.eclipse.emf.ecore.EReference; import org.eclipse.emf.edit.ui.provider.AdapterFactoryLabelProvider; import org.eclipse.emf.eef.runtime.EEFRuntimePlugin; import org.eclipse.emf.eef.runtime.api.component.IPropertiesEditionComponent; import org.eclipse.emf.eef.runtime.api.notify.IPropertiesEditionEvent; import org.eclipse.emf.eef.runtime.api.parts.ISWTPropertiesEditionPart; import org.eclipse.emf.eef.runtime.context.impl.EObjectPropertiesEditionContext; import org.eclipse.emf.eef.runtime.impl.notify.PropertiesEditionEvent; import org.eclipse.emf.eef.runtime.impl.parts.CompositePropertiesEditionPart; import org.eclipse.emf.eef.runtime.policies.PropertiesEditingPolicy; import org.eclipse.emf.eef.runtime.providers.PropertiesEditingProvider; import org.eclipse.emf.eef.runtime.ui.parts.PartComposer; import org.eclipse.emf.eef.runtime.ui.parts.sequence.BindingCompositionSequence; import org.eclipse.emf.eef.runtime.ui.parts.sequence.CompositionSequence; import org.eclipse.emf.eef.runtime.ui.parts.sequence.CompositionStep; import org.eclipse.emf.eef.runtime.ui.utils.EditingUtils; import org.eclipse.emf.eef.runtime.ui.widgets.EMFComboViewer; import org.eclipse.emf.eef.runtime.ui.widgets.ReferencesTable; import org.eclipse.emf.eef.runtime.ui.widgets.ReferencesTable.ReferencesTableListener; import org.eclipse.emf.eef.runtime.ui.widgets.SWTUtils; import org.eclipse.emf.eef.runtime.ui.widgets.TabElementTreeSelectionDialog; import org.eclipse.emf.eef.runtime.ui.widgets.referencestable.ReferencesTableContentProvider; import org.eclipse.emf.eef.runtime.ui.widgets.referencestable.ReferencesTableSettings; import org.eclipse.jface.viewers.ArrayContentProvider; import org.eclipse.jface.viewers.ISelectionChangedListener; import org.eclipse.jface.viewers.IStructuredSelection; import org.eclipse.jface.viewers.SelectionChangedEvent; import org.eclipse.jface.viewers.StructuredSelection; import org.eclipse.jface.viewers.ViewerFilter; import org.eclipse.swt.SWT; import org.eclipse.swt.events.FocusAdapter; import org.eclipse.swt.events.FocusEvent; import org.eclipse.swt.events.KeyAdapter; import org.eclipse.swt.events.KeyEvent; import org.eclipse.swt.events.SelectionAdapter; import org.eclipse.swt.events.SelectionEvent; import org.eclipse.swt.layout.GridData; import org.eclipse.swt.layout.GridLayout; import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Group; import org.eclipse.swt.widgets.Text; import com.github.lbroudoux.dsl.eip.parts.EipViewsRepository; import com.github.lbroudoux.dsl.eip.parts.EnricherPropertiesEditionPart; import com.github.lbroudoux.dsl.eip.providers.EipMessages; // End of user code /** * @author yanngv29 * */ public class EnricherPropertiesEditionPartImpl extends CompositePropertiesEditionPart implements ISWTPropertiesEditionPart, EnricherPropertiesEditionPart { protected Text name; protected ReferencesTable toChannels; protected List<ViewerFilter> toChannelsBusinessFilters = new ArrayList<ViewerFilter>(); protected List<ViewerFilter> toChannelsFilters = new ArrayList<ViewerFilter>(); protected ReferencesTable fromChannels; protected List<ViewerFilter> fromChannelsBusinessFilters = new ArrayList<ViewerFilter>(); protected List<ViewerFilter> fromChannelsFilters = new ArrayList<ViewerFilter>(); protected ReferencesTable ownedServiceInvocations; protected List<ViewerFilter> ownedServiceInvocationsBusinessFilters = new ArrayList<ViewerFilter>(); protected List<ViewerFilter> ownedServiceInvocationsFilters = new ArrayList<ViewerFilter>(); protected EMFComboViewer part; /** * Default constructor * @param editionComponent the {@link IPropertiesEditionComponent} that manage this part * */ public EnricherPropertiesEditionPartImpl(IPropertiesEditionComponent editionComponent) { super(editionComponent); } /** * {@inheritDoc} * * @see org.eclipse.emf.eef.runtime.api.parts.ISWTPropertiesEditionPart# * createFigure(org.eclipse.swt.widgets.Composite) * */ public Composite createFigure(final Composite parent) { view = new Composite(parent, SWT.NONE); GridLayout layout = new GridLayout(); layout.numColumns = 3; view.setLayout(layout); createControls(view); return view; } /** * {@inheritDoc} * * @see org.eclipse.emf.eef.runtime.api.parts.ISWTPropertiesEditionPart# * createControls(org.eclipse.swt.widgets.Composite) * */ public void createControls(Composite view) { CompositionSequence enricherStep = new BindingCompositionSequence(propertiesEditionComponent); CompositionStep propertiesStep = enricherStep.addStep(EipViewsRepository.Enricher.Properties.class); propertiesStep.addStep(EipViewsRepository.Enricher.Properties.name); propertiesStep.addStep(EipViewsRepository.Enricher.Properties.toChannels); propertiesStep.addStep(EipViewsRepository.Enricher.Properties.fromChannels); propertiesStep.addStep(EipViewsRepository.Enricher.Properties.ownedServiceInvocations); propertiesStep.addStep(EipViewsRepository.Enricher.Properties.part); composer = new PartComposer(enricherStep) { @Override public Composite addToPart(Composite parent, Object key) { if (key == EipViewsRepository.Enricher.Properties.class) { return createPropertiesGroup(parent); } if (key == EipViewsRepository.Enricher.Properties.name) { return createNameText(parent); } if (key == EipViewsRepository.Enricher.Properties.toChannels) { return createToChannelsAdvancedReferencesTable(parent); } if (key == EipViewsRepository.Enricher.Properties.fromChannels) { return createFromChannelsAdvancedReferencesTable(parent); } if (key == EipViewsRepository.Enricher.Properties.ownedServiceInvocations) { return createOwnedServiceInvocationsAdvancedTableComposition(parent); } if (key == EipViewsRepository.Enricher.Properties.part) { return createPartEMFComboViewer(parent); } return parent; } }; composer.compose(view); } /** * */ protected Composite createPropertiesGroup(Composite parent) { Group propertiesGroup = new Group(parent, SWT.NONE); propertiesGroup.setText(EipMessages.EnricherPropertiesEditionPart_PropertiesGroupLabel); GridData propertiesGroupData = new GridData(GridData.FILL_HORIZONTAL); propertiesGroupData.horizontalSpan = 3; propertiesGroup.setLayoutData(propertiesGroupData); GridLayout propertiesGroupLayout = new GridLayout(); propertiesGroupLayout.numColumns = 3; propertiesGroup.setLayout(propertiesGroupLayout); return propertiesGroup; } protected Composite createNameText(Composite parent) { createDescription(parent, EipViewsRepository.Enricher.Properties.name, EipMessages.EnricherPropertiesEditionPart_NameLabel); name = SWTUtils.createScrollableText(parent, SWT.BORDER); GridData nameData = new GridData(GridData.FILL_HORIZONTAL); name.setLayoutData(nameData); name.addFocusListener(new FocusAdapter() { /** * {@inheritDoc} * * @see org.eclipse.swt.events.FocusAdapter#focusLost(org.eclipse.swt.events.FocusEvent) * */ @Override @SuppressWarnings("synthetic-access") public void focusLost(FocusEvent e) { if (propertiesEditionComponent != null) propertiesEditionComponent.firePropertiesChanged(new PropertiesEditionEvent(EnricherPropertiesEditionPartImpl.this, EipViewsRepository.Enricher.Properties.name, PropertiesEditionEvent.COMMIT, PropertiesEditionEvent.SET, null, name.getText())); } }); name.addKeyListener(new KeyAdapter() { /** * {@inheritDoc} * * @see org.eclipse.swt.events.KeyAdapter#keyPressed(org.eclipse.swt.events.KeyEvent) * */ @Override @SuppressWarnings("synthetic-access") public void keyPressed(KeyEvent e) { if (e.character == SWT.CR) { if (propertiesEditionComponent != null) propertiesEditionComponent.firePropertiesChanged(new PropertiesEditionEvent(EnricherPropertiesEditionPartImpl.this, EipViewsRepository.Enricher.Properties.name, PropertiesEditionEvent.COMMIT, PropertiesEditionEvent.SET, null, name.getText())); } } }); EditingUtils.setID(name, EipViewsRepository.Enricher.Properties.name); EditingUtils.setEEFtype(name, "eef::Text"); //$NON-NLS-1$ SWTUtils.createHelpButton(parent, propertiesEditionComponent.getHelpContent(EipViewsRepository.Enricher.Properties.name, EipViewsRepository.SWT_KIND), null); //$NON-NLS-1$ // Start of user code for createNameText // End of user code return parent; } /** * */ protected Composite createToChannelsAdvancedReferencesTable(Composite parent) { String label = getDescription(EipViewsRepository.Enricher.Properties.toChannels, EipMessages.EnricherPropertiesEditionPart_ToChannelsLabel); this.toChannels = new ReferencesTable(label, new ReferencesTableListener() { public void handleAdd() { addToChannels(); } public void handleEdit(EObject element) { editToChannels(element); } public void handleMove(EObject element, int oldIndex, int newIndex) { moveToChannels(element, oldIndex, newIndex); } public void handleRemove(EObject element) { removeFromToChannels(element); } public void navigateTo(EObject element) { } }); this.toChannels.setHelpText(propertiesEditionComponent.getHelpContent(EipViewsRepository.Enricher.Properties.toChannels, EipViewsRepository.SWT_KIND)); this.toChannels.createControls(parent); this.toChannels.addSelectionListener(new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { if (e.item != null && e.item.getData() instanceof EObject) { propertiesEditionComponent.firePropertiesChanged(new PropertiesEditionEvent(EnricherPropertiesEditionPartImpl.this, EipViewsRepository.Enricher.Properties.toChannels, PropertiesEditionEvent.CHANGE, PropertiesEditionEvent.SELECTION_CHANGED, null, e.item.getData())); } } }); GridData toChannelsData = new GridData(GridData.FILL_HORIZONTAL); toChannelsData.horizontalSpan = 3; this.toChannels.setLayoutData(toChannelsData); this.toChannels.disableMove(); toChannels.setID(EipViewsRepository.Enricher.Properties.toChannels); toChannels.setEEFType("eef::AdvancedReferencesTable"); //$NON-NLS-1$ return parent; } /** * */ protected void addToChannels() { TabElementTreeSelectionDialog dialog = new TabElementTreeSelectionDialog(toChannels.getInput(), toChannelsFilters, toChannelsBusinessFilters, "toChannels", propertiesEditionComponent.getEditingContext().getAdapterFactory(), current.eResource()) { @Override public void process(IStructuredSelection selection) { for (Iterator<?> iter = selection.iterator(); iter.hasNext();) { EObject elem = (EObject) iter.next(); propertiesEditionComponent.firePropertiesChanged(new PropertiesEditionEvent(EnricherPropertiesEditionPartImpl.this, EipViewsRepository.Enricher.Properties.toChannels, PropertiesEditionEvent.COMMIT, PropertiesEditionEvent.ADD, null, elem)); } toChannels.refresh(); } }; dialog.open(); } /** * */ protected void moveToChannels(EObject element, int oldIndex, int newIndex) { propertiesEditionComponent.firePropertiesChanged(new PropertiesEditionEvent(EnricherPropertiesEditionPartImpl.this, EipViewsRepository.Enricher.Properties.toChannels, PropertiesEditionEvent.COMMIT, PropertiesEditionEvent.MOVE, element, newIndex)); toChannels.refresh(); } /** * */ protected void removeFromToChannels(EObject element) { propertiesEditionComponent.firePropertiesChanged(new PropertiesEditionEvent(EnricherPropertiesEditionPartImpl.this, EipViewsRepository.Enricher.Properties.toChannels, PropertiesEditionEvent.COMMIT, PropertiesEditionEvent.REMOVE, null, element)); toChannels.refresh(); } /** * */ protected void editToChannels(EObject element) { EObjectPropertiesEditionContext context = new EObjectPropertiesEditionContext(propertiesEditionComponent.getEditingContext(), propertiesEditionComponent, element, adapterFactory); PropertiesEditingProvider provider = (PropertiesEditingProvider)adapterFactory.adapt(element, PropertiesEditingProvider.class); if (provider != null) { PropertiesEditingPolicy policy = provider.getPolicy(context); if (policy != null) { policy.execute(); toChannels.refresh(); } } } /** * */ protected Composite createFromChannelsAdvancedReferencesTable(Composite parent) { String label = getDescription(EipViewsRepository.Enricher.Properties.fromChannels, EipMessages.EnricherPropertiesEditionPart_FromChannelsLabel); this.fromChannels = new ReferencesTable(label, new ReferencesTableListener() { public void handleAdd() { addFromChannels(); } public void handleEdit(EObject element) { editFromChannels(element); } public void handleMove(EObject element, int oldIndex, int newIndex) { moveFromChannels(element, oldIndex, newIndex); } public void handleRemove(EObject element) { removeFromFromChannels(element); } public void navigateTo(EObject element) { } }); this.fromChannels.setHelpText(propertiesEditionComponent.getHelpContent(EipViewsRepository.Enricher.Properties.fromChannels, EipViewsRepository.SWT_KIND)); this.fromChannels.createControls(parent); this.fromChannels.addSelectionListener(new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { if (e.item != null && e.item.getData() instanceof EObject) { propertiesEditionComponent.firePropertiesChanged(new PropertiesEditionEvent(EnricherPropertiesEditionPartImpl.this, EipViewsRepository.Enricher.Properties.fromChannels, PropertiesEditionEvent.CHANGE, PropertiesEditionEvent.SELECTION_CHANGED, null, e.item.getData())); } } }); GridData fromChannelsData = new GridData(GridData.FILL_HORIZONTAL); fromChannelsData.horizontalSpan = 3; this.fromChannels.setLayoutData(fromChannelsData); this.fromChannels.disableMove(); fromChannels.setID(EipViewsRepository.Enricher.Properties.fromChannels); fromChannels.setEEFType("eef::AdvancedReferencesTable"); //$NON-NLS-1$ return parent; } /** * */ protected void addFromChannels() { TabElementTreeSelectionDialog dialog = new TabElementTreeSelectionDialog(fromChannels.getInput(), fromChannelsFilters, fromChannelsBusinessFilters, "fromChannels", propertiesEditionComponent.getEditingContext().getAdapterFactory(), current.eResource()) { @Override public void process(IStructuredSelection selection) { for (Iterator<?> iter = selection.iterator(); iter.hasNext();) { EObject elem = (EObject) iter.next(); propertiesEditionComponent.firePropertiesChanged(new PropertiesEditionEvent(EnricherPropertiesEditionPartImpl.this, EipViewsRepository.Enricher.Properties.fromChannels, PropertiesEditionEvent.COMMIT, PropertiesEditionEvent.ADD, null, elem)); } fromChannels.refresh(); } }; dialog.open(); } /** * */ protected void moveFromChannels(EObject element, int oldIndex, int newIndex) { propertiesEditionComponent.firePropertiesChanged(new PropertiesEditionEvent(EnricherPropertiesEditionPartImpl.this, EipViewsRepository.Enricher.Properties.fromChannels, PropertiesEditionEvent.COMMIT, PropertiesEditionEvent.MOVE, element, newIndex)); fromChannels.refresh(); } /** * */ protected void removeFromFromChannels(EObject element) { propertiesEditionComponent.firePropertiesChanged(new PropertiesEditionEvent(EnricherPropertiesEditionPartImpl.this, EipViewsRepository.Enricher.Properties.fromChannels, PropertiesEditionEvent.COMMIT, PropertiesEditionEvent.REMOVE, null, element)); fromChannels.refresh(); } /** * */ protected void editFromChannels(EObject element) { EObjectPropertiesEditionContext context = new EObjectPropertiesEditionContext(propertiesEditionComponent.getEditingContext(), propertiesEditionComponent, element, adapterFactory); PropertiesEditingProvider provider = (PropertiesEditingProvider)adapterFactory.adapt(element, PropertiesEditingProvider.class); if (provider != null) { PropertiesEditingPolicy policy = provider.getPolicy(context); if (policy != null) { policy.execute(); fromChannels.refresh(); } } } /** * @param container * */ protected Composite createOwnedServiceInvocationsAdvancedTableComposition(Composite parent) { this.ownedServiceInvocations = new ReferencesTable(getDescription(EipViewsRepository.Enricher.Properties.ownedServiceInvocations, EipMessages.EnricherPropertiesEditionPart_OwnedServiceInvocationsLabel), new ReferencesTableListener() { public void handleAdd() { propertiesEditionComponent.firePropertiesChanged(new PropertiesEditionEvent(EnricherPropertiesEditionPartImpl.this, EipViewsRepository.Enricher.Properties.ownedServiceInvocations, PropertiesEditionEvent.COMMIT, PropertiesEditionEvent.ADD, null, null)); ownedServiceInvocations.refresh(); } public void handleEdit(EObject element) { propertiesEditionComponent.firePropertiesChanged(new PropertiesEditionEvent(EnricherPropertiesEditionPartImpl.this, EipViewsRepository.Enricher.Properties.ownedServiceInvocations, PropertiesEditionEvent.COMMIT, PropertiesEditionEvent.EDIT, null, element)); ownedServiceInvocations.refresh(); } public void handleMove(EObject element, int oldIndex, int newIndex) { propertiesEditionComponent.firePropertiesChanged(new PropertiesEditionEvent(EnricherPropertiesEditionPartImpl.this, EipViewsRepository.Enricher.Properties.ownedServiceInvocations, PropertiesEditionEvent.COMMIT, PropertiesEditionEvent.MOVE, element, newIndex)); ownedServiceInvocations.refresh(); } public void handleRemove(EObject element) { propertiesEditionComponent.firePropertiesChanged(new PropertiesEditionEvent(EnricherPropertiesEditionPartImpl.this, EipViewsRepository.Enricher.Properties.ownedServiceInvocations, PropertiesEditionEvent.COMMIT, PropertiesEditionEvent.REMOVE, null, element)); ownedServiceInvocations.refresh(); } public void navigateTo(EObject element) { } }); for (ViewerFilter filter : this.ownedServiceInvocationsFilters) { this.ownedServiceInvocations.addFilter(filter); } this.ownedServiceInvocations.setHelpText(propertiesEditionComponent.getHelpContent(EipViewsRepository.Enricher.Properties.ownedServiceInvocations, EipViewsRepository.SWT_KIND)); this.ownedServiceInvocations.createControls(parent); this.ownedServiceInvocations.addSelectionListener(new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { if (e.item != null && e.item.getData() instanceof EObject) { propertiesEditionComponent.firePropertiesChanged(new PropertiesEditionEvent(EnricherPropertiesEditionPartImpl.this, EipViewsRepository.Enricher.Properties.ownedServiceInvocations, PropertiesEditionEvent.CHANGE, PropertiesEditionEvent.SELECTION_CHANGED, null, e.item.getData())); } } }); GridData ownedServiceInvocationsData = new GridData(GridData.FILL_HORIZONTAL); ownedServiceInvocationsData.horizontalSpan = 3; this.ownedServiceInvocations.setLayoutData(ownedServiceInvocationsData); this.ownedServiceInvocations.setLowerBound(0); this.ownedServiceInvocations.setUpperBound(-1); ownedServiceInvocations.setID(EipViewsRepository.Enricher.Properties.ownedServiceInvocations); ownedServiceInvocations.setEEFType("eef::AdvancedTableComposition"); //$NON-NLS-1$ // Start of user code for createOwnedServiceInvocationsAdvancedTableComposition // End of user code return parent; } protected Composite createPartEMFComboViewer(Composite parent) { createDescription(parent, EipViewsRepository.Enricher.Properties.part, EipMessages.EnricherPropertiesEditionPart_PartLabel); part = new EMFComboViewer(parent); part.setContentProvider(new ArrayContentProvider()); part.setLabelProvider(new AdapterFactoryLabelProvider(EEFRuntimePlugin.getDefault().getAdapterFactory())); GridData partData = new GridData(GridData.FILL_HORIZONTAL); part.getCombo().setLayoutData(partData); part.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(EnricherPropertiesEditionPartImpl.this, EipViewsRepository.Enricher.Properties.part, PropertiesEditionEvent.COMMIT, PropertiesEditionEvent.SET, null, getPart())); } }); part.setID(EipViewsRepository.Enricher.Properties.part); SWTUtils.createHelpButton(parent, propertiesEditionComponent.getHelpContent(EipViewsRepository.Enricher.Properties.part, EipViewsRepository.SWT_KIND), null); //$NON-NLS-1$ // Start of user code for createPartEMFComboViewer // End of user code return parent; } /** * {@inheritDoc} * * @see org.eclipse.emf.eef.runtime.api.notify.IPropertiesEditionListener#firePropertiesChanged(org.eclipse.emf.eef.runtime.api.notify.IPropertiesEditionEvent) * */ public void firePropertiesChanged(IPropertiesEditionEvent event) { // Start of user code for tab synchronization // End of user code } /** * {@inheritDoc} * * @see com.github.lbroudoux.dsl.eip.parts.EnricherPropertiesEditionPart#getName() * */ public String getName() { return name.getText(); } /** * {@inheritDoc} * * @see com.github.lbroudoux.dsl.eip.parts.EnricherPropertiesEditionPart#setName(String newValue) * */ public void setName(String newValue) { if (newValue != null) { name.setText(newValue); } else { name.setText(""); //$NON-NLS-1$ } boolean eefElementEditorReadOnlyState = isReadOnly(EipViewsRepository.Enricher.Properties.name); if (eefElementEditorReadOnlyState && name.isEnabled()) { name.setEnabled(false); name.setToolTipText(EipMessages.Enricher_ReadOnly); } else if (!eefElementEditorReadOnlyState && !name.isEnabled()) { name.setEnabled(true); } } /** * {@inheritDoc} * * @see com.github.lbroudoux.dsl.eip.parts.EnricherPropertiesEditionPart#initToChannels(org.eclipse.emf.eef.runtime.ui.widgets.referencestable.ReferencesTableSettings) */ public void initToChannels(ReferencesTableSettings settings) { if (current.eResource() != null && current.eResource().getResourceSet() != null) this.resourceSet = current.eResource().getResourceSet(); ReferencesTableContentProvider contentProvider = new ReferencesTableContentProvider(); toChannels.setContentProvider(contentProvider); toChannels.setInput(settings); boolean eefElementEditorReadOnlyState = isReadOnly(EipViewsRepository.Enricher.Properties.toChannels); if (eefElementEditorReadOnlyState && toChannels.getTable().isEnabled()) { toChannels.setEnabled(false); toChannels.setToolTipText(EipMessages.Enricher_ReadOnly); } else if (!eefElementEditorReadOnlyState && !toChannels.getTable().isEnabled()) { toChannels.setEnabled(true); } } /** * {@inheritDoc} * * @see com.github.lbroudoux.dsl.eip.parts.EnricherPropertiesEditionPart#updateToChannels() * */ public void updateToChannels() { toChannels.refresh(); } /** * {@inheritDoc} * * @see com.github.lbroudoux.dsl.eip.parts.EnricherPropertiesEditionPart#addFilterToChannels(ViewerFilter filter) * */ public void addFilterToToChannels(ViewerFilter filter) { toChannelsFilters.add(filter); } /** * {@inheritDoc} * * @see com.github.lbroudoux.dsl.eip.parts.EnricherPropertiesEditionPart#addBusinessFilterToChannels(ViewerFilter filter) * */ public void addBusinessFilterToToChannels(ViewerFilter filter) { toChannelsBusinessFilters.add(filter); } /** * {@inheritDoc} * * @see com.github.lbroudoux.dsl.eip.parts.EnricherPropertiesEditionPart#isContainedInToChannelsTable(EObject element) * */ public boolean isContainedInToChannelsTable(EObject element) { return ((ReferencesTableSettings)toChannels.getInput()).contains(element); } /** * {@inheritDoc} * * @see com.github.lbroudoux.dsl.eip.parts.EnricherPropertiesEditionPart#initFromChannels(org.eclipse.emf.eef.runtime.ui.widgets.referencestable.ReferencesTableSettings) */ public void initFromChannels(ReferencesTableSettings settings) { if (current.eResource() != null && current.eResource().getResourceSet() != null) this.resourceSet = current.eResource().getResourceSet(); ReferencesTableContentProvider contentProvider = new ReferencesTableContentProvider(); fromChannels.setContentProvider(contentProvider); fromChannels.setInput(settings); boolean eefElementEditorReadOnlyState = isReadOnly(EipViewsRepository.Enricher.Properties.fromChannels); if (eefElementEditorReadOnlyState && fromChannels.getTable().isEnabled()) { fromChannels.setEnabled(false); fromChannels.setToolTipText(EipMessages.Enricher_ReadOnly); } else if (!eefElementEditorReadOnlyState && !fromChannels.getTable().isEnabled()) { fromChannels.setEnabled(true); } } /** * {@inheritDoc} * * @see com.github.lbroudoux.dsl.eip.parts.EnricherPropertiesEditionPart#updateFromChannels() * */ public void updateFromChannels() { fromChannels.refresh(); } /** * {@inheritDoc} * * @see com.github.lbroudoux.dsl.eip.parts.EnricherPropertiesEditionPart#addFilterFromChannels(ViewerFilter filter) * */ public void addFilterToFromChannels(ViewerFilter filter) { fromChannelsFilters.add(filter); } /** * {@inheritDoc} * * @see com.github.lbroudoux.dsl.eip.parts.EnricherPropertiesEditionPart#addBusinessFilterFromChannels(ViewerFilter filter) * */ public void addBusinessFilterToFromChannels(ViewerFilter filter) { fromChannelsBusinessFilters.add(filter); } /** * {@inheritDoc} * * @see com.github.lbroudoux.dsl.eip.parts.EnricherPropertiesEditionPart#isContainedInFromChannelsTable(EObject element) * */ public boolean isContainedInFromChannelsTable(EObject element) { return ((ReferencesTableSettings)fromChannels.getInput()).contains(element); } /** * {@inheritDoc} * * @see com.github.lbroudoux.dsl.eip.parts.EnricherPropertiesEditionPart#initOwnedServiceInvocations(EObject current, EReference containingFeature, EReference feature) */ public void initOwnedServiceInvocations(ReferencesTableSettings settings) { if (current.eResource() != null && current.eResource().getResourceSet() != null) this.resourceSet = current.eResource().getResourceSet(); ReferencesTableContentProvider contentProvider = new ReferencesTableContentProvider(); ownedServiceInvocations.setContentProvider(contentProvider); ownedServiceInvocations.setInput(settings); boolean eefElementEditorReadOnlyState = isReadOnly(EipViewsRepository.Enricher.Properties.ownedServiceInvocations); if (eefElementEditorReadOnlyState && ownedServiceInvocations.isEnabled()) { ownedServiceInvocations.setEnabled(false); ownedServiceInvocations.setToolTipText(EipMessages.Enricher_ReadOnly); } else if (!eefElementEditorReadOnlyState && !ownedServiceInvocations.isEnabled()) { ownedServiceInvocations.setEnabled(true); } } /** * {@inheritDoc} * * @see com.github.lbroudoux.dsl.eip.parts.EnricherPropertiesEditionPart#updateOwnedServiceInvocations() * */ public void updateOwnedServiceInvocations() { ownedServiceInvocations.refresh(); } /** * {@inheritDoc} * * @see com.github.lbroudoux.dsl.eip.parts.EnricherPropertiesEditionPart#addFilterOwnedServiceInvocations(ViewerFilter filter) * */ public void addFilterToOwnedServiceInvocations(ViewerFilter filter) { ownedServiceInvocationsFilters.add(filter); if (this.ownedServiceInvocations != null) { this.ownedServiceInvocations.addFilter(filter); } } /** * {@inheritDoc} * * @see com.github.lbroudoux.dsl.eip.parts.EnricherPropertiesEditionPart#addBusinessFilterOwnedServiceInvocations(ViewerFilter filter) * */ public void addBusinessFilterToOwnedServiceInvocations(ViewerFilter filter) { ownedServiceInvocationsBusinessFilters.add(filter); } /** * {@inheritDoc} * * @see com.github.lbroudoux.dsl.eip.parts.EnricherPropertiesEditionPart#isContainedInOwnedServiceInvocationsTable(EObject element) * */ public boolean isContainedInOwnedServiceInvocationsTable(EObject element) { return ((ReferencesTableSettings)ownedServiceInvocations.getInput()).contains(element); } /** * {@inheritDoc} * * @see com.github.lbroudoux.dsl.eip.parts.EnricherPropertiesEditionPart#getPart() * */ public Enumerator getPart() { Enumerator selection = (Enumerator) ((StructuredSelection) part.getSelection()).getFirstElement(); return selection; } /** * {@inheritDoc} * * @see com.github.lbroudoux.dsl.eip.parts.EnricherPropertiesEditionPart#initPart(Object input, Enumerator current) */ public void initPart(Object input, Enumerator current) { part.setInput(input); part.modelUpdating(new StructuredSelection(current)); boolean eefElementEditorReadOnlyState = isReadOnly(EipViewsRepository.Enricher.Properties.part); if (eefElementEditorReadOnlyState && part.isEnabled()) { part.setEnabled(false); part.setToolTipText(EipMessages.Enricher_ReadOnly); } else if (!eefElementEditorReadOnlyState && !part.isEnabled()) { part.setEnabled(true); } } /** * {@inheritDoc} * * @see com.github.lbroudoux.dsl.eip.parts.EnricherPropertiesEditionPart#setPart(Enumerator newValue) * */ public void setPart(Enumerator newValue) { part.modelUpdating(new StructuredSelection(newValue)); boolean eefElementEditorReadOnlyState = isReadOnly(EipViewsRepository.Enricher.Properties.part); if (eefElementEditorReadOnlyState && part.isEnabled()) { part.setEnabled(false); part.setToolTipText(EipMessages.Enricher_ReadOnly); } else if (!eefElementEditorReadOnlyState && !part.isEnabled()) { part.setEnabled(true); } } /** * {@inheritDoc} * * @see org.eclipse.emf.eef.runtime.api.parts.IPropertiesEditionPart#getTitle() * */ public String getTitle() { return EipMessages.Enricher_Part_Title; } // Start of user code additional methods // End of user code }