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.eclipse.ui.IViewPart;
19 import org.seasar.uruma.annotation.ConfigurationAttribute;
20 import org.seasar.uruma.component.rcp.ViewPartComponent;
21 import org.seasar.uruma.core.UrumaConstants;
22 import org.seasar.uruma.rcp.configuration.ConfigurationElement;
23
24 /**
25 * <code>view</code> 要素のための {@link ConfigurationElement} です。<br />
26 *
27 * @author y-komori <a
28 * href="http://help.eclipse.org/help33/topic/org.eclipse.platform.doc.isv/reference/extension-points/org_eclipse_ui_views.html#e.view">view</a>
29 */
30 public class ViewElement extends AbstractConfigurationElement implements
31 UrumaConstants {
32
33 /**
34 * 要素名です。<br />
35 */
36 public static final String ELEMENT_NAME = "view";
37
38 /**
39 * {@link ViewElement} を構築します。<br />
40 */
41 public ViewElement() {
42 super();
43 }
44
45 /**
46 * {@link ViewPartComponent} を元にして {@link ViewElement} を構築します。<br />
47 *
48 * @param component
49 * {@link ViewPartComponent} オブジェクト
50 */
51 public ViewElement(final ViewPartComponent component) {
52 super();
53 this.id = createRcpId(component.getId());
54 this.name = component.title;
55 this.category = component.category;
56 this.clazz = component.clazz;
57 this.icon = component.image;
58 this.allowMultiple = Boolean.parseBoolean(component.allowMultiple);
59 }
60
61 /**
62 * ビューの ID です。<br />
63 */
64 @ConfigurationAttribute(required = true)
65 public String id;
66
67 /**
68 * ビューの名称です。<br />
69 */
70 @ConfigurationAttribute(required = true)
71 public String name;
72
73 /**
74 * ビューのカテゴリ名称です。<br />
75 */
76 @ConfigurationAttribute
77 public String category;
78
79 /**
80 * {@link IViewPart} 実装クラスのフルネームです。<br />
81 */
82 @ConfigurationAttribute(name = "class", required = true)
83 public String clazz;
84
85 /**
86 * アイコンのパスです。<br />
87 */
88 @ConfigurationAttribute
89 public String icon;
90
91 /**
92 * 高速ビュー表示時の表示割合です。<br />
93 */
94 @ConfigurationAttribute
95 public String fastViewWidthRatio;
96
97 /**
98 * ビューの複数表示を許可するかどうかのフラグです。<br />
99 */
100 @ConfigurationAttribute
101 public boolean allowMultiple;
102
103 /*
104 * @see java.lang.Object#toString()
105 */
106 @Override
107 public String toString() {
108 return name + " : " + id;
109 }
110 }