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 org.objectweb.salome_tmf.ihm.plugins;
025:
026: import java.util.LinkedList;
027:
028: import org.objectweb.salome_tmf.data.Environment;
029: import org.objectweb.salome_tmf.data.Execution;
030: import org.objectweb.salome_tmf.data.ExecutionResult;
031: import org.objectweb.salome_tmf.data.ExecutionTestResult;
032: import org.objectweb.salome_tmf.data.Project;
033: import org.objectweb.salome_tmf.data.ProjectData;
034: import org.objectweb.salome_tmf.data.Test;
035: import org.objectweb.salome_tmf.data.User;
036: import org.objectweb.salome_tmf.ihm.SalomeTMF;
037: import org.objectweb.salome_tmf.ihm.datawrapper.DataModel;
038: import org.objectweb.salome_tmf.plugins.core.Common;
039:
040: /**
041: * Methods and tools for plugins management
042: * @author capg2710
043: */
044: public class PluginsTools {
045:
046: /** Creates a new instance of PluginsTools */
047: public PluginsTools() {
048: }
049:
050: /**
051: * Activates associated plugins to dynamic UI components
052: * @param uiConst
053: */
054: public static void activateAssociatedPlgs(Integer uiConst) {
055: LinkedList list = SalomeTMF
056: .getAssociatedPluginsToUIComp(uiConst);
057: if (list != null) {
058: for (int i = 0; i < list.size(); i++) {
059: ((Common) list.get(i))
060: .activatePluginInDynamicComponent(uiConst);
061: }
062: }
063: }
064:
065: /**
066: * Returns the current project in Salomé
067: * @return Current project in Salomé
068: */
069: public static Project getCurrentProject() {
070: return ProjectData.getCurrentProject();
071: }
072:
073: /**
074: * Returns the current user in Salomé
075: * @return Current user in Salomé
076: */
077: public static User getCurrentUser() {
078: return ProjectData.getCurrentUser();
079: }
080:
081: /**
082: * Returns current campaign execution
083: * @return current campaign execution
084: */
085: public static Execution getCurrentCampExecution() {
086: return DataModel.getObservedExecution();
087: }
088:
089: /**
090: * Returns current campaign execution's environement
091: * @return current campaign execution's environement
092: */
093: public static Environment getCurrentCampExecutionEnvironment() {
094: Environment result;
095: if (DataModel.getObservedExecution() == null) {
096: result = null;
097: } else {
098: result = DataModel.getObservedExecution().getEnvironment();
099: }
100: return result;
101: }
102:
103: /**
104: * Returns current campaign execution result
105: * @return current campaign execution result
106: */
107: public static ExecutionResult getCurrentCampExecResult() {
108: return DataModel.getObservedExecutionResult();
109: }
110:
111: /**
112: * Returns current test execution result
113: * @return current test execution result
114: */
115: public static ExecutionTestResult getCurrentTestExecutionResult() {
116: return DataModel.getCurrentExecutionTestResult();
117: }
118:
119: /**
120: * Returns the associated test to the current test execution result
121: * @return the associated test to the current test execution result
122: */
123: public static Test getTestForCurrentTestExecResult() {
124: Test result;
125: if (DataModel.getCurrentExecutionTestResult() == null) {
126: result = null;
127: } else {
128: result = DataModel.getCurrentExecutionTestResult()
129: .getTest();
130: }
131: return result;
132: }
133:
134: }
|