Pixelord
Pixelord

Reputation: 641

Making a headless eclipse application with optional UI interface

I have been planning to create an eclipse application which needs to be a console application by default but have the UI (window/menu/views) as optional.

I need to run the application from command line for most of the time, but need to take the console application take command to enable the UI when I need it.

Can anyone direct me to proper resource how to configure these sort of application through eclipse?

Thanks.

Upvotes: 2

Views: 639

Answers (1)

greg-449
greg-449

Reputation: 111142

I don't think this can be done once the application has started.

For a 3.x compatibility mode RCP implementing IApplication you could check the command line arguments for something to tell you which type of start is required in the start method:

@Override
public Object start(final IApplicationContext context) throws Exception
{
  String [] args = (String [])context.getArguments().get(IApplicationContext.APPLICATION_ARGS);

  // TODO scan args for an option telling you which start is required

  // TODO If GUI required call PlatformUI.createAndRunWorkbench in the usual way
  // TODO otherwise do console app
}

Upvotes: 2

Related Questions