Revision 38763

View differences:

branches/v2_0_0_prep/applications/appgvSIG/config/config.xml
760 760
        accelerator=""
761 761
        />
762 762
      <action 
763
        name="tools-devel-show-plugin-report"
764
        label="_Show_plugin_report" 
765
        tooltip="_Show_plugin_report_of_actions_menus_and_icons" 
766
        position="908500100" 
767
        action-command="tools-devel-show-plugin-report"
768
        icon="tools-devel-show-plugin-report"
769
        accelerator=""
770
        />
771
      <action 
763 772
        name="tools-devel-show-menus"
764 773
        label="_Show_menu_information" 
765 774
        tooltip="_Show_menu_information" 
......
786 795
        text="tools/Development/Show icon theme information" 
787 796
        />
788 797
      <menu 
798
        name="tools-devel-show-plugin-report"
799
        text="tools/Development/Show plugin report of actions menus and icons" 
800
        />
801
      <menu 
789 802
        name="tools-devel-show-actions"
790 803
        text="tools/Development/Show actions information" 
791 804
        />
branches/v2_0_0_prep/applications/appgvSIG/src/org/gvsig/app/extension/develtools/MenusDevelTool.java
1 1
package org.gvsig.app.extension.develtools;
2 2

  
3
import java.util.ArrayList;
3 4
import java.util.Collections;
4 5
import java.util.Comparator;
5 6
import java.util.List;
......
11 12

  
12 13
public class MenusDevelTool {
13 14
	public void showAllMenus() {
14
		String html = this.getAllMenus();
15
		InfoPanel.save2file("menusinfo", html);
15
		String html = "<html>\n<body>\n"+ this.getAllMenus()+"</body>\n</html>\n";
16
		InfoPanel.save2file("menus-report", html);
16 17
		InfoPanel.showPanel("Menu information", WindowManager.MODE.WINDOW, html);
17 18
	}
18 19
	public void showAllMenusByPlugin() {
19
		String html = this.getAllMenusByPlugin();
20
		InfoPanel.save2file("menusbyplugininfo", html);
20
		String html = "<html>\n<body>\n"+ this.getAllMenusByPlugin()+"</body>\n</html>\n";
21
		InfoPanel.save2file("menus-report-sorted-by-plugin", html);
21 22
		InfoPanel.showPanel("Menu by plugin information", WindowManager.MODE.WINDOW, html);
22 23
	}
23 24
	
......
28 29
		return this.getAllMenus(menuItems);
29 30
	}
30 31
	
32
	public String getMenusOfPlugin(String pluginName) {
33
		Launcher launcher = Launcher.getInstance();
34
		List<PluginMenuItem> menuItems = launcher.getPluginMenuItems();
35
		List<PluginMenuItem> pluginMenus = new ArrayList<Launcher.PluginMenuItem>();
36
		
37
		for (PluginMenuItem pluginMenuItem : menuItems) {
38
			if( pluginName.equalsIgnoreCase(pluginMenuItem.getPluginName())) {
39
				pluginMenus.add(pluginMenuItem);
40
			}
41
		}
42
		if( pluginMenus.isEmpty() ) {
43
			return "";
44
		}
45
		return this.getAllMenus(pluginMenus);
46
	}
47
	
48

  
31 49
	public String getAllMenusByPlugin() {
32 50
		Launcher launcher = Launcher.getInstance();
33 51
		List<PluginMenuItem> menuItems = launcher.getPluginMenuItems();
......
51 69
		String error_open = "<b><font color=\"red\">";
52 70
		String error_close = "</font></b>";
53 71
		
54
		buffer.append("<html>\n");
55
		buffer.append("<body>\n");
72
		buffer.append("<div>\n");
56 73
		buffer.append("<h2>Menu information </h2>\n");
57 74
		buffer.append("<br>\n");
58 75
		
......
111 128
			buffer.append("  </tr>\n");
112 129
		}
113 130
		buffer.append("</table>\n");
114
		buffer.append("</body>\n");
115
		buffer.append("</html>\n");
131
		buffer.append("</div>\n");
116 132

  
117 133
		return buffer.toString();
118 134
	}
