From c7da892cb23d50d4d85746c9a0b6b14bf570989d Mon Sep 17 00:00:00 2001 From: Adrian Dudau Date: Thu, 26 Jun 2014 13:23:09 +0200 Subject: initial commit for Enea Linux 4.0 Migrated from the internal git server on the daisy-enea branch Signed-off-by: Adrian Dudau --- .../yocto/bc/ui/views/RecipeContentProvider.java | 61 ++++++++++++++++++++++ 1 file changed, 61 insertions(+) create mode 100644 plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/views/RecipeContentProvider.java (limited to 'plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/views/RecipeContentProvider.java') 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..2346031 --- /dev/null +++ b/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/views/RecipeContentProvider.java @@ -0,0 +1,61 @@ +/***************************************************************************** + * Copyright (c) 2013 Ken Gilmer, Intel Corporation + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Ken Gilmer - initial API and implementation + * Ioana Grigoropol (Intel) - adapt class for remote support + *******************************************************************************/ +package org.yocto.bc.ui.views; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.List; + +import org.eclipse.core.resources.IProject; +import org.eclipse.core.resources.IProjectNature; +import org.eclipse.core.resources.ResourcesPlugin; +import org.eclipse.core.runtime.CoreException; +import org.eclipse.jface.viewers.IStructuredContentProvider; +import org.eclipse.jface.viewers.Viewer; + +import org.yocto.bc.bitbake.BBSession; +import org.yocto.bc.ui.Activator; +import org.yocto.bc.ui.builder.BitbakeCommanderNature; + +class RecipeContentProvider implements IStructuredContentProvider { + public void dispose() { + } + + public Object[] getElements(Object parent) { + List recipes = new ArrayList(); + IProject[] projects = ResourcesPlugin.getWorkspace().getRoot().getProjects(); + IProjectNature nature = null; + for (int i = 0; i < projects.length; ++i) { + try { + if (projects[i].isOpen() && projects[i].hasNature(BitbakeCommanderNature.NATURE_ID)) { + recipes.addAll(getRecipesFromProject(projects[i])); + } + } catch (CoreException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } catch (Exception e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + + return recipes.toArray(); + } + + private Collection getRecipesFromProject(IProject project) throws Exception { + BBSession session = Activator.getBBSession(Activator.getProjInfo(project.getLocationURI()), null); + return session.getRecipeFiles(project); + } + + public void inputChanged(Viewer v, Object oldInput, Object newInput) { + } +} -- cgit v1.2.3-54-g00ecf