1 19 20 package org.netbeans.core.output; 21 22 import org.openide.util.HelpCtx; 23 import org.openide.util.NbBundle; 24 import org.openide.util.actions.CallableSystemAction; 25 26 import org.openide.windows.Mode; 27 import org.openide.windows.TopComponent; 28 import org.openide.windows.WindowManager; 29 30 34 public final class OutputWindowAction extends CallableSystemAction { 35 36 public void performAction() { 37 OutputView output = OutputView.findDefault(); 38 if (!output.isDisplayable()) { 39 output = findOutputComponent(); 40 if (output != null) { 41 output.open(); 44 output.requestActive(); 45 } else { 46 output = OutputView.findDefault(); 49 if (!output.isShowing()) { 50 Mode mode = WindowManager.getDefault().getCurrentWorkspace().findMode("output"); if (mode == null) { 52 String displayName = NbBundle.getBundle(OutputWindowAction.class).getString("CTL_OutputWindow_OutputTab"); 54 mode = WindowManager.getDefault().getCurrentWorkspace().createMode("output", displayName, null); 55 } 56 mode.dockInto(output); 58 output.open(); 59 } 60 } 61 } 62 output.requestActive(); 63 64 } 68 69 protected boolean asynchronous() { 70 return false; 71 } 72 73 public String getName() { 74 return NbBundle.getBundle(OutputWindowAction.class).getString("OutputWindow"); 75 } 76 77 public HelpCtx getHelpCtx() { 78 return new HelpCtx (OutputWindowAction.class); 79 } 80 81 protected String iconResource () { 82 return "org/netbeans/core/resources/frames/output.gif"; } 84 85 87 private static OutputView findOutputComponent() { 88 Mode mode = WindowManager.getDefault().getCurrentWorkspace().findMode("output"); 90 if (mode != null) { 91 TopComponent[] tcs = mode.getTopComponents(); 92 for (int i = 0; i < tcs.length; i++) { 93 if (tcs[i] instanceof OutputView) { 94 return (OutputView) tcs[i]; 95 } 96 } 97 } 98 99 return null; 100 } 101 102 } 103 | Popular Tags |