java - Eclipse RCP: command line argument without starting application -


i have rcp application had started in 3.x , have done soft migration 4.x.

i need add command line argument options end-user such -version, -help etc. when user types myapp -version in console, not start application, display version number.

thank you!

i tried out in application class,

public object start(iapplicationcontext context) throws exception {         string[] args = platform.getcommandlineargs();         int = 0;         while (i < args.length)         {             if (args[i].equals("-v"))             {                 system.out.println("version abc");                 return iapplication.exit_ok;             }             i++;         }          display display = platformui.createdisplay();         try {             int returncode = platformui.createandrunworkbench(display, new applicationworkbenchadvisor());             if (returncode == platformui.return_restart)                 return iapplication.exit_restart;             else                 return iapplication.exit_ok;         } {             display.dispose();         }      } 

it doesn't start ui starts splash screen. there method can place getcommandlineargs() before start of splash screen?

splashhandler attempt: tried bind own splashhandler hit same problem. time reach splashhandler's init method, shell splash image displayed , think shell created before of classes can have change intervene.

i haven't looked @ 4.x docs, appears can use start method in iapplication handle before gui starts.

then in before application starts ...

map args = context.getarguments();  string[] parms_ = (string[]) args.get("application.args"); list parms = arrays.aslist(parms_);  if (parms.contains("-version")) {     system.out.println("version found");     return iapplication.exit_ok; } 

Popular posts from this blog

How to calculate SNR of signals in MATLAB? -

c# - Attempting to upload to FTP: System.Net.WebException: System error -

ios - UISlider customization: how to properly add shadow to custom knob image -