blob: fd155b53e8ab52246d760b80aff53c15fffea09c [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.builtin;
import java.util.List;
import org.eclipse.viatra2.framework.IFramework;
import org.eclipse.viatra2.frameworkgui.FrameworkGUIPlugin;
import org.eclipse.viatra2.frameworkgui.views.console.commands.IVIATRAConsoleCommandProvider;
import org.eclipse.viatra2.frameworkgui.views.console.commands.IVIATRAConsoleCommandProviderFactory;
/**
* Supertrivial implementation for the "listcommands" command.
* It will print out a list of available commands with their short descriptions.
* @author istvan
*
*/
public class ListCommands implements IVIATRAConsoleCommandProvider {
public void executeCommand(IFramework fw, List<String> parameters) {
for (IVIATRAConsoleCommandProviderFactory f : FrameworkGUIPlugin.getDefault().getCommandProviderFactories())
{
fw.getLogger().info("Console command factory: "+f.getClass().getSimpleName());
for (IVIATRAConsoleCommandProvider cp : f.getProviders(fw))
{
fw.getLogger().info("\t"+cp.getCommandSignature()+" : "+cp.getDescription());
}
}
}
public String getCommandSignature() {
return "listcommands()";
}
public String getDescription() {
return "Prints a list of commands with their short descriptions";
}
public String getHelpText() {
return getDescription();
}
}