Skip to main content
aboutsummaryrefslogtreecommitdiffstats
blob: 90ca9ef3a997ccd5107fdb9b0fd19c3d5b0375cf (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
/*****************************************************************************
 * Copyright (c) 2010 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:
 *  Remi Schnekenburger (CEA LIST) remi.schnekenburger@cea.fr - Initial API and implementation
 *****************************************************************************/
package org.eclipse.papyrus.properties.runtime.propertyeditor;

import org.eclipse.gmf.runtime.common.core.service.IOperation;
import org.eclipse.gmf.runtime.common.core.service.IProvider;
import org.eclipse.papyrus.properties.runtime.propertyeditor.descriptor.IPropertyEditorDescriptor;
import org.w3c.dom.Node;


/**
 * Operation that creates the descriptor for a given editor
 */
public class CreatePropertyEditorDescriptorOperation implements IOperation {

	/** configuration node for this operation */
	private Node editorNode;

	/** editor unique identifier */
	private String editorID;

	/**
	 * Creates a new CreatePropertyEditorDescriptorOperation.
	 * 
	 * @param editorID
	 *        the id of the editor to create
	 * @param editorNode
	 *        the configuration node for this editor descriptor
	 */
	public CreatePropertyEditorDescriptorOperation(String editorID, Node editorNode) {
		this.editorNode = editorNode;
		this.editorID = editorID;
	}

	/**
	 * {@inheritDoc}
	 */
	public IPropertyEditorDescriptor execute(IProvider provider) {
		if(provider instanceof PropertyEditorProvider) {
			return ((PropertyEditorProvider)provider).createPropertyEditorDescriptor(editorID, editorNode);
		}

		return null;
	}

	/**
	 * Returns the editor identifier
	 * 
	 * @return the editor identifier
	 */
	public String getEditorId() {
		return editorID;
	}

}

Back to the top