1   /**
2    * QJ-Pro
3    * Copyright (c) 2004, http://qjpro.sourceforge.net
4    *
5    * This program is free software; you can redistribute it and/or modify it
6    * under the terms of the GNU General Public License as published by the
7    * Free Software Foundation; either version 2 of the License, or
8    * (at your option) any later version.
9    *
10   * This program is distributed in the hope that it will be useful, but WITHOUT
11   * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
12   * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
13   * details.
14   *
15   * You should have received a copy of the GNU General Public License along with
16   * this program; if not, write to the Free Software Foundation, Inc.,
17   * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18   */
19  package com.qasystems.qstudio.java.integration.eclipse.actions;
20  
21  import com.qasystems.debug.DebugWriter;
22  import com.qasystems.qstudio.java.browser.EditionBrowser;
23  
24  import org.eclipse.jface.action.Action;
25  
26  /**
27   *  This class implements Guide actions for the
28   *  Eclipse integration. This class also takes care of
29   *  the about box.
30   */
31  public class GuideAction extends Action {
32    public static final int RULES_GUIDE_ID = 0;
33    public static final int PATTERN_GUIDE_ID = 1;
34    public static final int USER_GUIDE_ID = 2;
35    private int guideID = -1;
36  
37    /**
38     * Creates a new GuideAction object.
39     *
40     * @param id DOCUMENT ME!
41     */
42    public GuideAction(int id) {
43      super();
44      guideID = id;
45    }
46  
47    /**
48     * Opens the guide.
49     *
50     */
51    public void run() {
52      switch (guideID) {
53      case RULES_GUIDE_ID : {
54        new EditionBrowser().openRuleGuide();
55  
56        break;
57      }
58  
59      case PATTERN_GUIDE_ID : {
60        new EditionBrowser().openPatternGuide();
61  
62        break;
63      }
64  
65      case USER_GUIDE_ID : {
66        new EditionBrowser().openTutorial();
67  
68        break;
69      }
70  
71      default : {
72        new DebugWriter().writeMessage("Unknown guide in class GuideAction");
73  
74        break;
75      }
76      }
77    }
78  }
79