Skip to main content
aboutsummaryrefslogtreecommitdiffstats
blob: 5c925730610a5462b65abc25608c67c3f3fc736c (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
69
70
71
72
73
74
75
/*****************************************************************************
 * Copyright (c) 2012 CEA LIST.
 *
 * 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:
 *  Camille Letavernier (CEA LIST) camille.letavernier@cea.fr - Initial API and implementation
 *****************************************************************************/
package org.eclipse.papyrus.infra.gmfdiag.css.properties.databinding;

import java.util.Collection;

import org.eclipse.emf.common.command.Command;
import org.eclipse.emf.edit.domain.EditingDomain;
import org.eclipse.gmf.runtime.notation.View;
import org.eclipse.papyrus.infra.gmfdiag.common.databinding.custom.CustomEObjectStyleObservableList;

/**
 * An ObservableList for manipulating CSS StyleSheets in a Diagram. The styleSheets
 * are stored in the view's Resource, and added as a CustomStyle (GMF NamedStyle)
 * in the view. When the last reference to a CSS Stylesheet is removed, it is
 * removed from the view's resource.
 *
 * A Stylesheet will only be deleted if it is contained in the same resource as
 * the argument View (A Model B referencing a StyleSheet from a Model A cannot
 * delete it).
 *
 *
 * @author Camille Letavernier
 */
public class DiagramStyleSheetObservableList extends CustomEObjectStyleObservableList {

	public DiagramStyleSheetObservableList(View view, EditingDomain domain, String styleName) {
		super(view, domain, styleName);
	}

	@Override
	public Command getAddCommand(int index, Object value) {
		return new AddCSSStyleSheetCommand(domain, view, styleName, eClass, feature, value, index);
	}

	@Override
	public Command getAddCommand(Object value) {
		return new AddCSSStyleSheetCommand(domain, view, styleName, eClass, feature, value);
	}

	@Override
	public Command getAddAllCommand(Collection<?> values) {
		return new AddAllCSSStyleSheetCommand(domain, view, styleName, eClass, feature, values);
	}

	@Override
	public Command getAddAllCommand(int index, Collection<?> values) {
		return new AddAllCSSStyleSheetCommand(domain, view, styleName, eClass, feature, values, index);
	}

	@Override
	public Command getRemoveCommand(Object value) {
		return new RemoveCSSStyleSheetCommand(domain, view, styleName, eClass, feature, value);
	}

	@Override
	public Command getRemoveAllCommand(Collection<?> values) {
		return new RemoveAllCSSStyleSheetValueCommand(domain, view, styleName, eClass, feature, values);
	}

	@Override
	public Command getSetCommand(int index, Object value) {
		return new SetCSSStyleSheetCommand(domain, view, styleName, eClass, feature, index, value);
	}

}

Back to the top