01: package com.vividsolutions.jump.workbench.ui.plugin;
02:
03: import com.vividsolutions.jump.I18N;
04: import com.vividsolutions.jump.workbench.WorkbenchContext;
05: import com.vividsolutions.jump.workbench.plugin.*;
06:
07: import javax.swing.JCheckBoxMenuItem;
08: import javax.swing.JComponent;
09:
10: public class MapToolTipsPlugIn extends AbstractPlugIn {
11: public static MultiEnableCheck createEnableCheck(
12: final WorkbenchContext workbenchContext) {
13: EnableCheckFactory checkFactory = new EnableCheckFactory(
14: workbenchContext);
15: return new MultiEnableCheck()
16: .add(
17: checkFactory
18: .createWindowWithLayerNamePanelMustBeActiveCheck())
19: .add(new EnableCheck() {
20: public String check(JComponent component) {
21: ((JCheckBoxMenuItem) component)
22: .setSelected(workbenchContext
23: .getLayerViewPanel()
24: .getToolTipWriter().isEnabled());
25: return null;
26: }
27: });
28: }
29:
30: public String getName() {
31: //Can't use auto-naming, which produces "Map Tool Tips"; and Unix/Windows
32: //CVS issues will occur if I rename MapToolTipsPlugIn to MapTooltipsPlugIn. [Jon Aquino]
33: return I18N.get("ui.plugin.MapToolTipsPlugIn.map-tooltips");
34: }
35:
36: public boolean execute(PlugInContext context) throws Exception {
37: context.getLayerViewPanel().getToolTipWriter().setEnabled(
38: !context.getLayerViewPanel().getToolTipWriter()
39: .isEnabled());
40: return true;
41: }
42: }
|