public interface IPlatformXMLStore {
/**
- * Sets the project of this xml store.
- * @param project - project in which xml is stored.
+ * Sets the project of this xml store.
+ *
+ * @param project
+ * project in which xml is stored.
*/
- public void setProject(IProject project);
-
- /**
+ public void setProject(IProject project);
+
+/**
* This roles same as {@link IXMLStore#setProject(IProject),
* except that this is for CLI because CLI cannot use IProject.
*
* @param projectPath path of project in which xml will be stored
*/
- public void setProject(String projectPath);
-
+ public void setProject(String projectPath);
+
/**
* Parses xml files and loads.
*/
- public boolean loadXml();
-
+ public boolean loadXml();
+
/**
* Returns application's version.
+ *
* @return application's version.
*/
public String getVersion();
-
+
/**
* Returns application's id.
+ *
+ * @param programPath
+ * program path
* @return application's id.
*/
- public String getAppId();
-
- /**
- * Returns application's label.
- * @return application's label.
- */
- public String getAppLabel();
-
+ public String getAppId(String programPath);
+
/**
* Returns icon file list of this xml store.
+ *
* @return list of icon files.
*/
public List<String> getIconFileList();
-
+
/**
* Returns application type.
+ *
* @return application type.
*/
public TizenProjectType getApplicationType();
-
+
/**
* Returns application's executable files.
+ *
* @return application's executable files.
*/
public List<String> getExecutableFiles();
-
+
/**
* Returns application's authors.
+ *
* @return application's authors.
*/
public List<String> getAuthors();
-
+
}
try {
boolean isEflApp = PlatformProjectUtil.isEFLApplication(project);
if (isEflApp) {
- String appId = PlatformLaunchUtil.getAppId(project);
+ programPath = config.getAttribute(ICDTLaunchConfigurationConstants.ATTR_PROGRAM_NAME, "");
+ String appId = PlatformLaunchUtil.getAppId(project, programPath);
killIfRunningApplication(appId);
}
} finally {
if (files != null) {
if (files.length > 1) {
SWTUtil.syncExec(new Runnable() {
- public void run() {
+ public void run() {
SelectItemDialog dlg = new SelectItemDialog(shell, files);
dlg.create();
if (Window.OK == dlg.open()) {
}
setOptionAttributes(wc, programPath, appProjectName, packages, reinstallOp, selectPkgOp);
if (isSetProgramPath(config)) {
- String appId = PlatformLaunchUtil.getAppId(project);
+ String appId = PlatformLaunchUtil.getAppId(project, programPath);
killIfRunningApplication(appId);
installPackages(config, mode, monitor);
} else {
dlg.create();
if (Window.OK == dlg.open()) {
String appProjectName = dlg.getAppProjectName();
- String programPath = dlg.getProgramPath();
+ programPath = dlg.getProgramPath();
List<IPackage> packages = dlg.getExtraPackages();
boolean reinstallOp = dlg.getReinstallOp();
boolean selectPkgOp = dlg.getSelectPkgOp();
try {
monitor.beginTask("", 1);
monitor.subTask(TizenLaunchMessages.LAUNCH_APPLICATION);
- String appId = PlatformLaunchUtil.getAppId(project);
+ String appId = PlatformLaunchUtil.getAppId(project, programPath);
if (appId == null) {
String envCmd = getEnvironments(config);
String execArg = getArguments(config);
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
+import java.util.ArrayList;
import java.util.List;
import javax.xml.parsers.DocumentBuilder;
private static final String ATTR_EXEC = "exec";
private String projectPath;
- private File manifestFile;
-
- private PlatformManifestModel model = new PlatformManifestModel();
+ private List<File> manifestFiles = new ArrayList<File>();
+ private List<PlatformManifestModel> models = new ArrayList<PlatformManifestModel>();
private static final org.slf4j.Logger logger = LoggerFactory
.getLogger(PlatformManifestXMLStore.class);
clear();
return false;
}
-
- if (manifestFile == null || !manifestFile.exists()) {
+ if (manifestFiles.isEmpty()) {
logger.error(NLS.bind(Messages.PlatformXmlStore_MANIFEST_NOT_EXIST, this.projectPath));
return false;
}
+ clear();
+ for (File f : manifestFiles) {
+ String filePath = f.getAbsolutePath();
- String filePath = manifestFile.getAbsolutePath();
-
- try {
- loadXML(filePath);
- } catch (IOException e) {
- return false;
- } catch (SAXException e2) {
- return false;
- } catch (ParserConfigurationException e3) {
- return false;
+ try {
+ PlatformManifestModel model = loadXML(filePath);
+ if (model != null) {
+ models.add(model);
+ }
+ } catch (IOException e) {
+ models.clear();
+ return false;
+ } catch (SAXException e2) {
+ models.clear();
+ return false;
+ } catch (ParserConfigurationException e3) {
+ models.clear();
+ return false;
+ }
}
-
return true;
}
- private boolean loadXML(final String path) throws FileNotFoundException, IOException,
- ParserConfigurationException, SAXException {
- clear();
- FileInputStream stream = null;
+ private PlatformManifestModel loadXML(final String path) throws FileNotFoundException,
+ IOException, ParserConfigurationException, SAXException {
+ FileInputStream stream = null;
+ PlatformManifestModel model = null;
try {
File file = new File(path);
if (!file.exists()) {
- return false;
+ return null;
}
stream = new FileInputStream(file);
DocumentBuilder db = dbf.newDocumentBuilder();
Document dom = db.parse(stream);
- parse(dom);
+ model = parse(dom);
} finally {
IOUtil.tryClose(stream);
}
-
- return true;
+ return model;
}
- private boolean parse(Document dom) {
+ private PlatformManifestModel parse(Document dom) {
Element root = dom.getDocumentElement();
String rootName = root.getNodeName();
+ PlatformManifestModel model = new PlatformManifestModel();
if (rootName.equals(ELEMENT_MANIFEST)) {
for (Node node = root.getFirstChild(); node != null; node = node.getNextSibling()) {
}
}
}
-
- return true;
+ return model;
}
private void parseApp(Node node, PlatformManifestModel model) {
@Override
public String getVersion() {
- // TODO Auto-generated method stub
return null;
}
@Override
public List<String> getIconFileList() {
- // TODO Auto-generated method stub
return null;
}
@Override
public TizenProjectType getApplicationType() {
- // TODO Auto-generated method stub
return null;
}
@Override
public List<String> getExecutableFiles() {
- return model.getExecutableFiles();
+ List<String> exec = new ArrayList<String>();
+ for (PlatformManifestModel m : models) {
+ exec.addAll(m.getExecutableFiles());
+ }
+ return exec;
}
@Override
public List<String> getAuthors() {
- // TODO Auto-generated method stub
return null;
}
String[] files = dir.list(new XmlFileFilter());
// return false if ".xml" file does not exist
if (files.length != 0) {
- String xmlFileName = files[0];
- IPath filePath = new Path(projectPath).append(xmlFileName);
- manifestFile = filePath.toFile();
+ for (String file : files) {
+ IPath filePath = new Path(projectPath).append(file);
+ manifestFiles.add(filePath.toFile());
+ }
}
}
private void clear() {
- model.clear();
+ for (PlatformManifestModel m : models) {
+ m.clear();
+ }
}
private static String getChildValue(Node node) {
return null;
}
- @Override
- public String getAppId() {
- return model.getAppId();
- }
-
- @Override
- public String getAppLabel() {
- return model.getLabel();
+ public String getAppId(String programPath) {
+ for (PlatformManifestModel m : models) {
+ for (String exec : m.getExecutableFiles()) {
+ if (exec.equals(programPath)) {
+ return m.getAppId();
+ }
+ }
+ }
+ return "";
}
}
ZypperTool.installLocalCommand(value.toArray(new String[0])));
status = execute(command, monitor);
} else if (type == TOOL.PKGCMD) {
- String command = makeCommand(getResetRpmDb(),
- PkgcmdTool.installCommand(value.toArray(new String[0])));
- status = execute(command, monitor);
+ for (String pkg : value) {
+ String command = makeCommand(getResetRpmDb(), PkgcmdTool.installCommand(pkg));
+ status = execute(command, monitor);
+ }
}
}
}
}
- public static String getAppId(IProject project) {
+ public static String getAppId(IProject project, String programPath) {
IPlatformXMLStore store = PlatformProjectUtil.getManifestXmlStore(project);
if (store.loadXml()) {
- return getAppId(store);
+ return getAppId(store, programPath);
} else {
return null;
}
}
- public static String getAppId(IPlatformXMLStore store) {
- return store.getAppId();
+ public static String getAppId(IPlatformXMLStore store, String programPath) {
+ return store.getAppId(programPath);
}
public static boolean questionPackaging(IProject project) {