blob: c44b7b58f634f206bfcf5918397f7e4ef4778943 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
|
/*****************************************************************************
* Copyright (c) 2013 Ken Gilmer, Intel Corporation
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Ken Gilmer - initial API and implementation
* Ioana Grigoropol (Intel) - adapt class for remote support
*******************************************************************************/
package org.yocto.bc.ui.wizards.newproject;
import java.io.Writer;
import java.lang.reflect.InvocationTargetException;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.jface.operation.IRunnableWithProgress;
import org.yocto.bc.bitbake.BBSession;
import org.yocto.bc.bitbake.ProjectInfoHelper;
import org.yocto.bc.ui.Activator;
import org.yocto.bc.ui.model.ProjectInfo;
import org.yocto.remote.utils.RemoteHelper;
public class BBConfigurationInitializeOperation implements IRunnableWithProgress {
private final ProjectInfo pinfo;
private final Writer writer;
private boolean errorOccured = false;
private String errorMessage = "";
public BBConfigurationInitializeOperation(ProjectInfo pinfo) {
this.pinfo = pinfo;
writer = null;
}
public boolean hasErrorOccured() {
return errorOccured;
}
public BBConfigurationInitializeOperation(ProjectInfo pinfo, Writer writer) {
this.pinfo = pinfo;
this.writer = writer;
}
public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
BBSession session;
try {
System.out.println("Initialize bitbake session ...");
monitor.beginTask("Initialize bitbake session ...", RemoteHelper.TOTALWORKLOAD);
session = Activator.getBBSession(pinfo, writer, monitor);
session.initialize();
monitor.worked(90);
monitor.done();
errorOccured = session.hasErrorOccured();
errorMessage = session.getErrorLines();
if (!errorOccured) {
System.out.println("Bitbake session initialized successfully.");
errorMessage = "";
} else
System.out.println("An error occured and Bitbake session was not initialized.");
} catch (Exception e) {
throw new InvocationTargetException(e);
}
}
public String getErrorMessage() {
return errorMessage;
}
}
|