Revision 44101 trunk/org.gvsig.desktop/org.gvsig.desktop.plugin/org.gvsig.app/org.gvsig.app.mainplugin/src/main/java/org/gvsig/app/project/documents/view/expressionevaluator/ViewCapturePointElement.java

View differences:

ViewCapturePointElement.java
1 1
package org.gvsig.app.project.documents.view.expressionevaluator;
2 2

  
3
import java.awt.Dialog;
4
import java.awt.Window;
3 5
import org.gvsig.expressionevaluator.ExpressionBuilder;
4 6
import org.gvsig.expressionevaluator.ExpressionBuilder.Config;
5 7
import org.gvsig.expressionevaluator.ExpressionBuilder.GeometrySupportType;
......
15 17
 *
16 18
 * @author jjdelcerro
17 19
 */
18
    @SuppressWarnings("UseSpecificCatch")
20
@SuppressWarnings("UseSpecificCatch")
19 21
public class ViewCapturePointElement
20 22
        extends AbstractElement
21
        implements SimpleElement, CalculatedElement 
22
    {
23
        implements SimpleElement, CalculatedElement {
24

  
23 25
    private ViewCapturePointPanel aditionalPanel;
24 26

  
25 27
    public ViewCapturePointElement() {
26 28
        super(
27
                ToolsLocator.getI18nManager().getTranslation("_Capture_point"), 
28
                "Capture a point in the current view", 
29
                ToolsLocator.getI18nManager().getTranslation("_Capture_point"),
30
                "Capture a point in the current view",
29 31
                "expressionbuilder-element-view-capture-point"
30 32
        );
31 33
    }
......
78 80
        return this.aditionalPanel;
79 81
    }
80 82

  
83
    @Override
84
    public boolean isEnabled() {
85
        return ! isModalDialogShowing();
86
    }
87

  
88
    private static boolean isModalDialogShowing() {
89
        Window[] windows = Window.getWindows();
90
        if (windows != null) { // don't rely on current implementation, which at least returns [0].
91
            for (Window w : windows) {
92
                if (w.isShowing() && w instanceof Dialog && ((Dialog) w).isModal()) {
93
                    return true;
94
                }
95
            }
96
        }
97
        return false;
98
    }
81 99
}

Also available in: Unified diff