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

(-)Controller.java (-1 / +15 lines)
Lines 75-80 Link Here
75
    private static final int ACTION_POSTMENU = 10;
75
    private static final int ACTION_POSTMENU = 10;
76
    private static final int ACTION_FINDPREVIOUS = 11;
76
    private static final int ACTION_FINDPREVIOUS = 11;
77
    private static final int ACTION_CLEAR = 12;
77
    private static final int ACTION_CLEAR = 12;
78
    private static final int ACTION_NEXTTAB = 13;
79
    private static final int ACTION_PREVTAB = 14;
78
80
79
    //Package private for unit tests
81
    //Package private for unit tests
80
    Action copyAction = new ControllerAction (ACTION_COPY,
82
    Action copyAction = new ControllerAction (ACTION_COPY,
Lines 102-107 Link Here
102
    Action postMenuAction = new ControllerAction (ACTION_POSTMENU, "postMenu", //NOI18N
104
    Action postMenuAction = new ControllerAction (ACTION_POSTMENU, "postMenu", //NOI18N
103
            KeyStroke.getKeyStroke(KeyEvent.VK_F10, KeyEvent.SHIFT_DOWN_MASK));
105
            KeyStroke.getKeyStroke(KeyEvent.VK_F10, KeyEvent.SHIFT_DOWN_MASK));
104
    Action clearAction = new ControllerAction (ACTION_CLEAR, "ACTION_CLEAR");
106
    Action clearAction = new ControllerAction (ACTION_CLEAR, "ACTION_CLEAR");
107
    Action nextTabAction = new ControllerAction (ACTION_NEXTTAB, "nextTab", //NOI18N
108
            KeyStroke.getKeyStroke(KeyEvent.VK_N, KeyEvent.ALT_DOWN_MASK));
109
    Action prevTabAction = new ControllerAction (ACTION_PREVTAB, "prevTab", //NOI18N
110
            KeyStroke.getKeyStroke(KeyEvent.VK_P, KeyEvent.ALT_DOWN_MASK));
105
111
106
    private Object[] popupItems = new Object[] {
112
    private Object[] popupItems = new Object[] {
107
        copyAction, new JSeparator(), findAction, findNextAction,
113
        copyAction, new JSeparator(), findAction, findNextAction,
Lines 112-118 Link Here
112
    private Action[] kbdActions = new Action[] {
118
    private Action[] kbdActions = new Action[] {
113
        copyAction, selectAllAction, findAction, findNextAction, 
119
        copyAction, selectAllAction, findAction, findNextAction, 
114
        findPreviousAction, wrapAction, saveAsAction, closeAction,
120
        findPreviousAction, wrapAction, saveAsAction, closeAction,
115
        navToLineAction, postMenuAction, clearAction,
121
        navToLineAction, postMenuAction, clearAction, nextTabAction, prevTabAction,
116
    };
122
    };
117
123
118
    Controller() {}
124
    Controller() {}
Lines 357-362 Link Here
357
            case ACTION_POSTMENU :
363
            case ACTION_POSTMENU :
358
                if (log) log ("Action POSTMENU received");
364
                if (log) log ("Action POSTMENU received");
359
                postPopupMenu(win, tab, new Point(0,0), tab);
365
                postPopupMenu(win, tab, new Point(0,0), tab);
366
                break;
367
            case ACTION_NEXTTAB :
368
                if (log) log ("Action NEXTTAB received");
369
                win.selectNextTab(tab);
370
                break;
371
            case ACTION_PREVTAB :
372
                if (log) log ("Action PREVTAB received");
373
                win.selectPreviousTab(tab);
360
                break;
374
                break;
361
            case ACTION_CLEAR :
375
            case ACTION_CLEAR :
362
                if (log) log ("Action CLEAR receieved");
376
                if (log) log ("Action CLEAR receieved");
(-)ui/AbstractOutputWindow.java (+43 lines)
Lines 125-130 Link Here
125
        return result;
125
        return result;
126
    }
126
    }
127
    
127
    
128
    /**
129
     * Set next tab relatively to the given tab. If the give tab is the last one
130
     * the first is selected.
131
     *
132
     * @param tab relative tab
133
     */
134
    public final void selectNextTab(AbstractOutputTab tab) {
135
        AbstractOutputTab[] tabs = this.getTabs();
136
        if (tabs.length > 1) {
137
            int nextTabIndex = getSelectedTabIndex(tabs, tab) + 1;
138
            if (nextTabIndex > (tabs.length - 1)) {
139
                nextTabIndex = 0;
140
            }
141
            this.setSelectedTab(tabs[nextTabIndex]);
142
        }
143
    }
144
145
    /**
146
     * Set previous tab relatively to the given tab. If the give tab is the
147
     * first one the last is selected.
148
     *
149
     * @param tab relative tab
150
     */
151
    public final void selectPreviousTab(AbstractOutputTab tab) {
152
        AbstractOutputTab[] tabs = this.getTabs();
153
        if (tabs.length > 1) {
154
            int prevTabIndex = getSelectedTabIndex(tabs, tab) - 1;
155
            if (prevTabIndex < 0) {
156
                prevTabIndex = tabs.length - 1;
157
            }
158
            this.setSelectedTab(tabs[prevTabIndex]);
159
        }
160
    }
161
162
    private int getSelectedTabIndex(AbstractOutputTab[] tabs, AbstractOutputTab tab) {
163
        for (int i = 0; i < tabs.length; i++) {
164
            if (tabs[i] == tab) {
165
                return i;
166
            }
167
        }
168
        return -1;
169
    }
170
128
    
171
    
129
    public void remove (Component c) {
172
    public void remove (Component c) {
130
        AbstractOutputTab removedSelectedView = null;
173
        AbstractOutputTab removedSelectedView = null;

Return to bug 50297