diff options
Diffstat (limited to 'extraplugins/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.tabbedproperties.uml/generated/org/eclipse/papyrus/tabbedproperties/uml/parts/impl/ClassifierTemplateParameterPropertiesEditionPartImpl.java')
1 files changed, 396 insertions, 0 deletions
diff --git a/extraplugins/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.tabbedproperties.uml/generated/org/eclipse/papyrus/tabbedproperties/uml/parts/impl/ClassifierTemplateParameterPropertiesEditionPartImpl.java b/extraplugins/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.tabbedproperties.uml/generated/org/eclipse/papyrus/tabbedproperties/uml/parts/impl/ClassifierTemplateParameterPropertiesEditionPartImpl.java new file mode 100644 index 00000000000..470d47c3992 --- /dev/null +++ b/extraplugins/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.tabbedproperties.uml/generated/org/eclipse/papyrus/tabbedproperties/uml/parts/impl/ClassifierTemplateParameterPropertiesEditionPartImpl.java @@ -0,0 +1,396 @@ +/******************************************************************************* + * Copyright (c) 2009 Obeo. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Obeo - initial API and implementation + *******************************************************************************/ +package org.eclipse.papyrus.tabbedproperties.uml.parts.impl; + +// Start of user code for imports + +import java.util.ArrayList; +import java.util.List; +import java.util.Map; + +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.ecore.EReference; +import org.eclipse.emf.eef.runtime.api.component.IPropertiesEditionComponent; +import org.eclipse.emf.eef.runtime.api.parts.ISWTPropertiesEditionPart; +import org.eclipse.emf.eef.runtime.api.policies.IPropertiesEditionPolicy; +import org.eclipse.emf.eef.runtime.api.providers.IPropertiesEditionPolicyProvider; +import org.eclipse.emf.eef.runtime.impl.notify.PropertiesEditionEvent; +import org.eclipse.emf.eef.runtime.impl.parts.CompositePropertiesEditionPart; +import org.eclipse.emf.eef.runtime.impl.policies.EObjectPropertiesEditionContext; +import org.eclipse.emf.eef.runtime.impl.services.PropertiesEditionPolicyProviderService; +import org.eclipse.emf.eef.runtime.impl.utils.EMFListEditUtil; +import org.eclipse.emf.eef.runtime.ui.widgets.ReferencesTable; +import org.eclipse.emf.eef.runtime.ui.widgets.SWTUtils; +import org.eclipse.emf.eef.runtime.ui.widgets.ReferencesTable.ReferencesTableListener; +import org.eclipse.jface.viewers.ViewerFilter; +import org.eclipse.papyrus.tabbedproperties.uml.parts.ClassifierTemplateParameterPropertiesEditionPart; +import org.eclipse.papyrus.tabbedproperties.uml.parts.UMLViewsRepository; +import org.eclipse.papyrus.tabbedproperties.uml.providers.UMLMessages; +import org.eclipse.swt.SWT; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.widgets.Button; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Group; +import org.eclipse.uml2.uml.Comment; +import org.eclipse.uml2.uml.UMLFactory; + +// End of user code + +/** + * @author <a href="mailto:jerome.benois@obeo.fr">Jerome Benois</a> + */ +public class ClassifierTemplateParameterPropertiesEditionPartImpl extends CompositePropertiesEditionPart implements ISWTPropertiesEditionPart, ClassifierTemplateParameterPropertiesEditionPart { + + protected EMFListEditUtil ownedCommentEditUtil; + + protected ReferencesTable<? extends EObject> ownedComment; + + protected List<ViewerFilter> ownedCommentBusinessFilters = new ArrayList<ViewerFilter>(); + + protected List<ViewerFilter> ownedCommentFilters = new ArrayList<ViewerFilter>(); + + protected Button allowSubstitutable; + + + + + + /** + * Default constructor + * + * @param editionComponent + * the {@link IPropertiesEditionComponent} that manage this part + */ + public ClassifierTemplateParameterPropertiesEditionPartImpl(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) { + createPropertiesGroup(view); + + // Start of user code for additional ui definition + + // End of user code + + } + + protected void createPropertiesGroup(Composite parent) { + Group propertiesGroup = new Group(parent, SWT.NONE); + propertiesGroup.setText(UMLMessages.ClassifierTemplateParameterPropertiesEditionPart_PropertiesGroupLabel); + GridData propertiesGroupData = new GridData(GridData.FILL_HORIZONTAL); + propertiesGroupData.horizontalSpan = 3; + propertiesGroup.setLayoutData(propertiesGroupData); + GridLayout propertiesGroupLayout = new GridLayout(); + propertiesGroupLayout.numColumns = 3; + propertiesGroup.setLayout(propertiesGroupLayout); + createOwnedCommentAdvancedTableComposition(propertiesGroup); + createAllowSubstitutableCheckbox(propertiesGroup); + } + + /** + * @param container + */ + protected void createOwnedCommentAdvancedTableComposition(Composite parent) { + this.ownedComment = new ReferencesTable<Comment>(UMLMessages.ClassifierTemplateParameterPropertiesEditionPart_OwnedCommentLabel, new ReferencesTableListener<Comment>() { + + public void handleAdd() { + addToOwnedComment(); + } + + public void handleEdit(Comment element) { + editOwnedComment(element); + } + + public void handleMove(Comment element, int oldIndex, int newIndex) { + moveOwnedComment(element, oldIndex, newIndex); + } + + public void handleRemove(Comment element) { + removeFromOwnedComment(element); + } + + public void navigateTo(Comment element) { + } + }); + this.ownedComment.setHelpText(propertiesEditionComponent.getHelpContent(UMLViewsRepository.ClassifierTemplateParameter.ownedComment, UMLViewsRepository.SWT_KIND)); + this.ownedComment.createControls(parent); + GridData ownedCommentData = new GridData(GridData.FILL_HORIZONTAL); + ownedCommentData.horizontalSpan = 3; + this.ownedComment.setLayoutData(ownedCommentData); + } + + /**
+ *
+ */ + protected void moveOwnedComment(Comment element, int oldIndex, int newIndex) { + EObject editedElement = ownedCommentEditUtil.foundCorrespondingEObject(element); + ownedCommentEditUtil.moveElement(element, oldIndex, newIndex); + ownedComment.refresh(); + propertiesEditionComponent.firePropertiesChanged(new PropertiesEditionEvent(ClassifierTemplateParameterPropertiesEditionPartImpl.this, UMLViewsRepository.ClassifierTemplateParameter.ownedComment, PropertiesEditionEvent.COMMIT, PropertiesEditionEvent.MOVE, editedElement, newIndex)); + } + + /**
+ *
+ */ + protected void addToOwnedComment() { + + // Start of user code addToOwnedComment() method body + Comment eObject = UMLFactory.eINSTANCE.createComment(); + IPropertiesEditionPolicyProvider policyProvider = PropertiesEditionPolicyProviderService.getInstance() + .getProvider(eObject); + IPropertiesEditionPolicy editionPolicy = policyProvider.getEditionPolicy(eObject); + if(editionPolicy != null) { + EObject propertiesEditionObject = editionPolicy + .getPropertiesEditionObject(new EObjectPropertiesEditionContext(propertiesEditionComponent, + eObject, resourceSet)); + if(propertiesEditionObject != null) { + ownedCommentEditUtil.addElement(propertiesEditionObject); + ownedComment.refresh(); + propertiesEditionComponent.firePropertiesChanged(new PropertiesEditionEvent( + ClassifierTemplateParameterPropertiesEditionPartImpl.this, + UMLViewsRepository.ClassifierTemplateParameter.ownedComment, PropertiesEditionEvent.CHANGE, + PropertiesEditionEvent.ADD, null, propertiesEditionObject)); + } + } + // End of user code + + } + + /**
+ *
+ */ + protected void removeFromOwnedComment(Comment element) { + + // Start of user code removeFromOwnedComment() method body + EObject editedElement = ownedCommentEditUtil.foundCorrespondingEObject(element); + ownedCommentEditUtil.removeElement(element); + ownedComment.refresh(); + propertiesEditionComponent.firePropertiesChanged(new PropertiesEditionEvent( + ClassifierTemplateParameterPropertiesEditionPartImpl.this, + UMLViewsRepository.ClassifierTemplateParameter.ownedComment, PropertiesEditionEvent.CHANGE, + PropertiesEditionEvent.REMOVE, null, editedElement)); + // End of user code + + } + + /**
+ *
+ */ + protected void editOwnedComment(Comment element) { + + // Start of user code editOwnedComment() method body + EObject editedElement = ownedCommentEditUtil.foundCorrespondingEObject(element); + IPropertiesEditionPolicyProvider policyProvider = PropertiesEditionPolicyProviderService.getInstance() + .getProvider(element); + IPropertiesEditionPolicy editionPolicy = policyProvider.getEditionPolicy(editedElement); + if(editionPolicy != null) { + EObject propertiesEditionObject = editionPolicy + .getPropertiesEditionObject(new EObjectPropertiesEditionContext(null, element, resourceSet)); + if(propertiesEditionObject != null) { + ownedCommentEditUtil.putElementToRefresh(editedElement, propertiesEditionObject); + ownedComment.refresh(); + propertiesEditionComponent.firePropertiesChanged(new PropertiesEditionEvent( + ClassifierTemplateParameterPropertiesEditionPartImpl.this, + UMLViewsRepository.ClassifierTemplateParameter.ownedComment, PropertiesEditionEvent.CHANGE, + PropertiesEditionEvent.SET, editedElement, propertiesEditionObject)); + } + } + // End of user code + + } + + protected void createAllowSubstitutableCheckbox(Composite parent) { + allowSubstitutable = new Button(parent, SWT.CHECK); + allowSubstitutable.setText(UMLMessages.ClassifierTemplateParameterPropertiesEditionPart_AllowSubstitutableLabel); + GridData allowSubstitutableData = new GridData(GridData.FILL_HORIZONTAL); + allowSubstitutableData.horizontalSpan = 2; + allowSubstitutable.setLayoutData(allowSubstitutableData); + SWTUtils.createHelpButton(parent, propertiesEditionComponent.getHelpContent(UMLViewsRepository.ClassifierTemplateParameter.allowSubstitutable, UMLViewsRepository.SWT_KIND), null); //$NON-NLS-1$ + } + + + public void firePropertiesChanged(PropertiesEditionEvent event) { + // Start of user code for tab synchronization + + // End of user code + + } + + /** + * {@inheritDoc} + * + * @see org.eclipse.papyrus.tabbedproperties.uml.parts.ClassifierTemplateParameterPropertiesEditionPart#getOwnedCommentToAdd() + */ + public List getOwnedCommentToAdd() { + return ownedCommentEditUtil.getElementsToAdd(); + } + + /** + * {@inheritDoc} + * + * @see org.eclipse.papyrus.tabbedproperties.uml.parts.ClassifierTemplateParameterPropertiesEditionPart#getOwnedCommentToRemove() + */ + public List getOwnedCommentToRemove() { + return ownedCommentEditUtil.getElementsToRemove(); + } + + /** + * {@inheritDoc} + * + * @see org.eclipse.papyrus.tabbedproperties.uml.parts.ClassifierTemplateParameterPropertiesEditionPart#getOwnedCommentToEdit() + */ + public Map getOwnedCommentToEdit() { + return ownedCommentEditUtil.getElementsToRefresh(); + } + + /** + * {@inheritDoc} + * + * @see org.eclipse.papyrus.tabbedproperties.uml.parts.ClassifierTemplateParameterPropertiesEditionPart#getOwnedCommentToMove() + */ + public List getOwnedCommentToMove() { + return ownedCommentEditUtil.getElementsToMove(); + } + + /** + * {@inheritDoc} + * + * @see org.eclipse.papyrus.tabbedproperties.uml.parts.ClassifierTemplateParameterPropertiesEditionPart#getOwnedCommentTable() + */ + public List getOwnedCommentTable() { + return ownedCommentEditUtil.getVirtualList(); + } + + /** + * {@inheritDoc} + * + * @see org.eclipse.papyrus.tabbedproperties.uml.parts.ClassifierTemplateParameterPropertiesEditionPart#initOwnedComment(EObject current, + * EReference containingFeature, EReference feature) + */ + public void initOwnedComment(EObject current, EReference containingFeature, EReference feature) { + if(current.eResource() != null && current.eResource().getResourceSet() != null) + this.resourceSet = current.eResource().getResourceSet(); + if(containingFeature != null) + ownedCommentEditUtil = new EMFListEditUtil(current, containingFeature, feature); + else + ownedCommentEditUtil = new EMFListEditUtil(current, feature); + this.ownedComment.setInput(ownedCommentEditUtil.getVirtualList()); + } + + /** + * {@inheritDoc} + * + * @see org.eclipse.papyrus.tabbedproperties.uml.parts.ClassifierTemplateParameterPropertiesEditionPart#updateOwnedComment(EObject newValue) + */ + public void updateOwnedComment(EObject newValue) { + if(ownedCommentEditUtil != null) { + ownedCommentEditUtil.reinit(newValue); + ownedComment.refresh(); + } + } + + /** + * {@inheritDoc} + * + * @see org.eclipse.papyrus.tabbedproperties.uml.parts.ClassifierTemplateParameterPropertiesEditionPart#addFilterOwnedComment(ViewerFilter filter) + */ + public void addFilterToOwnedComment(ViewerFilter filter) { + ownedCommentFilters.add(filter); + } + + /** + * {@inheritDoc} + * + * @see org.eclipse.papyrus.tabbedproperties.uml.parts.ClassifierTemplateParameterPropertiesEditionPart#addBusinessFilterOwnedComment(ViewerFilter + * filter) + */ + public void addBusinessFilterToOwnedComment(ViewerFilter filter) { + ownedCommentBusinessFilters.add(filter); + } + + /** + * {@inheritDoc} + * + * @see org.eclipse.papyrus.tabbedproperties.uml.parts.ClassifierTemplateParameterPropertiesEditionPart#isContainedInOwnedCommentTable(EObject + * element) + */ + public boolean isContainedInOwnedCommentTable(EObject element) { + return ownedCommentEditUtil.contains(element); + } + + public void setMessageForOwnedComment(String msg, int msgLevel) { + + } + + public void unsetMessageForOwnedComment() { + + } + + /** + * {@inheritDoc} + * + * @see org.eclipse.papyrus.tabbedproperties.uml.parts.ClassifierTemplateParameterPropertiesEditionPart#getAllowSubstitutable() + */ + public Boolean getAllowSubstitutable() { + return Boolean.valueOf(allowSubstitutable.getSelection()); + } + + /** + * {@inheritDoc} + * + * @see org.eclipse.papyrus.tabbedproperties.uml.parts.ClassifierTemplateParameterPropertiesEditionPart#setAllowSubstitutable(Boolean newValue) + */ + public void setAllowSubstitutable(Boolean newValue) { + if(newValue != null) { + allowSubstitutable.setSelection(newValue.booleanValue()); + } else { + allowSubstitutable.setSelection(false); + } + } + + public void setMessageForAllowSubstitutable(String msg, int msgLevel) { + + } + + public void unsetMessageForAllowSubstitutable() { + + } + + + + + + // Start of user code additional methods + + // End of user code + +} |