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 18137
Collapse All | Expand All

(-)core/src/org/netbeans/core/windows/RegistryImpl.java (-1 / +7 lines)
Lines 28-34 Link Here
28
import org.openide.windows.Workspace;
28
import org.openide.windows.Workspace;
29
import org.openide.nodes.Node;
29
import org.openide.nodes.Node;
30
import org.openide.util.WeakSet;
30
import org.openide.util.WeakSet;
31
import org.openide.explorer.ExplorerManager;
31
import org.openide.explorer.*;
32
32
33
import org.netbeans.core.NbTopManager;
33
import org.netbeans.core.NbTopManager;
34
34
Lines 144-149 Link Here
144
        support.firePropertyChange(PROP_ACTIVATED_NODES, null, em.getSelectedNodes());
144
        support.firePropertyChange(PROP_ACTIVATED_NODES, null, em.getSelectedNodes());
145
    }
145
    }
146
146
147
    // #18137: Delete etc. must be updated acc. to this manager
148
    ExplorerActions actions = ExplorerPanel.getActions();
149
    ExplorerManager actionsPrevious = actions.getAttachedManager();
150
    actions.attach(em);
151
147
    try {
152
    try {
148
153
149
      // execute the runnable
154
      // execute the runnable
Lines 160-165 Link Here
160
            support.firePropertyChange(PROP_ACTIVATED_NODES, null, previous.getSelectedNodes());
165
            support.firePropertyChange(PROP_ACTIVATED_NODES, null, previous.getSelectedNodes());
161
          }
166
          }
162
      }   
167
      }   
168
      actions.attach(actionsPrevious);
163
    }
169
    }
164
  }
170
  }
165
      
171
      
(-)openide/src/org/openide/explorer/ExplorerActions.java (+13 lines)
Lines 73-78 Link Here
73
    * @param m the manager to listen on
73
    * @param m the manager to listen on
74
    */
74
    */
75
    public synchronized void attach (ExplorerManager m) {
75
    public synchronized void attach (ExplorerManager m) {
76
        //System.err.println("attach: manager=" + manager + " m=" + m); Thread.dumpStack();//XXX
76
        if (manager != null) {
77
        if (manager != null) {
77
            // first of all detach
78
            // first of all detach
78
            detach ();
79
            detach ();
Lines 93-98 Link Here
93
    /** Detach from manager currently being listened on.
94
    /** Detach from manager currently being listened on.
94
    */
95
    */
95
    public synchronized void detach () {
96
    public synchronized void detach () {
97
        //System.err.println("detach: manager=" + manager); Thread.dumpStack();//XXX
96
        if (manager == null) return;
98
        if (manager == null) return;
97
99
98
        manager.removePropertyChangeListener (listener);
100
        manager.removePropertyChangeListener (listener);
Lines 105-110 Link Here
105
107
106
        manager = null;
108
        manager = null;
107
    }
109
    }
110
    
111
    /** Get the manager currently attached to this bridge, if any.
112
     * @return the manager, or null if none
113
     * @since XXX
114
     */
115
    public ExplorerManager getAttachedManager() {
116
        return manager;
117
    }
108
118
109
    /** Set whether to confirm deletions.
119
    /** Set whether to confirm deletions.
110
    * @param yes <code>true</code> to confirm deletions
120
    * @param yes <code>true</code> to confirm deletions
Lines 215-220 Link Here
215
            cut.setActionPerformer (null);
225
            cut.setActionPerformer (null);
216
            delete.setActionPerformer (null);
226
            delete.setActionPerformer (null);
217
        }
227
        }
228
        //System.err.println("EA.uA: path=" + java.util.Arrays.asList(path) + " copy=" + copy.getActionPerformer() + " cut=" + cut.getActionPerformer() + " delete=" + delete.getActionPerformer());//XXX
218
        updatePasteAction(path);
229
        updatePasteAction(path);
219
    }
230
    }
220
    
231
    
Lines 646-651 Link Here
646
        }
657
        }
647
658
648
        public void propertyChange (PropertyChangeEvent e) {
659
        public void propertyChange (PropertyChangeEvent e) {
660
            //System.err.println("eA.L.pC; delay=" + task.getDelay());//XXX
649
            if (task.getDelay () == 0) {
661
            if (task.getDelay () == 0) {
650
                // the task is not waiting in the queue 
662
                // the task is not waiting in the queue 
651
                // execute the update immediatelly (maybe somebody is 
663
                // execute the update immediatelly (maybe somebody is 
Lines 675-680 Link Here
675
        /** Updates the actions.
687
        /** Updates the actions.
676
        */
688
        */
677
        public void run() {
689
        public void run() {
690
            //System.err.println("eA.L.run");//XXX
678
            updateActions ();
691
            updateActions ();
679
        }
692
        }
680
    }
693
    }
(-)openide/src/org/openide/explorer/ExplorerManager.java (-1 / +17 lines)
Lines 95-100 Link Here
95
    
95
    
96
    /** Construct a new manager. */
96
    /** Construct a new manager. */
97
    public ExplorerManager () {
97
    public ExplorerManager () {
98
        //System.err.println("I am " + System.identityHashCode(this));Thread.dumpStack();//XXX
98
        init ();
99
        init ();
99
    }
100
    }
100
101
Lines 115-122 Link Here
115
        em.rootContext = rootContext;
116
        em.rootContext = rootContext;
116
        em.exploredContext = exploredContext;
117
        em.exploredContext = exploredContext;
117
        em.selectedNodes = selectedNodes;
118
        em.selectedNodes = selectedNodes;
119
        em.title = title;
118
        return em;
120
        return em;
119
    }
121
    }
