This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

View | Details | Raw Unified | Return to bug 267510
Collapse All | Expand All

(-)a/openide.explorer/src/org/netbeans/modules/openide/explorer/ExplorerActionsImpl.java (-7 / +12 lines)
Lines 61-66 import java.beans.PropertyVetoException; Link Here
61
import java.io.IOException;
61
import java.io.IOException;
62
import java.util.Arrays;
62
import java.util.Arrays;
63
import java.util.HashMap;
63
import java.util.HashMap;
64
import java.util.concurrent.atomic.AtomicInteger;
64
import java.util.logging.Level;
65
import java.util.logging.Level;
65
import java.util.logging.Logger;
66
import java.util.logging.Logger;
66
import javax.swing.AbstractAction;
67
import javax.swing.AbstractAction;
Lines 630-646 public class ExplorerActionsImpl { Link Here
630
    }
631
    }
631
    
632
    
632
    private static abstract class BaseAction extends AbstractAction {
633
    private static abstract class BaseAction extends AbstractAction {
633
        private volatile Boolean toEnable;
634
        private static final int NO_CHANGE = 0;
634
        
635
        private static final int ENABLED = 1;
636
        private static final int DISABLED = 2;
637
638
        private final AtomicInteger toEnable = new AtomicInteger(NO_CHANGE);
639
635
        public void toEnabled(boolean e) {
640
        public void toEnabled(boolean e) {
636
            toEnable = e;
641
            toEnable.set(e ? ENABLED : DISABLED);
637
        }
642
        }
638
        
643
639
        public void syncEnable() {
644
        public void syncEnable() {
640
            assert EventQueue.isDispatchThread();
645
            assert EventQueue.isDispatchThread();
641
            if (toEnable != null) {
646
            int toEnableValue = toEnable.getAndSet(NO_CHANGE);
642
                setEnabled(toEnable);
647
            if (toEnableValue != NO_CHANGE) {
643
                toEnable = null;
648
                setEnabled(toEnableValue == ENABLED);
644
            }
649
            }
645
        }
650
        }
646
    }
651
    }

Return to bug 267510