如何在 EMF 命令中使用输入对话框?

发布于 2024-10-03 03:01:47 字数 742 浏览 0 评论 0原文

我正在尝试在自定义命令的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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

苏辞 2024-10-10 03:01:47

我使用了与上面介绍的完全不同的方法,因为这种方法不是正确的方法。

I used a totally different approach than presented above since this approach is not the correct way of doing it.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文