branches/v2_0_0_prep/applications/appgvSIG/src/org/gvsig/app/extension/develtools/IconThemeDevelTool.java
20 20
public class IconThemeDevelTool {
21 21

  
22 22
	public void showDefaultIconTheme() {
23
		String html = this.getIconThemeInformationByGroup();
24
		InfoPanel.save2file("iconthemeinfo", html);
23
		String html = "<html>\n<body>\n"+ this.getIconThemeInformationByGroup()+"</body>\n</html>\n";
24
		InfoPanel.save2file("icontheme-report", html);
25 25
		InfoPanel.showPanel("Icon theme information", WindowManager.MODE.WINDOW, html);
26 26
	}
27 27

  
28 28
	public void showDefaultIconThemeByPlugin() {
29
		String html = this.getIconThemeInformationByPlugin();
30
		InfoPanel.save2file("iconthemeinfo", html);
29
		String html = "<html>\n<body>\n"+ this.getIconThemeInformationByPlugin()+"</body>\n</html>\n";
30
		InfoPanel.save2file("icontheme-report", html);
31 31
		InfoPanel.showPanel("Icon theme information", WindowManager.MODE.WINDOW, html);
32 32
	}
33 33

  
......
51 51
		return getIconThemeInformation(theme, themeIconsIt);
52 52
	}
53 53
	
54
	public String getIconThemeInformationOfPlugin(String pluginName) {
55
		if( pluginName == null ) {
56
			return "";
57
		}
58
		IconThemeManager manager = ToolsSwingLocator.getIconThemeManager();
59
		IconTheme theme = manager.getDefault();
60
		
61
		List<IconTheme.Icon>themeIcons = new ArrayList<IconTheme.Icon>();
62
		Iterator<IconTheme.Icon> themeIconsIt = theme.getThemeIcons();
63
		while (themeIconsIt.hasNext()) {
64
			IconTheme.Icon iconTheme = (IconTheme.Icon) themeIconsIt.next();
65
			if( !pluginName.equalsIgnoreCase(iconTheme.getProviderName()) ) {
66
				continue;
67
			}
68
			themeIcons.add(iconTheme);
69
		}
70
		Collections.sort(themeIcons, new Comparator<IconTheme.Icon>() {
71
			public int compare(IconTheme.Icon o1, IconTheme.Icon o2) {
72
				String s1 = String.format("%s:%s:%s", o1.getProviderName(), o1.getGroup(), o1.getName());
73
				String s2 = String.format("%s:%s:%s", o2.getProviderName(), o2.getGroup(), o2.getName());
74
				return s1.compareTo(s2);
75
			}
76
		});
77
		themeIconsIt = themeIcons.iterator();
78
		return getIconThemeInformation(theme, themeIconsIt);
79
	}
80
	
54 81
	private String getIconThemeInformationByGroup() {
55 82
		IconThemeManager manager = ToolsSwingLocator.getIconThemeManager();
56 83
		IconTheme theme = manager.getDefault();
......
95 122
		
96 123
		String previousPluginName = null;
97 124

  
98
		buffer.append("<html>\n");
99
		buffer.append("<body>\n");
125
		buffer.append("<div>\n");
100 126
		buffer.append("<h2>Icon theme information</h2>\n");
101 127
		buffer.append("<br>\n");
102 128
		buffer.append("Theme: ");
......
111 137
		buffer.append("    <td>Preview</td>\n");
112 138
		buffer.append("    <td>Group</td>\n");
113 139
		buffer.append("    <td>Name</td>\n");
114
		buffer.append("    <td>Plugin</td>\n");
140
		buffer.append("    <td>Provider/Plugin</td>\n");
115 141
		buffer.append("    <td>Resource</td>\n");
116 142
		buffer.append("  </tr>\n");
117 143
		
......
230 256
			buffer.append("  </tr>\n");
231 257
		}
232 258
		buffer.append("</table>\n");
233
		buffer.append("</body>\n");
234
		buffer.append("</html>\n");
259
		buffer.append("</div>\n");
235 260

  
236 261
		return buffer.toString();
237 262
	}
