1 /*
2 * Copyright 2004-2008 the Seasar Foundation and the Others.
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
13 * either express or implied. See the License for the specific language
14 * governing permissions and limitations under the License.
15 */
16 package org.seasar.uruma.rcp.configuration.elements;
17
18 import org.seasar.uruma.annotation.ConfigurationAttribute;
19 import org.seasar.uruma.component.jface.MenuItemComponent;
20 import org.seasar.uruma.rcp.configuration.ConfigurationElement;
21
22 /**
23 * <code>action</code> 要素のための {@link ConfigurationElement} です。<br />
24 *
25 * @author y-komori
26 * @see <a
27 * href="http://help.eclipse.org/help33/topic/org.eclipse.platform.doc.isv/reference/extension-points/org_eclipse_ui_actionSets.html">ActionSets</a>
28 */
29 public class ActionElement extends AbstractConfigurationElement {
30 /**
31 * 要素名です。<br />
32 */
33 public static final String ELEMENT_NAME = "action";
34
35 /**
36 * {@link ActionElement} を構築します。<br />
37 */
38 public ActionElement(final MenuItemComponent menuItem) {
39 super();
40 id = menuItem.getId();
41 label = menuItem.text;
42 icon = menuItem.image;
43 disabledIcon = menuItem.disabledImage;
44 hoverIcon = menuItem.hoverImage;
45 tooltip = menuItem.description;
46 }
47
48 /**
49 * ID です。<br />
50 */
51 @ConfigurationAttribute(required = true)
52 public String id;
53
54 /**
55 * 表示ラベルです。<br />
56 */
57 @ConfigurationAttribute(required = true)
58 public String label;
59
60 /**
61 * 関連付けられたコマンドの ID です。<br />
62 */
63 @ConfigurationAttribute
64 public String definitionId;
65
66 /**
67 * メニューバーの中のパスです。<br />
68 */
69 @ConfigurationAttribute
70 public String menubarPath;
71
72 /**
73 * ツールバーの中のパスです。<br />
74 */
75 @ConfigurationAttribute
76 public String toolbarPath;
77
78 /**
79 * アイコンのパスです。<br />
80 */
81 @ConfigurationAttribute
82 public String icon;
83
84 /**
85 * ディスエーブル時のアイコンのパスです。<br />
86 */
87 @ConfigurationAttribute
88 public String disabledIcon;
89
90 /**
91 * ホバー時のアイコンのパスです。<br />
92 */
93 @ConfigurationAttribute
94 public String hoverIcon;
95
96 /**
97 * ツールチップ表示内容です。<br />
98 */
99 @ConfigurationAttribute
100 public String tooltip;
101
102 /**
103 * ヘルプコンテクスト ID です。<br />
104 */
105 @ConfigurationAttribute
106 public String helpContextId;
107
108 /**
109 * アクションのスタイルです。<br />
110 * <code>push</code>、<code>radio</code>、<code>toggle</code>、<code>pulldown</code>
111 * のいずれかを指定します。<br />
112 * デフォルトは <code>push</code> です。<br />
113 */
114 @ConfigurationAttribute
115 public String style = "push";
116
117 /**
118 * {@link #style} 属性が <code>radio</code> または <code>toggle</code>
119 * の場合の初期状態です。<br />
120 */
121 @ConfigurationAttribute
122 public boolean state;
123
124 /**
125 * アクションに対応するクラス名です。<br />
126 */
127 @ConfigurationAttribute(name = "class")
128 public String clazz;
129
130 /**
131 * リターゲット・アクションにするかどうかを指定します。<br />
132 */
133 @ConfigurationAttribute
134 public boolean retarget;
135
136 /**
137 * {@link #retarget} 属性が <code>true</code> の場合に、ラベルの更新を許可するかどうかを指定します。<br />
138 */
139 @ConfigurationAttribute
140 public boolean allowLabelUpdate;
141
142 /**
143 * アクションを有効にするための条件を指定します。<br />
144 */
145 @ConfigurationAttribute
146 public String enablesFor;
147 }