Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 226784 Details for
Bug 385184
[Enhancement] Adding comments from properties view
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
Patch for properties view
patchCommentsPropertiesView.patch (text/plain), 30.60 KB, created by
Sebastien Poissonnet
on 2013-02-08 10:44:42 EST
(
hide
)
Description:
Patch for properties view
Filename:
MIME Type:
Creator:
Sebastien Poissonnet
Created:
2013-02-08 10:44:42 EST
Size:
30.60 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.papyrus.views.properties >Index: src/org/eclipse/papyrus/views/properties/xwt/XWTSection.java >=================================================================== >--- src/org/eclipse/papyrus/views/properties/xwt/XWTSection.java (revision 9762) >+++ src/org/eclipse/papyrus/views/properties/xwt/XWTSection.java (working copy) >@@ -44,15 +44,15 @@ > */ > public class XWTSection extends AbstractPropertySection implements IChangeListener { > >- private Section section; >+ private final Section section; > > private DataSource source; > >- private View view; >+ private final View view; > > private Composite self; > >- private DisplayEngine display; >+ private final DisplayEngine display; > > private Set<Constraint> constraints; > >Index: src/org/eclipse/papyrus/views/properties/runtime/DefaultDisplayEngine.java >=================================================================== >--- src/org/eclipse/papyrus/views/properties/runtime/DefaultDisplayEngine.java (revision 9762) >+++ src/org/eclipse/papyrus/views/properties/runtime/DefaultDisplayEngine.java (working copy) >@@ -47,13 +47,13 @@ > */ > public class DefaultDisplayEngine implements DisplayEngine { > >- private ILoadingContext loadingContext = new DefaultLoadingContext(getClass().getClassLoader()); >+ private final ILoadingContext loadingContext = new DefaultLoadingContext(getClass().getClassLoader()); > >- private Set<String> displayedSections = new HashSet<String>(); >+ private final Set<String> displayedSections = new HashSet<String>(); > >- private Set<Control> controls = new HashSet<Control>(); >+ private final Set<Control> controls = new HashSet<Control>(); > >- private boolean allowDuplicate; >+ private final boolean allowDuplicate; > > /** > * Constructs a new DisplayEnginet that doesn't allow the duplication of sections >Index: src/org/eclipse/papyrus/views/properties/widgets/MultiReferenceEditorWithPropertyView.java >=================================================================== >--- src/org/eclipse/papyrus/views/properties/widgets/MultiReferenceEditorWithPropertyView.java (revision 9762) >+++ src/org/eclipse/papyrus/views/properties/widgets/MultiReferenceEditorWithPropertyView.java (working copy) >@@ -19,21 +19,20 @@ > import org.eclipse.jface.viewers.ISelectionChangedListener; > import org.eclipse.jface.viewers.SelectionChangedEvent; > import org.eclipse.jface.viewers.StructuredSelection; >-import org.eclipse.papyrus.views.properties.contexts.View; >-import org.eclipse.papyrus.views.properties.runtime.ConfigurationManager; >-import org.eclipse.papyrus.views.properties.runtime.EmbeddedDisplayEngine; > import org.eclipse.papyrus.infra.widgets.creation.ReferenceValueFactory; > import org.eclipse.papyrus.infra.widgets.editors.AbstractListEditor; > import org.eclipse.papyrus.infra.widgets.editors.ICommitListener; > import org.eclipse.papyrus.infra.widgets.editors.MultipleReferenceEditor; >+import org.eclipse.papyrus.views.properties.contexts.View; >+import org.eclipse.papyrus.views.properties.runtime.ConfigurationManager; >+import org.eclipse.papyrus.views.properties.runtime.EmbeddedDisplayEngine; > import org.eclipse.swt.SWT; > import org.eclipse.swt.layout.FillLayout; > import org.eclipse.swt.layout.GridData; > import org.eclipse.swt.layout.GridLayout; > import org.eclipse.swt.widgets.Composite; > >-public class MultiReferenceEditorWithPropertyView extends AbstractListEditor >- implements ISelectionChangedListener { >+public class MultiReferenceEditorWithPropertyView extends AbstractListEditor implements ISelectionChangedListener { > > protected MultipleReferenceEditor multiReferenceEditor; > >@@ -44,17 +43,15 @@ > public MultiReferenceEditorWithPropertyView(Composite parent, int style) { > super(parent, style); > // parent.setBackground(getDisplay().getSystemColor(SWT.COLOR_RED)); >- ((GridLayout) getLayout()).numColumns++; >+ ((GridLayout)getLayout()).numColumns++; > > multiReferenceEditor = createMultipleReferenceEditor(style); > multiReferenceEditor.addSelectionChangedListener(this); >- multiReferenceEditor.setLayoutData(new GridData(SWT.BEGINNING, >- SWT.FILL, false, true)); >+ multiReferenceEditor.setLayoutData(new GridData(SWT.BEGINNING, SWT.FILL, false, true)); > > propertiesComposite = new Composite(this, style); > propertiesComposite.setLayout(new FillLayout()); >- propertiesComposite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, >- true, true)); >+ propertiesComposite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); > } > > /** >@@ -116,7 +113,7 @@ > @Override > public void setModelObservable(IObservableList modelObservable) { > multiReferenceEditor.setModelObservable(modelObservable); >- if (!modelObservable.isEmpty()) { >+ if(!modelObservable.isEmpty()) { > multiReferenceEditor.getViewer().setSelection(new StructuredSelection(modelObservable.get(0))); > } > } >@@ -130,8 +127,7 @@ > public void selectionChanged(SelectionChangedEvent event) { > ISelection selection = event.getSelection(); > >- Set<View> views = ConfigurationManager.instance.constraintEngine >- .getViews(selection); >+ Set<View> views = ConfigurationManager.instance.constraintEngine.getViews(selection); > displayEngine.display(views, propertiesComposite, selection, SWT.NONE); > this.layout(); > propertiesComposite.layout(); >#P org.eclipse.papyrus.uml.properties >Index: src/org/eclipse/papyrus/uml/properties/modelelement/CommentModelElement.java >=================================================================== >--- src/org/eclipse/papyrus/uml/properties/modelelement/CommentModelElement.java (revision 0) >+++ src/org/eclipse/papyrus/uml/properties/modelelement/CommentModelElement.java (working copy) >@@ -0,0 +1,78 @@ >+/***************************************************************************** >+ * Copyright (c) 2012 CEA LIST. >+ * >+ * 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: >+ * Sebastien Poissonnet (CEA LIST) sebastien.poissonnet@cea.fr >+ *****************************************************************************/ >+package org.eclipse.papyrus.uml.properties.modelelement; >+ >+import org.eclipse.core.databinding.observable.IObservable; >+import org.eclipse.emf.edit.domain.EditingDomain; >+import org.eclipse.papyrus.infra.widgets.creation.ReferenceValueFactory; >+import org.eclipse.papyrus.uml.properties.databinding.AppliedCommentsObservableList; >+import org.eclipse.papyrus.views.properties.modelelement.EMFModelElement; >+import org.eclipse.uml2.uml.Element; >+ >+public class CommentModelElement extends EMFModelElement { >+ >+ private static final String APPLIED_COMMENTS_PROPERTY = "appliedComments"; >+ >+ public CommentModelElement(Element source, EditingDomain domain) { >+ super(source, domain); >+ } >+ >+ @Override >+ public boolean isOrdered(String propertyPath) { >+ if(APPLIED_COMMENTS_PROPERTY.equals(propertyPath)) { >+ return false; >+ } >+ return super.isOrdered(propertyPath); >+ } >+ >+ @Override >+ public boolean isUnique(String propertyPath) { >+ if(APPLIED_COMMENTS_PROPERTY.equals(propertyPath)) { >+ return true; >+ } >+ return super.isUnique(propertyPath); >+ } >+ >+ @Override >+ protected IObservable doGetObservable(String propertyPath) { >+ if(APPLIED_COMMENTS_PROPERTY.equals(propertyPath)) { >+ return new AppliedCommentsObservableList(domain, (Element)source); >+ } >+ return super.doGetObservable(propertyPath); >+ } >+ >+ @Override >+ public ReferenceValueFactory getValueFactory(String propertyPath) { >+ if(APPLIED_COMMENTS_PROPERTY.equals(propertyPath)) { >+ return super.getValueFactory("ownedComment"); >+ } >+ >+ return super.getValueFactory(propertyPath); >+ } >+ >+ @Override >+ public boolean getDirectCreation(String propertyPath) { >+ if(APPLIED_COMMENTS_PROPERTY.equals(propertyPath)) { >+ return true; >+ } >+ return super.getDirectCreation(propertyPath); >+ } >+ >+ @Override >+ public boolean isEditable(String propertyPath) { >+ if(APPLIED_COMMENTS_PROPERTY.equals(propertyPath)) { >+ return true; >+ } >+ return super.isEditable(propertyPath); >+ } >+ >+} >Index: src/org/eclipse/papyrus/uml/properties/widgets/CommentEditor.java >=================================================================== >--- src/org/eclipse/papyrus/uml/properties/widgets/CommentEditor.java (revision 0) >+++ src/org/eclipse/papyrus/uml/properties/widgets/CommentEditor.java (working copy) >@@ -0,0 +1,37 @@ >+/***************************************************************************** >+ * Copyright (c) 2012 CEA LIST. >+ * >+ * 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: >+ * Sebastien Poissonnet (CEA LIST) sebastien.poissonnet@cea.fr >+ *****************************************************************************/ >+package org.eclipse.papyrus.uml.properties.widgets; >+ >+import org.eclipse.core.databinding.observable.list.IObservableList; >+import org.eclipse.papyrus.uml.properties.providers.CommentContentProvider; >+import org.eclipse.papyrus.views.properties.widgets.MultiReferenceEditorWithPropertyView; >+import org.eclipse.swt.widgets.Composite; >+ >+public class CommentEditor extends MultiReferenceEditorWithPropertyView { >+ >+ public CommentEditor(Composite parent, int style) { >+ super(parent, style); >+ } >+ >+ @Override >+ public void setModelObservable(IObservableList modelObservable) { >+ super.setModelObservable(modelObservable); >+ updateContentProvider(); >+ } >+ >+ >+ >+ private void updateContentProvider() { >+ multiReferenceEditor.getViewer().setContentProvider(new CommentContentProvider()); >+ } >+ >+} >Index: META-INF/MANIFEST.MF >=================================================================== >--- META-INF/MANIFEST.MF (revision 9790) >+++ META-INF/MANIFEST.MF (working copy) >@@ -55,4 +55,5 @@ > org.eclipse.papyrus.uml.properties.util, > org.eclipse.papyrus.uml.properties.widgets > Bundle-Version: 0.9.1.qualifier >+Import-Package: org.eclipse.papyrus.uml.properties.widgets > >Index: src/org/eclipse/papyrus/uml/properties/modelelement/CommentModelElementFactory.java >=================================================================== >--- src/org/eclipse/papyrus/uml/properties/modelelement/CommentModelElementFactory.java (revision 0) >+++ src/org/eclipse/papyrus/uml/properties/modelelement/CommentModelElementFactory.java (working copy) >@@ -0,0 +1,36 @@ >+/***************************************************************************** >+ * Copyright (c) 2012 CEA LIST. >+ * >+ * 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: >+ * Sebastien Poissonnet (CEA LIST) sebastien.poissonnet@cea.fr >+ *****************************************************************************/ >+package org.eclipse.papyrus.uml.properties.modelelement; >+ >+import org.eclipse.emf.edit.domain.EditingDomain; >+import org.eclipse.papyrus.infra.emf.utils.EMFHelper; >+import org.eclipse.papyrus.uml.tools.utils.UMLUtil; >+import org.eclipse.papyrus.views.properties.Activator; >+import org.eclipse.papyrus.views.properties.contexts.DataContextElement; >+import org.eclipse.papyrus.views.properties.modelelement.ModelElement; >+import org.eclipse.papyrus.views.properties.modelelement.ModelElementFactory; >+import org.eclipse.uml2.uml.Element; >+ >+public class CommentModelElementFactory implements ModelElementFactory { >+ >+ public ModelElement createFromSource(Object source, DataContextElement context) { >+ Element umlSource = UMLUtil.resolveUMLElement(source); >+ if(umlSource == null) { >+ Activator.log.warn("Unable to resolve the selected element to a UML Element"); //$NON-NLS-1$ >+ return null; >+ } >+ >+ EditingDomain domain = EMFHelper.resolveEditingDomain(umlSource); >+ return new CommentModelElement(umlSource, domain); >+ } >+ >+} >Index: src/org/eclipse/papyrus/uml/properties/databinding/AppliedCommentsObservableList.java >=================================================================== >--- src/org/eclipse/papyrus/uml/properties/databinding/AppliedCommentsObservableList.java (revision 0) >+++ src/org/eclipse/papyrus/uml/properties/databinding/AppliedCommentsObservableList.java (working copy) >@@ -0,0 +1,218 @@ >+/***************************************************************************** >+ * Copyright (c) 2012 CEA LIST. >+ * >+ * 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: >+ * Sebastien Poissonnet (CEA LIST) sebastien.poissonnet@cea.fr >+ *****************************************************************************/ >+package org.eclipse.papyrus.uml.properties.databinding; >+ >+import java.util.Collection; >+import java.util.Collections; >+import java.util.Iterator; >+import java.util.LinkedList; >+import java.util.List; >+ >+import org.eclipse.core.runtime.Assert; >+import org.eclipse.emf.common.command.Command; >+import org.eclipse.emf.common.command.CompoundCommand; >+import org.eclipse.emf.ecore.EStructuralFeature.Setting; >+import org.eclipse.emf.edit.command.AddCommand; >+import org.eclipse.emf.edit.domain.EditingDomain; >+import org.eclipse.gmf.runtime.emf.type.core.requests.SetRequest; >+import org.eclipse.papyrus.infra.emf.databinding.PapyrusObservableList; >+import org.eclipse.papyrus.infra.services.edit.service.IElementEditService; >+import org.eclipse.uml2.common.util.UML2Util; >+import org.eclipse.uml2.uml.Comment; >+import org.eclipse.uml2.uml.Element; >+import org.eclipse.uml2.uml.UMLPackage; >+ >+public class AppliedCommentsObservableList extends PapyrusObservableList { >+ >+ public AppliedCommentsObservableList(EditingDomain domain, Element source) { >+ super(getAppliedCommentsList(source), domain, source, UMLPackage.eINSTANCE.getElement_OwnedComment()); >+ } >+ >+ private static List<Comment> getAppliedCommentsList(Element source) { >+ List<Comment> result = new LinkedList<Comment>(); >+ >+ Iterator<Setting> it = UML2Util.getNonNavigableInverseReferences(source).iterator(); >+ while(it.hasNext()) { >+ Setting setting = it.next(); >+ if(setting.getEStructuralFeature() == UMLPackage.Literals.COMMENT__ANNOTATED_ELEMENT) { >+ if(setting.getEObject() instanceof Comment) { >+ Comment comment = (Comment)setting.getEObject(); >+ >+ // small bugfix... >+ // UML2Util.getNonNavigableInverseReferences returns more element than >+ // needed, especially elements that are not real ones >+ // so we must check if they are contained by the current resource or >+ // not... >+ boolean isProxy = false; >+ for(Element annotatedElement : comment.getAnnotatedElements()) { >+ if(annotatedElement.eResource() == null) { >+ isProxy = true; >+ } >+ } >+ >+ // this is the real element, not a ghost one. display it in the list >+ if(!isProxy) { >+ if(comment.getAnnotatedElements().contains(source)) { >+ result.add(comment); >+ } >+ } >+ >+ } >+ } >+ } >+ >+ return result; >+ } >+ >+ @Override >+ protected void refreshCacheList() { >+ if(isDisposed()) { >+ return; >+ } >+ wrappedList.clear(); >+ wrappedList.addAll(getAppliedCommentsList((Element)source)); >+ fireListChange(null); >+ } >+ >+ @Override >+ public Command getAddAllCommand(Collection<?> values) { >+ throw new UnsupportedOperationException(); >+ // return super.getAddAllCommand(values); >+ } >+ >+ @Override >+ public Command getAddAllCommand(int index, Collection<?> values) { >+ throw new UnsupportedOperationException(); >+ // return super.getAddAllCommand(index, values); >+ } >+ >+ @Override >+ public Command getAddCommand(int index, Object value) { >+ throw new UnsupportedOperationException(); >+ // return super.getAddCommand(index, value); >+ } >+ >+ @Override >+ public Command getAddCommand(Object value) { >+ Assert.isTrue(value instanceof Comment); >+ >+ Comment comment = (Comment)value; >+ >+ //Add the comment to source#ownedComment >+ CompoundCommand addAppliedCommentCommand = new CompoundCommand("Add applied comment"); >+ addAppliedCommentCommand.append(super.getAddCommand(value)); >+ >+ //Add the source element to comment#annotatedElement >+ // List<Element> values = new LinkedList<Element>(comment.getAnnotatedElements()); >+ // values.add((Element)source); >+ // >+ // SetRequest setRequest = new SetRequest(comment, UMLPackage.eINSTANCE.getComment_AnnotatedElement(), values); >+ // IElementEditService provider = getProvider(); >+ // >+ // addAppliedCommentCommand.append(getCommandFromRequests(provider, Collections.singletonList(setRequest))); >+ >+ >+ AddCommand addCommand = new AddCommand(editingDomain, comment, UMLPackage.eINSTANCE.getComment_AnnotatedElement(), source); >+ addAppliedCommentCommand.append(addCommand); >+ >+ return addAppliedCommentCommand; >+ } >+ >+ @Override >+ public Command getRemoveCommand(Object value) { >+ Assert.isTrue(value instanceof Comment); >+ >+ CompoundCommand removeAppliedCommentCommand = new CompoundCommand("Remove applied comment"); >+ Comment comment = (Comment)value; >+ >+ if(comment.getAnnotatedElements().size() <= 1) { >+ return super.getRemoveCommand(value); >+ } >+ >+ //Remove the source element to comment#annotatedElement >+ List<Element> values = new LinkedList<Element>(comment.getAnnotatedElements()); >+ values.remove(source); >+ SetRequest setRequest = new SetRequest(comment, UMLPackage.eINSTANCE.getComment_AnnotatedElement(), values); >+ IElementEditService provider = getProvider(); >+ >+ removeAppliedCommentCommand.append(getCommandFromRequests(provider, Collections.singletonList(setRequest))); >+ >+ >+ // if(editingDomain != null) { >+ // RemoveCommand command = new RemoveCommand(editingDomain, comment, UMLPackage.eINSTANCE.getComment_AnnotatedElement(), source); >+ // return command; >+ // } >+ >+ return removeAppliedCommentCommand; >+ } >+ >+ @Override >+ public Command getRemoveAllCommand(Collection<?> values) { >+ >+ Iterator<?> itr = values.iterator(); >+ Comment comment; >+ Element value; >+ List<Element> values_; >+ CompoundCommand removeAppliedCommentCommand = new CompoundCommand("Remove applied comment"); >+ >+ while(itr.hasNext()) { >+ value = (Element)itr.next(); >+ Assert.isTrue(value instanceof Comment); >+ comment = (Comment)value; >+ >+ if(comment.getAnnotatedElements().size() <= 1) { >+ removeAppliedCommentCommand.append(super.getRemoveCommand(value)); >+ } else { >+ values_ = new LinkedList<Element>(comment.getAnnotatedElements()); >+ values_.remove(source); >+ SetRequest setRequest = new SetRequest(comment, UMLPackage.eINSTANCE.getComment_AnnotatedElement(), values_); >+ IElementEditService provider = getProvider(); >+ >+ removeAppliedCommentCommand.append(getCommandFromRequests(provider, Collections.singletonList(setRequest))); >+ } >+ >+ } >+ >+ return removeAppliedCommentCommand; >+ } >+ >+ // >+ // Unsupported operations >+ // >+ >+ @Override >+ public Command getClearCommand() { >+ throw new UnsupportedOperationException(); >+ // return super.getClearCommand(); >+ } >+ >+ @Override >+ public List<Command> getMoveCommands(int oldIndex, int newIndex) { >+ throw new UnsupportedOperationException(); >+ // return super.getMoveCommands(oldIndex, newIndex); >+ } >+ >+ @Override >+ public Command getRemoveCommand(int index) { >+ throw new UnsupportedOperationException(); >+ // return super.getRemoveCommand(index); >+ } >+ >+ @Override >+ public Command getSetCommand(int index, Object value) { >+ throw new UnsupportedOperationException(); >+ // return super.getSetCommand(index, value); >+ } >+ >+ >+ >+} >Index: src/org/eclipse/papyrus/uml/properties/providers/CommentContentProvider.java >=================================================================== >--- src/org/eclipse/papyrus/uml/properties/providers/CommentContentProvider.java (revision 0) >+++ src/org/eclipse/papyrus/uml/properties/providers/CommentContentProvider.java (working copy) >@@ -0,0 +1,99 @@ >+/***************************************************************************** >+ * Copyright (c) 2012 CEA LIST. >+ * >+ * 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: >+ * Sebastien Poissonnet (CEA LIST) sebastien.poissonnet@cea.fr >+ *****************************************************************************/ >+package org.eclipse.papyrus.uml.properties.providers; >+ >+import java.util.Collection; >+import java.util.Iterator; >+import java.util.LinkedList; >+import java.util.List; >+ >+import org.eclipse.emf.ecore.EStructuralFeature.Setting; >+import org.eclipse.jface.viewers.Viewer; >+import org.eclipse.papyrus.infra.widgets.providers.IHierarchicContentProvider; >+import org.eclipse.uml2.common.util.UML2Util; >+import org.eclipse.uml2.uml.Comment; >+import org.eclipse.uml2.uml.Element; >+import org.eclipse.uml2.uml.UMLPackage; >+ >+public class CommentContentProvider implements IHierarchicContentProvider { >+ >+ public Object[] getElements(Object inputElement) { >+ // Roots >+ if(inputElement instanceof Collection) { >+ return ((Collection<?>)inputElement).toArray(); >+ } else if(inputElement instanceof Object[]) { >+ return (Object[])inputElement; >+ } >+ >+ return new Object[]{}; >+ } >+ >+ public Object[] getChildren(Object parentElement) { >+ // Comment's children >+ >+ List<Comment> result = new LinkedList<Comment>(); >+ >+ Iterator<Setting> it = UML2Util.getNonNavigableInverseReferences((Element)parentElement).iterator(); >+ while(it.hasNext()) { >+ Setting setting = it.next(); >+ if(setting.getEStructuralFeature() == UMLPackage.Literals.COMMENT__ANNOTATED_ELEMENT) { >+ if(setting.getEObject() instanceof Comment) { >+ Comment comment = (Comment)setting.getEObject(); >+ >+ // small bugfix... >+ // UML2Util.getNonNavigableInverseReferences returns more element than >+ // needed, especially elements that are not real ones >+ // so we must check if they are contained by the current resource or >+ // not... >+ boolean isProxy = false; >+ for(Element annotatedElement : comment.getAnnotatedElements()) { >+ if(annotatedElement.eResource() == null) { >+ isProxy = true; >+ } >+ } >+ >+ // this is the real element, not a ghost one. display it in the list >+ if(!isProxy) { >+ if(comment.getAnnotatedElements().contains(parentElement)) { >+ result.add(comment); >+ } >+ } >+ >+ } >+ } >+ } >+ >+ return result.toArray(); >+ } >+ >+ public Object getParent(Object element) { >+ // useful ? >+ return null; >+ } >+ >+ public boolean hasChildren(Object element) { >+ return getChildren(element).length > 0; >+ } >+ >+ public void dispose() { >+ //Nothing >+ } >+ >+ public void inputChanged(Viewer viewer, Object oldInput, Object newInput) { >+ //Nothing >+ } >+ >+ public boolean isValidValue(Object element) { >+ return true; >+ } >+ >+} >Index: Model/Environment.xmi >=================================================================== >--- Model/Environment.xmi (revision 9790) >+++ Model/Environment.xmi (working copy) >@@ -1,19 +1,74 @@ > <?xml version="1.0" encoding="ASCII"?> >-<environment:Environment xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:environment="http://www.eclipse.org/papyrus/properties/environment/0.9"> >- <modelElementFactories name="UML Specific Factory" factoryClass="org.eclipse.papyrus.uml.properties.modelelement.UMLEditorFactory"/> >- <modelElementFactories name="UML Factory" factoryClass="org.eclipse.papyrus.uml.properties.modelelement.UMLModelElementFactory"/> >- <modelElementFactories name="Stereotype Factory" factoryClass="org.eclipse.papyrus.uml.properties.modelelement.StereotypeModelElementFactory"/> >- <modelElementFactories name="Stereotype Application Factory" factoryClass="org.eclipse.papyrus.uml.properties.modelelement.StereotypeApplicationFactory"/> >- <modelElementFactories name="UML Notation Factory" factoryClass="org.eclipse.papyrus.uml.properties.modelelement.UMLNotationFactory"/> >- <modelElementFactories name="Custom Image Factory" factoryClass="org.eclipse.papyrus.uml.properties.modelelement.CustomImageModelElementFactory"/> >- <modelElementFactories name="Stereotype Appearance Factory" factoryClass="org.eclipse.papyrus.uml.properties.modelelement.StereotypeAppearanceFactory"/> >- <constraintTypes label="UML Instance Of" constraintClass="org.eclipse.papyrus.uml.properties.constraints.UmlInstanceOfConstraint"/> >- <constraintTypes label="Has Stereotype" constraintClass="org.eclipse.papyrus.uml.properties.constraints.HasStereotypeConstraint"/> >- <constraintTypes label="IsDataType" constraintClass="org.eclipse.papyrus.uml.properties.datatype.IsDataTypeConstraint"/> >- <propertyEditorTypes label="ExpressionEditor" widgetClass="ExpressionEditor" namespace="//@namespaces.0" multiplicity="-1"/> >- <propertyEditorTypes label="Profile Application Editor" widgetClass="ProfileApplicationPropertyEditor" namespace="//@namespaces.0" type="Reference" multiplicity="-1"/> >- <propertyEditorTypes label="StereotypeDisplayEditor" widgetClass="StereotypeDisplay" namespace="//@namespaces.0" type="Reference"/> >- <propertyEditorTypes label="Stereotype Application Editor" widgetClass="StereotypeApplication" namespace="//@namespaces.0" type="Reference" multiplicity="-1"/> >- <propertyEditorTypes label="Image content Editor" widgetClass="StereotypeImageEditor" namespace="//@namespaces.0"/> >- <namespaces prefix="clr-namespace" name="uml" value="org.eclipse.papyrus.uml.properties.widgets"/> >+<environment:Environment >+ xmi:version="2.0" >+ xmlns:xmi="http://www.omg.org/XMI" >+ xmlns:environment="http://www.eclipse.org/papyrus/properties/environment/0.9"> >+ <constraintTypes >+ label="UML Instance Of" >+ constraintClass="org.eclipse.papyrus.uml.properties.constraints.UmlInstanceOfConstraint"/> >+ <constraintTypes >+ label="Has Stereotype" >+ constraintClass="org.eclipse.papyrus.uml.properties.constraints.HasStereotypeConstraint"/> >+ <constraintTypes >+ label="IsDataType" >+ constraintClass="org.eclipse.papyrus.uml.properties.datatype.IsDataTypeConstraint"/> >+ <modelElementFactories >+ name="UML Specific Factory" >+ factoryClass="org.eclipse.papyrus.uml.properties.modelelement.UMLEditorFactory"/> >+ <modelElementFactories >+ name="UML Factory" >+ factoryClass="org.eclipse.papyrus.uml.properties.modelelement.UMLModelElementFactory"/> >+ <modelElementFactories >+ name="Stereotype Factory" >+ factoryClass="org.eclipse.papyrus.uml.properties.modelelement.StereotypeModelElementFactory"/> >+ <modelElementFactories >+ name="Stereotype Application Factory" >+ factoryClass="org.eclipse.papyrus.uml.properties.modelelement.StereotypeApplicationFactory"/> >+ <modelElementFactories >+ name="UML Notation Factory" >+ factoryClass="org.eclipse.papyrus.uml.properties.modelelement.UMLNotationFactory"/> >+ <modelElementFactories >+ name="Custom Image Factory" >+ factoryClass="org.eclipse.papyrus.uml.properties.modelelement.CustomImageModelElementFactory"/> >+ <modelElementFactories >+ name="Stereotype Appearance Factory" >+ factoryClass="org.eclipse.papyrus.uml.properties.modelelement.StereotypeAppearanceFactory"/> >+ <modelElementFactories >+ name="Applied Comments Model Element Factory" >+ factoryClass="org.eclipse.papyrus.uml.properties.modelelement.CommentModelElementFactory"/> >+ <propertyEditorTypes >+ label="ExpressionEditor" >+ widgetClass="ExpressionEditor" >+ namespace="//@namespaces.0" >+ multiplicity="-1"/> >+ <propertyEditorTypes >+ label="Profile Application Editor" >+ widgetClass="ProfileApplicationPropertyEditor" >+ namespace="//@namespaces.0" >+ type="Reference" >+ multiplicity="-1"/> >+ <propertyEditorTypes >+ label="StereotypeDisplayEditor" >+ widgetClass="StereotypeDisplay" >+ namespace="//@namespaces.0" >+ type="Reference"/> >+ <propertyEditorTypes >+ label="Stereotype Application Editor" >+ widgetClass="StereotypeApplication" >+ namespace="//@namespaces.0" >+ type="Reference" >+ multiplicity="-1"/> >+ <propertyEditorTypes >+ label="Image content Editor" >+ widgetClass="StereotypeImageEditor" >+ namespace="//@namespaces.0"/> >+ <propertyEditorTypes >+ label="Comment Editor" >+ widgetClass="CommentPropertyEditor" >+ namespace="//@namespaces.0" >+ type="Reference" >+ multiplicity="-1"/> >+ <namespaces >+ name="uml" >+ value="org.eclipse.papyrus.uml.properties.widgets"/> > </environment:Environment> >Index: src/org/eclipse/papyrus/uml/properties/widgets/CommentPropertyEditor.java >=================================================================== >--- src/org/eclipse/papyrus/uml/properties/widgets/CommentPropertyEditor.java (revision 0) >+++ src/org/eclipse/papyrus/uml/properties/widgets/CommentPropertyEditor.java (working copy) >@@ -0,0 +1,29 @@ >+/***************************************************************************** >+ * Copyright (c) 2012 CEA LIST. >+ * >+ * 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: >+ * Sebastien Poissonnet (CEA LIST) sebastien.poissonnet@cea.fr >+ *****************************************************************************/ >+package org.eclipse.papyrus.uml.properties.widgets; >+ >+import org.eclipse.papyrus.views.properties.widgets.MultiReferenceEditorWithPropertyView; >+import org.eclipse.papyrus.views.properties.widgets.MultiReferencePropertyEditorWithPropertyView; >+import org.eclipse.swt.widgets.Composite; >+ >+public class CommentPropertyEditor extends MultiReferencePropertyEditorWithPropertyView { >+ >+ public CommentPropertyEditor(Composite parent, int style) { >+ super(parent, style); >+ } >+ >+ @Override >+ protected MultiReferenceEditorWithPropertyView createMultiReferenceEditorWithPropertyView(Composite parent, int style) { >+ return new CommentEditor(parent, style); >+ } >+ >+}
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 385184
: 226784