| /******************************************************************************* |
| * 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.imports.NativeImporter; |
| import org.eclipse.viatra2.imports.NativeImporterFactory; |
| |
| public class GeneralNativeImporterFactory implements NativeImporterFactory { |
| String importerName; |
| |
| String id; |
| |
| IConfigurationElement importer; |
| |
| String[] fileExtensionList; |
| |
| public GeneralNativeImporterFactory(String id, String name, |
| IConfigurationElement importer, String[] fileExtensionList) { |
| this.id = id; |
| importerName = name; |
| this.importer = importer; |
| this.fileExtensionList = fileExtensionList; |
| } |
| |
| public String getImporterName() { |
| return importerName; |
| } |
| |
| public NativeImporter getImporterInstance() throws VPMRuntimeException { |
| try { |
| return (NativeImporter) importer.createExecutableExtension("class"); |
| } catch (CoreException e) { |
| throw new VPMRuntimeException("error instantiating importer class", |
| e); |
| } |
| } |
| |
| public String getId() { |
| return id; |
| } |
| |
| public String[] getFileExtensionList() { |
| return fileExtensionList; |
| } |
| |
| public void setFileExtensionList(String[] fileExtensionList) { |
| this.fileExtensionList = fileExtensionList; |
| } |
| |
| } |