diff options
| author | Remi Schnekenburger | 2016-04-21 20:47:42 +0000 |
|---|---|---|
| committer | Gerrit Code Review @ Eclipse.org | 2016-04-22 12:04:44 +0000 |
| commit | 1c69a0fcd8a966a3fb5c91d93cb3da3ac7944dfe (patch) | |
| tree | 28a866b703b9e37c7637486c8583686274faa66a | |
| parent | 12744241daf9ba73c3d8194a789b1d6ab24a5c56 (diff) | |
| download | org.eclipse.papyrus-rt-1c69a0fcd8a966a3fb5c91d93cb3da3ac7944dfe.tar.gz org.eclipse.papyrus-rt-1c69a0fcd8a966a3fb5c91d93cb3da3ac7944dfe.tar.xz org.eclipse.papyrus-rt-1c69a0fcd8a966a3fb5c91d93cb3da3ac7944dfe.zip | |
Bug 491228: [Tooling] The protocol customization in model explorer
became broken in Neon
https://bugs.eclipse.org/bugs/show_bug.cgi?id=491228
- changing the isVisible custom by a new FacetOperation on
visibleReferences for Protocol and PackageProtocolContainers.
- Remove unused Query for Protocol Image.
- Update some classes to reduce checkstyle warnings.
Change-Id: I13c622bdb4fa8e9a40bf08f2f3d59372c2347d1d
10 files changed, 222 insertions, 168 deletions
diff --git a/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.modelexplorer/facet/Protocol.custom b/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.modelexplorer/facet/Protocol.custom index 65fe2b0f9..bbcb37bd8 100644 --- a/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.modelexplorer/facet/Protocol.custom +++ b/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.modelexplorer/facet/Protocol.custom @@ -46,6 +46,19 @@ xsi:type="javaQuery:JavaQuery" implementationClassName="org.eclipse.papyrusrt.umlrt.tooling.modelexplorer.queries.IsProtocolContainersContainerQuery"/> </facetOperations> + <facetOperations + name="DisplayOnlyContainmentReferencesExceptPackagedElement" + upperBound="-1"> + <eType + xsi:type="ecore:EClass" + href="http://www.eclipse.org/emf/2002/Ecore#//EReference"/> + <query + xsi:type="javaQuery:JavaQuery" + implementationClassName="org.eclipse.papyrusrt.umlrt.tooling.modelexplorer.queries.GetVisiblePackageUMLRTReferencesQuery"/> + <override + xsi:type="efacet:FacetOperation" + href="platform:/plugin/org.eclipse.papyrus.emf.facet.custom.ui/resources/customproperties.efacet#//CustomizedEObject/visibleReferences"/> + </facetOperations> </eClassifiers> <eClassifiers xsi:type="custom:FacetCustomization" @@ -66,24 +79,6 @@ operation="//ProtocolContainerHidden/GetFilteredProtocolsPackageElements"/> </facetElements> <facetOperations - name="HideProtocolContainers"> - <eType - xsi:type="ecore:EDataType" - href="http://www.eclipse.org/emf/2002/Ecore#//EBoolean"/> - <eParameters - name="eStructuralFeature"> - <eType - xsi:type="ecore:EClass" - href="http://www.eclipse.org/emf/2002/Ecore#//EStructuralFeature"/> - </eParameters> - <query - xsi:type="javaQuery:JavaQuery" - implementationClassName="org.eclipse.papyrusrt.umlrt.tooling.modelexplorer.queries.HideProtocolContainersQuery"/> - <override - xsi:type="efacet:FacetOperation" - href="platform:/plugin/org.eclipse.papyrus.emf.facet.custom.ui/resources/customproperties.efacet#//CustomizedEObject/isVisible"/> - </facetOperations> - <facetOperations name="GetFilteredProtocolsPackageElements" upperBound="-1"> <eType @@ -110,6 +105,19 @@ xsi:type="javaQuery:JavaQuery" implementationClassName="org.eclipse.papyrusrt.umlrt.tooling.modelexplorer.queries.IsProtocolQuery"/> </facetOperations> + <facetOperations + name="DisplayNoReferences" + upperBound="-1"> + <eType + xsi:type="ecore:EClass" + href="http://www.eclipse.org/emf/2002/Ecore#//EReference"/> + <query + xsi:type="javaQuery:JavaQuery" + implementationClassName="org.eclipse.papyrusrt.umlrt.tooling.modelexplorer.queries.EmptyReferencesListQuery"/> + <override + xsi:type="efacet:FacetOperation" + href="platform:/plugin/org.eclipse.papyrus.emf.facet.custom.ui/resources/customproperties.efacet#//CustomizedEObject/visibleReferences"/> + </facetOperations> </eClassifiers> <eClassifiers xsi:type="custom:FacetCustomization" @@ -158,7 +166,7 @@ xsi:type="query:OperationCallQuery" operation="//ProtocolContainment_OnlyRTMessages/GetRTMessagesInOut"/> </facetElements> - <facetElements + <facetElements xsi:type="efacet:FacetReference" name="comments" upperBound="-1" @@ -217,24 +225,6 @@ implementationClassName="org.eclipse.papyrusrt.umlrt.tooling.modelexplorer.queries.GetOwnedComments"/> </facetOperations> <facetOperations - name="DisplayMessageSetsOnly"> - <eType - xsi:type="ecore:EDataType" - href="http://www.eclipse.org/emf/2002/Ecore#//EBoolean"/> - <eParameters - name="eStructuralFeature"> - <eType - xsi:type="ecore:EClass" - href="http://www.eclipse.org/emf/2002/Ecore#//EStructuralFeature"/> - </eParameters> - <query - xsi:type="javaQuery:JavaQuery" - implementationClassName="org.eclipse.papyrusrt.umlrt.tooling.modelexplorer.queries.DisplayMessagesOnlyQuery"/> - <override - xsi:type="efacet:FacetOperation" - href="platform:/plugin/org.eclipse.papyrus.emf.facet.custom.ui/resources/customproperties.efacet#//CustomizedEObject/isVisible"/> - </facetOperations> - <facetOperations name="HideCollapseLinks"> <eType xsi:type="ecore:EDataType" diff --git a/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.modelexplorer/src/org/eclipse/papyrusrt/umlrt/tooling/modelexplorer/queries/EmptyReferencesListQuery.java b/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.modelexplorer/src/org/eclipse/papyrusrt/umlrt/tooling/modelexplorer/queries/EmptyReferencesListQuery.java new file mode 100644 index 000000000..e4f1e5cb4 --- /dev/null +++ b/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.modelexplorer/src/org/eclipse/papyrusrt/umlrt/tooling/modelexplorer/queries/EmptyReferencesListQuery.java @@ -0,0 +1,45 @@ +/***************************************************************************** + * Copyright (c) 2016 CEA LIST and others. + * + * 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: + * CEA LIST - Initial API and implementation + * + *****************************************************************************/ + +package org.eclipse.papyrusrt.umlrt.tooling.modelexplorer.queries; + +import java.util.Collections; +import java.util.List; + +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.ecore.EReference; +import org.eclipse.papyrus.emf.facet.efacet.core.IFacetManager; +import org.eclipse.papyrus.emf.facet.efacet.core.exception.DerivedTypedElementException; +import org.eclipse.papyrus.emf.facet.query.java.core.IJavaQuery2; +import org.eclipse.papyrus.emf.facet.query.java.core.IParameterValueList2; + +/** + * Query that returns always the empty list. + */ +public class EmptyReferencesListQuery implements IJavaQuery2<EObject, List<EReference>> { + + /** + * Constructor. + */ + public EmptyReferencesListQuery() { + // empty + } + + /** + * {@inheritDoc} + */ + @Override + public List<EReference> evaluate(final EObject source, final IParameterValueList2 parameterValues, final IFacetManager facetManager) throws DerivedTypedElementException { + return Collections.emptyList(); + } +} diff --git a/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.modelexplorer/src/org/eclipse/papyrusrt/umlrt/tooling/modelexplorer/queries/GetLabelQuery.java b/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.modelexplorer/src/org/eclipse/papyrusrt/umlrt/tooling/modelexplorer/queries/GetLabelQuery.java index 825a59718..540530cd5 100644 --- a/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.modelexplorer/src/org/eclipse/papyrusrt/umlrt/tooling/modelexplorer/queries/GetLabelQuery.java +++ b/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.modelexplorer/src/org/eclipse/papyrusrt/umlrt/tooling/modelexplorer/queries/GetLabelQuery.java @@ -19,21 +19,38 @@ import org.eclipse.papyrus.uml.modelexplorer.queries.GetComplexName; import org.eclipse.papyrusrt.umlrt.tooling.modelexplorer.provider.UMLRTFilteredLabelProvider; import org.eclipse.uml2.uml.NamedElement; +/** + * Query to get names for elements displayed in the model explorer. It delegates to the {@link UMLRTFilteredLabelProvider}. + * + */ public class GetLabelQuery extends GetComplexName { - + + /** label provider used to compute labels. */ private static final UMLRTFilteredLabelProvider UML_LABEL_PROVIDER = new UMLRTFilteredLabelProvider(); - + + /** + * Constructor. + */ + public GetLabelQuery() { + // empty + } + /** * {@inheritDoc} */ + @Override public String evaluate(final NamedElement context, final IParameterValueList2 parameterValues, final IFacetManager facetManager) throws DerivedTypedElementException { + String result = null; + if (UML_LABEL_PROVIDER.accept(context)) { - return UML_LABEL_PROVIDER.getText(context); + result = UML_LABEL_PROVIDER.getText(context); + } else { + result = super.evaluate(context, parameterValues, facetManager); } - return super.evaluate(context, parameterValues, facetManager); - + return result; + } } diff --git a/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.modelexplorer/src/org/eclipse/papyrusrt/umlrt/tooling/modelexplorer/queries/GetProtocolImageQuery.java b/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.modelexplorer/src/org/eclipse/papyrusrt/umlrt/tooling/modelexplorer/queries/GetProtocolImageQuery.java deleted file mode 100644 index 67ff16cf2..000000000 --- a/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.modelexplorer/src/org/eclipse/papyrusrt/umlrt/tooling/modelexplorer/queries/GetProtocolImageQuery.java +++ /dev/null @@ -1,66 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2015 CEA LIST and others. - * - * 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: - * CEA LIST - Initial API and implementation - * - *****************************************************************************/ -package org.eclipse.papyrusrt.umlrt.tooling.modelexplorer.queries; - -import org.eclipse.emf.ecore.EStructuralFeature; -import org.eclipse.papyrus.emf.facet.custom.metamodel.custompt.IImage; -import org.eclipse.papyrus.emf.facet.custom.ui.ImageUtils; -import org.eclipse.papyrus.emf.facet.efacet.core.IFacetManager; -import org.eclipse.papyrus.emf.facet.efacet.core.exception.DerivedTypedElementException; -import org.eclipse.papyrus.emf.facet.efacet.metamodel.v0_2_0.efacet.FacetReference; -import org.eclipse.papyrus.emf.facet.efacet.metamodel.v0_2_0.efacet.ParameterValue; -import org.eclipse.papyrus.emf.facet.query.java.core.IJavaQuery2; -import org.eclipse.papyrus.emf.facet.query.java.core.IParameterValueList2; -import org.eclipse.papyrusrt.umlrt.core.utils.ProtocolContainerUtils; -import org.eclipse.papyrusrt.umlrt.tooling.modelexplorer.provider.UMLRTFilteredLabelProvider; -import org.eclipse.uml2.uml.Package; - -/** - * Returns the icon of a protocol for a Protocol Container. - */ -public class GetProtocolImageQuery implements IJavaQuery2<Package, IImage> { - - UMLRTFilteredLabelProvider labelProvider = new UMLRTFilteredLabelProvider(); - - /** - * {@inheritDoc} - */ - public IImage evaluate(final Package context, - final IParameterValueList2 parameterValues, - final IFacetManager facetManager) - throws DerivedTypedElementException { - ParameterValue parameterValue = parameterValues.getParameterValueByName("eObject"); - - if (parameterValue != null) { - EStructuralFeature eStructuralFeature = (EStructuralFeature) parameterValue.getValue(); - // the eStructure is a containmentReference or Facet Reference? - if (eStructuralFeature instanceof FacetReference) { - // check this is in / out or inout - String name = ((FacetReference) eStructuralFeature).getName(); - if ("in".equals(name)) { - return ImageUtils.wrap(labelProvider.getImage(ProtocolContainerUtils.getMessageSetIn(context))); - } - if ("out".equals(name)) { - return ImageUtils.wrap(labelProvider.getImage(ProtocolContainerUtils.getMessageSetOut(context))); - } - if ("inout".equals(name)) { - return ImageUtils.wrap(labelProvider.getImage(ProtocolContainerUtils.getMessageSetInOut(context))); - } - } - } - - - // by default, return the protocol container image - return ImageUtils.wrap(labelProvider.getImage(context)); - } -} diff --git a/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.modelexplorer/src/org/eclipse/papyrusrt/umlrt/tooling/modelexplorer/queries/GetVisiblePackageUMLRTReferencesQuery.java b/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.modelexplorer/src/org/eclipse/papyrusrt/umlrt/tooling/modelexplorer/queries/GetVisiblePackageUMLRTReferencesQuery.java new file mode 100644 index 000000000..b3d33c4a6 --- /dev/null +++ b/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.modelexplorer/src/org/eclipse/papyrusrt/umlrt/tooling/modelexplorer/queries/GetVisiblePackageUMLRTReferencesQuery.java @@ -0,0 +1,64 @@ +/***************************************************************************** + * Copyright (c) 2016 CEA LIST and others. + * + * 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: + * CEA LIST - Initial API and implementation + * + *****************************************************************************/ + +package org.eclipse.papyrusrt.umlrt.tooling.modelexplorer.queries; + +import java.util.ArrayList; +import java.util.HashSet; +import java.util.List; +import java.util.Set; + +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.ecore.EReference; +import org.eclipse.papyrus.emf.facet.efacet.core.IFacetManager; +import org.eclipse.papyrus.emf.facet.efacet.core.exception.DerivedTypedElementException; +import org.eclipse.papyrus.emf.facet.query.java.core.IParameterValueList2; +import org.eclipse.papyrus.uml.modelexplorer.queries.GetVisibleUMLReferencesQuery; +import org.eclipse.uml2.uml.UMLPackage; + +/** + * Query that returns all usual UML references, except also Package:PackageElement. + */ +public class GetVisiblePackageUMLRTReferencesQuery extends GetVisibleUMLReferencesQuery { + + /** excluded reference set. */ + private static final Set<EReference> EXCLUDED_REFERENCES = getExcludedReferences(); + + /** + * Constructor. + */ + public GetVisiblePackageUMLRTReferencesQuery() { + // empty + } + + /** + * Returns the list of Excluded references from this query. + * + * @return the list of Excluded references from this query. + */ + private static Set<EReference> getExcludedReferences() { + final Set<EReference> result = new HashSet<>(1); + result.add(UMLPackage.Literals.PACKAGE__PACKAGED_ELEMENT); + return result; + } + + /** + * {@inheritDoc} + */ + @Override + public List<EReference> evaluate(final EObject source, final IParameterValueList2 parameterValues, final IFacetManager facetManager) throws DerivedTypedElementException { + List<EReference> result = new ArrayList<>(super.evaluate(source, parameterValues, facetManager)); + result.removeAll(EXCLUDED_REFERENCES); + return result; + } +} diff --git a/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.modelexplorer/src/org/eclipse/papyrusrt/umlrt/tooling/modelexplorer/queries/HideProtocolContainersQuery.java b/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.modelexplorer/src/org/eclipse/papyrusrt/umlrt/tooling/modelexplorer/queries/HideProtocolContainersQuery.java deleted file mode 100644 index ff508a26f..000000000 --- a/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.modelexplorer/src/org/eclipse/papyrusrt/umlrt/tooling/modelexplorer/queries/HideProtocolContainersQuery.java +++ /dev/null @@ -1,50 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2015 CEA LIST and others. - * - * 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: - * CEA LIST - Initial API and implementation - * - *****************************************************************************/ -package org.eclipse.papyrusrt.umlrt.tooling.modelexplorer.queries; - -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.EReference; -import org.eclipse.emf.ecore.EStructuralFeature; -import org.eclipse.papyrus.emf.facet.efacet.core.IFacetManager; -import org.eclipse.papyrus.emf.facet.efacet.core.exception.DerivedTypedElementException; -import org.eclipse.papyrus.emf.facet.efacet.metamodel.v0_2_0.efacet.ParameterValue; -import org.eclipse.papyrus.emf.facet.query.java.core.IJavaQuery2; -import org.eclipse.papyrus.emf.facet.query.java.core.IParameterValueList2; -import org.eclipse.papyrus.uml.modelexplorer.queries.DisplayUMLStructuralFeature; -import org.eclipse.uml2.uml.Element; -import org.eclipse.uml2.uml.UMLPackage; - -public class HideProtocolContainersQuery extends DisplayUMLStructuralFeature implements IJavaQuery2<EObject, Boolean> { - - /** - * {@inheritDoc} - */ - public Boolean evaluate(final EObject context, - final IParameterValueList2 parameterValues, - final IFacetManager facetManager) - throws DerivedTypedElementException { - - ParameterValue parameterValue = parameterValues.getParameterValueByName("eStructuralFeature"); - EStructuralFeature eStructuralFeature = (EStructuralFeature) parameterValue.getValue(); - // This is an UML element? - if (parameterValue != null && context instanceof Element) { - // the eStructure is a containmentReference or Facet Reference? - if (eStructuralFeature instanceof EReference) { - if (UMLPackage.eINSTANCE.getPackage_PackagedElement().equals(eStructuralFeature)) { - return false; - } - } - } - return super.evaluate(context, parameterValues, facetManager); - } -} diff --git a/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.modelexplorer/src/org/eclipse/papyrusrt/umlrt/tooling/modelexplorer/queries/IsProtocolContainerQuery.java b/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.modelexplorer/src/org/eclipse/papyrusrt/umlrt/tooling/modelexplorer/queries/IsProtocolContainerQuery.java index f1c5f0e4d..1e0cb48f2 100644 --- a/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.modelexplorer/src/org/eclipse/papyrusrt/umlrt/tooling/modelexplorer/queries/IsProtocolContainerQuery.java +++ b/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.modelexplorer/src/org/eclipse/papyrusrt/umlrt/tooling/modelexplorer/queries/IsProtocolContainerQuery.java @@ -19,16 +19,27 @@ import org.eclipse.papyrus.emf.facet.query.java.core.IParameterValueList2; import org.eclipse.papyrusrt.umlrt.core.utils.ProtocolContainerUtils; import org.eclipse.uml2.uml.Package; +/** + * Query that returns <code>true</code> if the specified package 'context' is a ProtocolContainer. + */ public class IsProtocolContainerQuery implements IJavaQuery2<Package, Boolean> { /** + * Creates a new {@link IsProtocolContainerQuery}. + */ + public IsProtocolContainerQuery() { + + } + + /** * {@inheritDoc} */ + @Override public Boolean evaluate(final Package context, final IParameterValueList2 parameterValues, final IFacetManager facetManager) - throws DerivedTypedElementException { - + throws DerivedTypedElementException { + return ProtocolContainerUtils.isProtocolContainer(context); } } diff --git a/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.modelexplorer/src/org/eclipse/papyrusrt/umlrt/tooling/modelexplorer/queries/IsProtocolContainersContainerQuery.java b/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.modelexplorer/src/org/eclipse/papyrusrt/umlrt/tooling/modelexplorer/queries/IsProtocolContainersContainerQuery.java index 232469521..3d46edfc8 100644 --- a/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.modelexplorer/src/org/eclipse/papyrusrt/umlrt/tooling/modelexplorer/queries/IsProtocolContainersContainerQuery.java +++ b/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.modelexplorer/src/org/eclipse/papyrusrt/umlrt/tooling/modelexplorer/queries/IsProtocolContainersContainerQuery.java @@ -19,8 +19,22 @@ import org.eclipse.papyrus.emf.facet.query.java.core.IParameterValueList2; import org.eclipse.papyrusrt.umlrt.core.utils.ProtocolContainerUtils; import org.eclipse.uml2.uml.Package; +/** + * Query that returns <code>true</code> if the specified Package context contains a protocolContainer Package. + */ public class IsProtocolContainersContainerQuery implements IJavaQuery2<Package, Boolean> { + /** + * Constructor. + */ + public IsProtocolContainersContainerQuery() { + // empty constructor + } + + /** + * {@inheritDoc} + */ + @Override public Boolean evaluate(final Package context, final IParameterValueList2 parameterValues, final IFacetManager facetManager) throws DerivedTypedElementException { return ProtocolContainerUtils.containsProtocolContainer(context); } diff --git a/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.modelexplorer/src/org/eclipse/papyrusrt/umlrt/tooling/modelexplorer/queries/IsProtocolQuery.java b/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.modelexplorer/src/org/eclipse/papyrusrt/umlrt/tooling/modelexplorer/queries/IsProtocolQuery.java index 457e78e06..ac1e622ff 100644 --- a/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.modelexplorer/src/org/eclipse/papyrusrt/umlrt/tooling/modelexplorer/queries/IsProtocolQuery.java +++ b/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.modelexplorer/src/org/eclipse/papyrusrt/umlrt/tooling/modelexplorer/queries/IsProtocolQuery.java @@ -9,7 +9,8 @@ * Contributors: * CEA LIST - Initial API and implementation * - *****************************************************************************/package org.eclipse.papyrusrt.umlrt.tooling.modelexplorer.queries; + *****************************************************************************/ +package org.eclipse.papyrusrt.umlrt.tooling.modelexplorer.queries; import org.eclipse.papyrus.emf.facet.efacet.core.IFacetManager; import org.eclipse.papyrus.emf.facet.efacet.core.exception.DerivedTypedElementException; @@ -18,12 +19,23 @@ import org.eclipse.papyrus.emf.facet.query.java.core.IParameterValueList2; import org.eclipse.papyrusrt.umlrt.core.utils.ProtocolUtils; import org.eclipse.uml2.uml.Collaboration; +/** + * Query that returns <code>true</code> if the specified Collaboration is a Protocol. + */ public class IsProtocolQuery implements IJavaQuery2<Collaboration, Boolean> { - + + /** + * Constructor. + */ + public IsProtocolQuery() { + // empty constructor + } + /** * {@inheritDoc} */ - public Boolean evaluate(final Collaboration context, + @Override + public Boolean evaluate(final Collaboration context, final IParameterValueList2 parameterValues, final IFacetManager facetManager) throws DerivedTypedElementException { diff --git a/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.modelexplorer/src/org/eclipse/papyrusrt/umlrt/tooling/modelexplorer/queries/collaboration/HideCollapseLinksExceptDirectionQuery.java b/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.modelexplorer/src/org/eclipse/papyrusrt/umlrt/tooling/modelexplorer/queries/collaboration/HideCollapseLinksExceptDirectionQuery.java index 4aa3623e2..0380bbbc1 100644 --- a/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.modelexplorer/src/org/eclipse/papyrusrt/umlrt/tooling/modelexplorer/queries/collaboration/HideCollapseLinksExceptDirectionQuery.java +++ b/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.modelexplorer/src/org/eclipse/papyrusrt/umlrt/tooling/modelexplorer/queries/collaboration/HideCollapseLinksExceptDirectionQuery.java @@ -22,8 +22,23 @@ import org.eclipse.papyrus.emf.facet.query.java.core.IParameterValueList2; import org.eclipse.papyrusrt.umlrt.tooling.modelexplorer.utils.FacetUtils; import org.eclipse.uml2.uml.Collaboration; +/** + * Query that returns always false, except when the facet reference is comment/message in,out or inout. + */ public class HideCollapseLinksExceptDirectionQuery implements IJavaQuery2<Collaboration, Boolean> { - public Boolean evaluate(final Collaboration context, + + /** + * Constructor. + */ + public HideCollapseLinksExceptDirectionQuery() { + + } + + /** + * {@inheritDoc} + */ + @Override + public Boolean evaluate(final Collaboration context, final IParameterValueList2 parameterValues, final IFacetManager facetManager) throws DerivedTypedElementException { @@ -31,13 +46,15 @@ public class HideCollapseLinksExceptDirectionQuery implements IJavaQuery2<Collab ParameterValue parameterValue = parameterValues.getParameterValueByName("eStructuralFeature"); //$NON-NLS-1$ EStructuralFeature eStructuralFeature = (EStructuralFeature) parameterValue.getValue(); // the eStructure is a containmentReference or Facet Reference? + + boolean result = false; if (eStructuralFeature instanceof FacetReference) { String name = ((FacetReference) eStructuralFeature).getName(); // check facet name - if(FacetUtils.isMessageOrComment(name)) { - return true; + if (FacetUtils.isMessageOrComment(name)) { + result = true; } - } - return false; + } + return result; } } |
