root / branches / v2_0_0_prep / applications / appgvSIG / src / org / gvsig / app / extension / develtools / ActionsInfoDevelTool.java @ 38564
History | View | Annotate | Download (5.6 KB)
1 | 38564 | jjdelcerro | package org.gvsig.app.extension.develtools; |
---|---|---|---|
2 | |||
3 | import java.util.Iterator; |
||
4 | |||
5 | import org.gvsig.andami.PluginsLocator; |
||
6 | import org.gvsig.andami.actioninfo.ActionInfo; |
||
7 | import org.gvsig.tools.swing.api.windowmanager.WindowManager; |
||
8 | |||
9 | public class ActionsInfoDevelTool { |
||
10 | |||
11 | public void showActions() { |
||
12 | String html = this.getActionsInformation(); |
||
13 | InfoPanel.save2file("actionsinfo", html);
|
||
14 | InfoPanel.showPanel("Actions information", WindowManager.MODE.WINDOW, html);
|
||
15 | } |
||
16 | |||
17 | public String getActionsInformation() { |
||
18 | |||
19 | String previousPluginName = null; |
||
20 | |||
21 | String warning_open = "<b>"; |
||
22 | String warning_close = "</b>"; |
||
23 | |||
24 | String error_open = "<b><font color=\"red\">"; |
||
25 | String error_close = "</font></b>"; |
||
26 | |||
27 | StringBuffer buffer = new StringBuffer(); |
||
28 | |||
29 | buffer.append("<html>\n");
|
||
30 | buffer.append("<body>\n");
|
||
31 | buffer.append("<h2>Actions information </h2>\n");
|
||
32 | buffer.append("<br>\n");
|
||
33 | |||
34 | buffer.append("<table border=\"0\">\n");
|
||
35 | buffer.append(" <tr>\n");
|
||
36 | buffer.append(" <td>Plugin</td>\n");
|
||
37 | buffer.append(" <td>Extension</td>\n");
|
||
38 | buffer.append(" <td>Name</td>\n");
|
||
39 | buffer.append(" <td>Position</td>\n");
|
||
40 | buffer.append(" <td>Text</td>\n");
|
||
41 | buffer.append(" <td>Command</td>\n");
|
||
42 | buffer.append(" <td>Icon</td>\n");
|
||
43 | buffer.append(" <td>Tip</td>\n");
|
||
44 | buffer.append(" <td>Accelerator</td>\n");
|
||
45 | buffer.append(" </tr>\n");
|
||
46 | Iterator<ActionInfo> actions = PluginsLocator.getActionInfoManager().getActions();
|
||
47 | while (actions.hasNext()) {
|
||
48 | ActionInfo action = actions.next(); |
||
49 | if( previousPluginName!=null && !action.getPluginName().equals(previousPluginName) ) { |
||
50 | buffer |
||
51 | .append(" <tr>\n")
|
||
52 | .append(" <td colspan=\"9\"><hr></td>\n")
|
||
53 | .append(" </tr>\n");
|
||
54 | previousPluginName = action.getPluginName(); |
||
55 | } |
||
56 | buffer.append(" <tr valign=\"top\">\n");
|
||
57 | buffer.append(" <td>")
|
||
58 | .append(action.getPluginName()) |
||
59 | .append("</td>\n");
|
||
60 | buffer.append(" <td>")
|
||
61 | .append(action.getExtensionName()) |
||
62 | .append("</td>\n");
|
||
63 | if( action.getName().startsWith("anonymous__") ) { |
||
64 | buffer.append(" <td title=\"Missing action name, asigned one by default\">")
|
||
65 | .append(error_open) |
||
66 | .append(action.getName()) |
||
67 | .append(error_close) |
||
68 | .append("</td>\n");
|
||
69 | } else if( !action.getName().contains("-") ) { |
||
70 | buffer.append(" <td title=\"Name don't have recomended syntax\">")
|
||
71 | .append(warning_open) |
||
72 | .append(action.getName()) |
||
73 | .append(warning_close) |
||
74 | .append("</td>\n");
|
||
75 | } else {
|
||
76 | buffer.append(" <td>")
|
||
77 | .append(action.getName()) |
||
78 | .append("</td>\n");
|
||
79 | } |
||
80 | if( action.getPosition()<100000000 ) { |
||
81 | buffer.append(" <td title=\"Incorrect position\">")
|
||
82 | .append(error_open) |
||
83 | .append(action.getPosition()) |
||
84 | .append(error_close) |
||
85 | .append("</td>\n");
|
||
86 | } else {
|
||
87 | buffer.append(" <td>")
|
||
88 | .append(action.getPosition()) |
||
89 | .append("</td>\n");
|
||
90 | } |
||
91 | if( action.getLabel()==null ) { |
||
92 | buffer.append(" <td title=\"Missing label of action\">")
|
||
93 | .append(error_open) |
||
94 | .append("(missing)")
|
||
95 | .append(error_close) |
||
96 | .append("</td>\n");
|
||
97 | } else {
|
||
98 | buffer.append(" <td>")
|
||
99 | .append(action.getLabel()) |
||
100 | .append("</td>\n");
|
||
101 | } |
||
102 | if( action.getCommand()==null ) { |
||
103 | buffer.append(" <td title=\"Missing command of action\">")
|
||
104 | .append(error_open) |
||
105 | .append(action.getCommand()) |
||
106 | .append(error_close) |
||
107 | .append("</td>\n");
|
||
108 | |||
109 | } else if(!action.getCommand().contains("-") && !action.getCommand().equals(action.getName())) { |
||
110 | buffer.append(" <td title=\"Command don't have recomended syntax and differ fron action name\">")
|
||
111 | .append(warning_open) |
||
112 | .append(action.getCommand()) |
||
113 | .append(warning_close) |
||
114 | .append("</td>\n");
|
||
115 | |||
116 | } else if(!action.getCommand().contains("-") ) { |
||
117 | buffer.append(" <td title=\"Command don't have recomended syntax\">")
|
||
118 | .append(warning_open) |
||
119 | .append(action.getCommand()) |
||
120 | .append(warning_close) |
||
121 | .append("</td>\n");
|
||
122 | |||
123 | } else if(!action.getCommand().equals(action.getName())) { |
||
124 | buffer.append(" <td title=\"Command differ fron action name\">")
|
||
125 | .append(warning_open) |
||
126 | .append(action.getCommand()) |
||
127 | .append(warning_close) |
||
128 | .append("</td>\n");
|
||
129 | |||
130 | } else {
|
||
131 | buffer.append(" <td>")
|
||
132 | .append(action.getCommand()) |
||
133 | .append("</td>\n");
|
||
134 | } |
||
135 | if( action.getIconName()==null ) { |
||
136 | buffer.append(" <td title=\"Missing icon name\">")
|
||
137 | .append(error_open) |
||
138 | .append("(missing)")
|
||
139 | .append(error_close) |
||
140 | .append("</td>\n");
|
||
141 | } else if( action.getIcon()==null ) { |
||
142 | buffer.append(" <td title=\"Missing icon\">")
|
||
143 | .append(error_open) |
||
144 | .append(action.getIconName()) |
||
145 | .append(error_close) |
||
146 | .append("</td>\n");
|
||
147 | } else {
|
||
148 | buffer.append(" <td>")
|
||
149 | .append(action.getIconName()) |
||
150 | .append("</td>\n");
|
||
151 | } |
||
152 | if( action.getTooltip()==null ) { |
||
153 | buffer.append(" <td title=\"Missing tooltip\">")
|
||
154 | .append(error_open) |
||
155 | .append(action.getTooltip()) |
||
156 | .append(error_close) |
||
157 | .append("</td>\n");
|
||
158 | |||
159 | } else {
|
||
160 | buffer.append(" <td>")
|
||
161 | .append(action.getTooltip()) |
||
162 | .append("</td>\n");
|
||
163 | } |
||
164 | if( action.getAccelerator()!=null && action.getKeyStroke()==null ) { |
||
165 | buffer.append(" <td title=\"Incorrect syntax of the accelerator key\">")
|
||
166 | .append(error_open) |
||
167 | .append(action.getAccelerator()) |
||
168 | .append(error_close) |
||
169 | .append("</td>\n");
|
||
170 | |||
171 | } else {
|
||
172 | buffer.append(" <td>")
|
||
173 | .append(action.getAccelerator()) |
||
174 | .append("</td>\n");
|
||
175 | } |
||
176 | buffer.append(" </tr>\n");
|
||
177 | |||
178 | } |
||
179 | buffer.append("</table>\n");
|
||
180 | buffer.append("</body>\n");
|
||
181 | buffer.append("</html>\n");
|
||
182 | |||
183 | return buffer.toString();
|
||
184 | } |
||
185 | |||
186 | |||
187 | } |