diff options
author | Adrian Dudau <adrian.dudau@enea.com> | 2013-12-12 13:36:50 +0100 |
---|---|---|
committer | Adrian Dudau <adrian.dudau@enea.com> | 2013-12-12 15:25:03 +0100 |
commit | 41ac47d732eed8392d60d0f6773e5a279d49b999 (patch) | |
tree | cf19d099db9cfdb8d73aa21c31e7aa1cc86ff860 /plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/views/RecipeContentProvider.java | |
download | eclipse-poky-juno-master.tar.gz |
Migrated from the internal git server on the dora-enea branch
Signed-off-by: Adrian Dudau <adrian.dudau@enea.com>
Diffstat (limited to 'plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/views/RecipeContentProvider.java')
-rw-r--r-- | plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/views/RecipeContentProvider.java | 60 |
1 files changed, 60 insertions, 0 deletions
diff --git a/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/views/RecipeContentProvider.java b/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/views/RecipeContentProvider.java new file mode 100644 index 0000000..7e29e7a --- /dev/null +++ b/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/views/RecipeContentProvider.java | |||
@@ -0,0 +1,60 @@ | |||
1 | /***************************************************************************** | ||
2 | * Copyright (c) 2009 Ken Gilmer | ||
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 | *******************************************************************************/ | ||
11 | package org.yocto.bc.ui.views; | ||
12 | |||
13 | import java.util.ArrayList; | ||
14 | import java.util.Collection; | ||
15 | import java.util.List; | ||
16 | |||
17 | import org.eclipse.core.resources.IProject; | ||
18 | import org.eclipse.core.resources.IProjectNature; | ||
19 | import org.eclipse.core.resources.ResourcesPlugin; | ||
20 | import org.eclipse.core.runtime.CoreException; | ||
21 | import org.eclipse.jface.viewers.IStructuredContentProvider; | ||
22 | import org.eclipse.jface.viewers.Viewer; | ||
23 | |||
24 | import org.yocto.bc.bitbake.BBSession; | ||
25 | import org.yocto.bc.ui.Activator; | ||
26 | import org.yocto.bc.ui.builder.BitbakeCommanderNature; | ||
27 | |||
28 | class RecipeContentProvider implements IStructuredContentProvider { | ||
29 | public void dispose() { | ||
30 | } | ||
31 | |||
32 | public Object[] getElements(Object parent) { | ||
33 | List recipes = new ArrayList(); | ||
34 | IProject[] projects = ResourcesPlugin.getWorkspace().getRoot().getProjects(); | ||
35 | IProjectNature nature = null; | ||
36 | for (int i = 0; i < projects.length; ++i) { | ||
37 | try { | ||
38 | if (projects[i].isOpen() && projects[i].hasNature(BitbakeCommanderNature.NATURE_ID)) { | ||
39 | recipes.addAll(getRecipesFromProject(projects[i])); | ||
40 | } | ||
41 | } catch (CoreException e) { | ||
42 | // TODO Auto-generated catch block | ||
43 | e.printStackTrace(); | ||
44 | } catch (Exception e) { | ||
45 | // TODO Auto-generated catch block | ||
46 | e.printStackTrace(); | ||
47 | } | ||
48 | } | ||
49 | |||
50 | return recipes.toArray(); | ||
51 | } | ||
52 | |||
53 | private Collection getRecipesFromProject(IProject project) throws Exception { | ||
54 | BBSession session = Activator.getBBSession(project.getLocationURI().getPath(), null); | ||
55 | return session.getRecipeFiles(project); | ||
56 | } | ||
57 | |||
58 | public void inputChanged(Viewer v, Object oldInput, Object newInput) { | ||
59 | } | ||
60 | } \ No newline at end of file | ||