import org.eclipse.jface.dialogs.ProgressMonitorDialog;
import org.eclipse.jface.operation.IRunnableWithProgress;
import org.eclipse.jface.preference.IPreferenceStore;
+import org.eclipse.swt.widgets.Display;
import org.eclipse.ui.IWorkbenchWindow;
import org.eclipse.ui.PlatformUI;
import org.tizen.common.IApplicationConfiguration;
import org.tizen.sdblib.SyncService.SyncResult;
public class TizenNativeApplicationProfileDelegate implements ILaunchConfigurationDelegate {
- private static TizenNativeApplicationProfileDelegate instance = null;
-
private final String TOOLS = "tools";// $NON_NLS-1$
private final String DYNAMIC_ANALYZER = "dynamic-analyzer";// $NON_NLS-1$
private final String PKG_TYPE = CommonProjectDependentPackager.DEFAULT;
}
}
- public static TizenNativeApplicationProfileDelegate getInstance() {
- if (instance == null) {
- instance = new TizenNativeApplicationProfileDelegate();
- }
- return instance;
- }
-
- private TizenNativeApplicationProfileDelegate() {
- }
-
@Override
public void launch(ILaunchConfiguration configuration, String mode, ILaunch launch, IProgressMonitor monitor) throws CoreException {
IWorkspace workspace = ResourcesPlugin.getWorkspace();
private void profileWithDABuild(final IProject project) {
bSuccessBuild = true;
- IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
- ProgressMonitorDialog dialog = new ProgressMonitorDialog(window.getShell());
+ Display.getDefault().syncExec(new Runnable() {
+ @Override
+ public void run() {
+ IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
+ ProgressMonitorDialog dialog = new ProgressMonitorDialog(window.getShell());
- try {
- dialog.run(true, true, new IRunnableWithProgress() {
- @Override
- public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
- monitor.beginTask(Labels.MESSAGE_PREPARING_PROFILE, 1);
- if (verifyDeviceReachability(currentDevice, project)) {
- DALog.dlgErrorMessage(Labels.MESSAGE_ERROR, Labels.MESSAGE_FAIL_TO_BUILD_PROJECT);
- bSuccessBuild = false;
- monitor.done();
- return;
- }
+ try {
+ dialog.run(true, true, new IRunnableWithProgress() {
+ @Override
+ public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
+ monitor.beginTask(Labels.MESSAGE_PREPARING_PROFILE, 1);
+ if (verifyDeviceReachability(currentDevice, project)) {
+ DALog.dlgErrorMessage(Labels.MESSAGE_ERROR, Labels.MESSAGE_FAIL_TO_BUILD_PROJECT);
+ bSuccessBuild = false;
+ monitor.done();
+ return;
+ }
- prevBuildConfiguration = ManagedBuildManager.getBuildInfo(project).getConfigurationName();
- prevProfileConfigArch = CommonConfigurationManager.getArchitecture(PlatformChangingManager.getConfigurationByName(project,
- Activator.PROFILE_BUILD_CONFIGURATION_NAME));
- PlatformChangingManager.changePlatform(project, Activator.PROFILE_BUILD_CONFIGURATION_NAME, currentDevice.getArch().toString());
+ prevBuildConfiguration = ManagedBuildManager.getBuildInfo(project).getConfigurationName();
+ prevProfileConfigArch = CommonConfigurationManager.getArchitecture(PlatformChangingManager.getConfigurationByName(project,
+ Activator.PROFILE_BUILD_CONFIGURATION_NAME));
+ PlatformChangingManager.changePlatform(project, Activator.PROFILE_BUILD_CONFIGURATION_NAME, currentDevice.getArch().toString());
- IProjectLaunchCommand manifest = ProjectUtil.getProjectManifest(project);
- CommonProjectDependentPackager packager = ProjectTypeManager.getProjectPackagerInstance(project);
+ IProjectLaunchCommand manifest = ProjectUtil.getProjectManifest(project);
+ CommonProjectDependentPackager packager = ProjectTypeManager.getProjectPackagerInstance(project);
- buildPackage(monitor, project, manifest, packager);
- if (bSuccessBuild == false) {
- monitor.done();
- return;
- }
+ buildPackage(monitor, project, manifest, packager);
+ if (bSuccessBuild == false) {
+ monitor.done();
+ return;
+ }
- try {
- if (RdsPreferencePage.isRdsMode(project)) {
- TizenLaunchCommand tizenCommand = new TizenLaunchCommand(currentDevice);
- RdsDeployer rdsDeployer = new NativeRdsDeployer(project, currentDevice, tizenCommand, null,
- CommonProjectDependentPackager.DEFAULT.toLowerCase(), monitor);
- rdsDeployer.setInterestList(new TizenLaunchInfo().makeInterestList(project));
- if (!rdsDeployer.deploy()) {
- normalDeploy(monitor, project, manifest, packager);
+ try {
+ if (RdsPreferencePage.isRdsMode(project)) {
+ TizenLaunchCommand tizenCommand = new TizenLaunchCommand(currentDevice);
+ RdsDeployer rdsDeployer = new NativeRdsDeployer(project, currentDevice, tizenCommand, null,
+ CommonProjectDependentPackager.DEFAULT.toLowerCase(), monitor);
+ rdsDeployer.setInterestList(new TizenLaunchInfo().makeInterestList(project));
+ if (!rdsDeployer.deploy()) {
+ normalDeploy(monitor, project, manifest, packager);
+ }
+ rdsDeployer.pushResInfoFile();
+ } else {
+ normalDeploy(monitor, project, manifest, packager);
+ }
+ } catch (CoreException e) {
+ bSuccessBuild = false;
+ monitor.done();
+ return;
}
- rdsDeployer.pushResInfoFile();
- } else {
- normalDeploy(monitor, project, manifest, packager);
}
- } catch (CoreException e) {
- bSuccessBuild = false;
- monitor.done();
- return;
- }
+ });
+ } catch (InvocationTargetException e) {
+ DALog.printLog(e);
+ DALog.dlgErrorMessage(Labels.MESSAGE_ERROR, Labels.MESSAGE_FAIL_TO_BUILD_PROJECT);
+ bSuccessBuild = false;
+ DALog.printLog("TizenNativeApplicationProfileDelegate - profileWithDABuild - InvocationTargetException");
+ } catch (InterruptedException e) {
+ DALog.printLog(e);
+ DALog.dlgErrorMessage(Labels.MESSAGE_ERROR, Labels.MESSAGE_FAIL_TO_BUILD_PROJECT);
+ bSuccessBuild = false;
+ DALog.printLog("TizenNativeApplicationProfileDelegate - profileWithDABuild - InterruptedException");
}
- });
- } catch (InvocationTargetException e) {
- DALog.printLog(e);
- DALog.dlgErrorMessage(Labels.MESSAGE_ERROR, Labels.MESSAGE_FAIL_TO_BUILD_PROJECT);
- bSuccessBuild = false;
- DALog.printLog("TizenNativeApplicationProfileDelegate - profileWithDABuild - InvocationTargetException");
- } catch (InterruptedException e) {
- DALog.printLog(e);
- DALog.dlgErrorMessage(Labels.MESSAGE_ERROR, Labels.MESSAGE_FAIL_TO_BUILD_PROJECT);
- bSuccessBuild = false;
- DALog.printLog("TizenNativeApplicationProfileDelegate - profileWithDABuild - InterruptedException");
- }
+ }
+ });
}
private void normalDeploy(IProgressMonitor monitor, IProject project, IProjectLaunchCommand manifest, CommonProjectDependentPackager packager) {