blob: be1f6b6a51152ca98c13aca6ac333defd97de954 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
|
/*******************************************************************************
* Copyright (c) 2010 THALES GLOBAL SERVICES.
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
* which accompanies this distribution, and is available at
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* Obeo - initial API and implementation
*******************************************************************************/
package org.eclipse.sirius.diagram.ui.tools.internal.palette;
import java.util.HashSet;
import java.util.Set;
import org.eclipse.gef.palette.PaletteStack;
import org.eclipse.sirius.common.tools.api.util.EqualityHelper;
import org.eclipse.sirius.diagram.description.Layer;
/**
* A palette drawer associated to a section.
*
* @author mchauvin
*/
public class ToolGroupPaletteStack extends PaletteStack implements ILayerContributionRegister {
private Set<Layer> contributingLayers = new HashSet<Layer>();
/**
* Construct a new palette stack.
*
* @param name
* the name
*/
public ToolGroupPaletteStack(final String name) {
super(name, null, null);
}
/**
* {@inheritDoc}
*
* @see org.eclipse.sirius.diagram.tools.internal.palette.ILayerContributionRegister#addLayer(org.eclipse.sirius.viewpoint.description.Layer)
*/
public void addLayer(final Layer layer) {
if (!EqualityHelper.contains(contributingLayers, layer)) {
contributingLayers.add(layer);
}
}
/**
* {@inheritDoc}
*
* @see org.eclipse.sirius.diagram.tools.internal.palette.ILayerContributionRegister#removeLayer(org.eclipse.sirius.viewpoint.description.Layer)
*/
public void removeLayer(final Layer layer) {
EqualityHelper.remove(contributingLayers, layer);
}
/**
* {@inheritDoc}
*
* @see org.eclipse.sirius.diagram.tools.internal.palette.ILayerContributionRegister#isEmptyOfContributors()
*/
public boolean isEmptyOfContributors() {
return contributingLayers.isEmpty();
}
}
|