Revision 38909 branches/v2_0_0_prep/frameworks/_fwAndami/src/org/gvsig/andami/actioninfo/impl/DefaultActionInfo.java
DefaultActionInfo.java | ||
---|---|---|
2 | 2 |
|
3 | 3 |
import java.awt.event.ActionEvent; |
4 | 4 |
import java.beans.PropertyChangeListener; |
5 |
import java.net.URL; |
|
5 | 6 |
import java.util.ArrayList; |
6 | 7 |
import java.util.Collection; |
7 | 8 |
import java.util.List; |
... | ... | |
17 | 18 |
import org.gvsig.andami.plugins.ExtensionHelper; |
18 | 19 |
import org.gvsig.andami.plugins.IExtension; |
19 | 20 |
import org.gvsig.andami.ui.mdiFrame.KeyMapping; |
21 |
import org.gvsig.tools.swing.api.ToolsSwingLocator; |
|
20 | 22 |
import org.gvsig.tools.swing.icontheme.IconTheme; |
23 |
|
|
24 |
import org.apache.commons.io.FilenameUtils; |
|
21 | 25 |
import org.slf4j.Logger; |
22 | 26 |
import org.slf4j.LoggerFactory; |
23 | 27 |
|
... | ... | |
50 | 54 |
this.tip = emptyToNull(tip); |
51 | 55 |
this.redirections = null; |
52 | 56 |
this.active = true; |
57 |
|
|
58 |
fixIcon(); |
|
53 | 59 |
} |
60 |
|
|
61 |
private void fixIcon() { |
|
62 |
if (iconName != null && (iconName.contains("/") || iconName.contains("."))) { |
|
63 |
// it's a file path |
|
64 |
String name = FilenameUtils.getBaseName(iconName); |
|
65 |
IconTheme iconTheme = ToolsSwingLocator.getIconThemeManager().getDefault(); |
|
66 |
URL resource = null; |
|
67 |
try { |
|
68 |
resource = this.extensionClass.getClassLoader().getResource(iconName); |
|
69 |
} catch (Exception e) { |
|
70 |
return; |
|
71 |
} |
|
72 |
if (resource == null) { |
|
73 |
return; |
|
74 |
} |
|
75 |
iconTheme.registerDefault(this.getPluginName(), "broken", name, null, resource); |
|
76 |
logger.info("Plugin " + this.getPluginName() + " contains icons out of icon theme (" + iconName + ")"); |
|
77 |
iconName = name; |
|
78 |
} |
|
79 |
} |
|
80 |
|
|
81 |
|
|
54 | 82 |
|
55 | 83 |
private String emptyToNull(String s) { |
56 | 84 |
if (s == null) { |
Also available in: Unified diff