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, 
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

Answer

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

Leave a Reply

Your email address will not be published. Required fields are marked *