1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18 /***
19 * <p>Title: WSMO Studio</p>
20 * <p>Description: Semantic Web Service Editor</p>
21 * <p>Copyright: Copyright (c) 2004-2008</p>
22 * <p>Company: Ontotext Lab. / SIRMA </p>
23 */
24
25 package org.wsmostudio.bpmo.ui.actions;
26
27 import org.eclipse.jface.resource.ImageDescriptor;
28 import org.wsmostudio.bpmo.ui.editor.BpmoEditor;
29
30 public class ActionExtensionDescriptor {
31
32
33 private BpmoActionProvider factory;
34 private String actionID, label, tooltip;
35
36 private ImageDescriptor icon, disabledIcon;
37
38 @SuppressWarnings("unused")
39 private ActionExtensionDescriptor() {
40 }
41
42 public ActionExtensionDescriptor(String id, BpmoActionProvider _factory) {
43 this.actionID = id;
44 this.factory = _factory;
45 }
46
47 public void setLabel(String lab) {
48 this.label = lab;
49 }
50
51 public String getTooltipText() {
52 return this.tooltip;
53 }
54 public void setTooltipText(String tooltip) {
55 this.tooltip = tooltip;
56 }
57
58 public ImageDescriptor getIconDescriptor() {
59 return this.icon;
60 }
61 public void setIconDescriptor(ImageDescriptor imageDescr) {
62 this.icon = imageDescr;
63 }
64
65 public ImageDescriptor getDisabledIconDescriptor() {
66 return this.disabledIcon;
67 }
68 public void setDisabledIconDescriptor(ImageDescriptor imageDescr) {
69 this.disabledIcon = imageDescr;
70 }
71
72 public AbstractDiagramAction createAction(BpmoEditor editor) {
73
74 AbstractDiagramAction actionHandler = factory.createAction(editor);
75 actionHandler.setId(actionID);
76 actionHandler.setText(
77 (label != null && label.trim().length() >= 0) ? label : actionID);
78 if (tooltip != null
79 && tooltip.length() > 0) {
80 actionHandler.setToolTipText(tooltip);
81 }
82 if (icon != null) {
83 actionHandler.setImageDescriptor(icon);
84 }
85 if (disabledIcon != null) {
86 actionHandler.setDisabledImageDescriptor(disabledIcon);
87 }
88 return actionHandler;
89 }
90
91 }