字號: 小 中 大 |
推薦給好友
上一篇 |
下一篇
基于RSA開發備忘單(Cheat Sheet)
發布: 2008-6-18 10:03 |
作者: 不詳 |
來源:
李東兵,劉昱,孫瑛霖 IBM 中國軟件開發實驗室 SOA設計中心 軟件工程師 |
查看: 118次 | 進入軟件測試論壇討論
領測軟件測試網
定義動作:具體需要實現什么樣的動作,由Cheat Sheet人員自行決定,下圖給出了實現打開一個創建窗口的動作的代碼實例。
表4 定義動作
package exampleCheatSheet.action;
import …..
public class ExecuteCommand extends Action implements ICheatSheetAction{
…
/*
* 為Cheat Sheet執行傳輸進來command
* eg:當參數是'org.eclipse.ui.newWizard'時,回將'新建窗口'菜單打開。
* 關于Command的詳細用法,請參見參考文獻。
* @see org.eclipse.ui.cheatsheets.ICheatSheetAction#run(java.lang.String[],
org.eclipse.ui.cheatsheets.ICheatSheetManager)
*/
public void run(String[] params, ICheatSheetManager manager) {
System.out.println("ExecuteCommand running");
// Check for null command.
if (params[0] == null) {
System.out.println("params[0] null");
}
// grab command name to execute
String commandName = params[0];
// retrieve the command manager
ICommandManager cManager =
PlatformUI.getWorkbench().getCommandSupport().getCommandManager();
// verify that its a valid command
if (!cManager.getDefinedCommandIds().contains(commandName)) {
System.err.println("no such command");
}
// get that command object and execute it with its parameters
ICommand command = cManager.getCommand(commandName);
try {
command.execute(null);
} catch (Exception ex) {
System.err.println("error executing command");
}
}
}
|
文章來源于領測軟件測試網 http://www.kjueaiud.com/