| /******************************************************************************* |
| * Copyright (c) 2004-2008 Andras Schmidt, Andras Balogh, Istvan Rath and Daniel Varro |
| * 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: |
| * Andras Schmidt, Andras Balogh, Istvan Rath - initial API and implementation |
| *******************************************************************************/ |
| |
| package org.eclipse.viatra2; |
| |
| import org.eclipse.core.runtime.CoreException; |
| import org.eclipse.core.runtime.IConfigurationElement; |
| import org.eclipse.viatra2.errors.VPMRuntimeException; |
| import org.eclipse.viatra2.loaders.Loader; |
| import org.eclipse.viatra2.loaders.LoaderFactory; |
| |
| public class GeneralLoaderFactory implements LoaderFactory { |
| String loaderName; |
| |
| String id; |
| |
| IConfigurationElement loader; |
| |
| String[] fileExtensionList; |
| |
| public GeneralLoaderFactory(String id, String name, |
| IConfigurationElement loader, String[] fileExtensionList) { |
| this.id = id; |
| loaderName = name; |
| this.loader = loader; |
| this.fileExtensionList = fileExtensionList; |
| } |
| |
| public String getLoaderName() { |
| return loaderName; |
| } |
| |
| public Loader getLoaderInstance() throws VPMRuntimeException { |
| try { |
| return (Loader) loader.createExecutableExtension("class"); |
| } catch (CoreException e) { |
| throw new VPMRuntimeException("error instantiating loader class", e); |
| } |
| } |
| |
| public String getId() { |
| return id; |
| } |
| |
| public String[] getFileExtensionList() { |
| return fileExtensionList; |
| } |
| |
| public void setFileExtensionList(String[] fileExtensionList) { |
| this.fileExtensionList = fileExtensionList; |
| } |
| |
| } |