renamed 'user platform' to 'project directories'

This commit is contained in:
fros4943 2007-03-23 23:33:54 +00:00
parent 8be4ba53d7
commit 61ab1ed1f3
29 changed files with 458 additions and 466 deletions

View file

@ -26,7 +26,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $Id: MoteDebugger.java,v 1.4 2007/01/09 09:19:23 fros4943 Exp $
* $Id: MoteDebugger.java,v 1.1 2007/03/23 23:33:55 fros4943 Exp $
*/
import java.awt.event.*;

View file

@ -26,7 +26,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $Id: app1.c,v 1.1 2006/08/21 12:13:09 fros4943 Exp $
* $Id: app1.c,v 1.1 2007/03/23 23:33:54 fros4943 Exp $
*/
#include "contiki.h"

View file

@ -26,7 +26,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $Id: app2.c,v 1.1 2006/08/21 12:13:09 fros4943 Exp $
* $Id: app2.c,v 1.1 2007/03/23 23:33:54 fros4943 Exp $
*/
#include "contiki.h"

View file

@ -26,7 +26,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $Id: dummy_intf.c,v 1.1 2006/08/21 12:13:13 fros4943 Exp $
* $Id: dummy_intf.c,v 1.1 2007/03/23 23:33:54 fros4943 Exp $
*/
#include "dummy_intf.h"

View file

@ -26,7 +26,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $Id: dummy_intf.h,v 1.1 2006/08/21 12:13:13 fros4943 Exp $
* $Id: dummy_intf.h,v 1.1 2007/03/23 23:33:54 fros4943 Exp $
*/
#ifndef __DUMMY_INTF_H__

View file

@ -26,7 +26,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $Id: DummyInterface.java,v 1.2 2007/01/09 09:19:54 fros4943 Exp $
* $Id: DummyInterface.java,v 1.1 2007/03/23 23:33:54 fros4943 Exp $
*/
import java.util.*;

View file

@ -26,7 +26,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $Id: MyDummyPlugin.java,v 1.2 2007/01/09 10:11:08 fros4943 Exp $
* $Id: MyDummyPlugin.java,v 1.1 2007/03/23 23:33:55 fros4943 Exp $
*/
import java.awt.event.*;

View file

@ -26,7 +26,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $Id: DummyRadioMedium.java,v 1.3 2007/02/28 09:51:11 fros4943 Exp $
* $Id: DummyRadioMedium.java,v 1.1 2007/03/23 23:33:54 fros4943 Exp $
*/
import java.util.Collection;

View file

@ -26,7 +26,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $Id: UAODVControl.java,v 1.2 2007/01/09 10:09:59 fros4943 Exp $
* $Id: UAODVControl.java,v 1.1 2007/03/23 23:33:54 fros4943 Exp $
*/
import java.awt.*;

View file

@ -26,7 +26,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $Id: VisUAODV.java,v 1.3 2007/02/28 09:50:51 fros4943 Exp $
* $Id: VisUAODV.java,v 1.1 2007/03/23 23:33:54 fros4943 Exp $
*/
import java.awt.*;

View file

@ -26,7 +26,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $Id: uaodv-example.c,v 1.2 2006/08/21 15:32:29 fros4943 Exp $
* $Id: uaodv-example.c,v 1.1 2007/03/23 23:33:54 fros4943 Exp $
*/
#include <stdio.h>

View file

