diff --git a/ge/org.osate.ge/src/org/osate/ge/internal/ui/editor/AgeContentOutlinePage.java b/ge/org.osate.ge/src/org/osate/ge/internal/ui/editor/AgeContentOutlinePage.java index b6eeb861cbc..7f0e4afabbd 100644 --- a/ge/org.osate.ge/src/org/osate/ge/internal/ui/editor/AgeContentOutlinePage.java +++ b/ge/org.osate.ge/src/org/osate/ge/internal/ui/editor/AgeContentOutlinePage.java @@ -1,18 +1,18 @@ /** - * Copyright (c) 2004-2020 Carnegie Mellon University and others. (see Contributors file). + * Copyright (c) 2004-2020 Carnegie Mellon University and others. (see Contributors file). * All Rights Reserved. - * + * * NO WARRANTY. ALL MATERIAL IS FURNISHED ON AN "AS-IS" BASIS. CARNEGIE MELLON UNIVERSITY MAKES NO WARRANTIES OF ANY * KIND, EITHER EXPRESSED OR IMPLIED, AS TO ANY MATTER INCLUDING, BUT NOT LIMITED TO, WARRANTY OF FITNESS FOR PURPOSE * OR MERCHANTABILITY, EXCLUSIVITY, OR RESULTS OBTAINED FROM USE OF THE MATERIAL. CARNEGIE MELLON UNIVERSITY DOES NOT * MAKE ANY WARRANTY OF ANY KIND WITH RESPECT TO FREEDOM FROM PATENT, TRADEMARK, OR COPYRIGHT INFRINGEMENT. - * + * * This program and the accompanying materials are made available under the terms of the Eclipse Public License 2.0 * which is available at https://www.eclipse.org/legal/epl-2.0/ * SPDX-License-Identifier: EPL-2.0 - * + * * Created, in part, with funding and support from the United States Government. (see Acknowledgments file). - * + * * This program includes and/or can make use of certain third party source code, object code, documentation and other * files ("Third Party Software"). The Third Party Software that is used by this program is dependent upon your system * configuration. By using this program, You agree to comply with any and all relevant Third Party Software terms and @@ -247,7 +247,8 @@ public Object getBusinessObject() { return !children.stream() .map(AgeContentOutlinePage.this::getRelativeReferenceForElement) .anyMatch(childRef::equals); - }) + }).filter( + this::includeHiddenBusinessObjectContext) .forEachOrdered(children::add); } } else if (parent instanceof BusinessObjectContext) { @@ -256,6 +257,8 @@ public Object getBusinessObject() { // Add children which are hidden based on user preference if (showHiddenElementsAction.isChecked()) { getChildContextsFromProvider(parent, parent, childRef -> true) + .filter( + this::includeHiddenBusinessObjectContext) .forEachOrdered(children::add); } } @@ -266,6 +269,20 @@ public Object getBusinessObject() { return new BusinessObjectContext[0]; } + /** + * Filter returns whether a hidden business object context should be shown. This is implemented to be consistent with + * handling for diagram elements. + */ + private boolean includeHiddenBusinessObjectContext(final BusinessObjectContext boc) { + final Object bo = boc.getBusinessObject(); + if (bo instanceof EObject) { + return true; + } + + final Object boh = extService.getApplicableBusinessObjectHandler(bo); + return boh != null && bocHelper.getNameForUserInterface(boc, boh) != null; + } + /** * Creates a stream of business object contexts representing the children returned by the business object provider. * Such contexts do not have a valid isChildren() method.