Skip to main content
aboutsummaryrefslogtreecommitdiffstats
blob: b63a4b3d5103ab61ce6344865639bf4a09e7e2a1 (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
/*****************************************************************************
 * 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:
 *  Camille Letavernier (CEA LIST) camille.letavernier@cea.fr - Initial API and implementation
 *****************************************************************************/
package org.eclipse.papyrus.properties.customization.editor.actions;

import org.eclipse.emf.common.command.CompoundCommand;
import org.eclipse.emf.edit.command.CommandActionDelegate;
import org.eclipse.swt.graphics.Image;

/**
 * An EMF Compound Command with support for Images, Tooltip text and description
 * (From CommandActionDelegate)
 * The first sub-command should be a CommandActionDelegate
 * 
 * @author Camille Letavernier
 */
public class CompoundCommandActionDelegate extends CompoundCommand implements CommandActionDelegate {

	private Image image;

	/**
	 * Sets the Image for this command
	 * 
	 * @param image
	 *        The image to display on the command
	 */
	public void setImage(Image image) {
		this.image = image;
	}

	public Object getImage() {
		if(image == null)
			return ((CommandActionDelegate)getCommandList().get(0)).getImage();
		else
			return image;
	}

	public String getText() {
		return ((CommandActionDelegate)getCommandList().get(0)).getText();
	}

	public String getToolTipText() {
		return ((CommandActionDelegate)getCommandList().get(0)).getToolTipText();
	}

	@Override
	public String getDescription() {
		return ((CommandActionDelegate)getCommandList().get(0)).getDescription();
	}

}

Back to the top