package org.tizen.nativeplatform.launcher.delegate;
-import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
-import java.util.Set;
import org.eclipse.cdt.debug.core.ICDTLaunchConfigurationConstants;
import org.eclipse.cdt.debug.ui.CDebugUIPlugin;
import org.eclipse.jface.window.Window;
import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.Shell;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import org.tizen.common.util.DialogUtil;
import org.tizen.common.util.SWTUtil;
import org.tizen.common.util.log.UserInteraction;
import org.tizen.nativeplatform.launcher.wizards.PlatformAttachLaunchWizard;
import org.tizen.nativeplatform.launcher.wizards.PlatformLaunchWizardDialog;
import org.tizen.nativeplatform.pkg.commander.IPkgCommander;
-import org.tizen.nativeplatform.pkg.commander.IPkgModelMaker;
import org.tizen.nativeplatform.pkg.commander.PkgCommandTarget;
import org.tizen.nativeplatform.pkg.model.IPackage;
import org.tizen.nativeplatform.pkg.tools.RpmTool;
import org.tizen.nativeplatform.types.CmdTargetTypes;
import org.tizen.nativeplatform.types.LaunchTypes;
-import org.tizen.nativeplatform.util.CommonPackageUtil;
import org.tizen.nativeplatform.util.IPackageUtil;
import org.tizen.nativeplatform.util.PlatformLaunchUtil;
import org.tizen.nativeplatform.util.PlatformProjectUtil;
private String deviceInstallLog = "";
private boolean continueLaunch = true;
+ private final Logger logger = LoggerFactory.getLogger(getClass());
+
public AttachLaunchConfigurationProcessor(Shell shell, ILaunchConfiguration launchConfig,
IProject project, String mode, PkgCommandTarget target, IProgressMonitor monitor) {
this.shell = shell;
SWTUtil.syncExec(new Runnable() {
@Override
public void run() {
- PlatformAttachLaunchWizard wizard = new PlatformAttachLaunchWizard(shell, launchConfig,
- project, buildConfig, target, mode);
+ boolean isPlatformVersion3 = false;
+ try {
+ isPlatformVersion3 = wc.getAttribute(ITizenLaunchConfigurationConstants.ATTR_TARGET_PLATFORM_VERSION, false);
+ } catch (CoreException e) {
+ logger.error("Failed to get platform version from config", e);
+ }
+
+ PlatformAttachLaunchWizard wizard = new PlatformAttachLaunchWizard(shell, launchConfig,
+ project, buildConfig, target, mode, isPlatformVersion3);
PlatformLaunchWizardDialog dlg = new PlatformLaunchWizardDialog(shell, wizard);
dlg.create();
if (Window.OK == dlg.open()) {
boolean selectPkgOp = false;
String procName = dlg.getProcName();
int pid = dlg.getProcId();
-
+
setOptionAttributes(wc, programPath, procName, pid, reinstallOp,
selectPkgOp);
}
return false;
}
}
-
+
protected void setOptionAttributes(ILaunchConfigurationWorkingCopy wc, String programPath,
String procName, int pid, boolean reinstallOp, boolean selectPkgOp) {
if (programPath != null) {
public static final String ATTR_ROOTSTRAP_NAME = PLATFORM_LAUNCH_ID + ".ROOTSTRAP_ATTR"; //$NON-NLS-1$
public static final String ATTR_COREFILE_LOCATION = PLATFORM_LAUNCH_ID + ".COREFILE_LOC_ATTR"; //$NON-NLS-1$
public static final String ATTR_FORWARD_TARGET_PORT = PLATFORM_LAUNCH_ID + ".DEBUG_REALPORT";
+
+ public static final String ATTR_TARGET_PLATFORM_VERSION = PLATFORM_LAUNCH_ID + ".TARGET_PLATFORM_VERSION";
}
import org.eclipse.jface.window.Window;
import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.Shell;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import org.tizen.common.util.DialogUtil;
import org.tizen.common.util.SWTUtil;
import org.tizen.common.util.log.UserInteraction;
private boolean continueLaunch = true;
private boolean onlyInstall = false;
+ private final Logger logger = LoggerFactory.getLogger(getClass());
+
public LaunchConfigurationProcessor() {
}
public void run() {
PlatformLaunchWizard wizard;
PlatformLaunchWizardDialog wizardDlg;
-
PlatformInstallAsWizard installWizard;
+ boolean isPlatformVersion3 = false;
+ try {
+ isPlatformVersion3 = wc.getAttribute(ITizenLaunchConfigurationConstants.ATTR_TARGET_PLATFORM_VERSION, false);
+ } catch (CoreException e) {
+ logger.error("Failed to get platform version from config", e);
+ }
+
if (onlyInstall) {
installWizard = new PlatformInstallAsWizard(shell, launchConfig, project,
- buildConfig, target, mode, isEflApp);
+ buildConfig, target, mode, isEflApp, isPlatformVersion3);
wizardDlg = new PlatformLaunchWizardDialog(shell, installWizard);
} else {
wizard = new PlatformLaunchWizard(shell, launchConfig, project,
- buildConfig, target, mode, isEflApp);
+ buildConfig, target, mode, isEflApp, isPlatformVersion3);
wizardDlg = new PlatformLaunchWizardDialog(shell, wizard);
}
}
*/
+ String targetPlatformVersion = null;
+ boolean isPlatformVersion3 = false;
+
+ try {
+ targetPlatformVersion = currentDevice.getPlatformInfo().getPlatformVersion();
+ } catch (IOException e) {
+ logger.error("Failed to get platform version", e);
+ }
+
+ if ("3.0".equals(targetPlatformVersion)) {
+ isPlatformVersion3 = true;
+ }
+ ILaunchConfigurationWorkingCopy wc = config.getWorkingCopy();
+ wc.setAttribute(ITizenLaunchConfigurationConstants.ATTR_TARGET_PLATFORM_VERSION, isPlatformVersion3);
+ config = wc.doSave();
+
ILaunchConfigurationProcessor processor = getConfigurationProcessor(shell, config,
project, mode, target, new SubProgressMonitor(monitor, 1));
if (!processor.process()) {
package org.tizen.nativeplatform.launcher.delegate;
import java.io.File;
+import java.io.IOException;
import java.util.List;
import org.eclipse.cdt.debug.core.ICDTLaunchConfigurationConstants;
import org.eclipse.core.runtime.SubProgressMonitor;
import org.eclipse.debug.core.ILaunch;
import org.eclipse.debug.core.ILaunchConfiguration;
+import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
import org.eclipse.debug.core.ILaunchManager;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;
* PlatformLaunchDelegateForInstallAs
*
* InstallAs feature in Context menu
- *
+ *
* @author jm.jaemin.kim{@literal <jm.jaemin.kim>} (S-Core)
*
*/
protected static final String EMULATOR_CLI_BIN = EMULATOR_PATH + File.separatorChar + "bin"
+ File.separatorChar + "ecp-cli";
+ private final Logger logger = LoggerFactory.getLogger(getClass());
+
@Override
protected String getPluginID() {
return null;
target.getRootstrap());
}
+ String targetPlatformVersion = null;
+ boolean isPlatformVersion3 = false;
+
+ try {
+ targetPlatformVersion = currentDevice.getPlatformInfo().getPlatformVersion();
+ } catch (IOException e) {
+ logger.error("Failed to get platform version", e);
+ }
+
+ if ("3.0".equals(targetPlatformVersion)) {
+ isPlatformVersion3 = true;
+ }
+ ILaunchConfigurationWorkingCopy wc = config.getWorkingCopy();
+ wc.setAttribute(ITizenLaunchConfigurationConstants.ATTR_TARGET_PLATFORM_VERSION, isPlatformVersion3);
+ config = wc.doSave();
+
ILaunchConfigurationProcessor processor = getConfigurationProcessor(shell, config,
project, mode, target, new SubProgressMonitor(monitor, 1));
if (!processor.process()) {
PkgCommandTarget target, IProgressMonitor monitor) {
return new LaunchConfigurationProcessor(shell, launchConfig, project, mode, target, monitor, true);
}
-
+
protected void setPkgCommandTarget() {
target = new PkgCommandTarget(PlatformProjectUtil.getPkgType(), currentDevice, rootstrap);
}
-
+
protected void activateProgressView() {
Display.getDefault().syncExec(new Runnable() {
public void run() {
}
});
}
+
protected void checkPackageFiles(IProject project, IConfiguration config) throws CoreException {
String selectedRootstrapArch = RootstrapProxy.getProxy().getSelectedRootstrap()
}
}
}
-
+
protected IConfiguration getBuildConfiguration(IProject project) {
return PlatformConfigurationManager.getDefaultConfiguration(project);
}
+
protected IProject getProject(ILaunchConfiguration config) throws CoreException {
String projectName = config.getAttribute(
ICDTLaunchConfigurationConstants.ATTR_PROJECT_NAME, "");
newCoreException(PlatformLaunchMessages.CANNOT_FIND_PROJECT_NAME, null);
}
return ResourcesPlugin.getWorkspace().getRoot().getProject(projectName);
- }
+ }
}
private void createButtons(Composite parent) {
Composite composite = new Composite(parent, SWT.NONE);
GridLayout gridLayout = new GridLayout();
- gridLayout.numColumns = 3;
gridLayout.marginWidth = 0;
gridLayout.marginHeight = 0;
+ if (wizard.isPlatformVersion3()) {
+ gridLayout.numColumns = 2;
+ } else {
+ gridLayout.numColumns = 3;
+ }
composite.setLayout(gridLayout);
composite.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL
| GridData.HORIZONTAL_ALIGN_FILL));
}
});
- Button selectPkgcmdBt = new Button(composite, SWT.NONE);
- selectPkgcmdBt.setText(resources.getString("PkgSelectionPage.Button.SelectPkgcmd"));
- selectPkgcmdBt.setLayoutData(gridData);
- selectPkgcmdBt.addSelectionListener(new SelectionListener() {
+ if (!wizard.isPlatformVersion3()) {
+ Button selectPkgcmdBt = new Button(composite, SWT.NONE);
+ selectPkgcmdBt.setText(resources.getString("PkgSelectionPage.Button.SelectPkgcmd"));
+ selectPkgcmdBt.setLayoutData(gridData);
+ selectPkgcmdBt.addSelectionListener(new SelectionListener() {
- @Override
- public void widgetDefaultSelected(SelectionEvent arg0) {
- }
+ @Override
+ public void widgetDefaultSelected(SelectionEvent arg0) {
+ }
- @Override
- public void widgetSelected(SelectionEvent arg0) {
- toolButtonClickHandler(PkgcmdTool.NAME);
- }
- });
+ @Override
+ public void widgetSelected(SelectionEvent arg0) {
+ toolButtonClickHandler(PkgcmdTool.NAME);
+ }
+ });
+ }
Button notInstallBt = new Button(composite, SWT.NONE);
notInstallBt.setText(resources.getString("PkgSelectionPage.Button.NotInstAll"));
| SWT.FULL_SELECTION);
packageTableDevice.setData("target", "device");
Table table = packageTableDevice.getTable();
- createPackageTableColumns(deviceGroup, packageTableDevice, true);
+
+ /* W/A for 3.0 platform support
+ * Since pkgcmd of 3.0 platform doesn't support rpm file any more,
+ * Platform IDE doesn't expose rpm selection UI.
+ */
+ createPackageTableColumns(deviceGroup, packageTableDevice, !wizard.isPlatformVersion3());
table.setHeaderVisible(true);
table.setLinesVisible(true);
package org.tizen.nativeplatform.launcher.wizards;
import java.lang.reflect.InvocationTargetException;
-import java.util.ArrayList;
import java.util.List;
import org.eclipse.cdt.managedbuilder.core.IConfiguration;
}
public PlatformAttachLaunchWizard(Shell shell, ILaunchConfiguration launchConfig,
- IProject project, IConfiguration config, PkgCommandTarget target, String mode) {
+ IProject project, IConfiguration config, PkgCommandTarget target, String mode, boolean isPlatformVersion3) {
super(shell, launchConfig, project, config, target, mode);
this.pkgFilter = PkgFilterFactory.getFilter(PlatformProjectUtil.getPkgType());
+ this.isPlatformVersion3 = isPlatformVersion3;
}
@Override
target);
page1.disableDeviceGroup();
addPage(page1);
-
+
// set page 2
addPage(new PlatformLaunchSettingProcPage(this, shell, SETTING_PROC_PAGE, project, config,
target));
}
programPath = page.getProgramPath();
pid = page.getPid();
- //packages = page.getPackages();
+ // packages = page.getPackages();
IWizardContainer container = getContainer();
reinstallOp = page.getReinstallOp();
- //selectPkgOp = page.getSelectPkgOp();
+ // selectPkgOp = page.getSelectPkgOp();
procName = page.getProcName();
pid = page.getPid();
&& targetPage.getName().equals(SETTING_PROC_PAGE)) {
PlatformLaunchSettingPkgPage pkgPage = (PlatformLaunchSettingPkgPage) currentPage;
PlatformLaunchSettingProcPage procPage = (PlatformLaunchSettingProcPage) targetPage;
-
+
// save package install information
pkgPage.savePkgInstallInfo();
} catch (Exception e) {
e.printStackTrace();
openErrorDialog(e.toString());
- //currentPage.setMessage(e.toString());
+ // currentPage.setMessage(e.toString());
cancelChanging(event);
return;
}
protected String deviceLog = "";
protected String rootstrapLog = "";
protected boolean loadSharedLib = true;
+ protected boolean isPlatformVersion3 = false;
public PlatformCommonLaunchWizard() {
}
return programPath;
}
+ public boolean isPlatformVersion3() {
+ return isPlatformVersion3;
+ }
+
public String getArguments() {
return arguments;
}
public Map<String, String> getEnvironments() {
return envs;
}
-
+
public boolean loadSharedLibAutomatically() {
- return loadSharedLib;
+ return loadSharedLib;
}
@Override
package org.tizen.nativeplatform.launcher.wizards;
import java.lang.reflect.InvocationTargetException;
-import java.util.ArrayList;
import java.util.List;
-import java.util.Map;
import org.eclipse.cdt.managedbuilder.core.IConfiguration;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.SubProgressMonitor;
import org.eclipse.debug.core.ILaunchConfiguration;
-import org.eclipse.debug.core.ILaunchManager;
import org.eclipse.jface.operation.IRunnableWithProgress;
import org.eclipse.jface.wizard.IWizardContainer;
import org.eclipse.jface.wizard.WizardDialog;
import org.tizen.nativeplatform.pkg.commander.PkgCommandTarget;
import org.tizen.nativeplatform.pkg.model.IPackage;
import org.tizen.nativeplatform.types.CmdTargetTypes;
-import org.tizen.nativeplatform.types.LaunchTypes;
-import org.tizen.nativeplatform.util.PlatformLaunchUtil;
import org.tizen.nativeplatform.util.PlatformProjectUtil;
/**
public PlatformInstallAsWizard(Shell shell, ILaunchConfiguration launchConfig,
IProject project, IConfiguration config, PkgCommandTarget target, String mode,
- boolean isEFL) {
+ boolean isEFL, boolean isPlatformVersion3) {
super(shell, launchConfig, project, config, target, mode);
setWindowTitle("Install Packages Configuration");
+ this.isPlatformVersion3 = isPlatformVersion3;
this.target = target;
this.pkgFilter = PkgFilterFactory.getFilter(PlatformProjectUtil.getPkgType());
}
pkgPage.savePkgInstallInfo();
final List<IPackage> checkedDevicePkgs = pkgPage.getCheckedDevicePackage();
- final List<IPackage> checkedRootstrapPkgs = pkgPage.getCheckedRootstrapPackage();
+ final List<IPackage> checkedRootstrapPkgs = pkgPage.getCheckedRootstrapPackage();
IWizardContainer container = getContainer();
try {
container.run(true, true, new IRunnableWithProgress() {
dialog.addPageChangedListener(this);
dialog.addPageChangingListener(this);
}
-
- private void setSmackRule() {
- String[] programPaths = PlatformLaunchUtil.getProgramPath(project);
- if (programPaths == null || programPaths.length <= 0) {
- return;
- }
- IPkgCommander commander = target.getDeviceCommander();
- StringBuffer pathlist = new StringBuffer();
- for (String path : programPaths) {
- pathlist.append(path);
- pathlist.append(" ");
- }
- String list = pathlist.toString().trim();
- Map<String, String[]> smackInfo = PlatformLaunchUtil.getSmackInfo(commander, list);
- if (smackInfo == null) {
- return;
- }
- for (String filepath : smackInfo.keySet()) {
- String[] labels = smackInfo.get(filepath);
- String a_label = labels[0];
- if (a_label != null && !a_label.isEmpty()) {
- commander.executeBinaryBySudo(getSmackRuleCommand(a_label));
- }
- commander.setSmackExecute(filepath, "\"\"");
- }
- }
-
- private String getSmackRuleCommand(String value) {
- value = value.replaceAll("\"", "");
- String cmd = String.format("echo \"sdbd::home %s rwx\" | smackload", value);
- return cmd;
- }
-
}
import java.lang.reflect.InvocationTargetException;
import java.util.List;
-import java.util.Map;
import org.eclipse.cdt.managedbuilder.core.IConfiguration;
import org.eclipse.core.resources.IProject;
import org.tizen.nativeplatform.launcher.wizard.pages.PlatformEFLLaunchSettingPage;
import org.tizen.nativeplatform.launcher.wizard.pages.PlatformLaunchSettingPage;
import org.tizen.nativeplatform.launcher.wizard.pages.PlatformLaunchSettingPkgPage;
-import org.tizen.nativeplatform.pkg.commander.IPkgCommander;
import org.tizen.nativeplatform.pkg.commander.PkgCommandTarget;
import org.tizen.nativeplatform.pkg.model.IPackage;
import org.tizen.nativeplatform.types.CmdTargetTypes;
import org.tizen.nativeplatform.types.LaunchTypes;
-import org.tizen.nativeplatform.util.PlatformLaunchUtil;
import org.tizen.nativeplatform.util.PlatformProjectUtil;
public class PlatformLaunchWizard extends PlatformCommonLaunchWizard {
}
public PlatformLaunchWizard(Shell shell, ILaunchConfiguration launchConfig, IProject project,
- IConfiguration config, PkgCommandTarget target, String mode, boolean isEFL) {
+ IConfiguration config, PkgCommandTarget target, String mode, boolean isEFL, boolean isPlatformVersion3) {
super(shell, launchConfig, project, config, target, mode);
+ this.isPlatformVersion3 = isPlatformVersion3;
this.isEFL = isEFL;
this.pkgFilter = PkgFilterFactory.getFilter(PlatformProjectUtil.getPkgType());
}
// set page 1
PlatformLaunchSettingPkgPage page1 = new PlatformLaunchSettingPkgPage(this, shell, SETTING_PKG_PAGE, project, config,
target);
- // if launch mode is run, disable rootstrap group
+ // if launch mode is run, disable rootstrap group
if (mode.equals("run")) {
page1.disableRootstrapGroup();
}
if (mode.equals(ILaunchManager.DEBUG_MODE)) {
pkgLauncher.debugLaunchPkgs(LaunchTypes.NONE, shell,
new SubProgressMonitor(monitor, 1));
- //setSmackRule();
+ // setSmackRule();
} else {
pkgLauncher.launchPkgs(shell, new SubProgressMonitor(monitor, 1));
}
} catch (Exception e) {
e.printStackTrace();
openErrorDialog(e.toString());
- //currentPage.setMessage(e.toString());
+ // currentPage.setMessage(e.toString());
cancelChanging(event);
}
settingPage.validate();
}
}
-
- private void setSmackRule() {
- String[] programPaths = PlatformLaunchUtil.getProgramPath(project);
- if (programPaths == null || programPaths.length <= 0) {
- return;
- }
- IPkgCommander commander = target.getDeviceCommander();
- StringBuffer pathlist = new StringBuffer();
- for (String path : programPaths) {
- pathlist.append(path);
- pathlist.append(" ");
- }
- String list = pathlist.toString().trim();
- Map<String, String[]> smackInfo = PlatformLaunchUtil.getSmackInfo(commander, list);
- if (smackInfo == null) {
- return;
- }
- for (String filepath : smackInfo.keySet()) {
- String[] labels = smackInfo.get(filepath);
- String a_label = labels[0];
- if (a_label != null && !a_label.isEmpty()) {
- commander.executeBinaryBySudo(getSmackRuleCommand(a_label));
- }
- commander.setSmackExecute(filepath, "\"\"");
- }
- }
-
- private String getSmackRuleCommand(String value) {
- value = value.replaceAll("\"", "");
- String cmd = String.format("echo \"sdbd::home %s rwx\" | smackload", value);
- return cmd;
- }
}
List<IPackage> cached = PackageStoreManager.get(project, config);
- if (cached != null) {
- if (cached.get(0).getArch().equals(selectedRootstrapArch)) {
+ if ((cached != null) && (cached.get(0) != null)) {
+ String cachedArch = cached.get(0).getArch();
+ // For i686 rootstrap, we can't know its naming rule.
+ // Therefore, we support rpm files for i686 named.
+ if (cachedArch.equals(selectedRootstrapArch) || cachedArch.equals("i686")) {
return cached;
} else {
return null;