如何在 EMF 命令中使用输入对话框?
我正在尝试在自定义命令的execute() 方法中打开一个InputDialog。它看起来如下:
public class MyCommand extends CompoundCommand{
...
execute(){
try {
...
super.execute();
}catch(Exception e){
InputDialog myDialog = ...
myDialog.open();
...
super.execute();
}
}
}
它工作正常,但会抛出一些异常。这些是:
org.eclipse.core.commands.ExecutionException: While executing the operation,
an exception occurred
这是由于
java.lang.IllegalStateException: Cannot open an operation while one
is already open
我在我的 EMF 项目中重写了 ItemProvider 的 createSetCommand() 方法而引起的。输入对话框是必要的,以便在用户输入错误值时从用户那里获取有效值。
事先非常感谢, 坎阿富汗人
I am trying to open an InputDialog inside the execute() method of a custom command. It looks as follows:
public class MyCommand extends CompoundCommand{
...
execute(){
try {
...
super.execute();
}catch(Exception e){
InputDialog myDialog = ...
myDialog.open();
...
super.execute();
}
}
}
It works fine but it throws some exceptions. These are:
org.eclipse.core.commands.ExecutionException: While executing the operation,
an exception occurred
which is caused by
java.lang.IllegalStateException: Cannot open an operation while one
is already open
I am overriding the createSetCommand() method of a ItemProvider in my EMF project. The input dialog is necessary in order to get the valid value from the user in case he/she entered a wrong value.
Thanx Alot Before Hand,
KanAfghan
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我使用了与上面介绍的完全不同的方法,因为这种方法不是正确的方法。
I used a totally different approach than presented above since this approach is not the correct way of doing it.