122
    
123
    // For access from ExplorerPanel only; for debugging!
124
    private transient String title;
125
    void setTitle(String s) {
126
        //System.err.println("I am " + System.identityHashCode(this));System.err.println("setTitle: " + s); Thread.dumpStack();//XXX
127
        title = s;
128
    }
129
    public String toString() {
130
        //System.err.println("I am " + System.identityHashCode(this));Thread.dumpStack();//XXX
131
        return "ExplorerManager[" + title + "]"; // NOI18N
132
    }
120
133
121
    /** Get the set of selected nodes.
134
    /** Get the set of selected nodes.
122
    * @return the selected nodes; empty (not <code>null</code>) if none are selected
135
    * @return the selected nodes; empty (not <code>null</code>) if none are selected
Lines 613-624 Link Here
613
    * @see Provider
626
    * @see Provider
614
    */
627
    */
615
    public static ExplorerManager find (Component comp) {
628
    public static ExplorerManager find (Component comp) {
629
        Component orig = comp;
616
        // start looking for manager from parent, not the component itself
630
        // start looking for manager from parent, not the component itself
617
        for (;;) {
631
        for (;;) {
618
            comp = comp.getParent ();
632
            comp = comp.getParent ();
619
            if (comp == null) {
633
            if (comp == null) {
620
                // create new explorer because nothing has been found
634
                // create new explorer because nothing has been found
621
                return new ExplorerManager ();
635
                ExplorerManager m = new ExplorerManager();
636
                m.setTitle("found from " + orig); // NOI18N
637
                return m;
622
            }
638
            }
623
            if (comp instanceof Provider) {
639
            if (comp instanceof Provider) {
624
                // ok, found a provider, return its manager
640
                // ok, found a provider, return its manager
(-)openide/src/org/openide/explorer/ExplorerPanel.java (-1 / +14 lines)
Lines 71-76 Link Here
71
    public void requestFocus() {
71
    public void requestFocus() {
72
        requestDefaultFocus();
72
        requestDefaultFocus();
73
    }
73
    }
74
    
75
    /** Get the actions bridge used by ExplorerPanel's by default.
76
     * @return the bridge
77
     * @since XXX
78
     */
79
    public static ExplorerActions getActions() {
80
        return actions;
81
    }
74
82
75
    /* Add a listener to the explorer panel in addition to the normal
83
    /* Add a listener to the explorer panel in addition to the normal
76
    * open behaviour.
84
    * open behaviour.
Lines 111-116 Link Here
111
            synchronized (this) {
119
            synchronized (this) {
112
                if (manager == null) {
120
                if (manager == null) {
113
                    manager = new ExplorerManager ();
121
                    manager = new ExplorerManager ();
122
                    manager.setTitle(toString());
114
                }
123
                }
115
            }
124
            }
116
        }
125
        }
Lines 126-132 Link Here
126
    /* Deactivates copy/cut/paste actions.
135
    /* Deactivates copy/cut/paste actions.
127
    */
136
    */
128
    protected void componentDeactivated () {
137
    protected void componentDeactivated () {
129
        actions.detach ();
138
        if (getExplorerManager() == actions.getAttachedManager()) {
139
            actions.detach ();
140
        }
130
    }
141
    }
131
142
132
    /** Called when the explored context changes.
143
    /** Called when the explored context changes.
Lines 222-227 Link Here
222
        Object anObj = oi.readObject ();
233
        Object anObj = oi.readObject ();
223
        if (anObj instanceof ExplorerManager) {
234
        if (anObj instanceof ExplorerManager) {
224
            manager = (ExplorerManager)anObj;
235
            manager = (ExplorerManager)anObj;
236
            manager.setTitle(toString());
225
            return;
237
            return;
226
        }
238
        }
227
        NbMarshalledObject obj = (NbMarshalledObject) anObj;
239
        NbMarshalledObject obj = (NbMarshalledObject) anObj;
Lines 229-234 Link Here
229
        // --- read all data from main stream, it is OK now ---
241
        // --- read all data from main stream, it is OK now ---
230
        try {
242
        try {
231
            manager = (ExplorerManager) obj.get ();
243
            manager = (ExplorerManager) obj.get ();
244
            manager.setTitle(toString());
232
        } catch (SafeException se) {
245
        } catch (SafeException se) {
233
//            System.err.println("rethrowing se: " + se.getLocalizedMessage ());
246
//            System.err.println("rethrowing se: " + se.getLocalizedMessage ());
234
            throw se;
247
            throw se;

Return to bug 18137