summaryrefslogtreecommitdiffstats
path: root/plugins/org.yocto.bc.ui/src/org/yocto/bc/bitbake/ProjectInfoHelper.java
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/org.yocto.bc.ui/src/org/yocto/bc/bitbake/ProjectInfoHelper.java')
-rw-r--r--plugins/org.yocto.bc.ui/src/org/yocto/bc/bitbake/ProjectInfoHelper.java64
1 files changed, 64 insertions, 0 deletions
diff --git a/plugins/org.yocto.bc.ui/src/org/yocto/bc/bitbake/ProjectInfoHelper.java b/plugins/org.yocto.bc.ui/src/org/yocto/bc/bitbake/ProjectInfoHelper.java
new file mode 100644
index 0000000..800fe2b
--- /dev/null
+++ b/plugins/org.yocto.bc.ui/src/org/yocto/bc/bitbake/ProjectInfoHelper.java
@@ -0,0 +1,64 @@
1/*****************************************************************************
2 * Copyright (c) 2013 Ken Gilmer, Intel Corporation
3 * All rights reserved. This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License v1.0
5 * which accompanies this distribution, and is available at
6 * http://www.eclipse.org/legal/epl-v10.html
7 *
8 * Contributors:
9 * Ken Gilmer - initial API and implementation
10 * Ioana Grigoropol (Intel) - adapt class for remote support
11 *******************************************************************************/
12package org.yocto.bc.bitbake;
13
14import java.io.BufferedReader;
15import java.io.File;
16import java.io.FileOutputStream;
17import java.io.FileReader;
18import java.io.IOException;
19import java.net.URI;
20
21import org.eclipse.core.resources.IProject;
22import org.eclipse.core.resources.ResourcesPlugin;
23
24import org.yocto.bc.ui.model.ProjectInfo;
25
26/**
27 * A helper class for ProjectInfo related tasks.
28 *
29 * @author kgilmer
30 *
31 */
32public class ProjectInfoHelper {
33 public static final String OEFS_SCHEME = "OEFS://";
34 public static final String FILE_SCHEME = "file";
35 public static final String RSE_SCHEME = "rse";
36
37 protected static final String DEFAULT_INIT_SCRIPT = "oe-init-build-env";
38 /**
39 * @param path
40 * @return The path to bitbake init script
41 * @throws IOException
42 */
43 public static String getInitScriptPath(URI uri) throws IOException {
44 String val = uri.getPath() + "/" + DEFAULT_INIT_SCRIPT;
45 return val;
46 }
47
48 public static String getProjectName(URI projectRoot) {
49 IProject[] projects = ResourcesPlugin.getWorkspace().getRoot().getProjects();
50 for (int i = 0; i < projects.length; ++i) {
51 try {
52 if (projects[i].getLocationURI().equals(projectRoot)) {
53 return projects[i].getName();
54 }
55
56 } catch (Exception e) {
57 // TODO Auto-generated catch block
58 e.printStackTrace();
59 }
60 }
61
62 return null;
63 }
64}