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

(-)core/windows/src/org/netbeans/core/windows/actions/RecentViewListAction.java (-1 / +27 lines)
Lines 14-19 Link Here
14
14
15
package org.netbeans.core.windows.actions;
15
package org.netbeans.core.windows.actions;
16
16
17
import java.util.ArrayList;
18
import java.util.List;
19
import org.netbeans.core.windows.Constants;
17
import org.netbeans.core.windows.ModeImpl;
20
import org.netbeans.core.windows.ModeImpl;
18
import org.netbeans.core.windows.WindowManagerImpl;
21
import org.netbeans.core.windows.WindowManagerImpl;
19
import org.netbeans.core.windows.view.ui.RecentViewListDlg;
22
import org.netbeans.core.windows.view.ui.RecentViewListDlg;
Lines 40-45 Link Here
40
public final class RecentViewListAction extends AbstractAction
43
public final class RecentViewListAction extends AbstractAction
41
implements PropertyChangeListener {
44
implements PropertyChangeListener {
42
    
45
    
46
    /** #37228 : option to only show document windows in recent window list */
47
    private static final boolean RESTRICT_TO_DOCUMENTS = Boolean.getBoolean("org.netbeans.core.windows.actions.recentViewListAction.RESTRICT_TO_DOCUMENTS"); // NOI18N
48
    
43
    /** Creates a new instance of RecentViewListAction */
49
    /** Creates a new instance of RecentViewListAction */
44
    public RecentViewListAction () {
50
    public RecentViewListAction () {
45
        putValue(NAME, NbBundle.getMessage(RecentViewListAction.class, "CTL_RecentViewListAction"));
51
        putValue(NAME, NbBundle.getMessage(RecentViewListAction.class, "CTL_RecentViewListAction"));
Lines 50-59 Link Here
50
    
56
    
51
    public void actionPerformed(ActionEvent evt) {
57
    public void actionPerformed(ActionEvent evt) {
52
        TopComponent[] tcs = WindowManagerImpl.getInstance().getRecentViewList();
58
        TopComponent[] tcs = WindowManagerImpl.getInstance().getRecentViewList();
59
60
        if ( RESTRICT_TO_DOCUMENTS ) {
61
            WindowManagerImpl wm = WindowManagerImpl.getInstance();
62
            List tcList = new ArrayList();
63
            for ( int i = 0; i < tcs.length; i++ ) {
64
                TopComponent tc = (TopComponent)tcs[i];
65
                if ( tc == null )
66
                    continue;
67
                ModeImpl mode = (ModeImpl)wm.findMode(tc);
68
                if(mode == null) {
69
                    continue;
70
                }
71
                
72
                if(mode.getKind() == Constants.MODE_KIND_EDITOR) {
73
                    tcList.add( tc );
74
                }
75
            }
76
            tcs = (TopComponent[])tcList.toArray( new TopComponent[0] );
77
        }
78
53
        if (tcs.length == 0) {
79
        if (tcs.length == 0) {
54
            return;
80
            return;
55
        }
81
        }
56
82
        
57
        // XXX Show dialog only if the action was invoked by shortcut (not from menu).
83
        // XXX Show dialog only if the action was invoked by shortcut (not from menu).
58
        if(!(evt.getSource() instanceof javax.swing.JMenuItem)) {
84
        if(!(evt.getSource() instanceof javax.swing.JMenuItem)) {
59
            // #46800: fetch key directly from action command
85
            // #46800: fetch key directly from action command

Return to bug 37228