| /******************************************************************************* |
| * Copyright (c) 2016 Fundación Tecnalia Research & Innovation. |
| * |
| * All rights reserved. This program and the accompanying materials |
| * are made available under the terms of the Eclipse Public License v2.0 |
| * which accompanies this distribution, and is available at |
| * https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.html |
| * |
| * SPDX-License-Identifier: EPL-2.0 |
| * |
| * Contributors: |
| * Huascar Espinoza - initial API and implementation |
| * Alejandra Ruíz - initial API and implementation |
| * Idoya Del Río - initial API and implementation |
| * Mari Carmen Palacios - initial API and implementation |
| * Angel López - initial API and implementation |
| *******************************************************************************/ |
| /** |
| * Generated with Acceleo |
| */ |
| package org.eclipse.opencert.evm.evidspec.evidence.parts.forms; |
| |
| // Start of user code for imports |
| import org.eclipse.emf.common.util.Enumerator;
|
| import org.eclipse.emf.ecore.EObject;
|
| import org.eclipse.emf.ecore.util.EcoreAdapterFactory;
|
| 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.IFormPropertiesEditionPart;
|
| import org.eclipse.emf.eef.runtime.impl.notify.PropertiesEditionEvent;
|
| import org.eclipse.emf.eef.runtime.part.impl.SectionPropertiesEditingPart;
|
| 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.ButtonsModeEnum;
|
| import org.eclipse.emf.eef.runtime.ui.widgets.EMFComboViewer;
|
| import org.eclipse.emf.eef.runtime.ui.widgets.EObjectFlatComboViewer;
|
| import org.eclipse.emf.eef.runtime.ui.widgets.FormUtils;
|
| import org.eclipse.emf.eef.runtime.ui.widgets.eobjflatcombo.EObjectFlatComboSettings;
|
| import org.eclipse.jface.dialogs.MessageDialog; |
| import org.eclipse.jface.viewers.ArrayContentProvider;
|
| import org.eclipse.jface.viewers.ISelectionChangedListener;
|
| 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.layout.GridData;
|
| import org.eclipse.swt.layout.GridLayout;
|
| import org.eclipse.swt.widgets.Composite;
|
| import org.eclipse.swt.widgets.Shell; |
| import org.eclipse.swt.widgets.Text;
|
| import org.eclipse.ui.forms.widgets.Form;
|
| import org.eclipse.ui.forms.widgets.FormToolkit;
|
| import org.eclipse.ui.forms.widgets.ScrolledForm;
|
| import org.eclipse.ui.forms.widgets.Section;
|
| import org.eclipse.opencert.evm.evidspec.evidence.parts.ArtefactRelPropertiesEditionPart;
|
| import org.eclipse.opencert.evm.evidspec.evidence.parts.EvidenceViewsRepository;
|
| import org.eclipse.opencert.evm.evidspec.evidence.providers.EvidenceMessages; |
| |
| // End of user code |
| |
| /** |
| * |
| * |
| */ |
| public class ArtefactRelPropertiesEditionPartForm extends SectionPropertiesEditingPart implements IFormPropertiesEditionPart, ArtefactRelPropertiesEditionPart { |
| |
| protected Text id; |
| protected Text name; |
| protected Text description; |
| protected EMFComboViewer modificationEffect; |
| protected EMFComboViewer revocationEffect; |
| protected EObjectFlatComboViewer source; |
| protected EObjectFlatComboViewer target; |
| |
| |
| |
| /** |
| * For {@link ISection} use only. |
| */ |
| public ArtefactRelPropertiesEditionPartForm() { super(); } |
| |
| /** |
| * Default constructor |
| * @param editionComponent the {@link IPropertiesEditionComponent} that manage this part |
| * |
| */ |
| public ArtefactRelPropertiesEditionPartForm(IPropertiesEditionComponent editionComponent) { |
| super(editionComponent); |
| } |
| |
| /** |
| * {@inheritDoc} |
| * |
| * @see org.eclipse.emf.eef.runtime.api.parts.IFormPropertiesEditionPart# |
| * createFigure(org.eclipse.swt.widgets.Composite, org.eclipse.ui.forms.widgets.FormToolkit) |
| * |
| */ |
| public Composite createFigure(final Composite parent, final FormToolkit widgetFactory) { |
| ScrolledForm scrolledForm = widgetFactory.createScrolledForm(parent); |
| Form form = scrolledForm.getForm(); |
| view = form.getBody(); |
| GridLayout layout = new GridLayout(); |
| layout.numColumns = 3; |
| view.setLayout(layout); |
| createControls(widgetFactory, view); |
| return scrolledForm; |
| } |
| |
| /** |
| * {@inheritDoc} |
| * |
| * @see org.eclipse.emf.eef.runtime.api.parts.IFormPropertiesEditionPart# |
| * createControls(org.eclipse.ui.forms.widgets.FormToolkit, org.eclipse.swt.widgets.Composite) |
| * |
| */ |
| public void createControls(final FormToolkit widgetFactory, Composite view) { |
| CompositionSequence artefactRelStep = new BindingCompositionSequence(propertiesEditionComponent); |
| CompositionStep propertiesStep = artefactRelStep.addStep(EvidenceViewsRepository.ArtefactRel.Properties.class); |
| propertiesStep.addStep(EvidenceViewsRepository.ArtefactRel.Properties.id); |
| propertiesStep.addStep(EvidenceViewsRepository.ArtefactRel.Properties.name); |
| propertiesStep.addStep(EvidenceViewsRepository.ArtefactRel.Properties.description); |
| propertiesStep.addStep(EvidenceViewsRepository.ArtefactRel.Properties.modificationEffect); |
| propertiesStep.addStep(EvidenceViewsRepository.ArtefactRel.Properties.revocationEffect); |
| propertiesStep.addStep(EvidenceViewsRepository.ArtefactRel.Properties.source); |
| propertiesStep.addStep(EvidenceViewsRepository.ArtefactRel.Properties.target); |
| |
| |
| composer = new PartComposer(artefactRelStep) { |
| |
| @Override |
| public Composite addToPart(Composite parent, Object key) { |
| if (key == EvidenceViewsRepository.ArtefactRel.Properties.class) { |
| return createPropertiesGroup(widgetFactory, parent); |
| } |
| if (key == EvidenceViewsRepository.ArtefactRel.Properties.id) { |
| return createIdText(widgetFactory, parent); |
| } |
| if (key == EvidenceViewsRepository.ArtefactRel.Properties.name) { |
| return createNameText(widgetFactory, parent); |
| } |
| if (key == EvidenceViewsRepository.ArtefactRel.Properties.description) { |
| return createDescriptionText(widgetFactory, parent); |
| } |
| if (key == EvidenceViewsRepository.ArtefactRel.Properties.modificationEffect) { |
| return createModificationEffectEMFComboViewer(widgetFactory, parent); |
| } |
| if (key == EvidenceViewsRepository.ArtefactRel.Properties.revocationEffect) { |
| return createRevocationEffectEMFComboViewer(widgetFactory, parent); |
| } |
| if (key == EvidenceViewsRepository.ArtefactRel.Properties.source) { |
| return createSourceFlatComboViewer(parent, widgetFactory); |
| } |
| if (key == EvidenceViewsRepository.ArtefactRel.Properties.target) { |
| return createTargetFlatComboViewer(parent, widgetFactory); |
| } |
| return parent; |
| } |
| }; |
| composer.compose(view); |
| } |
| /** |
| * |
| */ |
| protected Composite createPropertiesGroup(FormToolkit widgetFactory, final Composite parent) { |
| Section propertiesSection = widgetFactory.createSection(parent, Section.TITLE_BAR | Section.TWISTIE | Section.EXPANDED); |
| propertiesSection.setText(EvidenceMessages.ArtefactRelPropertiesEditionPart_PropertiesGroupLabel); |
| GridData propertiesSectionData = new GridData(GridData.FILL_HORIZONTAL); |
| propertiesSectionData.horizontalSpan = 3; |
| propertiesSection.setLayoutData(propertiesSectionData); |
| Composite propertiesGroup = widgetFactory.createComposite(propertiesSection); |
| GridLayout propertiesGroupLayout = new GridLayout(); |
| propertiesGroupLayout.numColumns = 3; |
| propertiesGroup.setLayout(propertiesGroupLayout); |
| propertiesSection.setClient(propertiesGroup); |
| return propertiesGroup; |
| } |
| |
| |
| protected Composite createIdText(FormToolkit widgetFactory, Composite parent) { |
| createDescription(parent, EvidenceViewsRepository.ArtefactRel.Properties.id, EvidenceMessages.ArtefactRelPropertiesEditionPart_IdLabel); |
| id = widgetFactory.createText(parent, ""); //$NON-NLS-1$ |
| id.setData(FormToolkit.KEY_DRAW_BORDER, FormToolkit.TEXT_BORDER); |
| widgetFactory.paintBordersFor(parent); |
| GridData idData = new GridData(GridData.FILL_HORIZONTAL); |
| id.setLayoutData(idData); |
| id.addFocusListener(new FocusAdapter() { |
| /** |
| * @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( |
| ArtefactRelPropertiesEditionPartForm.this, |
| EvidenceViewsRepository.ArtefactRel.Properties.id, |
| PropertiesEditionEvent.COMMIT, PropertiesEditionEvent.SET, null, id.getText())); |
| propertiesEditionComponent |
| .firePropertiesChanged(new PropertiesEditionEvent( |
| ArtefactRelPropertiesEditionPartForm.this, |
| EvidenceViewsRepository.ArtefactRel.Properties.id, |
| PropertiesEditionEvent.FOCUS_CHANGED, PropertiesEditionEvent.FOCUS_LOST, |
| null, id.getText())); |
| } |
| } |
| |
| /** |
| * @see org.eclipse.swt.events.FocusAdapter#focusGained(org.eclipse.swt.events.FocusEvent) |
| */ |
| @Override |
| public void focusGained(FocusEvent e) { |
| if (propertiesEditionComponent != null) { |
| propertiesEditionComponent |
| .firePropertiesChanged(new PropertiesEditionEvent( |
| ArtefactRelPropertiesEditionPartForm.this, |
| null, |
| PropertiesEditionEvent.FOCUS_CHANGED, PropertiesEditionEvent.FOCUS_GAINED, |
| null, null)); |
| } |
| } |
| }); |
| id.addKeyListener(new KeyAdapter() { |
| /** |
| * @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(ArtefactRelPropertiesEditionPartForm.this, EvidenceViewsRepository.ArtefactRel.Properties.id, PropertiesEditionEvent.COMMIT, PropertiesEditionEvent.SET, null, id.getText())); |
| } |
| } |
| }); |
| EditingUtils.setID(id, EvidenceViewsRepository.ArtefactRel.Properties.id); |
| EditingUtils.setEEFtype(id, "eef::Text"); //$NON-NLS-1$ |
| FormUtils.createHelpButton(widgetFactory, parent, propertiesEditionComponent.getHelpContent(EvidenceViewsRepository.ArtefactRel.Properties.id, EvidenceViewsRepository.FORM_KIND), null); //$NON-NLS-1$ |
| // Start of user code for createIdText |
| |
| // End of user code |
| return parent; |
| } |
| |
| |
| protected Composite createNameText(FormToolkit widgetFactory, Composite parent) { |
| createDescription(parent, EvidenceViewsRepository.ArtefactRel.Properties.name, EvidenceMessages.ArtefactRelPropertiesEditionPart_NameLabel); |
| name = widgetFactory.createText(parent, ""); //$NON-NLS-1$ |
| name.setData(FormToolkit.KEY_DRAW_BORDER, FormToolkit.TEXT_BORDER); |
| widgetFactory.paintBordersFor(parent); |
| GridData nameData = new GridData(GridData.FILL_HORIZONTAL); |
| name.setLayoutData(nameData); |
| name.addFocusListener(new FocusAdapter() { |
| /** |
| * @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( |
| ArtefactRelPropertiesEditionPartForm.this, |
| EvidenceViewsRepository.ArtefactRel.Properties.name, |
| PropertiesEditionEvent.COMMIT, PropertiesEditionEvent.SET, null, name.getText())); |
| propertiesEditionComponent |
| .firePropertiesChanged(new PropertiesEditionEvent( |
| ArtefactRelPropertiesEditionPartForm.this, |
| EvidenceViewsRepository.ArtefactRel.Properties.name, |
| PropertiesEditionEvent.FOCUS_CHANGED, PropertiesEditionEvent.FOCUS_LOST, |
| null, name.getText())); |
| } |
| } |
| |
| /** |
| * @see org.eclipse.swt.events.FocusAdapter#focusGained(org.eclipse.swt.events.FocusEvent) |
| */ |
| @Override |
| public void focusGained(FocusEvent e) { |
| if (propertiesEditionComponent != null) { |
| propertiesEditionComponent |
| .firePropertiesChanged(new PropertiesEditionEvent( |
| ArtefactRelPropertiesEditionPartForm.this, |
| null, |
| PropertiesEditionEvent.FOCUS_CHANGED, PropertiesEditionEvent.FOCUS_GAINED, |
| null, null)); |
| } |
| } |
| }); |
| name.addKeyListener(new KeyAdapter() { |
| /** |
| * @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(ArtefactRelPropertiesEditionPartForm.this, EvidenceViewsRepository.ArtefactRel.Properties.name, PropertiesEditionEvent.COMMIT, PropertiesEditionEvent.SET, null, name.getText())); |
| } |
| } |
| }); |
| EditingUtils.setID(name, EvidenceViewsRepository.ArtefactRel.Properties.name); |
| EditingUtils.setEEFtype(name, "eef::Text"); //$NON-NLS-1$ |
| FormUtils.createHelpButton(widgetFactory, parent, propertiesEditionComponent.getHelpContent(EvidenceViewsRepository.ArtefactRel.Properties.name, EvidenceViewsRepository.FORM_KIND), null); //$NON-NLS-1$ |
| // Start of user code for createNameText |
| |
| // End of user code |
| return parent; |
| } |
| |
| |
| protected Composite createDescriptionText(FormToolkit widgetFactory, Composite parent) { |
| createDescription(parent, EvidenceViewsRepository.ArtefactRel.Properties.description, EvidenceMessages.ArtefactRelPropertiesEditionPart_DescriptionLabel); |
| description = widgetFactory.createText(parent, ""); //$NON-NLS-1$ |
| description.setData(FormToolkit.KEY_DRAW_BORDER, FormToolkit.TEXT_BORDER); |
| widgetFactory.paintBordersFor(parent); |
| GridData descriptionData = new GridData(GridData.FILL_HORIZONTAL); |
| description.setLayoutData(descriptionData); |
| description.addFocusListener(new FocusAdapter() { |
| /** |
| * @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( |
| ArtefactRelPropertiesEditionPartForm.this, |
| EvidenceViewsRepository.ArtefactRel.Properties.description, |
| PropertiesEditionEvent.COMMIT, PropertiesEditionEvent.SET, null, description.getText())); |
| propertiesEditionComponent |
| .firePropertiesChanged(new PropertiesEditionEvent( |
| ArtefactRelPropertiesEditionPartForm.this, |
| EvidenceViewsRepository.ArtefactRel.Properties.description, |
| PropertiesEditionEvent.FOCUS_CHANGED, PropertiesEditionEvent.FOCUS_LOST, |
| null, description.getText())); |
| } |
| } |
| |
| /** |
| * @see org.eclipse.swt.events.FocusAdapter#focusGained(org.eclipse.swt.events.FocusEvent) |
| */ |
| @Override |
| public void focusGained(FocusEvent e) { |
| if (propertiesEditionComponent != null) { |
| propertiesEditionComponent |
| .firePropertiesChanged(new PropertiesEditionEvent( |
| ArtefactRelPropertiesEditionPartForm.this, |
| null, |
| PropertiesEditionEvent.FOCUS_CHANGED, PropertiesEditionEvent.FOCUS_GAINED, |
| null, null)); |
| } |
| } |
| }); |
| description.addKeyListener(new KeyAdapter() { |
| /** |
| * @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(ArtefactRelPropertiesEditionPartForm.this, EvidenceViewsRepository.ArtefactRel.Properties.description, PropertiesEditionEvent.COMMIT, PropertiesEditionEvent.SET, null, description.getText())); |
| } |
| } |
| }); |
| EditingUtils.setID(description, EvidenceViewsRepository.ArtefactRel.Properties.description); |
| EditingUtils.setEEFtype(description, "eef::Text"); //$NON-NLS-1$ |
| FormUtils.createHelpButton(widgetFactory, parent, propertiesEditionComponent.getHelpContent(EvidenceViewsRepository.ArtefactRel.Properties.description, EvidenceViewsRepository.FORM_KIND), null); //$NON-NLS-1$ |
| // Start of user code for createDescriptionText |
| |
| // End of user code |
| return parent; |
| } |
| |
| |
| protected Composite createModificationEffectEMFComboViewer(FormToolkit widgetFactory, Composite parent) { |
| createDescription(parent, EvidenceViewsRepository.ArtefactRel.Properties.modificationEffect, EvidenceMessages.ArtefactRelPropertiesEditionPart_ModificationEffectLabel); |
| modificationEffect = new EMFComboViewer(parent); |
| modificationEffect.setContentProvider(new ArrayContentProvider()); |
| modificationEffect.setLabelProvider(new AdapterFactoryLabelProvider(EEFRuntimePlugin.getDefault().getAdapterFactory())); |
| GridData modificationEffectData = new GridData(GridData.FILL_HORIZONTAL); |
| modificationEffect.getCombo().setLayoutData(modificationEffectData); |
| modificationEffect.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(ArtefactRelPropertiesEditionPartForm.this, EvidenceViewsRepository.ArtefactRel.Properties.modificationEffect, PropertiesEditionEvent.COMMIT, PropertiesEditionEvent.SET, null, getModificationEffect())); |
| } |
| |
| }); |
| modificationEffect.setID(EvidenceViewsRepository.ArtefactRel.Properties.modificationEffect); |
| FormUtils.createHelpButton(widgetFactory, parent, propertiesEditionComponent.getHelpContent(EvidenceViewsRepository.ArtefactRel.Properties.modificationEffect, EvidenceViewsRepository.FORM_KIND), null); //$NON-NLS-1$ |
| // Start of user code for createModificationEffectEMFComboViewer |
| |
| // End of user code |
| return parent; |
| } |
| |
| |
| protected Composite createRevocationEffectEMFComboViewer(FormToolkit widgetFactory, Composite parent) { |
| createDescription(parent, EvidenceViewsRepository.ArtefactRel.Properties.revocationEffect, EvidenceMessages.ArtefactRelPropertiesEditionPart_RevocationEffectLabel); |
| revocationEffect = new EMFComboViewer(parent); |
| revocationEffect.setContentProvider(new ArrayContentProvider()); |
| revocationEffect.setLabelProvider(new AdapterFactoryLabelProvider(EEFRuntimePlugin.getDefault().getAdapterFactory())); |
| GridData revocationEffectData = new GridData(GridData.FILL_HORIZONTAL); |
| revocationEffect.getCombo().setLayoutData(revocationEffectData); |
| revocationEffect.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(ArtefactRelPropertiesEditionPartForm.this, EvidenceViewsRepository.ArtefactRel.Properties.revocationEffect, PropertiesEditionEvent.COMMIT, PropertiesEditionEvent.SET, null, getRevocationEffect())); |
| } |
| |
| }); |
| revocationEffect.setID(EvidenceViewsRepository.ArtefactRel.Properties.revocationEffect); |
| FormUtils.createHelpButton(widgetFactory, parent, propertiesEditionComponent.getHelpContent(EvidenceViewsRepository.ArtefactRel.Properties.revocationEffect, EvidenceViewsRepository.FORM_KIND), null); //$NON-NLS-1$ |
| // Start of user code for createRevocationEffectEMFComboViewer |
| |
| // End of user code |
| return parent; |
| } |
| |
| /** |
| * @param parent the parent composite |
| * @param widgetFactory factory to use to instanciante widget of the form |
| * |
| */ |
| protected Composite createSourceFlatComboViewer(Composite parent, FormToolkit widgetFactory) { |
| createDescription(parent, EvidenceViewsRepository.ArtefactRel.Properties.source, EvidenceMessages.ArtefactRelPropertiesEditionPart_SourceLabel); |
| source = new EObjectFlatComboViewer(parent, !propertiesEditionComponent.isRequired(EvidenceViewsRepository.ArtefactRel.Properties.source, EvidenceViewsRepository.FORM_KIND)); |
| widgetFactory.adapt(source); |
| source.setLabelProvider(new AdapterFactoryLabelProvider(adapterFactory)); |
| GridData sourceData = new GridData(GridData.FILL_HORIZONTAL); |
| source.setLayoutData(sourceData); |
| source.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(ArtefactRelPropertiesEditionPartForm.this, EvidenceViewsRepository.ArtefactRel.Properties.source, PropertiesEditionEvent.COMMIT, PropertiesEditionEvent.SET, null, getSource())); |
| } |
| |
| }); |
| source.setID(EvidenceViewsRepository.ArtefactRel.Properties.source); |
| FormUtils.createHelpButton(widgetFactory, parent, propertiesEditionComponent.getHelpContent(EvidenceViewsRepository.ArtefactRel.Properties.source, EvidenceViewsRepository.FORM_KIND), null); //$NON-NLS-1$ |
| // Start of user code for createSourceFlatComboViewer |
| |
| // End of user code |
| return parent; |
| } |
| |
| /** |
| * @param parent the parent composite |
| * @param widgetFactory factory to use to instanciante widget of the form |
| * |
| */ |
| protected Composite createTargetFlatComboViewer(Composite parent, FormToolkit widgetFactory) { |
| createDescription(parent, EvidenceViewsRepository.ArtefactRel.Properties.target, EvidenceMessages.ArtefactRelPropertiesEditionPart_TargetLabel); |
| target = new EObjectFlatComboViewer(parent, !propertiesEditionComponent.isRequired(EvidenceViewsRepository.ArtefactRel.Properties.target, EvidenceViewsRepository.FORM_KIND)); |
| widgetFactory.adapt(target); |
| target.setLabelProvider(new AdapterFactoryLabelProvider(adapterFactory)); |
| GridData targetData = new GridData(GridData.FILL_HORIZONTAL); |
| target.setLayoutData(targetData); |
| target.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(ArtefactRelPropertiesEditionPartForm.this, EvidenceViewsRepository.ArtefactRel.Properties.target, PropertiesEditionEvent.COMMIT, PropertiesEditionEvent.SET, null, getTarget())); |
| } |
| |
| }); |
| target.setID(EvidenceViewsRepository.ArtefactRel.Properties.target); |
| FormUtils.createHelpButton(widgetFactory, parent, propertiesEditionComponent.getHelpContent(EvidenceViewsRepository.ArtefactRel.Properties.target, EvidenceViewsRepository.FORM_KIND), null); //$NON-NLS-1$ |
| // Start of user code for createTargetFlatComboViewer |
| |
| // 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 |
| Shell thisS= this.container.getShell(); |
| MessageDialog.openInformation(thisS, "Confirm", "Artefact REL Changed"); |
| // End of user code |
| } |
| |
| /** |
| * {@inheritDoc} |
| * |
| * @see org.eclipse.opencert.evm.evidspec.evidence.parts.ArtefactRelPropertiesEditionPart#getId() |
| * |
| */ |
| public String getId() { |
| return id.getText(); |
| } |
| |
| /** |
| * {@inheritDoc} |
| * |
| * @see org.eclipse.opencert.evm.evidspec.evidence.parts.ArtefactRelPropertiesEditionPart#setId(String newValue) |
| * |
| */ |
| public void setId(String newValue) { |
| if (newValue != null) { |
| id.setText(newValue); |
| } else { |
| id.setText(""); //$NON-NLS-1$ |
| } |
| boolean eefElementEditorReadOnlyState = isReadOnly(EvidenceViewsRepository.ArtefactRel.Properties.id); |
| if (eefElementEditorReadOnlyState && id.isEnabled()) { |
| id.setEnabled(false); |
| id.setToolTipText(EvidenceMessages.ArtefactRel_ReadOnly); |
| } else if (!eefElementEditorReadOnlyState && !id.isEnabled()) { |
| id.setEnabled(true); |
| } |
| |
| } |
| |
| /** |
| * {@inheritDoc} |
| * |
| * @see org.eclipse.opencert.evm.evidspec.evidence.parts.ArtefactRelPropertiesEditionPart#getName() |
| * |
| */ |
| public String getName() { |
| return name.getText(); |
| } |
| |
| /** |
| * {@inheritDoc} |
| * |
| * @see org.eclipse.opencert.evm.evidspec.evidence.parts.ArtefactRelPropertiesEditionPart#setName(String newValue) |
| * |
| */ |
| public void setName(String newValue) { |
| if (newValue != null) { |
| name.setText(newValue); |
| } else { |
| name.setText(""); //$NON-NLS-1$ |
| } |
| boolean eefElementEditorReadOnlyState = isReadOnly(EvidenceViewsRepository.ArtefactRel.Properties.name); |
| if (eefElementEditorReadOnlyState && name.isEnabled()) { |
| name.setEnabled(false); |
| name.setToolTipText(EvidenceMessages.ArtefactRel_ReadOnly); |
| } else if (!eefElementEditorReadOnlyState && !name.isEnabled()) { |
| name.setEnabled(true); |
| } |
| |
| } |
| |
| /** |
| * {@inheritDoc} |
| * |
| * @see org.eclipse.opencert.evm.evidspec.evidence.parts.ArtefactRelPropertiesEditionPart#getDescription() |
| * |
| */ |
| public String getDescription() { |
| return description.getText(); |
| } |
| |
| /** |
| * {@inheritDoc} |
| * |
| * @see org.eclipse.opencert.evm.evidspec.evidence.parts.ArtefactRelPropertiesEditionPart#setDescription(String newValue) |
| * |
| */ |
| public void setDescription(String newValue) { |
| if (newValue != null) { |
| description.setText(newValue); |
| } else { |
| description.setText(""); //$NON-NLS-1$ |
| } |
| boolean eefElementEditorReadOnlyState = isReadOnly(EvidenceViewsRepository.ArtefactRel.Properties.description); |
| if (eefElementEditorReadOnlyState && description.isEnabled()) { |
| description.setEnabled(false); |
| description.setToolTipText(EvidenceMessages.ArtefactRel_ReadOnly); |
| } else if (!eefElementEditorReadOnlyState && !description.isEnabled()) { |
| description.setEnabled(true); |
| } |
| |
| } |
| |
| /** |
| * {@inheritDoc} |
| * |
| * @see org.eclipse.opencert.evm.evidspec.evidence.parts.ArtefactRelPropertiesEditionPart#getModificationEffect() |
| * |
| */ |
| public Enumerator getModificationEffect() { |
| Enumerator selection = (Enumerator) ((StructuredSelection) modificationEffect.getSelection()).getFirstElement(); |
| return selection; |
| } |
| |
| /** |
| * {@inheritDoc} |
| * |
| * @see org.eclipse.opencert.evm.evidspec.evidence.parts.ArtefactRelPropertiesEditionPart#initModificationEffect(Object input, Enumerator current) |
| */ |
| public void initModificationEffect(Object input, Enumerator current) { |
| modificationEffect.setInput(input); |
| modificationEffect.modelUpdating(new StructuredSelection(current)); |
| boolean eefElementEditorReadOnlyState = isReadOnly(EvidenceViewsRepository.ArtefactRel.Properties.modificationEffect); |
| if (eefElementEditorReadOnlyState && modificationEffect.isEnabled()) { |
| modificationEffect.setEnabled(false); |
| modificationEffect.setToolTipText(EvidenceMessages.ArtefactRel_ReadOnly); |
| } else if (!eefElementEditorReadOnlyState && !modificationEffect.isEnabled()) { |
| modificationEffect.setEnabled(true); |
| } |
| |
| } |
| |
| /** |
| * {@inheritDoc} |
| * |
| * @see org.eclipse.opencert.evm.evidspec.evidence.parts.ArtefactRelPropertiesEditionPart#setModificationEffect(Enumerator newValue) |
| * |
| */ |
| public void setModificationEffect(Enumerator newValue) { |
| modificationEffect.modelUpdating(new StructuredSelection(newValue)); |
| boolean eefElementEditorReadOnlyState = isReadOnly(EvidenceViewsRepository.ArtefactRel.Properties.modificationEffect); |
| if (eefElementEditorReadOnlyState && modificationEffect.isEnabled()) { |
| modificationEffect.setEnabled(false); |
| modificationEffect.setToolTipText(EvidenceMessages.ArtefactRel_ReadOnly); |
| } else if (!eefElementEditorReadOnlyState && !modificationEffect.isEnabled()) { |
| modificationEffect.setEnabled(true); |
| } |
| |
| } |
| |
| /** |
| * {@inheritDoc} |
| * |
| * @see org.eclipse.opencert.evm.evidspec.evidence.parts.ArtefactRelPropertiesEditionPart#getRevocationEffect() |
| * |
| */ |
| public Enumerator getRevocationEffect() { |
| Enumerator selection = (Enumerator) ((StructuredSelection) revocationEffect.getSelection()).getFirstElement(); |
| return selection; |
| } |
| |
| /** |
| * {@inheritDoc} |
| * |
| * @see org.eclipse.opencert.evm.evidspec.evidence.parts.ArtefactRelPropertiesEditionPart#initRevocationEffect(Object input, Enumerator current) |
| */ |
| public void initRevocationEffect(Object input, Enumerator current) { |
| revocationEffect.setInput(input); |
| revocationEffect.modelUpdating(new StructuredSelection(current)); |
| boolean eefElementEditorReadOnlyState = isReadOnly(EvidenceViewsRepository.ArtefactRel.Properties.revocationEffect); |
| if (eefElementEditorReadOnlyState && revocationEffect.isEnabled()) { |
| revocationEffect.setEnabled(false); |
| revocationEffect.setToolTipText(EvidenceMessages.ArtefactRel_ReadOnly); |
| } else if (!eefElementEditorReadOnlyState && !revocationEffect.isEnabled()) { |
| revocationEffect.setEnabled(true); |
| } |
| |
| } |
| |
| /** |
| * {@inheritDoc} |
| * |
| * @see org.eclipse.opencert.evm.evidspec.evidence.parts.ArtefactRelPropertiesEditionPart#setRevocationEffect(Enumerator newValue) |
| * |
| */ |
| public void setRevocationEffect(Enumerator newValue) { |
| revocationEffect.modelUpdating(new StructuredSelection(newValue)); |
| boolean eefElementEditorReadOnlyState = isReadOnly(EvidenceViewsRepository.ArtefactRel.Properties.revocationEffect); |
| if (eefElementEditorReadOnlyState && revocationEffect.isEnabled()) { |
| revocationEffect.setEnabled(false); |
| revocationEffect.setToolTipText(EvidenceMessages.ArtefactRel_ReadOnly); |
| } else if (!eefElementEditorReadOnlyState && !revocationEffect.isEnabled()) { |
| revocationEffect.setEnabled(true); |
| } |
| |
| } |
| |
| /** |
| * {@inheritDoc} |
| * |
| * @see org.eclipse.opencert.evm.evidspec.evidence.parts.ArtefactRelPropertiesEditionPart#getSource() |
| * |
| */ |
| public EObject getSource() { |
| if (source.getSelection() instanceof StructuredSelection) { |
| Object firstElement = ((StructuredSelection) source.getSelection()).getFirstElement(); |
| if (firstElement instanceof EObject) |
| return (EObject) firstElement; |
| } |
| return null; |
| } |
| |
| /** |
| * {@inheritDoc} |
| * |
| * @see org.eclipse.opencert.evm.evidspec.evidence.parts.ArtefactRelPropertiesEditionPart#initSource(EObjectFlatComboSettings) |
| */ |
| public void initSource(EObjectFlatComboSettings settings) { |
| source.setInput(settings); |
| if (current != null) { |
| source.setSelection(new StructuredSelection(settings.getValue())); |
| } |
| boolean eefElementEditorReadOnlyState = isReadOnly(EvidenceViewsRepository.ArtefactRel.Properties.source); |
| if (eefElementEditorReadOnlyState && source.isEnabled()) { |
| source.setEnabled(false); |
| source.setToolTipText(EvidenceMessages.ArtefactRel_ReadOnly); |
| } else if (!eefElementEditorReadOnlyState && !source.isEnabled()) { |
| source.setEnabled(true); |
| } |
| |
| } |
| |
| /** |
| * {@inheritDoc} |
| * |
| * @see org.eclipse.opencert.evm.evidspec.evidence.parts.ArtefactRelPropertiesEditionPart#setSource(EObject newValue) |
| * |
| */ |
| public void setSource(EObject newValue) { |
| if (newValue != null) { |
| source.setSelection(new StructuredSelection(newValue)); |
| } else { |
| source.setSelection(new StructuredSelection()); //$NON-NLS-1$ |
| } |
| boolean eefElementEditorReadOnlyState = isReadOnly(EvidenceViewsRepository.ArtefactRel.Properties.source); |
| if (eefElementEditorReadOnlyState && source.isEnabled()) { |
| source.setEnabled(false); |
| source.setToolTipText(EvidenceMessages.ArtefactRel_ReadOnly); |
| } else if (!eefElementEditorReadOnlyState && !source.isEnabled()) { |
| source.setEnabled(true); |
| } |
| |
| } |
| |
| /** |
| * {@inheritDoc} |
| * |
| * @see org.eclipse.opencert.evm.evidspec.evidence.parts.ArtefactRelPropertiesEditionPart#setSourceButtonMode(ButtonsModeEnum newValue) |
| */ |
| public void setSourceButtonMode(ButtonsModeEnum newValue) { |
| source.setButtonMode(newValue); |
| } |
| |
| /** |
| * {@inheritDoc} |
| * |
| * @see org.eclipse.opencert.evm.evidspec.evidence.parts.ArtefactRelPropertiesEditionPart#addFilterSource(ViewerFilter filter) |
| * |
| */ |
| public void addFilterToSource(ViewerFilter filter) { |
| source.addFilter(filter); |
| } |
| |
| /** |
| * {@inheritDoc} |
| * |
| * @see org.eclipse.opencert.evm.evidspec.evidence.parts.ArtefactRelPropertiesEditionPart#addBusinessFilterSource(ViewerFilter filter) |
| * |
| */ |
| public void addBusinessFilterToSource(ViewerFilter filter) { |
| source.addBusinessRuleFilter(filter); |
| } |
| |
| /** |
| * {@inheritDoc} |
| * |
| * @see org.eclipse.opencert.evm.evidspec.evidence.parts.ArtefactRelPropertiesEditionPart#getTarget() |
| * |
| */ |
| public EObject getTarget() { |
| if (target.getSelection() instanceof StructuredSelection) { |
| Object firstElement = ((StructuredSelection) target.getSelection()).getFirstElement(); |
| if (firstElement instanceof EObject) |
| return (EObject) firstElement; |
| } |
| return null; |
| } |
| |
| /** |
| * {@inheritDoc} |
| * |
| * @see org.eclipse.opencert.evm.evidspec.evidence.parts.ArtefactRelPropertiesEditionPart#initTarget(EObjectFlatComboSettings) |
| */ |
| public void initTarget(EObjectFlatComboSettings settings) { |
| target.setInput(settings); |
| if (current != null) { |
| target.setSelection(new StructuredSelection(settings.getValue())); |
| } |
| boolean eefElementEditorReadOnlyState = isReadOnly(EvidenceViewsRepository.ArtefactRel.Properties.target); |
| if (eefElementEditorReadOnlyState && target.isEnabled()) { |
| target.setEnabled(false); |
| target.setToolTipText(EvidenceMessages.ArtefactRel_ReadOnly); |
| } else if (!eefElementEditorReadOnlyState && !target.isEnabled()) { |
| target.setEnabled(true); |
| } |
| |
| } |
| |
| /** |
| * {@inheritDoc} |
| * |
| * @see org.eclipse.opencert.evm.evidspec.evidence.parts.ArtefactRelPropertiesEditionPart#setTarget(EObject newValue) |
| * |
| */ |
| public void setTarget(EObject newValue) { |
| if (newValue != null) { |
| target.setSelection(new StructuredSelection(newValue)); |
| } else { |
| target.setSelection(new StructuredSelection()); //$NON-NLS-1$ |
| } |
| boolean eefElementEditorReadOnlyState = isReadOnly(EvidenceViewsRepository.ArtefactRel.Properties.target); |
| if (eefElementEditorReadOnlyState && target.isEnabled()) { |
| target.setEnabled(false); |
| target.setToolTipText(EvidenceMessages.ArtefactRel_ReadOnly); |
| } else if (!eefElementEditorReadOnlyState && !target.isEnabled()) { |
| target.setEnabled(true); |
| } |
| |
| } |
| |
| /** |
| * {@inheritDoc} |
| * |
| * @see org.eclipse.opencert.evm.evidspec.evidence.parts.ArtefactRelPropertiesEditionPart#setTargetButtonMode(ButtonsModeEnum newValue) |
| */ |
| public void setTargetButtonMode(ButtonsModeEnum newValue) { |
| target.setButtonMode(newValue); |
| } |
| |
| /** |
| * {@inheritDoc} |
| * |
| * @see org.eclipse.opencert.evm.evidspec.evidence.parts.ArtefactRelPropertiesEditionPart#addFilterTarget(ViewerFilter filter) |
| * |
| */ |
| public void addFilterToTarget(ViewerFilter filter) { |
| target.addFilter(filter); |
| } |
| |
| /** |
| * {@inheritDoc} |
| * |
| * @see org.eclipse.opencert.evm.evidspec.evidence.parts.ArtefactRelPropertiesEditionPart#addBusinessFilterTarget(ViewerFilter filter) |
| * |
| */ |
| public void addBusinessFilterToTarget(ViewerFilter filter) { |
| target.addBusinessRuleFilter(filter); |
| } |
| |
| |
| |
| |
| |
| |
| /** |
| * {@inheritDoc} |
| * |
| * @see org.eclipse.emf.eef.runtime.api.parts.IPropertiesEditionPart#getTitle() |
| * |
| */ |
| public String getTitle() { |
| return EvidenceMessages.ArtefactRel_Part_Title; |
| } |
| |
| // Start of user code additional methods |
| |
| // End of user code |
| |
| |
| } |