| /******************************************************************************* |
| * 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.sam.arg.arg.parts.impl; |
| |
| // Start of user code for imports |
| import java.util.ArrayList;
|
| import java.util.Iterator;
|
| import java.util.List;
|
|
|
| import org.eclipse.emf.ecore.EObject;
|
|
|
| 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.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.IStructuredSelection;
|
| 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 org.eclipse.opencert.sam.arg.arg.parts.ArgViewsRepository;
|
| import org.eclipse.opencert.sam.arg.arg.parts.AssertedChallengePropertiesEditionPart;
|
|
|
| import org.eclipse.opencert.sam.arg.arg.providers.ArgMessages; |
| |
| // End of user code |
| |
| /** |
| * |
| * |
| */ |
| public class AssertedChallengePropertiesEditionPartImpl extends CompositePropertiesEditionPart implements ISWTPropertiesEditionPart, AssertedChallengePropertiesEditionPart { |
| |
| protected Text id; |
| protected Text name; |
| protected Text description; |
| protected Text content; |
| protected ReferencesTable source; |
| protected List<ViewerFilter> sourceBusinessFilters = new ArrayList<ViewerFilter>(); |
| protected List<ViewerFilter> sourceFilters = new ArrayList<ViewerFilter>(); |
| protected ReferencesTable target; |
| protected List<ViewerFilter> targetBusinessFilters = new ArrayList<ViewerFilter>(); |
| protected List<ViewerFilter> targetFilters = new ArrayList<ViewerFilter>(); |
| |
| |
| |
| /** |
| * Default constructor |
| * @param editionComponent the {@link IPropertiesEditionComponent} that manage this part |
| * |
| */ |
| public AssertedChallengePropertiesEditionPartImpl(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 assertedChallengeStep = new BindingCompositionSequence(propertiesEditionComponent); |
| CompositionStep propertiesStep = assertedChallengeStep.addStep(ArgViewsRepository.AssertedChallenge.Properties.class); |
| propertiesStep.addStep(ArgViewsRepository.AssertedChallenge.Properties.id); |
| propertiesStep.addStep(ArgViewsRepository.AssertedChallenge.Properties.name); |
| propertiesStep.addStep(ArgViewsRepository.AssertedChallenge.Properties.description); |
| propertiesStep.addStep(ArgViewsRepository.AssertedChallenge.Properties.content); |
| propertiesStep.addStep(ArgViewsRepository.AssertedChallenge.Properties.source); |
| propertiesStep.addStep(ArgViewsRepository.AssertedChallenge.Properties.target); |
| |
| |
| composer = new PartComposer(assertedChallengeStep) { |
| |
| @Override |
| public Composite addToPart(Composite parent, Object key) { |
| if (key == ArgViewsRepository.AssertedChallenge.Properties.class) { |
| return createPropertiesGroup(parent); |
| } |
| if (key == ArgViewsRepository.AssertedChallenge.Properties.id) { |
| return createIdText(parent); |
| } |
| if (key == ArgViewsRepository.AssertedChallenge.Properties.name) { |
| return createNameText(parent); |
| } |
| if (key == ArgViewsRepository.AssertedChallenge.Properties.description) { |
| return createDescriptionText(parent); |
| } |
| if (key == ArgViewsRepository.AssertedChallenge.Properties.content) { |
| return createContentText(parent); |
| } |
| if (key == ArgViewsRepository.AssertedChallenge.Properties.source) { |
| return createSourceAdvancedReferencesTable(parent); |
| } |
| if (key == ArgViewsRepository.AssertedChallenge.Properties.target) { |
| return createTargetAdvancedReferencesTable(parent); |
| } |
| return parent; |
| } |
| }; |
| composer.compose(view); |
| } |
| |
| /** |
| * |
| */ |
| protected Composite createPropertiesGroup(Composite parent) { |
| Group propertiesGroup = new Group(parent, SWT.NONE); |
| propertiesGroup.setText(ArgMessages.AssertedChallengePropertiesEditionPart_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 createIdText(Composite parent) { |
| createDescription(parent, ArgViewsRepository.AssertedChallenge.Properties.id, ArgMessages.AssertedChallengePropertiesEditionPart_IdLabel); |
| id = SWTUtils.createScrollableText(parent, SWT.BORDER); |
| GridData idData = new GridData(GridData.FILL_HORIZONTAL); |
| id.setLayoutData(idData); |
| id.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(AssertedChallengePropertiesEditionPartImpl.this, ArgViewsRepository.AssertedChallenge.Properties.id, PropertiesEditionEvent.COMMIT, PropertiesEditionEvent.SET, null, id.getText())); |
| } |
| |
| }); |
| id.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(AssertedChallengePropertiesEditionPartImpl.this, ArgViewsRepository.AssertedChallenge.Properties.id, PropertiesEditionEvent.COMMIT, PropertiesEditionEvent.SET, null, id.getText())); |
| } |
| } |
| |
| }); |
| EditingUtils.setID(id, ArgViewsRepository.AssertedChallenge.Properties.id); |
| EditingUtils.setEEFtype(id, "eef::Text"); //$NON-NLS-1$ |
| SWTUtils.createHelpButton(parent, propertiesEditionComponent.getHelpContent(ArgViewsRepository.AssertedChallenge.Properties.id, ArgViewsRepository.SWT_KIND), null); //$NON-NLS-1$ |
| // Start of user code for createIdText |
| |
| // End of user code |
| return parent; |
| } |
| |
| |
| protected Composite createNameText(Composite parent) { |
| createDescription(parent, ArgViewsRepository.AssertedChallenge.Properties.name, ArgMessages.AssertedChallengePropertiesEditionPart_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(AssertedChallengePropertiesEditionPartImpl.this, ArgViewsRepository.AssertedChallenge.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(AssertedChallengePropertiesEditionPartImpl.this, ArgViewsRepository.AssertedChallenge.Properties.name, PropertiesEditionEvent.COMMIT, PropertiesEditionEvent.SET, null, name.getText())); |
| } |
| } |
| |
| }); |
| EditingUtils.setID(name, ArgViewsRepository.AssertedChallenge.Properties.name); |
| EditingUtils.setEEFtype(name, "eef::Text"); //$NON-NLS-1$ |
| SWTUtils.createHelpButton(parent, propertiesEditionComponent.getHelpContent(ArgViewsRepository.AssertedChallenge.Properties.name, ArgViewsRepository.SWT_KIND), null); //$NON-NLS-1$ |
| // Start of user code for createNameText |
| |
| // End of user code |
| return parent; |
| } |
| |
| |
| protected Composite createDescriptionText(Composite parent) { |
| createDescription(parent, ArgViewsRepository.AssertedChallenge.Properties.description, ArgMessages.AssertedChallengePropertiesEditionPart_DescriptionLabel); |
| description = SWTUtils.createScrollableText(parent, SWT.BORDER); |
| GridData descriptionData = new GridData(GridData.FILL_HORIZONTAL); |
| description.setLayoutData(descriptionData); |
| description.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(AssertedChallengePropertiesEditionPartImpl.this, ArgViewsRepository.AssertedChallenge.Properties.description, PropertiesEditionEvent.COMMIT, PropertiesEditionEvent.SET, null, description.getText())); |
| } |
| |
| }); |
| description.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(AssertedChallengePropertiesEditionPartImpl.this, ArgViewsRepository.AssertedChallenge.Properties.description, PropertiesEditionEvent.COMMIT, PropertiesEditionEvent.SET, null, description.getText())); |
| } |
| } |
| |
| }); |
| EditingUtils.setID(description, ArgViewsRepository.AssertedChallenge.Properties.description); |
| EditingUtils.setEEFtype(description, "eef::Text"); //$NON-NLS-1$ |
| SWTUtils.createHelpButton(parent, propertiesEditionComponent.getHelpContent(ArgViewsRepository.AssertedChallenge.Properties.description, ArgViewsRepository.SWT_KIND), null); //$NON-NLS-1$ |
| // Start of user code for createDescriptionText |
| |
| // End of user code |
| return parent; |
| } |
| |
| |
| protected Composite createContentText(Composite parent) { |
| createDescription(parent, ArgViewsRepository.AssertedChallenge.Properties.content, ArgMessages.AssertedChallengePropertiesEditionPart_ContentLabel); |
| content = SWTUtils.createScrollableText(parent, SWT.BORDER); |
| GridData contentData = new GridData(GridData.FILL_HORIZONTAL); |
| content.setLayoutData(contentData); |
| content.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(AssertedChallengePropertiesEditionPartImpl.this, ArgViewsRepository.AssertedChallenge.Properties.content, PropertiesEditionEvent.COMMIT, PropertiesEditionEvent.SET, null, content.getText())); |
| } |
| |
| }); |
| content.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(AssertedChallengePropertiesEditionPartImpl.this, ArgViewsRepository.AssertedChallenge.Properties.content, PropertiesEditionEvent.COMMIT, PropertiesEditionEvent.SET, null, content.getText())); |
| } |
| } |
| |
| }); |
| EditingUtils.setID(content, ArgViewsRepository.AssertedChallenge.Properties.content); |
| EditingUtils.setEEFtype(content, "eef::Text"); //$NON-NLS-1$ |
| SWTUtils.createHelpButton(parent, propertiesEditionComponent.getHelpContent(ArgViewsRepository.AssertedChallenge.Properties.content, ArgViewsRepository.SWT_KIND), null); //$NON-NLS-1$ |
| // Start of user code for createContentText |
| |
| // End of user code |
| return parent; |
| } |
| |
| /** |
| * |
| */ |
| protected Composite createSourceAdvancedReferencesTable(Composite parent) { |
| String label = getDescription(ArgViewsRepository.AssertedChallenge.Properties.source, ArgMessages.AssertedChallengePropertiesEditionPart_SourceLabel); |
| this.source = new ReferencesTable(label, new ReferencesTableListener() { |
| public void handleAdd() { addSource(); } |
| public void handleEdit(EObject element) { editSource(element); } |
| public void handleMove(EObject element, int oldIndex, int newIndex) { moveSource(element, oldIndex, newIndex); } |
| public void handleRemove(EObject element) { removeFromSource(element); } |
| public void navigateTo(EObject element) { } |
| }); |
| this.source.setHelpText(propertiesEditionComponent.getHelpContent(ArgViewsRepository.AssertedChallenge.Properties.source, ArgViewsRepository.SWT_KIND)); |
| this.source.createControls(parent); |
| this.source.addSelectionListener(new SelectionAdapter() { |
| |
| public void widgetSelected(SelectionEvent e) { |
| if (e.item != null && e.item.getData() instanceof EObject) { |
| propertiesEditionComponent.firePropertiesChanged(new PropertiesEditionEvent(AssertedChallengePropertiesEditionPartImpl.this, ArgViewsRepository.AssertedChallenge.Properties.source, PropertiesEditionEvent.CHANGE, PropertiesEditionEvent.SELECTION_CHANGED, null, e.item.getData())); |
| } |
| } |
| |
| }); |
| GridData sourceData = new GridData(GridData.FILL_HORIZONTAL); |
| sourceData.horizontalSpan = 3; |
| this.source.setLayoutData(sourceData); |
| this.source.disableMove(); |
| source.setID(ArgViewsRepository.AssertedChallenge.Properties.source); |
| source.setEEFType("eef::AdvancedReferencesTable"); //$NON-NLS-1$ |
| return parent; |
| } |
| |
| /** |
| * |
| */ |
| protected void addSource() { |
| TabElementTreeSelectionDialog dialog = new TabElementTreeSelectionDialog(source.getInput(), sourceFilters, sourceBusinessFilters, |
| "source", 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(AssertedChallengePropertiesEditionPartImpl.this, ArgViewsRepository.AssertedChallenge.Properties.source, |
| PropertiesEditionEvent.COMMIT, PropertiesEditionEvent.ADD, null, elem)); |
| } |
| source.refresh(); |
| } |
| }; |
| dialog.open(); |
| } |
| |
| /** |
| * |
| */ |
| protected void moveSource(EObject element, int oldIndex, int newIndex) { |
| propertiesEditionComponent.firePropertiesChanged(new PropertiesEditionEvent(AssertedChallengePropertiesEditionPartImpl.this, ArgViewsRepository.AssertedChallenge.Properties.source, PropertiesEditionEvent.COMMIT, PropertiesEditionEvent.MOVE, element, newIndex)); |
| source.refresh(); |
| } |
| |
| /** |
| * |
| */ |
| protected void removeFromSource(EObject element) { |
| propertiesEditionComponent.firePropertiesChanged(new PropertiesEditionEvent(AssertedChallengePropertiesEditionPartImpl.this, ArgViewsRepository.AssertedChallenge.Properties.source, PropertiesEditionEvent.COMMIT, PropertiesEditionEvent.REMOVE, null, element)); |
| source.refresh(); |
| } |
| |
| /** |
| * |
| */ |
| protected void editSource(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(); |
| source.refresh(); |
| } |
| } |
| } |
| |
| /** |
| * |
| */ |
| protected Composite createTargetAdvancedReferencesTable(Composite parent) { |
| String label = getDescription(ArgViewsRepository.AssertedChallenge.Properties.target, ArgMessages.AssertedChallengePropertiesEditionPart_TargetLabel); |
| this.target = new ReferencesTable(label, new ReferencesTableListener() { |
| public void handleAdd() { addTarget(); } |
| public void handleEdit(EObject element) { editTarget(element); } |
| public void handleMove(EObject element, int oldIndex, int newIndex) { moveTarget(element, oldIndex, newIndex); } |
| public void handleRemove(EObject element) { removeFromTarget(element); } |
| public void navigateTo(EObject element) { } |
| }); |
| this.target.setHelpText(propertiesEditionComponent.getHelpContent(ArgViewsRepository.AssertedChallenge.Properties.target, ArgViewsRepository.SWT_KIND)); |
| this.target.createControls(parent); |
| this.target.addSelectionListener(new SelectionAdapter() { |
| |
| public void widgetSelected(SelectionEvent e) { |
| if (e.item != null && e.item.getData() instanceof EObject) { |
| propertiesEditionComponent.firePropertiesChanged(new PropertiesEditionEvent(AssertedChallengePropertiesEditionPartImpl.this, ArgViewsRepository.AssertedChallenge.Properties.target, PropertiesEditionEvent.CHANGE, PropertiesEditionEvent.SELECTION_CHANGED, null, e.item.getData())); |
| } |
| } |
| |
| }); |
| GridData targetData = new GridData(GridData.FILL_HORIZONTAL); |
| targetData.horizontalSpan = 3; |
| this.target.setLayoutData(targetData); |
| this.target.disableMove(); |
| target.setID(ArgViewsRepository.AssertedChallenge.Properties.target); |
| target.setEEFType("eef::AdvancedReferencesTable"); //$NON-NLS-1$ |
| return parent; |
| } |
| |
| /** |
| * |
| */ |
| protected void addTarget() { |
| TabElementTreeSelectionDialog dialog = new TabElementTreeSelectionDialog(target.getInput(), targetFilters, targetBusinessFilters, |
| "target", 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(AssertedChallengePropertiesEditionPartImpl.this, ArgViewsRepository.AssertedChallenge.Properties.target, |
| PropertiesEditionEvent.COMMIT, PropertiesEditionEvent.ADD, null, elem)); |
| } |
| target.refresh(); |
| } |
| }; |
| dialog.open(); |
| } |
| |
| /** |
| * |
| */ |
| protected void moveTarget(EObject element, int oldIndex, int newIndex) { |
| propertiesEditionComponent.firePropertiesChanged(new PropertiesEditionEvent(AssertedChallengePropertiesEditionPartImpl.this, ArgViewsRepository.AssertedChallenge.Properties.target, PropertiesEditionEvent.COMMIT, PropertiesEditionEvent.MOVE, element, newIndex)); |
| target.refresh(); |
| } |
| |
| /** |
| * |
| */ |
| protected void removeFromTarget(EObject element) { |
| propertiesEditionComponent.firePropertiesChanged(new PropertiesEditionEvent(AssertedChallengePropertiesEditionPartImpl.this, ArgViewsRepository.AssertedChallenge.Properties.target, PropertiesEditionEvent.COMMIT, PropertiesEditionEvent.REMOVE, null, element)); |
| target.refresh(); |
| } |
| |
| /** |
| * |
| */ |
| protected void editTarget(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(); |
| target.refresh(); |
| } |
| } |
| } |
| |
| |
| /** |
| * {@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 org.eclipse.opencert.sam.arg.arg.parts.AssertedChallengePropertiesEditionPart#getId() |
| * |
| */ |
| public String getId() { |
| return id.getText(); |
| } |
| |
| /** |
| * {@inheritDoc} |
| * |
| * @see org.eclipse.opencert.sam.arg.arg.parts.AssertedChallengePropertiesEditionPart#setId(String newValue) |
| * |
| */ |
| public void setId(String newValue) { |
| if (newValue != null) { |
| id.setText(newValue); |
| } else { |
| id.setText(""); //$NON-NLS-1$ |
| } |
| boolean eefElementEditorReadOnlyState = isReadOnly(ArgViewsRepository.AssertedChallenge.Properties.id); |
| if (eefElementEditorReadOnlyState && id.isEnabled()) { |
| id.setEnabled(false); |
| id.setToolTipText(ArgMessages.AssertedChallenge_ReadOnly); |
| } else if (!eefElementEditorReadOnlyState && !id.isEnabled()) { |
| id.setEnabled(true); |
| } |
| |
| } |
| |
| /** |
| * {@inheritDoc} |
| * |
| * @see org.eclipse.opencert.sam.arg.arg.parts.AssertedChallengePropertiesEditionPart#getName() |
| * |
| */ |
| public String getName() { |
| return name.getText(); |
| } |
| |
| /** |
| * {@inheritDoc} |
| * |
| * @see org.eclipse.opencert.sam.arg.arg.parts.AssertedChallengePropertiesEditionPart#setName(String newValue) |
| * |
| */ |
| public void setName(String newValue) { |
| if (newValue != null) { |
| name.setText(newValue); |
| } else { |
| name.setText(""); //$NON-NLS-1$ |
| } |
| boolean eefElementEditorReadOnlyState = isReadOnly(ArgViewsRepository.AssertedChallenge.Properties.name); |
| if (eefElementEditorReadOnlyState && name.isEnabled()) { |
| name.setEnabled(false); |
| name.setToolTipText(ArgMessages.AssertedChallenge_ReadOnly); |
| } else if (!eefElementEditorReadOnlyState && !name.isEnabled()) { |
| name.setEnabled(true); |
| } |
| |
| } |
| |
| /** |
| * {@inheritDoc} |
| * |
| * @see org.eclipse.opencert.sam.arg.arg.parts.AssertedChallengePropertiesEditionPart#getDescription() |
| * |
| */ |
| public String getDescription() { |
| return description.getText(); |
| } |
| |
| /** |
| * {@inheritDoc} |
| * |
| * @see org.eclipse.opencert.sam.arg.arg.parts.AssertedChallengePropertiesEditionPart#setDescription(String newValue) |
| * |
| */ |
| public void setDescription(String newValue) { |
| if (newValue != null) { |
| description.setText(newValue); |
| } else { |
| description.setText(""); //$NON-NLS-1$ |
| } |
| boolean eefElementEditorReadOnlyState = isReadOnly(ArgViewsRepository.AssertedChallenge.Properties.description); |
| if (eefElementEditorReadOnlyState && description.isEnabled()) { |
| description.setEnabled(false); |
| description.setToolTipText(ArgMessages.AssertedChallenge_ReadOnly); |
| } else if (!eefElementEditorReadOnlyState && !description.isEnabled()) { |
| description.setEnabled(true); |
| } |
| |
| } |
| |
| /** |
| * {@inheritDoc} |
| * |
| * @see org.eclipse.opencert.sam.arg.arg.parts.AssertedChallengePropertiesEditionPart#getContent() |
| * |
| */ |
| public String getContent() { |
| return content.getText(); |
| } |
| |
| /** |
| * {@inheritDoc} |
| * |
| * @see org.eclipse.opencert.sam.arg.arg.parts.AssertedChallengePropertiesEditionPart#setContent(String newValue) |
| * |
| */ |
| public void setContent(String newValue) { |
| if (newValue != null) { |
| content.setText(newValue); |
| } else { |
| content.setText(""); //$NON-NLS-1$ |
| } |
| boolean eefElementEditorReadOnlyState = isReadOnly(ArgViewsRepository.AssertedChallenge.Properties.content); |
| if (eefElementEditorReadOnlyState && content.isEnabled()) { |
| content.setEnabled(false); |
| content.setToolTipText(ArgMessages.AssertedChallenge_ReadOnly); |
| } else if (!eefElementEditorReadOnlyState && !content.isEnabled()) { |
| content.setEnabled(true); |
| } |
| |
| } |
| |
| |
| |
| /** |
| * {@inheritDoc} |
| * |
| * @see org.eclipse.opencert.sam.arg.arg.parts.AssertedChallengePropertiesEditionPart#initSource(org.eclipse.emf.eef.runtime.ui.widgets.referencestable.ReferencesTableSettings) |
| */ |
| public void initSource(ReferencesTableSettings settings) { |
| if (current.eResource() != null && current.eResource().getResourceSet() != null) |
| this.resourceSet = current.eResource().getResourceSet(); |
| ReferencesTableContentProvider contentProvider = new ReferencesTableContentProvider(); |
| source.setContentProvider(contentProvider); |
| source.setInput(settings); |
| boolean eefElementEditorReadOnlyState = isReadOnly(ArgViewsRepository.AssertedChallenge.Properties.source); |
| if (eefElementEditorReadOnlyState && source.getTable().isEnabled()) { |
| source.setEnabled(false); |
| source.setToolTipText(ArgMessages.AssertedChallenge_ReadOnly); |
| } else if (!eefElementEditorReadOnlyState && !source.getTable().isEnabled()) { |
| source.setEnabled(true); |
| } |
| |
| } |
| |
| /** |
| * {@inheritDoc} |
| * |
| * @see org.eclipse.opencert.sam.arg.arg.parts.AssertedChallengePropertiesEditionPart#updateSource() |
| * |
| */ |
| public void updateSource() { |
| source.refresh(); |
| } |
| |
| /** |
| * {@inheritDoc} |
| * |
| * @see org.eclipse.opencert.sam.arg.arg.parts.AssertedChallengePropertiesEditionPart#addFilterSource(ViewerFilter filter) |
| * |
| */ |
| public void addFilterToSource(ViewerFilter filter) { |
| sourceFilters.add(filter); |
| } |
| |
| /** |
| * {@inheritDoc} |
| * |
| * @see org.eclipse.opencert.sam.arg.arg.parts.AssertedChallengePropertiesEditionPart#addBusinessFilterSource(ViewerFilter filter) |
| * |
| */ |
| public void addBusinessFilterToSource(ViewerFilter filter) { |
| sourceBusinessFilters.add(filter); |
| } |
| |
| /** |
| * {@inheritDoc} |
| * |
| * @see org.eclipse.opencert.sam.arg.arg.parts.AssertedChallengePropertiesEditionPart#isContainedInSourceTable(EObject element) |
| * |
| */ |
| public boolean isContainedInSourceTable(EObject element) { |
| return ((ReferencesTableSettings)source.getInput()).contains(element); |
| } |
| |
| |
| |
| /** |
| * {@inheritDoc} |
| * |
| * @see org.eclipse.opencert.sam.arg.arg.parts.AssertedChallengePropertiesEditionPart#initTarget(org.eclipse.emf.eef.runtime.ui.widgets.referencestable.ReferencesTableSettings) |
| */ |
| public void initTarget(ReferencesTableSettings settings) { |
| if (current.eResource() != null && current.eResource().getResourceSet() != null) |
| this.resourceSet = current.eResource().getResourceSet(); |
| ReferencesTableContentProvider contentProvider = new ReferencesTableContentProvider(); |
| target.setContentProvider(contentProvider); |
| target.setInput(settings); |
| boolean eefElementEditorReadOnlyState = isReadOnly(ArgViewsRepository.AssertedChallenge.Properties.target); |
| if (eefElementEditorReadOnlyState && target.getTable().isEnabled()) { |
| target.setEnabled(false); |
| target.setToolTipText(ArgMessages.AssertedChallenge_ReadOnly); |
| } else if (!eefElementEditorReadOnlyState && !target.getTable().isEnabled()) { |
| target.setEnabled(true); |
| } |
| |
| } |
| |
| /** |
| * {@inheritDoc} |
| * |
| * @see org.eclipse.opencert.sam.arg.arg.parts.AssertedChallengePropertiesEditionPart#updateTarget() |
| * |
| */ |
| public void updateTarget() { |
| target.refresh(); |
| } |
| |
| /** |
| * {@inheritDoc} |
| * |
| * @see org.eclipse.opencert.sam.arg.arg.parts.AssertedChallengePropertiesEditionPart#addFilterTarget(ViewerFilter filter) |
| * |
| */ |
| public void addFilterToTarget(ViewerFilter filter) { |
| targetFilters.add(filter); |
| } |
| |
| /** |
| * {@inheritDoc} |
| * |
| * @see org.eclipse.opencert.sam.arg.arg.parts.AssertedChallengePropertiesEditionPart#addBusinessFilterTarget(ViewerFilter filter) |
| * |
| */ |
| public void addBusinessFilterToTarget(ViewerFilter filter) { |
| targetBusinessFilters.add(filter); |
| } |
| |
| /** |
| * {@inheritDoc} |
| * |
| * @see org.eclipse.opencert.sam.arg.arg.parts.AssertedChallengePropertiesEditionPart#isContainedInTargetTable(EObject element) |
| * |
| */ |
| public boolean isContainedInTargetTable(EObject element) { |
| return ((ReferencesTableSettings)target.getInput()).contains(element); |
| } |
| |
| |
| |
| |
| |
| |
| /** |
| * {@inheritDoc} |
| * |
| * @see org.eclipse.emf.eef.runtime.api.parts.IPropertiesEditionPart#getTitle() |
| * |
| */ |
| public String getTitle() { |
| return ArgMessages.AssertedChallenge_Part_Title; |
| } |
| |
| // Start of user code additional methods |
| |
| // End of user code |
| |
| |
| } |