blob: e29b89e7201709a4e315706ae1c81802cc56a502 [file] [log] [blame]
/*******************************************************************************
* 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 java.util.StringTokenizer;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IConfigurationElement;
import org.eclipse.viatra2.interpreters.ModelInterpreter;
import org.eclipse.viatra2.interpreters.ModelInterpreterFactory;
public class GeneralInterpreterFactory implements ModelInterpreterFactory {
IConfigurationElement className;
public GeneralInterpreterFactory(IConfigurationElement name2) {
className = name2;
}
public String getDescription() {
return className.getAttribute("description");
}
public String getId() {
return className.getAttribute("id");
}
public String getName() {
return className.getAttribute("name");
}
public ModelInterpreter getInterpreter() {
ModelInterpreter o = null;
try {
o = (ModelInterpreter) className.createExecutableExtension("class");
} catch (CoreException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return o;
}
public String[] getInterpretedClasses() {
String ret = className.getAttribute("interpretedClasses");
if (ret == null)
return null;
if (ret.length() > 0) {
StringTokenizer tok = new StringTokenizer(ret, ",");
String[] args = new String[tok.countTokens()];
for (int i = 0; i < args.length; ++i) {
args[i] = tok.nextToken();
}
return args;
} else {
return null;
}
}
}