Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLaurent Fasani2017-08-02 08:47:26 +0000
committerLaurent Fasani2017-08-04 15:47:13 +0000
commit9391bed56abe5f6397646087549bcc5570ed15e6 (patch)
treef818c21b34c3a19ce41db601c366c58d4b6639ac
parent1d84b063132e8896a141b730c8ad55081cf88ab6 (diff)
downloadorg.eclipse.sirius-9391bed56abe5f6397646087549bcc5570ed15e6.tar.gz
org.eclipse.sirius-9391bed56abe5f6397646087549bcc5570ed15e6.tar.xz
org.eclipse.sirius-9391bed56abe5f6397646087549bcc5570ed15e6.zip
[516669] Prevent DanglingRepFilter to load representation
Bug: 516669 Change-Id: I6b1046286e18c2e5dd70bc33888baa3e2fb77c11 Signed-off-by: Laurent Fasani <laurent.fasani@obeo.fr>
-rw-r--r--plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/tools/internal/views/common/navigator/filter/DanglingRepresentationCommonFilter.java27
1 files changed, 12 insertions, 15 deletions
diff --git a/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/tools/internal/views/common/navigator/filter/DanglingRepresentationCommonFilter.java b/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/tools/internal/views/common/navigator/filter/DanglingRepresentationCommonFilter.java
index 0ff0419075..b75d6cbb04 100644
--- a/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/tools/internal/views/common/navigator/filter/DanglingRepresentationCommonFilter.java
+++ b/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/tools/internal/views/common/navigator/filter/DanglingRepresentationCommonFilter.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2014, 2016 THALES GLOBAL SERVICES.
+ * Copyright (c) 2014, 2017 THALES GLOBAL SERVICES.
* 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
@@ -12,15 +12,15 @@ package org.eclipse.sirius.ui.tools.internal.views.common.navigator.filter;
import org.eclipse.jface.viewers.Viewer;
import org.eclipse.jface.viewers.ViewerFilter;
+import org.eclipse.sirius.business.api.query.DRepresentationDescriptorQuery;
import org.eclipse.sirius.business.api.query.DRepresentationQuery;
import org.eclipse.sirius.ui.tools.internal.views.common.item.RepresentationItemImpl;
import org.eclipse.sirius.viewpoint.DRepresentation;
import org.eclipse.sirius.viewpoint.DRepresentationDescriptor;
/**
- * Filter to allow the user to hide {@link RepresentationItemImpl} or
- * {@link DRepresentationDescriptor} if there is no target semantic element or
- * if this element no more belongs to a session.
+ * Filter to allow the user to hide {@link RepresentationItemImpl} or {@link DRepresentationDescriptor} if there is no
+ * target semantic element or if this element no more belongs to a session.
*
* @author mporhel
*
@@ -29,23 +29,20 @@ public class DanglingRepresentationCommonFilter extends ViewerFilter {
@Override
public boolean select(Viewer viewer, Object parentElement, Object element) {
- DRepresentation representation = null;
+ boolean select = true;
+ DRepresentationDescriptor repDesc = null;
if (element instanceof DRepresentation) {
- representation = (DRepresentation) element;
+ select = !new DRepresentationQuery((DRepresentation) element).isDanglingRepresentation();
} else if (element instanceof DRepresentationDescriptor) {
- representation = ((DRepresentationDescriptor) element).getRepresentation();
+ repDesc = (DRepresentationDescriptor) element;
} else if (element instanceof RepresentationItemImpl) {
- DRepresentationDescriptor repDesc = ((RepresentationItemImpl) element).getDRepresentationDescriptor();
- if (repDesc != null) {
- representation = repDesc.getRepresentation();
- }
+ repDesc = ((RepresentationItemImpl) element).getDRepresentationDescriptor();
}
- if (representation != null) {
- return !new DRepresentationQuery(representation).isDanglingRepresentation();
+ if (repDesc != null) {
+ select = !new DRepresentationDescriptorQuery(repDesc).isDangling();
}
- return true;
+ return select;
}
-
}

Back to the top