001: /*
002: * SalomeTMF is a Test Management Framework
003: * Copyright (C) 2005 France Telecom R&D
004: *
005: * This library is free software; you can redistribute it and/or
006: * modify it under the terms of the GNU Lesser General Public
007: * License as published by the Free Software Foundation; either
008: * version 2 of the License, or (at your option) any later version.
009: *
010: * This library is distributed in the hope that it will be useful,
011: * but WITHOUT ANY WARRANTY; without even the implied warranty of
012: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
013: * Lesser General Public License for more details.
014: *
015: * You should have received a copy of the GNU Lesser General Public
016: * License along with this library; if not, write to the Free Software
017: * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
018: *
019: * @author Fayçal SOUGRATI, Vincent Pautret, Marche Mikael
020: *
021: * Contact: mikael.marche@rd.francetelecom.com
022: */
023:
024: package salomeTMF_plug.weighting;
025:
026: import java.awt.event.ActionEvent;
027: import java.awt.event.ActionListener;
028: import java.util.Properties;
029:
030: import javax.swing.JMenu;
031: import javax.swing.JMenuItem;
032:
033: import org.java.plugin.Plugin;
034: import org.java.plugin.PluginDescriptor;
035: import org.java.plugin.PluginManager;
036: import org.objectweb.salome_tmf.api.Api;
037: import org.objectweb.salome_tmf.api.api2ihm.Utile;
038: import org.objectweb.salome_tmf.data.Test;
039: import org.objectweb.salome_tmf.ihm.datawrapper.DataModel;
040: import org.objectweb.salome_tmf.plugins.core.Common;
041:
042: import salomeTMF_plug.weighting.languages.Language;
043:
044: /**
045: *
046: * @author marchemi
047: */
048: public class weightingPlugin extends Plugin implements Common {
049:
050: Properties statements = null;
051:
052: /** Creates a new instance of weightingPlugin */
053: public weightingPlugin(PluginManager manager, PluginDescriptor descr) {
054: super (manager, descr);
055: }
056:
057: /********************* extends Plugin**********************************/
058:
059: /**
060: * @see org.java.plugin.Plugin()
061: */
062: protected void doStart() throws Exception {
063: Api.log("[weightingPlugin:doStart] chargement du plugin");
064: }
065:
066: /**
067: * @see org.java.plugin.Plugin()
068: */
069: protected void doStop() throws Exception {
070: // no-op
071: }
072:
073: //********************* interface common ********************//
074:
075: public void activatePluginInCampToolsMenu(javax.swing.JMenu jMenu) {
076: }
077:
078: public void activatePluginInDataToolsMenu(javax.swing.JMenu jMenu) {
079: }
080:
081: public void activatePluginInDynamicComponent(Integer integer) {
082: }
083:
084: public void activatePluginInStaticComponent(Integer integer) {
085: }
086:
087: public void activatePluginInTestToolsMenu(javax.swing.JMenu jMenu) {
088: JMenu weightingSubMenu = new JMenu("Plugin weighting");
089:
090: JMenuItem modifyTestweight = new JMenuItem(Language
091: .getInstance().getText(
092: "Modifier_la_pondération_du_test"));
093: modifyTestweight.addActionListener(new ActionListener() {
094: public void actionPerformed(ActionEvent e) {
095: Test test = DataModel.getCurrentTest();
096: if (test != null) {
097: new modifyTestWeight(test, statements);
098: }
099: }
100: });
101:
102: weightingSubMenu.add(modifyTestweight);
103:
104: jMenu.addSeparator();
105: jMenu.add(weightingSubMenu);
106: }
107:
108: public void freeze() {
109: }
110:
111: public java.util.Vector getUsedUIComponents() {
112: return null;
113: }
114:
115: public void init(Object pIhm) {
116: try {
117: statements = Utile
118: .getPropertiesFile(getClass()
119: .getResource(
120: "/salomeTMF_plug/weighting/resources/sql/weighting_Stmts.properties"));
121: } catch (Exception E) {
122: E.printStackTrace();
123: }
124: }
125:
126: public boolean isActivableInCampToolsMenu() {
127: return false;
128: }
129:
130: public boolean isActivableInDataToolsMenu() {
131: return false;
132: }
133:
134: public boolean isActivableInTestToolsMenu() {
135: return true;
136: }
137:
138: public boolean isFreezable() {
139: return false;
140: }
141:
142: public boolean isFreezed() {
143: return false;
144: }
145:
146: public void unFreeze() {
147: }
148:
149: public boolean usesOtherUIComponents() {
150: return true;
151: }
152:
153: }
|