diff options
author | Adrian Dudau <adrian.dudau@enea.com> | 2014-06-26 13:23:09 +0200 |
---|---|---|
committer | Adrian Dudau <adrian.dudau@enea.com> | 2014-06-26 13:24:09 +0200 |
commit | c7da892cb23d50d4d85746c9a0b6b14bf570989d (patch) | |
tree | e7136073f386d6156f51766c498c52c30c8df85f /plugins/org.yocto.bc.ui/src/org/yocto/bc/bitbake/ProjectInfoHelper.java | |
download | eclipse-poky-kepler-c7da892cb23d50d4d85746c9a0b6b14bf570989d.tar.gz |
initial commit for Enea Linux 4.0daisy
Migrated from the internal git server on the daisy-enea branch
Signed-off-by: Adrian Dudau <adrian.dudau@enea.com>
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.java | 64 |
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 | *******************************************************************************/ | ||
12 | package org.yocto.bc.bitbake; | ||
13 | |||
14 | import java.io.BufferedReader; | ||
15 | import java.io.File; | ||
16 | import java.io.FileOutputStream; | ||
17 | import java.io.FileReader; | ||
18 | import java.io.IOException; | ||
19 | import java.net.URI; | ||
20 | |||
21 | import org.eclipse.core.resources.IProject; | ||
22 | import org.eclipse.core.resources.ResourcesPlugin; | ||
23 | |||
24 | import org.yocto.bc.ui.model.ProjectInfo; | ||
25 | |||
26 | /** | ||
27 | * A helper class for ProjectInfo related tasks. | ||
28 | * | ||
29 | * @author kgilmer | ||
30 | * | ||
31 | */ | ||
32 | public 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 | } | ||