1 19 20 package org.netbeans.core.multiview; 21 22 import java.awt.Toolkit ; 23 import java.util.HashMap ; 24 import javax.swing.AbstractAction ; 25 import javax.swing.Action ; 26 import org.netbeans.core.api.multiview.MultiViews; 27 import org.openide.util.NbBundle; 28 import org.openide.windows.TopComponent; 29 30 import java.beans.PropertyChangeListener ; 31 import org.netbeans.core.api.multiview.MultiViewHandler; 32 import org.netbeans.core.api.multiview.MultiViewPerspective; 33 import org.openide.windows.WindowManager; 34 35 36 40 public class GetRightEditorAction extends AbstractAction { 41 42 public GetRightEditorAction() { 43 putValue(Action.NAME, NbBundle.getMessage(GetRightEditorAction.class, "GetRightEditorAction.name")); 44 } 45 46 47 public void actionPerformed(java.awt.event.ActionEvent ev) { 48 WindowManager wm = WindowManager.getDefault(); 49 MultiViewHandler handler = MultiViews.findMultiViewHandler(wm.getRegistry().getActivated()); 50 if (handler != null) { 51 MultiViewPerspective pers = handler.getSelectedPerspective(); 52 MultiViewPerspective[] all = handler.getPerspectives(); 53 for (int i = 0; i < all.length; i++) { 54 if (pers.equals(all[i])) { 55 int newIndex = i != all.length - 1 ? i + 1 : 0; 56 handler.requestActive(all[newIndex]); 57 } 58 } 59 } else { 60 Toolkit.getDefaultToolkit().beep(); 61 } 62 } 63 64 } 65 | Popular Tags |