diff options
| author | lfasani | 2017-10-12 15:35:14 +0000 |
|---|---|---|
| committer | Laurent Redor | 2017-10-26 10:45:56 +0000 |
| commit | a4e0636395b159e7dd2fa6c8a8d2c727f2a2eff1 (patch) | |
| tree | 75a2f98f03275662242113b70e9711d207af976f | |
| parent | cb7e63dd771eeb24851f83a4b98fcd6698ee50fc (diff) | |
| download | org.eclipse.sirius-a4e0636395b159e7dd2fa6c8a8d2c727f2a2eff1.tar.gz org.eclipse.sirius-a4e0636395b159e7dd2fa6c8a8d2c727f2a2eff1.tar.xz org.eclipse.sirius-a4e0636395b159e7dd2fa6c8a8d2c727f2a2eff1.zip | |
[525933] Fix palette content with transient layer active by default
Bug: 525933
Change-Id: I57c10c333666b0a65c51281ac32b8a41eda311dd
Signed-off-by: lfasani <laurent.fasani@obeo.fr>
Signed-off-by: Laurent Redor <laurent.redor@obeo.fr>
4 files changed, 35 insertions, 6 deletions
diff --git a/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/tools/internal/palette/PaletteManagerImpl.java b/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/tools/internal/palette/PaletteManagerImpl.java index c5bc8f1739..5b563033dc 100644 --- a/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/tools/internal/palette/PaletteManagerImpl.java +++ b/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/tools/internal/palette/PaletteManagerImpl.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2010, 2016 THALES GLOBAL SERVICES and others. + * Copyright (c) 2010, 2017 THALES GLOBAL SERVICES 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 @@ -56,6 +56,7 @@ import org.eclipse.sirius.diagram.DiagramPlugin; import org.eclipse.sirius.diagram.business.api.componentization.DiagramComponentizationManager; import org.eclipse.sirius.diagram.business.api.helper.SiriusDiagramUtil; import org.eclipse.sirius.diagram.business.api.helper.layers.LayerService; +import org.eclipse.sirius.diagram.business.api.query.DDiagramQuery; import org.eclipse.sirius.diagram.description.DiagramDescription; import org.eclipse.sirius.diagram.description.Layer; import org.eclipse.sirius.diagram.description.tool.ContainerCreationDescription; @@ -319,7 +320,7 @@ public class PaletteManagerImpl implements PaletteManager { HashSet<Layer> layersInActivatedViewpoints = new HashSet<Layer>(new DiagramComponentizationManager().getAllLayers(session.getSelectedViewpoints(false), description)); // Copy of diagram activated layers (in all Viewpoints: activated or // not) - HashSet<Layer> activatedLayers = new HashSet<Layer>(dDiagram.getActivatedLayers()); + Set<Layer> activatedLayers = new HashSet<Layer>(new DDiagramQuery(dDiagram).getAllActivatedLayers()); // Get the list of activated layers (of selected viewpoints) final List<Layer> activatedLayersOfSelectedViewpoints = Lists.newArrayList(Sets.intersection(layersInActivatedViewpoints, activatedLayers)); // Get the list of deactivated layers (deactivated layers of selected diff --git a/plugins/org.eclipse.sirius.diagram/src-core/org/eclipse/sirius/diagram/business/api/query/DDiagramQuery.java b/plugins/org.eclipse.sirius.diagram/src-core/org/eclipse/sirius/diagram/business/api/query/DDiagramQuery.java index 6495e1ec72..20c0812744 100644 --- a/plugins/org.eclipse.sirius.diagram/src-core/org/eclipse/sirius/diagram/business/api/query/DDiagramQuery.java +++ b/plugins/org.eclipse.sirius.diagram/src-core/org/eclipse/sirius/diagram/business/api/query/DDiagramQuery.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2007, 2010 THALES GLOBAL SERVICES. + * Copyright (c) 2007, 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 @@ -10,7 +10,9 @@ *******************************************************************************/ package org.eclipse.sirius.diagram.business.api.query; +import java.util.ArrayList; import java.util.Collection; +import java.util.List; import java.util.Set; import org.eclipse.sirius.business.api.query.DRepresentationQuery; @@ -23,6 +25,7 @@ import org.eclipse.sirius.diagram.business.api.componentization.DiagramMappingsM import org.eclipse.sirius.diagram.business.api.componentization.DiagramMappingsManagerRegistry; import org.eclipse.sirius.diagram.business.internal.metamodel.helper.LayerHelper; import org.eclipse.sirius.diagram.business.internal.query.DDiagramInternalQuery; +import org.eclipse.sirius.diagram.description.Layer; import com.google.common.collect.Sets; @@ -123,4 +126,15 @@ public class DDiagramQuery extends DRepresentationQuery { return !(dDiagram == null) && !(dDiagram.getHiddenElements() == null) && !dDiagram.getHiddenElements().isEmpty(); } + /** + * Returns all the activated layers (transient or not) of the given diagram. + * + * @return all the activated layers (transient or not) of the given diagram. + */ + public List<Layer> getAllActivatedLayers() { + final List<Layer> activatedLayers = new ArrayList<Layer>(); + activatedLayers.addAll(dDiagram.getActivatedLayers()); + activatedLayers.addAll(dDiagram.getActivatedTransientLayers()); + return activatedLayers; + } } diff --git a/plugins/org.eclipse.sirius.doc/doc/Release_Notes.html b/plugins/org.eclipse.sirius.doc/doc/Release_Notes.html index f910602ba9..8dc908978e 100644 --- a/plugins/org.eclipse.sirius.doc/doc/Release_Notes.html +++ b/plugins/org.eclipse.sirius.doc/doc/Release_Notes.html @@ -299,6 +299,16 @@ <code>getFilesFromWorkspace(Collection<IContainer>, String)</code> to be more generic. </li> </ul> + <h4 id="Changesinorg.eclipse.sirius.diagram">Changes in + <code>org.eclipse.sirius.diagram</code> + </h4> + <ul> + <li><span class="label label-success">Added</span> A new query has been added in + <code>org.eclipse.sirius.diagram.business.api.query.DDiagramQuery</code>. This query, + <code>getAllActivatedLayers</code>, returns all the activated layers (transient or not) of the given diagram. It should replace + <code>DDiagram.getActivatedLayers</code> in several cases if you directly use it. + </li> + </ul> <h4 id="Changesinorg.eclipse.sirius.diagram.ui">Changes in <code>org.eclipse.sirius.diagram.ui</code> </h4> @@ -753,7 +763,7 @@ <em>Model Request Interpreter</em> view is still present if needed during the transition, but not exposed or used anywhere. It will be removed in a future version. </li> </ul> - <h4 id="Changesinorg.eclipse.sirius.diagram">Changes in + <h4 id="Changesinorg.eclipse.sirius.diagram2">Changes in <code>org.eclipse.sirius.diagram</code> </h4> <ul> @@ -1361,7 +1371,7 @@ SWTBotUtils.waitAllUiEvents(); <code>HierarchyLabelProvider</code>. </li> </ul> - <h4 id="Changesinorg.eclipse.sirius.diagram2">Changes in + <h4 id="Changesinorg.eclipse.sirius.diagram3">Changes in <code>org.eclipse.sirius.diagram</code> </h4> <ul> @@ -1785,7 +1795,7 @@ SWTBotUtils.waitAllUiEvents(); <code>org.eclipse.sirius.common.tools.api.interpreter.IInterpreterStatus</code> to reflect all kind of language validation severity (of AQL for example). </li> </ul> - <h4 id="Changesinorg.eclipse.sirius.diagram3">Changes in + <h4 id="Changesinorg.eclipse.sirius.diagram4">Changes in <code>org.eclipse.sirius.diagram</code> </h4> <ul> diff --git a/plugins/org.eclipse.sirius.doc/doc/Release_Notes.textile b/plugins/org.eclipse.sirius.doc/doc/Release_Notes.textile index 8fc77f9bdd..7fe5cb729a 100644 --- a/plugins/org.eclipse.sirius.doc/doc/Release_Notes.textile +++ b/plugins/org.eclipse.sirius.doc/doc/Release_Notes.textile @@ -79,6 +79,10 @@ h4. Changes in @org.eclipse.sirius.common@ * <span class="label label-success">Added</span> @org.eclipse.sirius.common.tools.api.util.LazyCrossReferencer.setEObjectToBeIgnored(Predicate<EObject>)@ has been added to filter inverse references to prevent some references resolution. * <span class="label label-info">Modified</span> @org.eclipse.sirius.common.tools.api.util.WorkspaceUtil.getFilesFromWorkspace(Collection<IProject>, String)@ signature has been modified in @getFilesFromWorkspace(Collection<IContainer>, String)@ to be more generic. +h4. Changes in @org.eclipse.sirius.diagram@ + +* <span class="label label-success">Added</span> A new query has been added in @org.eclipse.sirius.diagram.business.api.query.DDiagramQuery@. This query, @getAllActivatedLayers@, returns all the activated layers (transient or not) of the given diagram. It should replace @DDiagram.getActivatedLayers@ in several cases if you directly use it. + h4. Changes in @org.eclipse.sirius.diagram.ui@ * <span class="label label-success">Added</span> Three new preferences have been added to @org.eclipse.sirius.diagram.ui.tools.api.preferences.SiriusDiagramUiPreferencesKeys@: @PREF_SCALE_DIAGRAMS_ON_EXPORT@, @PREF_MAXIMUM_EXPORT_BUFFER_SIZE@, @PREF_MAXIMUM_EXPORT_BUFFER_SIZE_WINDOWS@. They are used to control the auto-scaling behavior when exporting diagrams. Refer to the JavaDoc for the details. |
