| 1 | package de.uka.ipd.sdq.dsexplore.designdecisions; |
| 2 | |
| 3 | import java.util.ArrayList; |
| 4 | import java.util.Collection; |
| 5 | import java.util.Iterator; |
| 6 | import java.util.List; |
| 7 | |
| 8 | import org.apache.log4j.Logger; |
| 9 | import org.eclipse.core.runtime.CoreException; |
| 10 | import org.eclipse.core.runtime.IConfigurationElement; |
| 11 | import de.uka.ipd.sdq.dsexplore.helper.ExtensionHelper; |
| 12 | |
| 13 | /** |
| 14 | * Handles the loading of the plugins with the extension <extension-point id="de.uka.idd.sdq.dsexplore.newcandidates" name="de.uka.idd.sdq.dsexplore.newcandidates" schema="schema/de.uka.idd.sdq.dsexplore.newcandidates.exsd"/>. |
| 15 | * |
| 16 | * See also the tutorial at http://www.ibm.com/developerworks/xml/library/x-wxxm29.html, where the idea is described. |
| 17 | * @author Anne |
| 18 | * |
| 19 | */ |
| 20 | @Deprecated |
| 21 | public class NewCandidateFactory { |
| 22 | |
| 23 | /** Logger for log4j. */ |
| 24 | private static Logger logger = |
| 25 | Logger.getLogger("de.uka.ipd.sdq.dsexplore"); |
| 26 | |
| 27 | protected IConfigurationElement element; |
| 28 | private List<INewCandidates> nc; |
| 29 | |
| 30 | private static NewCandidateFactory instance = new NewCandidateFactory(); |
| 31 | |
| 32 | public List<INewCandidates> getAllNewCandidateExtensions() throws CoreException{ |
| 33 | if (nc == null){ |
| 34 | Collection<Object> extensions = ExtensionHelper.loadExtension("de.uka.ipd.sdq.dsexplore.newcandidates"); |
| 35 | nc = new ArrayList<INewCandidates>(); |
| 36 | for (Iterator<Object> iterator = extensions.iterator(); iterator |
| 37 | .hasNext();) { |
| 38 | nc.add((INewCandidates)iterator.next()); |
| 39 | logger.debug("Added an extension de.uka.ipd.sdq.dsexplore.newcandidates"); |
| 40 | } |
| 41 | } |
| 42 | return nc; |
| 43 | } |
| 44 | |
| 45 | public static NewCandidateFactory getInstance(){ |
| 46 | return instance; |
| 47 | } |
| 48 | |
| 49 | |
| 50 | |
| 51 | } |