Skip to main content
aboutsummaryrefslogtreecommitdiffstats
blob: 35187f16e4675042dccf55e142f38fe08517bcbd (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
/*****************************************************************************
 * Copyright (c) 2014 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:
 *	Gabriel Pascual (ALL4TEC) gabriel.pascual@all4tec.net - Initial API and implementation
 *****************************************************************************/
package org.eclipse.papyrus.infra.gmfdiag.css.properties.creation;

import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.EReference;
import org.eclipse.emf.ecore.util.EcoreUtil;
import org.eclipse.papyrus.infra.gmfdiag.css.stylesheets.Theme;
import org.eclipse.papyrus.infra.properties.ui.creation.EcorePropertyEditorFactory;
import org.eclipse.swt.widgets.Control;


/**
 * Editor factor for workspace theme.
 *
 * @author gpascual
 *
 */
public class ThemePropertyEditorFactory extends EcorePropertyEditorFactory {

	/**
	 * Default constructor.
	 *
	 * @param referenceIn
	 */
	public ThemePropertyEditorFactory(EReference referenceIn) {
		super(referenceIn);
	}


	/**
	 * @see org.eclipse.papyrus.infra.properties.ui.creation.EcorePropertyEditorFactory#simpleCreateObject(org.eclipse.swt.widgets.Control)
	 *
	 * @param widget
	 * @return
	 */
	@Override
	protected EObject simpleCreateObject(Control widget) {
		EObject createdObject = super.simpleCreateObject(widget);

		// Generate an unique ID for created theme
		if (createdObject instanceof Theme) {
			((Theme) createdObject).setId(EcoreUtil.generateUUID());
		}

		return createdObject;
	}

}

Back to the top