开发者

How to use an InputDialog inside EMF Commands?

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,开发者_Go百科 
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


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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