blob: 834e99c325d59edeab388ba0dc2a779ad38bb61a [file] [log] [blame]
/*******************************************************************************
* Copyright (c) 2008-2010, 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:
* Istvan Rath - initial API and implementation
*******************************************************************************/
package org.eclipse.viatra2.frameworkgui.views.console.commands.imports;
import java.io.File;
import java.util.ArrayList;
import java.util.List;
import org.eclipse.viatra2.framework.IFramework;
import org.eclipse.viatra2.frameworkgui.views.console.commands.IVIATRAConsoleCommandProvider;
import org.eclipse.viatra2.frameworkgui.views.console.commands.IVIATRAConsoleCommandProviderFactory;
/**
* Simple console commandprovider factory which provides importer invocation functions
*
* @author istvan rath
*
*/
public class NativeImporterCommands implements IVIATRAConsoleCommandProviderFactory {
public NativeImporterCommands() {
}
public List<IVIATRAConsoleCommandProvider> getProviders(IFramework fw) {
ArrayList<IVIATRAConsoleCommandProvider> ps = new ArrayList<IVIATRAConsoleCommandProvider>();
ps.add(new NativeImport());
ps.add(new NativeImportUsing());
return ps;
}
protected static void commenceImport(IFramework fw, File f, String impID) {
try {
fw.nativeImport(f.getAbsolutePath(), impID);
}
catch (Exception e) {
fw.getLogger().error("[NativeImporterCommands] path "+f.getAbsolutePath()+" is not importable.");
fw.getLogger().printStackTrace(e);
return;
}
}
}