Revision 41334
trunk/org.gvsig.desktop/org.gvsig.desktop.framework/org.gvsig.andami/src/main/java/org/gvsig/andami/ui/mdiFrame/MDIFrame.java | ||
---|---|---|
74 | 74 |
import org.gvsig.andami.Launcher; |
75 | 75 |
import org.gvsig.andami.PluginServices; |
76 | 76 |
import org.gvsig.andami.PluginsLocator; |
77 |
import org.gvsig.andami.PluginsManager; |
|
77 | 78 |
import org.gvsig.andami.actioninfo.ActionInfo; |
78 | 79 |
import org.gvsig.andami.actioninfo.ActionInfoManager; |
79 | 80 |
import org.gvsig.andami.actioninfo.ActionInfoStatusCache; |
... | ... | |
203 | 204 |
|
204 | 205 |
private static final String noIcon = "no-icon"; |
205 | 206 |
|
207 |
private Map<JComponent,IExtension> control2extensions = new HashMap<JComponent, IExtension>(); |
|
208 |
|
|
206 | 209 |
private MDIFrame() { |
207 | 210 |
|
208 | 211 |
} |
... | ... | |
1139 | 1142 |
|
1140 | 1143 |
while ( e.hasNext() ) { |
1141 | 1144 |
JComponent control = (JComponent) e.next(); |
1142 |
String actionlName = control.getName();
|
|
1143 |
ActionInfo action = actionManager.getAction(actionlName);
|
|
1145 |
String actionName = control.getName(); |
|
1146 |
ActionInfo action = actionManager.getAction(actionName); |
|
1144 | 1147 |
try { |
1145 | 1148 |
boolean enabled = false; |
1146 | 1149 |
boolean visible = false; |
1147 | 1150 |
|
1148 | 1151 |
if ( action == null ) { |
1149 |
enabled = true; |
|
1150 |
visible = true; |
|
1152 |
if( control instanceof JMenuTraslatable ) { |
|
1153 |
enabled = true; |
|
1154 |
visible = true; |
|
1155 |
} else { |
|
1156 |
IExtension extension = this.control2extensions.get(control); |
|
1157 |
if( extension!=null ) { |
|
1158 |
enabled = extension.isEnabled(); |
|
1159 |
visible = extension.isVisible(); |
|
1160 |
} else { |
|
1161 |
logger.warn("Can't enable/show control '"+control.getClass().getName()+"/"+control.getName()+"."); |
|
1162 |
enabled = true; |
|
1163 |
visible = true; |
|
1164 |
} |
|
1165 |
} |
|
1151 | 1166 |
} else { |
1152 | 1167 |
enabled = false; |
1153 | 1168 |
visible = cache.isVisible(action); |
... | ... | |
1158 | 1173 |
control.setEnabled(enabled); |
1159 | 1174 |
control.setVisible(visible); |
1160 | 1175 |
} catch (Exception ex) { |
1161 |
logger.info("Can't enable/show control '" + actionlName + "'.", ex);
|
|
1162 |
this.message("Can't enable/show control '" + actionlName + "'.", JOptionPane.ERROR_MESSAGE);
|
|
1176 |
logger.info("Can't enable/show control '" + actionName + "'.", ex); |
|
1177 |
this.message("Can't enable/show control '" + actionName + "'.", JOptionPane.ERROR_MESSAGE); |
|
1163 | 1178 |
try { |
1164 | 1179 |
control.setEnabled(false); |
1165 | 1180 |
control.setVisible(false); |
... | ... | |
1576 | 1591 |
bEstado.addControl(control.getName(), (Component) control); |
1577 | 1592 |
if ( control instanceof JComponent ) { |
1578 | 1593 |
addControl((JComponent) control); |
1594 |
PluginsManager pluginsManager = PluginsLocator.getManager(); |
|
1595 |
IExtension extension = pluginsManager.getExtension((Class<? extends IExtension>) extensionClass); |
|
1596 |
this.control2extensions.put((JComponent)control, extension); |
|
1579 | 1597 |
} |
1580 | 1598 |
} |
1581 | 1599 |
|
1582 | 1600 |
public void addToolBarControl(Class<?> extensionClass, JToolBar control, String name) { |
1583 | 1601 |
toolBars.add(control); |
1584 | 1602 |
addControl(control); |
1603 |
|
|
1604 |
PluginsManager pluginsManager = PluginsLocator.getManager(); |
|
1605 |
IExtension extension = pluginsManager.getExtension((Class<? extends IExtension>) extensionClass); |
|
1606 |
this.control2extensions.put(control, extension); |
|
1585 | 1607 |
} |
1586 | 1608 |
|
1587 | 1609 |
public void removeStatusBarControl(String name) { |
Also available in: Unified diff