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.international.MessageResource;
22  import com.qasystems.qstudio.java.browser.EditionBrowser;
23  import com.qasystems.qstudio.java.gui.RuleIdentifier;
24  import com.qasystems.qstudio.java.gui.observation.ObservationPaneController;
25  import com.qasystems.qstudio.java.io.Observation;
26  
27  import org.eclipse.jface.action.Action;
28  
29  /**
30   * This class implement the RulesGuideAction necessary for
31   * the right menu click on the observation table.
32   */
33  public class RulesGuideAction extends Action {
34    private ObservationPaneController controller;
35  
36    /**
37     * Creates a new RulesGuideAction object.
38     *
39     * @param controller DOCUMENT ME!
40     */
41    public RulesGuideAction(ObservationPaneController controller) {
42      this.controller = controller;
43      setText(MessageResource.getClientInstance().getString("MENU_022"));
44    }
45  
46    /**
47     * DOCUMENT ME!
48     */
49    public void run() {
50      final Observation observation = controller.getSelectedObservation();
51  
52      if (observation != null) {
53        final RuleIdentifier ruleId = observation.getIdentifier();
54        new EditionBrowser().openRuleGuide(ruleId);
55      } else {
56        new EditionBrowser().openRuleGuide();
57      }
58    }
59  }
60