minor changes due to deletion of static variables. added support for new contiki mote type information: compilation files

This commit is contained in:
fros4943 2007-01-09 10:07:44 +00:00
parent db0cb3d04c
commit 74e55fbb81
1 changed files with 19 additions and 14 deletions

View File

@ -26,7 +26,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE. * SUCH DAMAGE.
* *
* $Id: ContikiMoteTypeDialog.java,v 1.13 2006/11/06 18:03:34 fros4943 Exp $ * $Id: ContikiMoteTypeDialog.java,v 1.14 2007/01/09 10:07:44 fros4943 Exp $
*/ */
package se.sics.cooja.contikimote; package se.sics.cooja.contikimote;
@ -101,9 +101,12 @@ public class ContikiMoteTypeDialog extends JDialog {
// user // user
// platforms // platforms
private Vector<File> compilationFiles = null;
private Vector<MoteType> allOtherTypes = null; // Used to check for private Vector<MoteType> allOtherTypes = null; // Used to check for
// conflicting parameters // conflicting parameters
private GUI myGUI = null;
private ContikiMoteTypeDialog myDialog; private ContikiMoteTypeDialog myDialog;
/** /**
@ -125,6 +128,7 @@ public class ContikiMoteTypeDialog extends JDialog {
parentFrame); parentFrame);
myDialog.myMoteType = moteTypeToConfigure; myDialog.myMoteType = moteTypeToConfigure;
myDialog.myGUI = simulation.getGUI();
myDialog.allOtherTypes = simulation.getMoteTypes(); myDialog.allOtherTypes = simulation.getMoteTypes();
// Set identifier of mote type // Set identifier of mote type
@ -988,9 +992,9 @@ public class ContikiMoteTypeDialog extends JDialog {
compilationThread = new Thread(new Runnable() { compilationThread = new Thread(new Runnable() {
public void run() { public void run() {
// Add all user platform directories // Add all user platform directories
Vector<File> filesToCompile = (Vector<File>) GUI.currentGUI compilationFiles = (Vector<File>) myGUI
.getUserPlatforms().clone(); .getUserPlatforms().clone();
filesToCompile.addAll(moteTypeUserPlatforms); compilationFiles.addAll(moteTypeUserPlatforms);
// Add source files from platform configs // Add source files from platform configs
String[] projectSourceFiles = newMoteTypeConfig.getStringArrayValue( String[] projectSourceFiles = newMoteTypeConfig.getStringArrayValue(
@ -1004,11 +1008,11 @@ public class ContikiMoteTypeDialog extends JDialog {
ContikiMoteType.class, "C_SOURCES", projectSourceFile); ContikiMoteType.class, "C_SOURCES", projectSourceFile);
if (userPlatform != null) { if (userPlatform != null) {
// We found a user platform - Add directory // We found a user platform - Add directory
filesToCompile.add(new File(userPlatform.getPath(), file compilationFiles.add(new File(userPlatform.getPath(), file
.getParent())); .getParent()));
} }
} }
filesToCompile.add(new File(file.getName())); compilationFiles.add(new File(file.getName()));
} }
} }
@ -1017,13 +1021,13 @@ public class ContikiMoteTypeDialog extends JDialog {
if (((JCheckBox) checkBox).isSelected()) { if (((JCheckBox) checkBox).isSelected()) {
String processName = ((JCheckBox) checkBox).getToolTipText(); String processName = ((JCheckBox) checkBox).getToolTipText();
if (processName != null) { if (processName != null) {
filesToCompile.add(new File(processName)); compilationFiles.add(new File(processName));
} }
} }
} }
compilationSucceded = ContikiMoteTypeDialog.compileLibrary(identifier, compilationSucceded = ContikiMoteTypeDialog.compileLibrary(identifier,
contikiDir, filesToCompile, symbolsCheckBox.isSelected(), contikiDir, compilationFiles, symbolsCheckBox.isSelected(),
taskOutput.getInputStream(MessageList.NORMAL), taskOutput.getInputStream(MessageList.NORMAL),
taskOutput.getInputStream(MessageList.ERROR)); taskOutput.getInputStream(MessageList.ERROR));
} }
@ -1641,7 +1645,7 @@ public class ContikiMoteTypeDialog extends JDialog {
boolean foundFile = sourceFile.exists(); boolean foundFile = sourceFile.exists();
if (!foundFile) if (!foundFile)
for (File userPlatform : GUI.currentGUI.getUserPlatforms()) { for (File userPlatform : myGUI.getUserPlatforms()) {
sourceFile = new File(userPlatform, sourceFilename); sourceFile = new File(userPlatform, sourceFilename);
if (foundFile = sourceFile.exists()) if (foundFile = sourceFile.exists())
break; break;
@ -1971,6 +1975,7 @@ public class ContikiMoteTypeDialog extends JDialog {
myMoteType.setContikiBaseDir(textContikiDir.getText()); myMoteType.setContikiBaseDir(textContikiDir.getText());
myMoteType.setContikiCoreDir(textCoreDir.getText()); myMoteType.setContikiCoreDir(textCoreDir.getText());
myMoteType.setUserPlatformDirs(moteTypeUserPlatforms); myMoteType.setUserPlatformDirs(moteTypeUserPlatforms);
myMoteType.setCompilationFiles(compilationFiles);
myMoteType.setConfig(newMoteTypeConfig); myMoteType.setConfig(newMoteTypeConfig);
// Set startup processes // Set startup processes
@ -2037,7 +2042,7 @@ public class ContikiMoteTypeDialog extends JDialog {
pathsWereUpdated(); pathsWereUpdated();
} else if (e.getActionCommand().equals("manageuserplatforms")) { } else if (e.getActionCommand().equals("manageuserplatforms")) {
Vector<File> newPlatforms = UserPlatformsDialog.showDialog( Vector<File> newPlatforms = UserPlatformsDialog.showDialog(
ContikiMoteTypeDialog.this, moteTypeUserPlatforms, GUI.currentGUI ContikiMoteTypeDialog.this, moteTypeUserPlatforms, myGUI
.getUserPlatforms()); .getUserPlatforms());
if (newPlatforms != null) { if (newPlatforms != null) {
moteTypeUserPlatforms = newPlatforms; moteTypeUserPlatforms = newPlatforms;
@ -2063,7 +2068,7 @@ public class ContikiMoteTypeDialog extends JDialog {
textCoreDir.getText()))); textCoreDir.getText())));
// If user platforms exists, scan those too // If user platforms exists, scan those too
for (File userPlatform : GUI.currentGUI.getUserPlatforms()) { for (File userPlatform : myGUI.getUserPlatforms()) {
processes processes
.addAll(ContikiMoteTypeDialog.scanForProcesses(userPlatform)); .addAll(ContikiMoteTypeDialog.scanForProcesses(userPlatform));
} }
@ -2105,7 +2110,7 @@ public class ContikiMoteTypeDialog extends JDialog {
textCoreDir.getText()))); textCoreDir.getText())));
// If user platforms exists, scan those too // If user platforms exists, scan those too
for (File userPlatform : GUI.currentGUI.getUserPlatforms()) { for (File userPlatform : myGUI.getUserPlatforms()) {
sensors.addAll(ContikiMoteTypeDialog.scanForSensors(userPlatform)); sensors.addAll(ContikiMoteTypeDialog.scanForSensors(userPlatform));
} }
if (moteTypeUserPlatforms != null) { if (moteTypeUserPlatforms != null) {
@ -2140,7 +2145,7 @@ public class ContikiMoteTypeDialog extends JDialog {
textCoreDir.getText()))); textCoreDir.getText())));
// If user platforms exists, scan those too // If user platforms exists, scan those too
for (File userPlatform : GUI.currentGUI.getUserPlatforms()) { for (File userPlatform : myGUI.getUserPlatforms()) {
interfaces.addAll(ContikiMoteTypeDialog interfaces.addAll(ContikiMoteTypeDialog
.scanForInterfaces(userPlatform)); .scanForInterfaces(userPlatform));
} }
@ -2173,7 +2178,7 @@ public class ContikiMoteTypeDialog extends JDialog {
moteInterfacePanel.removeAll(); moteInterfacePanel.removeAll();
// Clone general simulator config // Clone general simulator config
newMoteTypeConfig = GUI.currentGUI.getPlatformConfig().clone(); newMoteTypeConfig = myGUI.getPlatformConfig().clone();
// Merge with all user platform configs (if any) // Merge with all user platform configs (if any)
for (File userPlatform : moteTypeUserPlatforms) { for (File userPlatform : moteTypeUserPlatforms) {
@ -2190,7 +2195,7 @@ public class ContikiMoteTypeDialog extends JDialog {
ContikiMoteType.class, "MOTE_INTERFACES"); ContikiMoteType.class, "MOTE_INTERFACES");
Vector<Class<? extends MoteInterface>> moteIntfClasses = new Vector<Class<? extends MoteInterface>>(); Vector<Class<? extends MoteInterface>> moteIntfClasses = new Vector<Class<? extends MoteInterface>>();
ClassLoader classLoader = GUI.currentGUI ClassLoader classLoader = myGUI
.createUserPlatformClassLoader(moteTypeUserPlatforms); .createUserPlatformClassLoader(moteTypeUserPlatforms);
// Find and load the mote interface classes // Find and load the mote interface classes