@ -24,7 +24,7 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* $Id: GUI.java,v 1.32 2007/03/23 21:04:19 fros4943 Exp $
* $Id: GUI.java,v 1.33 2007/03/23 23:34:33 fros4943 Exp $
*/
package se.sics.cooja;
@ -58,7 +58,7 @@ import se.sics.cooja.plugins.*;
* Main file of COOJA Simulator. Typically contains a visualizer for the
* simulator, but can also be started without visualizer.
*
* This class loads external Java classes (in user platforms), and handles the
* This class loads external Java classes (in project directories), and handles the
* COOJA plugins as well as the configuration system. If provides a number of
* help methods for the rest of the COOJA system, and is the starting point for
* loading and saving simulation configs.
@ -88,14 +88,14 @@ public class GUI {
public static final String LOG_CONFIG_FILE = "log4j_config.xml";
/**
* Default platform configuration filename.
* Default project configuration filename.
*/
public static final String PLATFORM_DEFAULT_CONFIG_FILENAME = "/cooja_default.config";
public static final String PROJECT_DEFAULT_CONFIG_FILENAME = "/cooja_default.config";
/**
* User platform configuration filename.
* User project configuration filename.
*/
public static final String PLATFORM_CONFIG_FILENAME = "cooja.config";
public static final String PROJECT_CONFIG_FILENAME = "cooja.config";
/**
* File filter only showing saved simulations files (*.csc).
@ -140,7 +140,7 @@ public class GUI {
"CONTIKI_STANDARD_PROCESSES", "CMD_GREP_PROCESSES",
"REGEXP_PARSE_PROCESSES", "CMD_GREP_INTERFACES",
"REGEXP_PARSE_INTERFACES", "CMD_GREP_SENSORS", "REGEXP_PARSE_SENSORS",
"CONTIKI_MAIN_TEMPLATE_FILENAME", "DEFAULT_USERPLATFORMS",
"CONTIKI_MAIN_TEMPLATE_FILENAME", "DEFAULT_PROJECTDIRS",
"CORECOMM_TEMPLATE_FILENAME", "PATH_JAVAC"};
private static final int FRAME_NEW_OFFSET = 30;
@ -166,12 +166,12 @@ public class GUI {
private Vector<Plugin> startedPlugins = new Vector<Plugin>();
// Platform configuration variables
// Maintained via method reparsePlatformConfig()
private PlatformConfig platformConfig;
// Maintained via method reparseProjectConfig()
private ProjectConfig projectConfig;
private Vector<File> currentUserPlatforms = new Vector<File>();
private Vector<File> currentProjectDirs = new Vector<File>();
private ClassLoader userPlatformClassLoader;
private ClassLoader projectDirClassLoader;
private Vector<Class<? extends MoteType>> moteTypeClasses = new Vector<Class<? extends MoteType>>();
@ -202,23 +202,23 @@ public class GUI {
frame.setJMenuBar(createMenuBar());
}
// Register default user platforms
String defaultUserPlatforms = getExternalToolsSetting(
"DEFAULT_USERPLATFORMS", null);
if (defaultUserPlatforms != null) {
String[] defaultUserPlatformsArr = defaultUserPlatforms.split(";");
if (defaultUserPlatformsArr.length > 0) {
for (String defaultUserPlatform : defaultUserPlatformsArr) {
File userPlatform = new File(defaultUserPlatform);
if (userPlatform.exists() && userPlatform.isDirectory()) {
currentUserPlatforms.add(userPlatform);
// Register default project directories
String defaultProjectDirs = getExternalToolsSetting(
"DEFAULT_PROJECTDIRS", null);
if (defaultProjectDirs != null) {
String[] defaultProjectDirsArr = defaultProjectDirs.split(";");
if (defaultProjectDirsArr.length > 0) {
for (String defaultProjectDir : defaultProjectDirsArr) {
File projectDir = new File(defaultProjectDir);
if (projectDir.exists() && projectDir.isDirectory()) {
currentProjectDirs.add(projectDir);
}
}
}
}
// Load extendable parts (using current platform config)
reparsePlatformConfig();
// Load extendable parts (using current project config)
reparseProjectConfig();
// Start all standard GUI plugins
for (Class<? extends Plugin> visPluginClass : pluginClasses) {
@ -511,8 +511,8 @@ public class GUI {
menuItem.addActionListener(guiEventHandler);
menu.add(menuItem);
menuItem = new JMenuItem("Manage user platforms");
menuItem.setActionCommand("manage platforms");
menuItem = new JMenuItem("Manage project directories");
menuItem.setActionCommand("manage projects");
menuItem.addActionListener(guiEventHandler);
menu.add(menuItem);
@ -572,8 +572,8 @@ public class GUI {
*
* @param moteTypeID
* Mote type ID (if null "mtype1" will be used)
* @param userPlatforms
* GUI user platforms
* @param projectDirs
* GUI project directories
* @param sensors
* Contiki sensors (if null sensors will be scanned for)
* @param coreInterfaces
@ -592,13 +592,13 @@ public class GUI {
* @param simulationStartinge
* Simulation automatically started?
* @param filename
* Main Contiki user process file
* Main Contiki process file
* @param contikiPath
* Contiki path
* @return True if simulation was quickstarted correctly
*/
private static boolean quickStartSimulation(String moteTypeID,
Vector<String> userPlatforms, Vector<String> sensors,
Vector<String> projectDirs, Vector<String> sensors,
Vector<String> coreInterfaces, Vector<String> userProcesses,
boolean addAutostartProcesses, int numberOfNodes, double areaSideLength,
int delayTime, boolean simulationStarting, String filename,
@ -615,7 +615,7 @@ public class GUI {
JDesktopPane desktop = new JDesktopPane();
desktop.setDragMode(JDesktopPane.OUTLINE_DRAG_MODE);
GUI gui = new GUI(desktop); // loads external settings and creates initial
// platform config
// project config
// Add menu bar
frame.setSize(700, 700);
@ -630,21 +630,21 @@ public class GUI {
if (contikiPath != null)
setExternalToolsSetting("PATH_CONTIKI", contikiPath);
// Parse user platforms and create config
if (userPlatforms == null) {
userPlatforms = new Vector<String>();
userPlatforms.add(".");
// Parse project directories and create config
if (projectDirs == null) {
projectDirs = new Vector<String>();
projectDirs.add(".");
}
// XXX Should add user prop platforms as well here...
logger.info("> Reparsing user platforms and creating config");
for (String userPlatform : userPlatforms) {
logger.info(">> Adding: " + userPlatform);
gui.currentUserPlatforms.add(new File(userPlatform));
// TODO Should add user prop projects as well here...
logger.info("> Reparsing project directories and creating config");
for (String projectDir : projectDirs) {
logger.info(">> Adding: " + projectDir);
gui.currentProjectDirs.add(new File(projectDir));
}
boolean parsedPlatforms = gui.reparsePlatformConfig();
if (!parsedPlatforms) {
logger.fatal(">> Error when parsing platforms, aborting");
boolean parsedProjects = gui.reparseProjectConfig();
if (!parsedProjects) {
logger.fatal(">> Error when parsing project directories, aborting");
return false;
}
@ -688,8 +688,8 @@ public class GUI {
logger.info(">> Searching main process file: "
+ mainProcessFile.getAbsolutePath());
boolean foundFile = false;
for (String userPlatform : userPlatforms) {
mainProcessFile = new File(userPlatform, filename);
for (String projectDir : projectDirs) {
mainProcessFile = new File(projectDir, filename);
logger.info(">> Searching main process file: "
+ mainProcessFile.getAbsolutePath());
if (mainProcessFile.exists()) {
@ -707,22 +707,22 @@ public class GUI {
logger.info("> Setting up compilation arguments");
Vector<File> filesToCompile = new Vector<File>();
filesToCompile.add(mainProcessFile); // main process file
for (String userPlatform : userPlatforms)
// user platforms
filesToCompile.add(new File(userPlatform));
String[] platformSources = // platform config sources
gui.getPlatformConfig().getStringArrayValue(ContikiMoteType.class,
for (String projectDir : projectDirs)
// project directories
filesToCompile.add(new File(projectDir));
String[] projectSources = // project config sources
gui.getProjectConfig().getStringArrayValue(ContikiMoteType.class,
"C_SOURCES");
for (String platformSource : platformSources) {
if (!platformSource.equals("")) {
File file = new File(platformSource);
for (String projectSource : projectSources) {
if (!projectSource.equals("")) {
File file = new File(projectSource);
if (file.getParent() != null) {
// Find which user platform added this file
File userPlatform = gui.getPlatformConfig().getUserPlatformDefining(
ContikiMoteType.class, "C_SOURCES", platformSource);
if (userPlatform != null) {
// We found a user platform - Add directory
filesToCompile.add(new File(userPlatform.getPath(), file
// Find which project directory added this file
File projectDir = gui.getProjectConfig().getUserProjectDefining(
ContikiMoteType.class, "C_SOURCES", projectSource);
if (projectDir != null) {
// We found a project directory - Add it
filesToCompile.add(new File(projectDir.getPath(), file
.getParent()));
}
}
@ -736,10 +736,10 @@ public class GUI {
sensors = new Vector<String>();
Vector<String[]> scannedSensorInfo = ContikiMoteTypeDialog
.scanForSensors(contikiCoreDir);
for (String userPlatform : userPlatforms)
// user platforms
for (String projectDir : projectDirs)
// project directories
scannedSensorInfo.addAll(ContikiMoteTypeDialog.scanForSensors(new File(
userPlatform)));
projectDir)));
for (String[] sensorInfo : scannedSensorInfo) {
// logger.info(">> Found and added: " + sensorInfo[1] + " (" +
@ -754,10 +754,10 @@ public class GUI {
coreInterfaces = new Vector<String>();
Vector<String[]> scannedCoreInterfaceInfo = ContikiMoteTypeDialog
.scanForInterfaces(contikiCoreDir);
for (String userPlatform : userPlatforms)
// user platforms
for (String projectDir : projectDirs)
// project directories
scannedCoreInterfaceInfo.addAll(ContikiMoteTypeDialog
.scanForInterfaces(new File(userPlatform)));
.scanForInterfaces(new File(projectDir)));
for (String[] coreInterfaceInfo : scannedCoreInterfaceInfo) {
// logger.info(">> Found and added: " + coreInterfaceInfo[1] + " (" +
@ -768,7 +768,7 @@ public class GUI {
// Scan for mote interfaces
logger.info("> Loading mote interfaces");
String[] moteInterfaces = gui.getPlatformConfig().getStringArrayValue(
String[] moteInterfaces = gui.getProjectConfig().getStringArrayValue(
ContikiMoteType.class, "MOTE_INTERFACES");
Vector<Class<? extends MoteInterface>> moteIntfClasses = new Vector<Class<? extends MoteInterface>>();
for (String moteInterface : moteInterfaces) {
@ -791,10 +791,10 @@ public class GUI {
Vector<String> autostartProcesses = new Vector<String>();
Vector<String[]> scannedProcessInfo = ContikiMoteTypeDialog
.scanForProcesses(contikiCoreDir);
for (String userPlatform : userPlatforms)
// user platforms
for (String projectDir : projectDirs)
// project directories
scannedProcessInfo.addAll(ContikiMoteTypeDialog
.scanForProcesses(new File(userPlatform)));
.scanForProcesses(new File(projectDir)));
for (String[] processInfo : scannedProcessInfo) {
if (processInfo[0].equals(mainProcessFile.getName())) {
@ -885,9 +885,9 @@ public class GUI {
moteType.setDescription("Mote type: " + filename);
moteType.setContikiBaseDir(contikiBaseDir.getPath());
moteType.setContikiCoreDir(contikiCoreDir.getPath());
moteType.setUserPlatformDirs(new Vector<File>());
moteType.setProjectDirs(new Vector<File>());
moteType.setCompilationFiles(filesToCompile);
moteType.setConfig(gui.getPlatformConfig());
moteType.setConfig(gui.getProjectConfig());
moteType.setProcesses(userProcesses);
moteType.setSensors(sensors);
moteType.setCoreInterfaces(coreInterfaces);
@ -902,7 +902,7 @@ public class GUI {
simulation.setTickTime(1);
String radioMediumClassName = null;
try {
radioMediumClassName = gui.getPlatformConfig().getStringArrayValue(
radioMediumClassName = gui.getProjectConfig().getStringArrayValue(
GUI.class, "RADIOMEDIUMS")[0];
Class<? extends RadioMedium> radioMediumClass = gui.tryLoadClass(gui,
RadioMedium.class, radioMediumClassName);
@ -968,7 +968,7 @@ public class GUI {
return true;
}
// // PLATFORM CONFIG AND EXTENDABLE PARTS METHODS ////
//// PROJECT CONFIG AND EXTENDABLE PARTS METHODS ////
/**
* Register new mote type class.
@ -1104,17 +1104,17 @@ public class GUI {
}
/**
* Builds new platform configuration using current user platforms settings.
* Builds new project configuration using current project directories settings.
* Reregisters mote types, plugins, IP distributors, positioners and radio
* mediums. This method may still return true even if all classes could not be
* registered, but always returns false if all user platform configuration
* registered, but always returns false if all project directory configuration
* files were not parsed correctly.
*
* Any registered temporary plugins will be saved and reregistered.
*
* @return True if external configuration files were found and parsed OK
*/
public boolean reparsePlatformConfig() {
public boolean reparseProjectConfig() {
// Backup temporary plugins
Vector<Class<? extends Plugin>> oldTempPlugins = (Vector<Class<? extends Plugin>>) pluginClassesTemporary
.clone();
@ -1128,42 +1128,38 @@ public class GUI {
try {
// Read default configuration
platformConfig = new PlatformConfig(true);
// logger.info("Loading default platform configuration: " +
// PLATFORM_DEFAULT_CONFIG_FILENAME);
projectConfig = new ProjectConfig(true);
} catch (FileNotFoundException e) {
logger.fatal("Could not find default platform config file: "
+ PLATFORM_DEFAULT_CONFIG_FILENAME);
logger.fatal("Could not find default project config file: "
+ PROJECT_DEFAULT_CONFIG_FILENAME);
return false;
} catch (IOException e) {
logger.fatal("Error when reading default platform config file: "
+ PLATFORM_DEFAULT_CONFIG_FILENAME);
logger.fatal("Error when reading default project config file: "
+ PROJECT_DEFAULT_CONFIG_FILENAME);
return false;
}
// Append user platform configurations
for (File userPlatform : currentUserPlatforms) {
// Append project directory configurations
for (File projectDir : currentProjectDirs) {
try {
// Append config to general config
// logger.info("Appending user platform configuration: " +
// userPlatform);
platformConfig.appendUserPlatform(userPlatform);
projectConfig.appendProjectDir(projectDir);
} catch (FileNotFoundException e) {
logger.fatal("Could not find platform config file: " + userPlatform);
logger.fatal("Could not find project config file: " + projectDir);
return false;
} catch (IOException e) {
logger
.fatal("Error when reading platform config file: " + userPlatform);
.fatal("Error when reading project config file: " + projectDir);
return false;
}
}
// Create class loader
userPlatformClassLoader = createClassLoader(currentUserPlatforms);
projectDirClassLoader = createClassLoader(currentProjectDirs);
// Register mote types
String[] moteTypeClassNames = platformConfig.getStringArrayValue(GUI.class,
String[] moteTypeClassNames = projectConfig.getStringArrayValue(GUI.class,
"MOTETYPES");
if (moteTypeClassNames != null) {
for (String moteTypeClassName : moteTypeClassNames) {
@ -1183,7 +1179,7 @@ public class GUI {
registerPlugin(SimControl.class, false); // Not in menu
registerPlugin(SimInformation.class, false); // Not in menu
registerPlugin(MoteTypeInformation.class, false); // Not in menu
String[] pluginClassNames = platformConfig.getStringArrayValue(GUI.class,
String[] pluginClassNames = projectConfig.getStringArrayValue(GUI.class,
"PLUGINS");
if (pluginClassNames != null) {
for (String pluginClassName : pluginClassNames) {
@ -1212,7 +1208,7 @@ public class GUI {
}
// Register IP distributors
String[] ipDistClassNames = platformConfig.getStringArrayValue(GUI.class,
String[] ipDistClassNames = projectConfig.getStringArrayValue(GUI.class,
"IP_DISTRIBUTORS");
if (ipDistClassNames != null) {
for (String ipDistClassName : ipDistClassNames) {
@ -1230,7 +1226,7 @@ public class GUI {
}
// Register positioners
String[] positionerClassNames = platformConfig.getStringArrayValue(
String[] positionerClassNames = projectConfig.getStringArrayValue(
GUI.class, "POSITIONERS");
if (positionerClassNames != null) {
for (String positionerClassName : positionerClassNames) {
@ -1248,7 +1244,7 @@ public class GUI {
}
// Register radio mediums
String[] radioMediumsClassNames = platformConfig.getStringArrayValue(
String[] radioMediumsClassNames = projectConfig.getStringArrayValue(
GUI.class, "RADIOMEDIUMS");
if (radioMediumsClassNames != null) {
for (String radioMediumClassName : radioMediumsClassNames) {
@ -1269,21 +1265,21 @@ public class GUI {
}
/**
* Returns the current platform configuration common to the entire simulator.
* Returns the current project configuration common to the entire simulator.
*
* @return Current platform configuration
* @return Current project configuration
*/
public PlatformConfig getPlatformConfig() {
return platformConfig;
public ProjectConfig getProjectConfig() {
return projectConfig;
}
/**
* Returns the current user platforms common to the entire simulator.
* Returns the current project directories common to the entire simulator.
*
* @return Current user platforms.
* @return Current project directories.
*/
public Vector<File> getUserPlatforms() {
return currentUserPlatforms;
public Vector<File> getProjectDirs() {
return currentProjectDirs;
}
// // PLUGIN METHODS ////
@ -2322,12 +2318,12 @@ public class GUI {
Object[] plugins = startedPlugins.toArray();
for (Object plugin : plugins)
removePlugin((Plugin) plugin, false);
} else if (e.getActionCommand().equals("manage platforms")) {
Vector<File> newPlatforms = UserPlatformsDialog.showDialog(frame,
currentUserPlatforms, null);
if (newPlatforms != null) {
currentUserPlatforms = newPlatforms;
reparsePlatformConfig();
} else if (e.getActionCommand().equals("manage projects")) {
Vector<File> newProjects = ProjectDirectoriesDialog.showDialog(frame,
currentProjectDirs, null);
if (newProjects != null) {
currentProjectDirs = newProjects;
reparseProjectConfig();
}
} else if (e.getActionCommand().equals("start plugin")) {
Class<? extends VisPlugin> pluginClass = (Class<? extends VisPlugin>) ((JMenuItem) e
@ -2369,8 +2365,8 @@ public class GUI {
}
try {
if (userPlatformClassLoader != null) {
return userPlatformClassLoader.loadClass(className).asSubclass(
if (projectDirClassLoader != null) {
return projectDirClassLoader.loadClass(className).asSubclass(
classType);
}
} catch (ClassNotFoundException e) {
@ -2379,57 +2375,57 @@ public class GUI {
return null;
}
public ClassLoader createUserPlatformClassLoader(Vector<File> platformsList) {
if (userPlatformClassLoader == null) {
reparsePlatformConfig();
public ClassLoader createProjectDirClassLoader(Vector<File> projectsDirs) {
if (projectDirClassLoader == null) {
reparseProjectConfig();
}
return createClassLoader(userPlatformClassLoader, platformsList);
return createClassLoader(projectDirClassLoader, projectsDirs);
}
private ClassLoader createClassLoader(Vector<File> currentUserPlatforms) {
private ClassLoader createClassLoader(Vector<File> currentProjectDirs) {
return createClassLoader(ClassLoader.getSystemClassLoader(),
currentUserPlatforms);
currentProjectDirs);
}
private File findJarFile(File platformPath, String jarfile) {
private File findJarFile(File projectDir, String jarfile) {
File fp = new File(jarfile);
if (!fp.exists()) {
fp = new File(platformPath, jarfile);
fp = new File(projectDir, jarfile);
}
if (!fp.exists()) {
fp = new File(platformPath, "java/" + jarfile);
fp = new File(projectDir, "java/" + jarfile);
}
if (!fp.exists()) {
fp = new File(platformPath, "java/lib/" + jarfile);
fp = new File(projectDir, "java/lib/" + jarfile);
}
if (!fp.exists()) {
fp = new File(platformPath, "lib/" + jarfile);
fp = new File(projectDir, "lib/" + jarfile);
}
return fp.exists() ? fp : null;
}
private ClassLoader createClassLoader(ClassLoader parent,
Vector<File> platformsList) {
if (platformsList == null || platformsList.isEmpty()) {
Vector<File> projectDirs) {
if (projectDirs == null || projectDirs.isEmpty()) {
return parent;
}
// Combine class loader from all user platforms (including any
// Combine class loader from all project directories (including any
// specified JAR files)
ArrayList<URL> urls = new ArrayList<URL>();
for (int j = platformsList.size() - 1; j >= 0; j--) {
File userPlatform = platformsList.get(j);
for (int j = projectDirs.size() - 1; j >= 0; j--) {
File projectDir = projectDirs.get(j);
try {
urls.add((new File(userPlatform, "java")).toURL());
urls.add((new File(projectDir, "java")).toURL());
// Read configuration to check if any JAR files should be loaded
PlatformConfig userPlatformConfig = new PlatformConfig(false);
userPlatformConfig.appendUserPlatform(userPlatform);
String[] platformJarFiles = userPlatformConfig.getStringArrayValue(
ProjectConfig projectConfig = new ProjectConfig(false);
projectConfig.appendProjectDir(projectDir);
String[] projectJarFiles = projectConfig.getStringArrayValue(
GUI.class, "JARFILES");
if (platformJarFiles != null && platformJarFiles.length > 0) {
for (String jarfile : platformJarFiles) {
File jarpath = findJarFile(userPlatform, jarfile);
if (projectJarFiles != null && projectJarFiles.length > 0) {
for (String jarfile : projectJarFiles) {
File jarpath = findJarFile(projectDir, jarfile);
if (jarpath == null) {
throw new FileNotFoundException(jarfile);
}
@ -2438,7 +2434,7 @@ public class GUI {
}
} catch (Exception e) {
logger.fatal("Error when trying to read JAR-file in " + userPlatform
logger.fatal("Error when trying to read JAR-file in " + projectDir
+ ": " + e);
}
}
@ -2497,7 +2493,7 @@ public class GUI {
String filename = args[0].substring("-quickstart=".length());
String moteTypeID = "mtype1";
Vector<String> userPlatforms = null;
Vector<String> projectDirs = null;
Vector<String> sensors = null;
Vector<String> coreInterfaces = null;
Vector<String> userProcesses = null;
@ -2514,12 +2510,12 @@ public class GUI {
if (args[i].startsWith("-id=")) {
moteTypeID = args[i].substring("-id=".length());
} else if (args[i].startsWith("-platforms=")) {
String arg = args[i].substring("-platforms=".length());
} else if (args[i].startsWith("-projects=")) {
String arg = args[i].substring("-projects=".length());
String[] argArray = arg.split(",");
userPlatforms = new Vector<String>();
projectDirs = new Vector<String>();
for (String argValue : argArray)
userPlatforms.add(argValue);
projectDirs.add(argValue);
} else if (args[i].startsWith("-sensors=")) {
String arg = args[i].substring("-sensors=".length());
@ -2570,7 +2566,7 @@ public class GUI {
}
}
boolean ok = quickStartSimulation(moteTypeID, userPlatforms, sensors,
boolean ok = quickStartSimulation(moteTypeID, projectDirs, sensors,
coreInterfaces, userProcesses, addAutostartProcesses, numberOfNodes,
areaSideLength, delayTime, startSimulation, filename, contikiPath);
if (!ok)

View file

@ -24,7 +24,7 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* $Id: MoteType.java,v 1.3 2007/01/10 14:57:42 fros4943 Exp $
* $Id: MoteType.java,v 1.4 2007/03/23 23:34:33 fros4943 Exp $
*/
package se.sics.cooja;
@ -86,11 +86,11 @@ public interface MoteType {
public JPanel getTypeVisualizer();
/**
* Returns this mote type's platform configuration.
* Returns this mote type's project configuration.
*
* @return Platform configuration
* @return Project configuration
*/
public PlatformConfig getConfig();
public ProjectConfig getConfig();
/**
* Generates a mote of this mote type.

View file

@ -26,7 +26,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $Id: PlatformConfig.java,v 1.5 2007/01/16 10:32:55 fros4943 Exp $
* $Id: ProjectConfig.java,v 1.1 2007/03/23 23:34:33 fros4943 Exp $
*/
package se.sics.cooja;
@ -36,13 +36,13 @@ import java.util.*;
import org.apache.log4j.Logger;
/**
* A platform configuration may hold the configuration for one or several user
* platforms as well as a general simulator configuration.
* A project configuration may hold the configuration for one or several project
* directories as well as a general simulator configuration.
*
* The configuration for a user platform may for example consist of which
* plugins, interfaces and processes that the specific platform supplies. Each
* user platform configuration is read from the property file cooja.config, a
* file which is required in each user platform.
* The configuration for a project directory may for example consist of which
* plugins, interfaces and processes that the specific project directory supplies.
* Each project directory configuration is read from the property file cooja.config, a
* file which is required in each project directory.
*
* Values can be fetched as String, Boolean, Integer, Double or String array.
*
@ -67,8 +67,8 @@ import org.apache.log4j.Logger;
*
* will result in the final value "a b c d e".
*
* The simulator will hold a merged platform configuration, depending on which
* user platforms are used. Additionally. each mote type may also have a
* The simulator will hold a merged project configuration, depending on which
* project directories are used. Additionally. each mote type may also have a
* configuration of its own, that differs from the general simulator
* configuration.
*
@ -83,14 +83,14 @@ import org.apache.log4j.Logger;
*
* @author Fredrik Osterlind
*/
public class PlatformConfig {
private static Logger logger = Logger.getLogger(PlatformConfig.class);
public class ProjectConfig {
private static Logger logger = Logger.getLogger(ProjectConfig.class);
private Properties myConfig = null;
private Vector<File> myUserPlatformHistory = null;
private Vector<File> myProjectDirHistory = null;
/**
* Creates new platform configuration.
* Creates new project configuration.
*
* @param useDefault
* If true the default configuration will be loaded
@ -99,15 +99,15 @@ public class PlatformConfig {
* @throws IOException
* Stream read error
*/
public PlatformConfig(boolean useDefault) throws IOException,
public ProjectConfig(boolean useDefault) throws IOException,
FileNotFoundException {
// Create empty configuration
myConfig = new Properties();
myUserPlatformHistory = new Vector<File>();
myProjectDirHistory = new Vector<File>();
if (useDefault) {
InputStream input = GUI.class
.getResourceAsStream(GUI.PLATFORM_DEFAULT_CONFIG_FILENAME);
.getResourceAsStream(GUI.PROJECT_DEFAULT_CONFIG_FILENAME);
if (input != null) {
try {
appendConfigStream(input);
@ -115,37 +115,37 @@ public class PlatformConfig {
input.close();
}
} else {
throw new FileNotFoundException(GUI.PLATFORM_DEFAULT_CONFIG_FILENAME);
throw new FileNotFoundException(GUI.PROJECT_DEFAULT_CONFIG_FILENAME);
}
}
}
/**
* Appends the given user platform's config file. Thus method also saved a
* local history of which user platforms has been loaded.
* Appends the given project directory's config file. This method also saves a
* local history of which project directories has been loaded.
*
* @param userPlatform
* User platform
* @param projectDir
* Project directory
* @return True if loaded OK
* @throws FileNotFoundException
* If file was not found
* @throws IOException
* Stream read error
*/
public boolean appendUserPlatform(File userPlatform)
public boolean appendProjectDir(File projectDir)
throws FileNotFoundException, IOException {
File userPlatformConfig = new File(userPlatform.getPath(),
GUI.PLATFORM_CONFIG_FILENAME);
myUserPlatformHistory.add(userPlatform);
return appendConfigFile(userPlatformConfig);
File projectConfig = new File(projectDir.getPath(),
GUI.PROJECT_CONFIG_FILENAME);
myProjectDirHistory.add(projectDir);
return appendConfigFile(projectConfig);
}
/**
* Returns the user platform earlier appended to this configuration that
* Returns the project directory earlier appended to this configuration that
* defined the given key. If the key is of an array format and the given array
* element is non-null, then the user platform that added this element will be
* returned instead. If no such user platform can be found null is returned
* element is non-null, then the project directory that added this element will be
* returned instead. If no such project directory can be found null is returned
* instead.
*
* @param callingClass
@ -154,9 +154,9 @@ public class PlatformConfig {
* Key
* @param arrayElement
* Value or array element
* @return User platform defining arguments or null
* @return Project directory defining arguments or null
*/
public File getUserPlatformDefining(Class callingClass, String key, String arrayElement) {
public File getUserProjectDefining(Class callingClass, String key, String arrayElement) {
// Check that key really exists in current config
if (getStringValue(callingClass, key, null) == null) {
@ -176,30 +176,30 @@ public class PlatformConfig {
}
}
// Search in all user platform in reversed order
// Search in all project directory in reversed order
try {
PlatformConfig remadeConfig = new PlatformConfig(false);
ProjectConfig remadeConfig = new ProjectConfig(false);
for (int i=myUserPlatformHistory.size()-1; i >= 0; i--) {
remadeConfig.appendUserPlatform(myUserPlatformHistory.get(i));
for (int i=myProjectDirHistory.size()-1; i >= 0; i--) {
remadeConfig.appendProjectDir(myProjectDirHistory.get(i));
if (arrayElement != null) {
// Look for array
String[] array = remadeConfig.getStringArrayValue(callingClass, key);
for (int c=0; c < array.length; c++) {
if (array[c].equals(arrayElement))
return myUserPlatformHistory.get(i);
return myProjectDirHistory.get(i);
}
} else {
// Look for key
if (remadeConfig.getStringValue(callingClass, key, null) != null) {
return myUserPlatformHistory.get(i);
return myProjectDirHistory.get(i);
}
}
}
} catch (Exception e) {
logger.fatal("Exception when searching in user platform history: " + e);
logger.fatal("Exception when searching in project directory history: " + e);
return null;
}
@ -211,7 +211,7 @@ public class PlatformConfig {
* If a property already exists it will be overwritten, unless the new value
* begins with a '+' in which case the old value will be extended.
*
* WARNING! The user platform history will not be saved if this method is
* WARNING! The project directory history will not be saved if this method is
* called, instead the appendUserPlatform method should be used.
*
* @param propertyFile
@ -234,7 +234,7 @@ public class PlatformConfig {
* the new value begins with a '+' in which case the old value will be
* extended.
*
* WARNING! The user platform history will not be saved if this method is
* WARNING! The project directory history will not be saved if this method is
* called, instead the appendUserPlatform method should be used.
*
* @param configFileStream
@ -480,11 +480,11 @@ public class PlatformConfig {
return getBooleanValue(callingClass, id, false);
}
public PlatformConfig clone() {
public ProjectConfig clone() {
try {
PlatformConfig clone = new PlatformConfig(false);
ProjectConfig clone = new ProjectConfig(false);
clone.myConfig = (Properties) this.myConfig.clone();
clone.myUserPlatformHistory = (Vector<File>) this.myUserPlatformHistory.clone();
clone.myProjectDirHistory = (Vector<File>) this.myProjectDirHistory.clone();
return clone;
} catch (Exception e) {
return null;

View file

@ -26,7 +26,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $Id: VisPlugin.java,v 1.4 2007/01/10 14:57:42 fros4943 Exp $
* $Id: VisPlugin.java,v 1.5 2007/03/23 23:34:33 fros4943 Exp $
*/
package se.sics.cooja;
@ -42,8 +42,8 @@ import org.jdom.Element;
* visualizers. By extending JInternalFrame, the visual apperence is decided by
* the plugin itself.
*
* To add a new plugin to the simulator environment either add it via a user
* platform or by altering the standard configuration files.
* To add a new plugin to the simulator environment either add it via a project
* directory or by altering the standard configuration files.
*
* For example how to implement a plugin see plugins SimControl or Visualizer2D.
*

View file

@ -26,20 +26,18 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $Id: ContikiMoteType.java,v 1.7 2007/01/09 10:09:19 fros4943 Exp $
* $Id: ContikiMoteType.java,v 1.8 2007/03/23 23:34:33 fros4943 Exp $
*/
package se.sics.cooja.contikimote;
import java.awt.BorderLayout;
import java.awt.Component;
import java.awt.Dimension;
import java.io.*;
import java.security.*;
import java.util.*;
import java.util.regex.*;
import javax.swing.*;
import org.apache.log4j.Logger;
import org.jdom.Element;
@ -52,7 +50,7 @@ import se.sics.cooja.*;
* <p>
* This type also contains information about which processes, sensors and core
* interfaces a mote of this type has, as well as where the Contiki OS, COOJA
* core files and an optional user platform are located.
* core files and optional mote type specific project directories are located.
* <p>
* All core communication with the Contiki mote should be via this class. When a
* mote type is created it allocates a CoreComm to be used with this type, and
@ -108,7 +106,7 @@ public class ContikiMoteType implements MoteType {
private String description = null;
private String contikiBaseDir = null;
private String contikiCoreDir = null;
private Vector<File> userPlatformDirs = null;
private Vector<File> projectDirs = null;
private Vector<File> compilationFiles = null;
private Vector<String> processes = null;
private Vector<String> sensors = null;
@ -120,7 +118,7 @@ public class ContikiMoteType implements MoteType {
private Simulation mySimulation = null;
// Type specific class configuration
private PlatformConfig myConfig = null;
private ProjectConfig myConfig = null;
// Core communication variables
private String libraryClassName = null;
@ -834,36 +832,36 @@ public class ContikiMoteType implements MoteType {
}
/**
* Returns user platform directories
* Returns mote type specific project directories
*
* @return User platform directories
* @return Project directories
*/
public Vector<File> getUserPlatformDirs() {
return userPlatformDirs;
public Vector<File> getProjectDirs() {
return projectDirs;
}
/**
* Sets user platform directories.
* Sets mote type specific project directories.
*
* @param dirs
* New user platform directories
* New project directories
*/
public void setUserPlatformDirs(Vector<File> dirs) {
userPlatformDirs = dirs;
public void setProjectDirs(Vector<File> dirs) {
projectDirs = dirs;
}
public PlatformConfig getConfig() {
public ProjectConfig getConfig() {
return myConfig;
}
/**
* Sets mote type platform configuration. This may differ from the general
* simulator platform configuration.
* Sets mote type project configuration. This may differ from the general
* simulator project configuration.
*
* @param moteTypeConfig
* Platform configuration
* Project configuration
*/
public void setConfig(PlatformConfig moteTypeConfig) {
public void setConfig(ProjectConfig moteTypeConfig) {
myConfig = moteTypeConfig;
}
@ -1100,10 +1098,10 @@ public class ContikiMoteType implements MoteType {
element.setText(getContikiCoreDir());
config.add(element);
// User platform directory
for (File userPlatform: userPlatformDirs) {
element = new Element("userplatformdir");
element.setText(userPlatform.getPath());
// User project directory
for (File projectDir: projectDirs) {
element = new Element("projectdir");
element.setText(projectDir.getPath());
config.add(element);
}
@ -1152,7 +1150,7 @@ public class ContikiMoteType implements MoteType {
public boolean setConfigXML(Simulation simulation,
Collection<Element> configXML, boolean visAvailable) {
userPlatformDirs = new Vector<File>();
projectDirs = new Vector<File>();
compilationFiles = new Vector<File>();
processes = new Vector<String>();
sensors = new Vector<String>();
@ -1171,8 +1169,8 @@ public class ContikiMoteType implements MoteType {
contikiBaseDir = element.getText();
} else if (name.equals("contikicoredir")) {
contikiCoreDir = element.getText();
} else if (name.equals("userplatformdir")) {
userPlatformDirs.add(new File(element.getText()));
} else if (name.equals("projectdir")) {
projectDirs.add(new File(element.getText()));
} else if (name.equals("compilefile")) {
compilationFiles.add(new File(element.getText()));
} else if (name.equals("process")) {
@ -1197,14 +1195,14 @@ public class ContikiMoteType implements MoteType {
}
// Create class specific configuration
myConfig = simulation.getGUI().getPlatformConfig().clone();
myConfig = simulation.getGUI().getProjectConfig().clone();
// Merge with all user platform configs (if any)
for (File userPlatform : userPlatformDirs) {
// Merge with all project directory configs (if any)
for (File projectDir : projectDirs) {
try {
myConfig.appendUserPlatform(userPlatform);
myConfig.appendProjectDir(projectDir);
} catch (Exception ex) {
logger.fatal("Error when parsing user platform config: " + ex);
logger.fatal("Error when parsing project directory config: " + ex);
return false;
}
}

View file

@ -26,7 +26,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $Id: ContikiMoteTypeDialog.java,v 1.21 2007/03/23 11:16:53 fros4943 Exp $
* $Id: ContikiMoteTypeDialog.java,v 1.22 2007/03/23 23:34:33 fros4943 Exp $
*/
package se.sics.cooja.contikimote;
@ -44,7 +44,7 @@ import org.apache.log4j.Logger;
import se.sics.cooja.*;
import se.sics.cooja.dialogs.MessageList;
import se.sics.cooja.dialogs.UserPlatformsDialog;
import se.sics.cooja.dialogs.ProjectDirectoriesDialog;
/**
* A dialog for configuring Contiki mote types and compiling Contiki mote type
@ -79,7 +79,7 @@ public class ContikiMoteTypeDialog extends JDialog {
private ContikiMoteType myMoteType = null;
private JTextField textID, textOutputFiles, textDescription, textContikiDir,
textCoreDir, textUserPlatforms;
textCoreDir, textProjectDirs;
private JButton createButton, testButton, rescanButton;
private JCheckBox symbolsCheckBox;
@ -96,10 +96,8 @@ public class ContikiMoteTypeDialog extends JDialog {
private boolean compilationSucceded = false; // Did compilation succeed?
private boolean libraryCreatedOK = false; // Was a library created?
private PlatformConfig newMoteTypeConfig = null; // Mote type platform config
private Vector<File> moteTypeUserPlatforms = new Vector<File>(); // Mote type
// user
// platforms
private ProjectConfig newMoteTypeConfig = null; // Mote type project config
private Vector<File> moteTypeProjectDirs = new Vector<File>(); // Mote type project directories
private Vector<File> compilationFiles = null;
@ -210,18 +208,18 @@ public class ContikiMoteTypeDialog extends JDialog {
myDialog.textCoreDir.setText(moteTypeToConfigure.getContikiCoreDir());
}
// Set preset user platform directories of mote type
if (moteTypeToConfigure.getUserPlatformDirs() != null) {
myDialog.moteTypeUserPlatforms = moteTypeToConfigure
.getUserPlatformDirs();
String userPlatformText = null;
for (File userPlatform : myDialog.moteTypeUserPlatforms) {
if (userPlatformText == null)
userPlatformText = "'" + userPlatform.getPath() + "'";
// Set preset project directories of mote type
if (moteTypeToConfigure.getProjectDirs() != null) {
myDialog.moteTypeProjectDirs = moteTypeToConfigure
.getProjectDirs();
String projectText = null;
for (File projectDir : myDialog.moteTypeProjectDirs) {
if (projectText == null)
projectText = "'" + projectDir.getPath() + "'";
else
userPlatformText += ", '" + userPlatform.getPath() + "'";
projectText += ", '" + projectDir.getPath() + "'";
}
myDialog.textUserPlatforms.setText(userPlatformText);
myDialog.textProjectDirs.setText(projectText);
}
// Set preset "use symbols"
@ -580,21 +578,21 @@ public class ContikiMoteTypeDialog extends JDialog {
mainPane.add(Box.createRigidArea(new Dimension(0, 5)));
// COOJA user platform dir
// COOJA project directory
smallPane = new JPanel();
smallPane.setAlignmentX(Component.LEFT_ALIGNMENT);
smallPane.setLayout(new BoxLayout(smallPane, BoxLayout.X_AXIS));
label = new JLabel("Mote type user platforms");
label = new JLabel("Mote type project directories");
label.setPreferredSize(new Dimension(LABEL_WIDTH, LABEL_HEIGHT));
textField = new JTextField();
textField.setText("");
textField.setEditable(false);
textUserPlatforms = textField;
textProjectDirs = textField;
label.setLabelFor(textField);
button = new JButton("Manage");
button.setActionCommand("manageuserplatforms");
button.setActionCommand("manageprojectdirs");
button.addActionListener(myEventHandler);
smallPane.add(label);
@ -1049,24 +1047,24 @@ public class ContikiMoteTypeDialog extends JDialog {
compilationThread = new Thread(new Runnable() {
public void run() {
// Add all user platform directories
// Add all project directories
compilationFiles = (Vector<File>) myGUI
.getUserPlatforms().clone();
compilationFiles.addAll(moteTypeUserPlatforms);
.getProjectDirs().clone();
compilationFiles.addAll(moteTypeProjectDirs);
// Add source files from platform configs
// Add source files from project configs
String[] projectSourceFiles = newMoteTypeConfig.getStringArrayValue(
ContikiMoteType.class, "C_SOURCES");
for (String projectSourceFile : projectSourceFiles) {
if (!projectSourceFile.equals("")) {
File file = new File(projectSourceFile);
if (file.getParent() != null) {
// Find which user platform added this file
File userPlatform = newMoteTypeConfig.getUserPlatformDefining(
// Find which project directory added this file
File projectDir = newMoteTypeConfig.getUserProjectDefining(
ContikiMoteType.class, "C_SOURCES", projectSourceFile);
if (userPlatform != null) {
// We found a user platform - Add directory
compilationFiles.add(new File(userPlatform.getPath(), file
if (projectDir != null) {
// We found a project directory; add it to path
compilationFiles.add(new File(projectDir.getPath(), file
.getParent()));
}
}
@ -1704,15 +1702,15 @@ public class ContikiMoteTypeDialog extends JDialog {
boolean foundFile = sourceFile.exists();
if (!foundFile)
for (File userPlatform : myGUI.getUserPlatforms()) {
sourceFile = new File(userPlatform, sourceFilename);
for (File projectDir : myGUI.getProjectDirs()) {
sourceFile = new File(projectDir, sourceFilename);
if (foundFile = sourceFile.exists())
break;
}
if (!foundFile)
for (File userPlatform : moteTypeUserPlatforms) {
sourceFile = new File(userPlatform, sourceFilename);
for (File projectDir : moteTypeProjectDirs) {
sourceFile = new File(projectDir, sourceFilename);
if (foundFile = sourceFile.exists())
break;
}
@ -1873,13 +1871,13 @@ public class ContikiMoteTypeDialog extends JDialog {
.setToolTipText("Compilation may not work correctly with spaced paths");
}
// Warn if spaces in a user platform path
textUserPlatforms.setBackground(Color.WHITE);
textUserPlatforms.setToolTipText(null);
for (File userPlatform : moteTypeUserPlatforms) {
if (userPlatform.getPath().contains(" ")) {
textUserPlatforms.setBackground(Color.ORANGE);
textUserPlatforms
// Warn if spaces in a project directory path
textProjectDirs.setBackground(Color.WHITE);
textProjectDirs.setToolTipText(null);
for (File projectDir : moteTypeProjectDirs) {
if (projectDir.getPath().contains(" ")) {
textProjectDirs.setBackground(Color.ORANGE);
textProjectDirs
.setToolTipText("Compilation may not work correctly with spaced paths");
}
}
@ -1897,11 +1895,11 @@ public class ContikiMoteTypeDialog extends JDialog {
}
/**
* Scans Contiki base + (optional) user platform for Contiki processes,
* Scans Contiki base + (optional) project directories for Contiki processes,
* sensors and core interfaces. The new mote type config is recreated every
* time this method is run. If a user platform is specified, it looks for a
* special class config file there, and appends it to the new mote type
* config. By reading that config all available mote interfaces are parsed -
* time this method is run. If any project directories are specified, it reads
* the configuration files, and appends it to the new mote type config.
* By reading those configs all available mote interfaces are parsed -
* which will all be selected initially. This method also selects the core
* interfaces needed by the mote interfaces.
*
@ -1919,7 +1917,7 @@ public class ContikiMoteTypeDialog extends JDialog {
pathErrorFound = true;
}
// Check that cooja main platform path is correct
// Check that Cooja main platform path is correct
if (!new File(myDialog.textCoreDir.getText()).isDirectory()) {
// Cooja main platform specified does not exist
textContikiDir.setBackground(Color.RED);
@ -1929,14 +1927,14 @@ public class ContikiMoteTypeDialog extends JDialog {
pathErrorFound = true;
}
// Check that all user platforms are valid
for (File userPlatform : moteTypeUserPlatforms) {
File userPlatformConfig = new File(userPlatform.getPath(),
GUI.PLATFORM_CONFIG_FILENAME);
if (!userPlatformConfig.exists()) {
textUserPlatforms.setBackground(Color.RED);
textUserPlatforms.setToolTipText("Invalid user platform: "
+ userPlatform);
// Check that all project directories are valid
for (File projectDir : moteTypeProjectDirs) {
File userProjectConfig = new File(projectDir.getPath(),
GUI.PROJECT_CONFIG_FILENAME);
if (!userProjectConfig.exists()) {
textProjectDirs.setBackground(Color.RED);
textProjectDirs.setToolTipText("Invalid project directory: "
+ projectDir);
pathErrorFound = true;
}
}
@ -2033,7 +2031,7 @@ public class ContikiMoteTypeDialog extends JDialog {
myMoteType.setDescription(textDescription.getText());
myMoteType.setContikiBaseDir(textContikiDir.getText());
myMoteType.setContikiCoreDir(textCoreDir.getText());
myMoteType.setUserPlatformDirs(moteTypeUserPlatforms);
myMoteType.setProjectDirs(moteTypeProjectDirs);
myMoteType.setCompilationFiles(compilationFiles);
myMoteType.setConfig(newMoteTypeConfig);
@ -2099,20 +2097,20 @@ public class ContikiMoteTypeDialog extends JDialog {
}
createButton.setEnabled(libraryCreatedOK = false);
pathsWereUpdated();
} else if (e.getActionCommand().equals("manageuserplatforms")) {
Vector<File> newPlatforms = UserPlatformsDialog.showDialog(
ContikiMoteTypeDialog.this, moteTypeUserPlatforms, myGUI
.getUserPlatforms());
if (newPlatforms != null) {
moteTypeUserPlatforms = newPlatforms;
String userPlatformText = null;
for (File userPlatform : newPlatforms) {
if (userPlatformText == null)
userPlatformText = "'" + userPlatform.getPath() + "'";
} else if (e.getActionCommand().equals("manageprojectdirs")) {
Vector<File> newProjectDirs = ProjectDirectoriesDialog.showDialog(
ContikiMoteTypeDialog.this, moteTypeProjectDirs, myGUI
.getProjectDirs());
if (newProjectDirs != null) {
moteTypeProjectDirs = newProjectDirs;
String projectDirText = null;
for (File projectDir : newProjectDirs) {
if (projectDirText == null)
projectDirText = "'" + projectDir.getPath() + "'";
else
userPlatformText += " + '" + userPlatform.getPath() + "'";
projectDirText += " + '" + projectDir.getPath() + "'";
}
textUserPlatforms.setText(userPlatformText);
textProjectDirs.setText(projectDirText);
createButton.setEnabled(libraryCreatedOK = false);
pathsWereUpdated();
@ -2126,15 +2124,15 @@ public class ContikiMoteTypeDialog extends JDialog {
processes.addAll(ContikiMoteTypeDialog.scanForProcesses(new File(
textCoreDir.getText())));
// If user platforms exists, scan those too
for (File userPlatform : myGUI.getUserPlatforms()) {
// If project directories exists, scan those too
for (File projectDir : myGUI.getProjectDirs()) {
processes
.addAll(ContikiMoteTypeDialog.scanForProcesses(userPlatform));
.addAll(ContikiMoteTypeDialog.scanForProcesses(projectDir));
}
if (moteTypeUserPlatforms != null) {
for (File userPlatform : moteTypeUserPlatforms) {
if (moteTypeProjectDirs != null) {
for (File projectDir : moteTypeProjectDirs) {
processes.addAll(ContikiMoteTypeDialog
.scanForProcesses(userPlatform));
.scanForProcesses(projectDir));
}
}
@ -2168,13 +2166,13 @@ public class ContikiMoteTypeDialog extends JDialog {
sensors.addAll(ContikiMoteTypeDialog.scanForSensors(new File(
textCoreDir.getText())));
// If user platforms exists, scan those too
for (File userPlatform : myGUI.getUserPlatforms()) {
sensors.addAll(ContikiMoteTypeDialog.scanForSensors(userPlatform));
// If project directories exists, scan those too
for (File projectDir : myGUI.getProjectDirs()) {
sensors.addAll(ContikiMoteTypeDialog.scanForSensors(projectDir));
}
if (moteTypeUserPlatforms != null) {
for (File userPlatform : moteTypeUserPlatforms) {
sensors.addAll(ContikiMoteTypeDialog.scanForSensors(userPlatform));
if (moteTypeProjectDirs != null) {
for (File projectDir : moteTypeProjectDirs) {
sensors.addAll(ContikiMoteTypeDialog.scanForSensors(projectDir));
}
}
@ -2203,15 +2201,15 @@ public class ContikiMoteTypeDialog extends JDialog {
interfaces.addAll(ContikiMoteTypeDialog.scanForInterfaces(new File(
textCoreDir.getText())));
// If user platforms exists, scan those too
for (File userPlatform : myGUI.getUserPlatforms()) {
// If project directories exists, scan those too
for (File projectDir : myGUI.getProjectDirs()) {
interfaces.addAll(ContikiMoteTypeDialog
.scanForInterfaces(userPlatform));
.scanForInterfaces(projectDir));
}
if (moteTypeUserPlatforms != null) {
for (File userPlatform : moteTypeUserPlatforms) {
if (moteTypeProjectDirs != null) {
for (File projectDir : moteTypeProjectDirs) {
interfaces.addAll(ContikiMoteTypeDialog
.scanForInterfaces(userPlatform));
.scanForInterfaces(projectDir));
}
}
@ -2237,14 +2235,14 @@ public class ContikiMoteTypeDialog extends JDialog {
moteInterfacePanel.removeAll();
// Clone general simulator config
newMoteTypeConfig = myGUI.getPlatformConfig().clone();
newMoteTypeConfig = myGUI.getProjectConfig().clone();
// Merge with all user platform configs (if any)
for (File userPlatform : moteTypeUserPlatforms) {
// Merge with all project directory configs (if any)
for (File projectDir : moteTypeProjectDirs) {
try {
newMoteTypeConfig.appendUserPlatform(userPlatform);
newMoteTypeConfig.appendProjectDir(projectDir);
} catch (Exception ex) {
logger.fatal("Error when parsing user platform config: " + ex);
logger.fatal("Error when parsing project directory config: " + ex);
return;
}
}
@ -2255,7 +2253,7 @@ public class ContikiMoteTypeDialog extends JDialog {
Vector<Class<? extends MoteInterface>> moteIntfClasses = new Vector<Class<? extends MoteInterface>>();
ClassLoader classLoader = myGUI
.createUserPlatformClassLoader(moteTypeUserPlatforms);
.createProjectDirClassLoader(moteTypeProjectDirs);
// Find and load the mote interface classes
for (String moteInterface : moteInterfaces) {

View file

@ -26,7 +26,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $Id: UserPlatformsDialog.java,v 1.7 2007/03/23 21:57:24 fros4943 Exp $
* $Id: ProjectDirectoriesDialog.java,v 1.1 2007/03/23 23:34:33 fros4943 Exp $
*/
package se.sics.cooja.dialogs;
@ -42,99 +42,99 @@ import javax.swing.*;
import org.apache.log4j.Logger;
import se.sics.cooja.GUI;
import se.sics.cooja.PlatformConfig;
import se.sics.cooja.ProjectConfig;
/**
* This dialog allows a user to manage the user platforms configuration. User
* platforms can be added, removed or reordered. The resulting platform
* This dialog allows a user to manage the project directory configurations. Project
* directories can be added, removed or reordered. The resulting
* configuration can also be viewed.
*
* This dialog reads from the external platform configuration files in each user
* platform, as well as from any specified default configuration files.
* This dialog reads from the external project configuration files in each project
* directory, as well as from any specified default configuration files.
*
* @author Fredrik Osterlind
*/
public class UserPlatformsDialog extends JDialog {
public class ProjectDirectoriesDialog extends JDialog {
private static final long serialVersionUID = 1L;
private static Logger logger = Logger.getLogger(UserPlatformsDialog.class);
private static Logger logger = Logger.getLogger(ProjectDirectoriesDialog.class);
private List changablePlatformsList = new List();
private List fixedPlatformsList = null;
private Vector<File> fixedUserPlatforms = null;
private Vector<File> changableUserPlatforms = null;
private List changableProjectsList = new List();
private List fixedProjectsList = null;
private Vector<File> changableProjects = null;
private Vector<File> fixedProjects = null;
private UserPlatformsDialog myDialog;
private ProjectDirectoriesDialog myDialog;
private Frame myParentFrame = null;
private Dialog myParentDialog = null;
/**
* Allows user to alter the given user platforms list by adding new,
* reordering or removing user platforms. Only the changable user platforms
* may be changed,
* Allows user to alter the given project directories list by adding new,
* reordering or removing project directories. Only the changable project directories
* can be altered.
*
* @param parentFrame
* Parent frame
* @param changablePlatforms
* Changeable user platforms
* @param fixedPlatforms
* Fixed user platform
* @return Null if dialog aborted, else the new CHANGEABLE user platform list.
* @param changableProjects
* Changeable project directories
* @param fixedProjects
* Fixed project directory
* @return Null if dialog aborted, else the new CHANGEABLE project directory list.
*/
public static Vector<File> showDialog(Frame parentFrame,
Vector<File> changablePlatforms, Vector<File> fixedPlatforms) {
UserPlatformsDialog myDialog = new UserPlatformsDialog(parentFrame,
changablePlatforms, fixedPlatforms);
Vector<File> changableProjects, Vector<File> fixedProjects) {
ProjectDirectoriesDialog myDialog = new ProjectDirectoriesDialog(parentFrame,
changableProjects, fixedProjects);
myDialog.setLocationRelativeTo(parentFrame);
if (myDialog != null) {
myDialog.setVisible(true);
}
return myDialog.changableUserPlatforms;
return myDialog.changableProjects;
}
/**
* Allows user to alter the given user platforms list by adding new,
* reordering or removing user platforms. Only the changable user platforms
* may be changed,
* Allows user to alter the given project directories list by adding new,
* reordering or removing project directories. Only the changable project directories
* may be altered.
*
* @param parentDialog
* Parent dialog
* @param changablePlatforms
* Changeable user platforms
* @param fixedPlatforms
* Fixed user platform
* @return Null if dialog aborted, else the new CHANGEABLE user platform list.
* @param changableProjects
* Changeable project directories
* @param fixedProjects
* Fixed project directory
* @return Null if dialog aborted, else the new CHANGEABLE project directory list.
*/
public static Vector<File> showDialog(Dialog parentDialog,
Vector<File> changablePlatforms, Vector<File> fixedPlatforms) {
UserPlatformsDialog myDialog = new UserPlatformsDialog(parentDialog,
changablePlatforms, fixedPlatforms);
Vector<File> changableProjects, Vector<File> fixedProjects) {
ProjectDirectoriesDialog myDialog = new ProjectDirectoriesDialog(parentDialog,
changableProjects, fixedProjects);
myDialog.setLocationRelativeTo(parentDialog);
if (myDialog != null) {
myDialog.setVisible(true);
}
return myDialog.changableUserPlatforms;
return myDialog.changableProjects;
}
private UserPlatformsDialog(Frame frame, Vector<File> changablePlatforms,
Vector<File> fixedPlatforms) {
super(frame, "Manage User Platforms", true);
private ProjectDirectoriesDialog(Frame frame, Vector<File> changableProjects,
Vector<File> fixedProjects) {
super(frame, "Manage Project Directories", true);
myParentFrame = frame;
init(changablePlatforms, fixedPlatforms);
init(changableProjects, fixedProjects);
}
private UserPlatformsDialog(Dialog dialog, Vector<File> changablePlatforms,
Vector<File> fixedPlatforms) {
super(dialog, "Manage User Platforms", true);
private ProjectDirectoriesDialog(Dialog dialog, Vector<File> changableProjects,
Vector<File> fixedProjects) {
super(dialog, "Manage Project Directories", true);
myParentDialog = dialog;
init(changablePlatforms, fixedPlatforms);
init(changableProjects, fixedProjects);
}
private void init(Vector<File> changablePlatforms, Vector<File> fixedPlatforms) {
private void init(Vector<File> changablePlatforms, Vector<File> fixedProjects) {
myDialog = this;
JPanel mainPane = new JPanel();
@ -152,7 +152,7 @@ public class UserPlatformsDialog extends JDialog {
button = new JButton("Cancel");
button.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
changableUserPlatforms = null;
changableProjects = null;
dispose();
}
});
@ -163,13 +163,13 @@ public class UserPlatformsDialog extends JDialog {
button = new JButton("OK");
button.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
changableUserPlatforms = new Vector<File>();
for (String directory : changablePlatformsList.getItems()) {
File userPlatform = new File(directory);
if (userPlatform.exists() && userPlatform.isDirectory())
changableUserPlatforms.add(userPlatform);
changableProjects = new Vector<File>();
for (String directory : changableProjectsList.getItems()) {
File projectDir = new File(directory);
if (projectDir.exists() && projectDir.isDirectory())
changableProjects.add(projectDir);
else
logger.fatal("Can't find user platform: " + userPlatform);
logger.fatal("Can't find project directory: " + projectDir);
}
dispose();
}
@ -185,15 +185,15 @@ public class UserPlatformsDialog extends JDialog {
JPanel listPane2 = new JPanel();
listPane2.setLayout(new BoxLayout(listPane2, BoxLayout.Y_AXIS));
if (fixedPlatforms != null) {
fixedPlatformsList = new List();
fixedPlatformsList.setEnabled(false);
if (fixedProjects != null) {
fixedProjectsList = new List();
fixedProjectsList.setEnabled(false);
listPane2.add(new JLabel("Fixed:"));
listPane2.add(fixedPlatformsList);
listPane2.add(fixedProjectsList);
}
listPane2.add(new JLabel("Changable:"));
listPane2.add(changablePlatformsList);
listPane2.add(changableProjectsList);
listPane.add(listPane2);
@ -203,15 +203,15 @@ public class UserPlatformsDialog extends JDialog {
button = new JButton("Move up");
button.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
int selectedIndex = changablePlatformsList.getSelectedIndex();
int selectedIndex = changableProjectsList.getSelectedIndex();
if (selectedIndex <= 0)
return;
File file = new File(changablePlatformsList.getItem(selectedIndex));
File file = new File(changableProjectsList.getItem(selectedIndex));
removeUserPlatform(selectedIndex);
addUserPlatform(file, selectedIndex - 1);
changablePlatformsList.select(selectedIndex - 1);
removeProjectDir(selectedIndex);
addProjectDir(file, selectedIndex - 1);
changableProjectsList.select(selectedIndex - 1);
}
});
smallPane.add(button);
@ -219,16 +219,16 @@ public class UserPlatformsDialog extends JDialog {
button = new JButton("Move down");
button.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
int selectedIndex = changablePlatformsList.getSelectedIndex();
int selectedIndex = changableProjectsList.getSelectedIndex();
if (selectedIndex < 0)
return;
if (selectedIndex >= changablePlatformsList.getItemCount() - 1)
if (selectedIndex >= changableProjectsList.getItemCount() - 1)
return;
File file = new File(changablePlatformsList.getItem(selectedIndex));
removeUserPlatform(selectedIndex);
addUserPlatform(file, selectedIndex + 1);
changablePlatformsList.select(selectedIndex + 1);
File file = new File(changableProjectsList.getItem(selectedIndex));
removeProjectDir(selectedIndex);
addProjectDir(file, selectedIndex + 1);
changableProjectsList.select(selectedIndex + 1);
}
});
smallPane.add(button);
@ -238,10 +238,10 @@ public class UserPlatformsDialog extends JDialog {
button = new JButton("Remove");
button.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
if (changablePlatformsList.getSelectedIndex() < 0)
if (changableProjectsList.getSelectedIndex() < 0)
return;
removeUserPlatform(changablePlatformsList.getSelectedIndex());
removeProjectDir(changableProjectsList.getSelectedIndex());
}
});
smallPane.add(button);
@ -256,25 +256,25 @@ public class UserPlatformsDialog extends JDialog {
button = new JButton("View resulting config");
button.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
PlatformConfig config;
ProjectConfig config;
try {
// Create default configuration
config = new PlatformConfig(true);
config = new ProjectConfig(true);
} catch (FileNotFoundException ex) {
logger.fatal("Could not find default platform config file: "
+ GUI.PLATFORM_DEFAULT_CONFIG_FILENAME);
logger.fatal("Could not find default project config file: "
+ GUI.PROJECT_DEFAULT_CONFIG_FILENAME);
return;
} catch (IOException ex) {
logger.fatal("Error when reading default platform config file: "
+ GUI.PLATFORM_DEFAULT_CONFIG_FILENAME);
logger.fatal("Error when reading default project config file: "
+ GUI.PROJECT_DEFAULT_CONFIG_FILENAME);
return;
}
// Add the fixed platform configurations
if (fixedPlatformsList != null) {
for (String userPlatform : fixedPlatformsList.getItems()) {
// Add the fixed project configurations
if (fixedProjectsList != null) {
for (String projectDir : fixedProjectsList.getItems()) {
try {
config.appendUserPlatform(new File(userPlatform));
config.appendProjectDir(new File(projectDir));
} catch (Exception ex) {
logger.fatal("Error when merging configurations: " + ex);
return;
@ -282,10 +282,10 @@ public class UserPlatformsDialog extends JDialog {
}
}
// Add the user platform configurations
for (String userPlatform : changablePlatformsList.getItems()) {
// Add the project directory configurations
for (String projectDir : changableProjectsList.getItems()) {
try {
config.appendUserPlatform(new File(userPlatform));
config.appendProjectDir(new File(projectDir));
} catch (Exception ex) {
logger.fatal("Error when merging configurations: " + ex);
return;
@ -306,11 +306,11 @@ public class UserPlatformsDialog extends JDialog {
button = new JButton("Add manually");
button.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
String newUserPlatformPath = JOptionPane.showInputDialog(myDialog,
"Enter path to user platform", "Enter path",
String newProjectPath = JOptionPane.showInputDialog(myDialog,
"Enter path to project directory", "Enter path",
JOptionPane.QUESTION_MESSAGE);
if (newUserPlatformPath != null) {
addUserPlatform(new File(newUserPlatformPath));
if (newProjectPath != null) {
addProjectDir(new File(newProjectPath));
}
}
});
@ -324,10 +324,10 @@ public class UserPlatformsDialog extends JDialog {
JFileChooser fc = new JFileChooser();
fc.setCurrentDirectory(new java.io.File("."));
fc.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
fc.setDialogTitle("Select user platform");
fc.setDialogTitle("Select project directory");
if (fc.showOpenDialog(myDialog) == JFileChooser.APPROVE_OPTION) {
addUserPlatform(fc.getSelectedFile());
addProjectDir(fc.getSelectedFile());
}
}
});
@ -340,48 +340,48 @@ public class UserPlatformsDialog extends JDialog {
contentPane.add(mainPane, BorderLayout.CENTER);
contentPane.add(buttonPane, BorderLayout.SOUTH);
// Add fixed user platforms if any
if (fixedPlatforms != null) {
for (File userPlatform : fixedPlatforms) {
fixedPlatformsList.add(userPlatform.getPath());
// Add fixed project directories if any
if (fixedProjects != null) {
for (File projectDir : fixedProjects) {
fixedProjectsList.add(projectDir.getPath());
}
}
// Add already existing user platforms
for (File userPlatform : changablePlatforms) {
addUserPlatform(userPlatform);
// Add already existing project directories
for (File projectDir : changablePlatforms) {
addProjectDir(projectDir);
}
pack();
}
private void addUserPlatform(File userPlatform) {
addUserPlatform(userPlatform, changablePlatformsList.getItemCount());
private void addProjectDir(File projectDir) {
addProjectDir(projectDir, changableProjectsList.getItemCount());
}
private void addUserPlatform(File userPlatform, int index) {
private void addProjectDir(File projectDir, int index) {
// Check that file exists, is a directory and contains the correct files
if (!userPlatform.exists()) {
logger.fatal("Can't find user platform: " + userPlatform);
if (!projectDir.exists()) {
logger.fatal("Can't find project directory: " + projectDir);
return;
}
if (!userPlatform.isDirectory()) {
logger.fatal("User platform is not a directory: " + userPlatform);
if (!projectDir.isDirectory()) {
logger.fatal("Specified path is not a directory: " + projectDir);
return;
}
File userPlatformConfigFile = new File(userPlatform.getPath(),
GUI.PLATFORM_CONFIG_FILENAME);
if (!userPlatformConfigFile.exists()) {
File projectConfigFile = new File(projectDir.getPath(),
GUI.PROJECT_CONFIG_FILENAME);
if (!projectConfigFile.exists()) {
Object[] options = {"Create",
"Cancel"};
int n = JOptionPane.showOptionDialog(
this,
"No " + GUI.PLATFORM_CONFIG_FILENAME + " file exists in specified directory!"
+ "\nCreate an empty " + GUI.PLATFORM_CONFIG_FILENAME + " file?",
"Create user platform configuration?",
"No " + GUI.PROJECT_CONFIG_FILENAME + " file exists in specified directory!"
+ "\nCreate an empty " + GUI.PROJECT_CONFIG_FILENAME + " file?",
"Create project directory configuration?",
JOptionPane.YES_NO_OPTION,
JOptionPane.QUESTION_MESSAGE,
null, options, options[1]);
@ -390,19 +390,19 @@ public class UserPlatformsDialog extends JDialog {
return;
try {
userPlatformConfigFile.createNewFile();
projectConfigFile.createNewFile();
} catch (IOException e) {
logger.fatal("Could not create user platform configuration file: "
+ userPlatformConfigFile);
logger.fatal("Could not create project directory configuration file: "
+ projectConfigFile);
return;
}
}
changablePlatformsList.add(userPlatform.getPath(), index);
changableProjectsList.add(projectDir.getPath(), index);
}
private void removeUserPlatform(int index) {
changablePlatformsList.remove(index);
private void removeProjectDir(int index) {
changableProjectsList.remove(index);
}
}
@ -417,7 +417,7 @@ class ConfigViewer extends JDialog {
private static final long serialVersionUID = 1L;
private static Logger logger = Logger.getLogger(ConfigViewer.class);
public static void showDialog(Frame parentFrame, PlatformConfig config) {
public static void showDialog(Frame parentFrame, ProjectConfig config) {
ConfigViewer myDialog = new ConfigViewer(parentFrame, config);
myDialog.setLocationRelativeTo(parentFrame);
myDialog.setAlwaysOnTop(true);
@ -427,7 +427,7 @@ class ConfigViewer extends JDialog {
}
}
public static void showDialog(Dialog parentDialog, PlatformConfig config) {
public static void showDialog(Dialog parentDialog, ProjectConfig config) {
ConfigViewer myDialog = new ConfigViewer(parentDialog, config);
myDialog.setLocationRelativeTo(parentDialog);
myDialog.setAlwaysOnTop(true);
@ -437,17 +437,17 @@ class ConfigViewer extends JDialog {
}
}
private ConfigViewer(Dialog dialog, PlatformConfig config) {
private ConfigViewer(Dialog dialog, ProjectConfig config) {
super(dialog, "Current class configuration", true);
init(config);
}
private ConfigViewer(Frame frame, PlatformConfig config) {
private ConfigViewer(Frame frame, ProjectConfig config) {
super(frame, "Current class configuration", true);
init(config);
}
private void init(PlatformConfig config) {
private void init(ProjectConfig config) {
JPanel mainPane = new JPanel(new BorderLayout());
JLabel label;
JButton button;

View file

@ -26,7 +26,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $Id: MantisMoteType.java,v 1.2 2007/01/09 10:02:16 fros4943 Exp $
* $Id: MantisMoteType.java,v 1.3 2007/03/23 23:34:33 fros4943 Exp $
*/
package se.sics.cooja.mantismote;
@ -346,7 +346,7 @@ public class MantisMoteType implements MoteType {
return panel;
}
public PlatformConfig getConfig() {
public ProjectConfig getConfig() {
logger.debug("MantisMoteType::getConfig");
return null;
}

View file

@ -26,7 +26,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $Id: MantisMoteTypeDialog.java,v 1.3 2007/01/10 08:48:39 fros4943 Exp $
* $Id: MantisMoteTypeDialog.java,v 1.4 2007/03/23 23:34:33 fros4943 Exp $
*/
package se.sics.cooja.mantismote;
@ -156,7 +156,7 @@ public class MantisMoteTypeDialog extends JDialog {
}
// Load all mote interface classes
String[] moteInterfaces = simulation.getGUI().getPlatformConfig().getStringArrayValue(MantisMoteType.class, "MOTE_INTERFACES");
String[] moteInterfaces = simulation.getGUI().getProjectConfig().getStringArrayValue(MantisMoteType.class, "MOTE_INTERFACES");
myDialog.moteInterfaceClasses = new Vector<Class<? extends MoteInterface>>();
for (String moteInterface : moteInterfaces) {
try {

View file

@ -58,7 +58,7 @@ public class DisturberMoteType implements MoteType {
private Vector<Class<? extends MoteInterface>> moteInterfaces = null;
// Type specific class configuration
private PlatformConfig myConfig = null;
private ProjectConfig myConfig = null;
// Simulation holding this mote type
private Simulation mySimulation = null;
@ -194,7 +194,7 @@ public class DisturberMoteType implements MoteType {
return panel;
}
public PlatformConfig getConfig() {
public ProjectConfig getConfig() {
return myConfig;
//return null; /* TV */
}

View file

@ -26,7 +26,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $Id: DummyMoteType.java,v 1.2 2007/01/09 10:01:14 fros4943 Exp $
* $Id: DummyMoteType.java,v 1.3 2007/03/23 23:34:33 fros4943 Exp $
*/
package se.sics.cooja.motes;
@ -116,7 +116,7 @@ public class DummyMoteType implements MoteType {
return null;
}
public PlatformConfig getConfig() {
public ProjectConfig getConfig() {
return null;
}