branches/v2_0_0_prep/applications/appgvSIG/src/org/gvsig/app/extension/develtools/ActionsInfoDevelTool.java
4 4

  
5 5
import org.gvsig.andami.PluginsLocator;
6 6
import org.gvsig.andami.actioninfo.ActionInfo;
7
import org.gvsig.app.ApplicationLocator;
8
import org.gvsig.app.ApplicationManager;
7 9
import org.gvsig.tools.swing.api.windowmanager.WindowManager;
8 10

  
9 11
public class ActionsInfoDevelTool {
10 12

  
11 13
	public void showActions() {
12
		String html = this.getActionsInformation();
13
		InfoPanel.save2file("actionsinfo", html);
14
		String html = "<html>\n<body>\n"+ this.getActionsInformation(null)+"</body>\n</html>\n";
15
		
16
		InfoPanel.save2file("actions-report", html);
14 17
		InfoPanel.showPanel("Actions information", WindowManager.MODE.WINDOW, html);
15 18
	}
19

  
20
	public void showReportOfPlugin() {
21
		ApplicationManager application = ApplicationLocator.getManager();
22
		String pluginName = null;
23
		
24
		pluginName = application.inputDialog("Introduzca el nombre del plugin del que desea el informe", "Plugin actions report");
25
		if( pluginName == null ) {
26
			return;
27
		}
28
		String actionsHtml = this.getActionsInformation(pluginName);
29
		String menusHtml = new MenusDevelTool().getMenusOfPlugin(pluginName);
30
		String iconsHtml = new IconThemeDevelTool().getIconThemeInformationOfPlugin(pluginName);
31
		
32
		String html = "<html>\n<body>\n"+actionsHtml+"<br>"+menusHtml+"<br>"+iconsHtml+"</body>\n</html>\n";
33
		
34
		InfoPanel.save2file("plugin-report", html);
35
		InfoPanel.showPanel("Plugin report", WindowManager.MODE.WINDOW, html);
36
	}
37

  
16 38
	
17
	public String getActionsInformation() {
39
	
40
	public String getActionsInformation(String pluginName) {
18 41
		
19 42
		String previousPluginName = null;
20 43
		
......
28 51

  
29 52
		buffer.append("<html>\n");
30 53
		buffer.append("<body>\n");
54
		
55
		buffer.append("<div>\n");
31 56
		buffer.append("<h2>Actions information </h2>\n");
32 57
		buffer.append("<br>\n");
33 58

  
......
46 71
		Iterator<ActionInfo> actions = PluginsLocator.getActionInfoManager().getActions(); 
47 72
		while (actions.hasNext()) {
48 73
			ActionInfo action = actions.next();
74
			if( pluginName!=null && !pluginName.equalsIgnoreCase(action.getPluginName()) ) {
75
				continue;
76
			}
49 77
			if( previousPluginName!=null && !action.getPluginName().equals(previousPluginName) ) {
50 78
				buffer
51 79
					.append("  <tr>\n")
......
177 205
			
178 206
		}
179 207
		buffer.append("</table>\n");
180
		buffer.append("</body>\n");
181
		buffer.append("</html>\n");
208
		buffer.append("</div>\n");
182 209

  
183 210
		return buffer.toString();
184 211
	}
branches/v2_0_0_prep/applications/appgvSIG/src/org/gvsig/app/extension/develtools/InfoPanel.java
42 42
	public static void save2file(String name, String contents) {
43 43
		File file;
44 44
		try {
45
			file = File.createTempFile("gvsig-" + name, ".html");
45
			file = File.createTempFile("gvsig-" + name + "-", ".html");
46 46
			FileWriter fwriter = new FileWriter(file);
47 47
			fwriter.append(contents);
48 48
			fwriter.close();
branches/v2_0_0_prep/applications/appgvSIG/src/org/gvsig/app/extension/ShowDevelInfoExtension.java
51 51
			new MenusDevelTool().showAllMenus();
52 52
		} else if ("tools-devel-show-menus-by-plugin".equalsIgnoreCase(actionCommand)) {
53 53
			new MenusDevelTool().showAllMenusByPlugin();
54
		} else if ("tools-devel-show-plugin-report".equalsIgnoreCase(actionCommand)) {
55
			new ActionsInfoDevelTool().showReportOfPlugin();
54 56
		}
55 57
	}
56 58

  

Also available in: Unified diff