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 GetLeftEditorAction extends AbstractAction { 41 42 public GetLeftEditorAction() { 43 putValue(Action.NAME, NbBundle.getMessage(GetLeftEditorAction.class, "GetLeftEditorAction.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.getDisplayName().equals(all[i].getDisplayName())) { 55 int newIndex = i != 0 ? i -1 : all.length - 1; 56 handler.requestActive(all[newIndex]); 57 } 58 } 59 } else { 60 Toolkit.getDefaultToolkit().beep(); 61 } 62 } 63 64 } 65 66 | Popular Tags |