mirror of
https://github.com/oliverschmidt/contiki.git
synced 2024-12-22 10:30:13 +00:00
compile from separate thread, not edt
This commit is contained in:
parent
3320f8cb35
commit
c46bb21f5e
@ -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: MspMoteType.java,v 1.18 2008/11/03 13:18:28 fros4943 Exp $
|
* $Id: MspMoteType.java,v 1.19 2008/11/04 17:37:09 fros4943 Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package se.sics.cooja.mspmote;
|
package se.sics.cooja.mspmote;
|
||||||
@ -239,6 +239,7 @@ public abstract class MspMoteType implements MoteType {
|
|||||||
newException = (MoteTypeCreationException) newException.initCause(e);
|
newException = (MoteTypeCreationException) newException.initCause(e);
|
||||||
newException.setCompilationOutput(compilationOutput);
|
newException.setCompilationOutput(compilationOutput);
|
||||||
|
|
||||||
|
/* Print last compilation errors */
|
||||||
try { Thread.sleep(500); } catch (InterruptedException ignore) { }
|
try { Thread.sleep(500); } catch (InterruptedException ignore) { }
|
||||||
ListModel tmp = compilationOutput.getModel();
|
ListModel tmp = compilationOutput.getModel();
|
||||||
for (int i=tmp.getSize()-5; i < tmp.getSize(); i++) {
|
for (int i=tmp.getSize()-5; i < tmp.getSize(); i++) {
|
||||||
@ -634,9 +635,9 @@ public abstract class MspMoteType implements MoteType {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
else {
|
else {
|
||||||
}
|
}
|
||||||
} catch (IOException ex) {
|
} catch (IOException ex) {
|
||||||
if (failAction != null) {
|
if (failAction != null) {
|
||||||
failAction.actionPerformed(null);
|
failAction.actionPerformed(null);
|
||||||
}
|
}
|
||||||
@ -680,13 +681,17 @@ public abstract class MspMoteType implements MoteType {
|
|||||||
|
|
||||||
cleanButton.addActionListener(new ActionListener() {
|
cleanButton.addActionListener(new ActionListener() {
|
||||||
public void actionPerformed(ActionEvent e) {
|
public void actionPerformed(ActionEvent e) {
|
||||||
try {
|
new Thread(new Runnable() {
|
||||||
File parentDir = new File(sourceTextField.getText()).getParentFile();
|
public void run() {
|
||||||
compileFirmware(
|
try {
|
||||||
"make clean TARGET=" + target, new File(sourceTextField.getText()), null,
|
File parentDir = new File(sourceTextField.getText()).getParentFile();
|
||||||
parentDir, null, null, taskOutput, true);
|
compileFirmware(
|
||||||
} catch (Exception e2) {
|
"make clean TARGET=" + target, new File(sourceTextField.getText()), null,
|
||||||
}
|
parentDir, null, null, taskOutput, true);
|
||||||
|
} catch (Exception e2) {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}).start();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -703,7 +708,7 @@ public abstract class MspMoteType implements MoteType {
|
|||||||
final String filenameNoExtension = selectedSourceFile.getName()
|
final String filenameNoExtension = selectedSourceFile.getName()
|
||||||
.substring(0, selectedSourceFile.getName().length() - 2);
|
.substring(0, selectedSourceFile.getName().length() - 2);
|
||||||
|
|
||||||
Action successAction = new AbstractAction() {
|
final Action successAction = new AbstractAction() {
|
||||||
public void actionPerformed(ActionEvent e) {
|
public void actionPerformed(ActionEvent e) {
|
||||||
updateDialog(DialogState.COMPILED_SOURCE);
|
updateDialog(DialogState.COMPILED_SOURCE);
|
||||||
File parentFile = selectedSourceFile.getParentFile();
|
File parentFile = selectedSourceFile.getParentFile();
|
||||||
@ -712,7 +717,7 @@ public abstract class MspMoteType implements MoteType {
|
|||||||
ELFFile = new File(parentFile, filenameNoExtension + getTargetFileExtension(target));
|
ELFFile = new File(parentFile, filenameNoExtension + getTargetFileExtension(target));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
Action failAction = new AbstractAction() {
|
final Action failAction = new AbstractAction() {
|
||||||
public void actionPerformed(ActionEvent e) {
|
public void actionPerformed(ActionEvent e) {
|
||||||
updateDialog(DialogState.SELECTED_SOURCE);
|
updateDialog(DialogState.SELECTED_SOURCE);
|
||||||
}
|
}
|
||||||
@ -720,8 +725,17 @@ public abstract class MspMoteType implements MoteType {
|
|||||||
|
|
||||||
updateDialog(DialogState.IS_COMPILING);
|
updateDialog(DialogState.IS_COMPILING);
|
||||||
try {
|
try {
|
||||||
compileFirmware(selectedSourceFile, successAction,
|
new Thread(new Runnable() {
|
||||||
failAction, taskOutput, false);
|
public void run() {
|
||||||
|
try {
|
||||||
|
compileFirmware(selectedSourceFile,
|
||||||
|
successAction, failAction,
|
||||||
|
taskOutput, false);
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}).start();
|
||||||
} catch (Exception e2) {
|
} catch (Exception e2) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user