//----------------------------------------------------------------------------
// COMPONENT NAME: LPEX Editor
//
// All Rights Reserved.
//
// DESCRIPTION:
// TestCommand - sample user-defined command
//----------------------------------------------------------------------------
package com.ibm.lpex.samples;
import com.ibm.lpex.core.LpexCommand;
import com.ibm.lpex.core.LpexView;
/**
* Sample command - display a short message.
* Running this command will display a short message on the editor message line.
*
* <p>Here is the TestCommand <a href="doc-files/TestCommand.java.html">source
* code</a>.</p>
*
* <p>To run this sample:
* <ul>
* <li>Define the command via an editor preference page, where available, or
* from the editor command line:
* <pre>set commandClass.testCommand com.ibm.lpex.samples.TestCommand</pre></li>
* <li>Run it from the editor command line:
* <pre>testCommand</pre></li>
* </ul></p>
*
* <p>A user command is a Java class that implements the
* com.ibm.lpex.core.LpexCommand interface.</p>
*
* @see com.ibm.lpex.samples All the samples
*/
public class TestCommand implements LpexCommand
{
public boolean doCommand(LpexView lpexView, String parameters)
{
String command = "testCommand";
if (parameters.length() != 0)
{
command += ' ' + parameters;
}
lpexView.doCommand("set messageText Command \"" + command + "\" was run.");
return true;
}
}