1 /* 2 * $Id$ 3 * 4 * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved. 5 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 6 * 7 * This code is free software; you can redistribute it and/or modify it 8 * under the terms of the GNU General Public License version 2 only, as 9 * published by the Free Software Foundation. Oracle designates this 10 * particular file as subject to the "Classpath" exception as provided 11 * by Oracle in the LICENSE file that accompanied this code. 12 * 13 * This code is distributed in the hope that it will be useful, but WITHOUT 14 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 15 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 16 * version 2 for more details (a copy is included in the LICENSE file that 17 * accompanied this code). 18 * 19 * You should have received a copy of the GNU General Public License version 20 * 2 along with this work; if not, write to the Free Software Foundation, 21 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 22 * 23 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 24 * or visit www.oracle.com if you need additional information or have any 25 * questions. 26 */ 27 28 package com.sun.javatest.exec; 29 30 import com.sun.javatest.tool.Tool; 31 import com.sun.javatest.tool.ToolAction; 32 import com.sun.javatest.tool.UIFactory; 33 import com.sun.javatest.tool.jthelp.HelpBroker; 34 import java.awt.event.ActionEvent; 35 import java.util.ArrayList; 36 import java.util.List; 37 import java.util.Map; 38 import javax.swing.Action; 39 import javax.swing.JMenu; 40 41 /** 42 * 43 * @author Dmitry Fazunenko 44 */ 45 public class ET_DefaultHelpControl implements ET_HelpControl { 46 47 Tool tool; 48 UIFactory uif; 49 50 ET_DefaultHelpControl(Tool tool, UIFactory uif) { 51 52 this.tool = tool; 53 this.uif = uif; 54 initActions(); 55 } 56 57 /** 58 * Does nothing 59 */ 60 public void updateGUI() { 61 } 62 63 /** 64 * Does nothing 65 */ 66 public void save(Map m) { 67 } 68 69 /** 70 * Does nothing 71 */ 72 public void restore(Map m) { 73 } 74 75 /** 76 * @return null 77 */ 78 public JMenu getMenu() { 79 return null; 80 } 81 82 public List<Action> getToolBarActionList() { 83 if (actionList == null) { 84 actionList = new ArrayList<Action>(); 85 actionList.add(helpAction); 86 } 87 return actionList; 88 } 89 90 /** 91 * Does nothing 92 */ 93 public void dispose() { 94 } 95 96 private List<Action> actionList = null; 97 private Action helpAction = null; 98 99 void initActions() { 100 helpAction = new ToolAction(uif, "exec.help", true) { 101 public void actionPerformed(ActionEvent e) { 102 HelpBroker b = tool.getHelpBroker(); 103 if (b != null) { 104 b.displayCurrentID("browse.window.csh"); 105 } else { 106 // could internationalize this, but the error isn't that helpful because a 107 // end-user probably can't fix the problem 108 System.err.println("Unable to display Test Manager help, the help system isn't available."); 109 } 110 } 111 }; 112 } 113 114 115 }