| Open file from command line (Pure E4 RCP) [message #1021151] |
Tue, 19 March 2013 11:25  |
Severin Raevskiy Messages: 4 Registered: March 2013 |
Junior Member |
|
|
Hello. I would like to open files passed as command line arguments in my pure E4 RCP application (Eclipse 4.2). So I am using this article http://help.eclipse.org/juno/index.jsp?topic=%2Forg.eclipse.platform.doc.isv%2Freference%2Fmisc%2Fruntime-options.html and and I am tring to rewrite everything in E4 style.
I have created a listener class
public class OpenKmlEventProcessor implements Listener
{
@Override
public void handleEvent(Event event)
{
if (event.text != null)
{
...
}
}
}
and attached in to Display in @PostConstruct method of my Addon
@PostConstruct
void hookListeners(...)
{
...
Display.getDefault().addListener(SWT.OpenDocument, openKmlProcessor);
}
In the same addon I am processing command line arguments
@Inject
void proccessCmdLineArguments(IApplicationContext appContext)
{
...
String[] args = (String[])appContext.getArguments().get(IApplicationContext.APPLICATION_ARGS);
...
}
My product appName property matches my launcher name. And
--launcher.defaultAction
openFile
is present in my <launcher>.ini
Everything works fine in 2 cases:
1. I launch my application with the command line argument only once. Here "proccessCmdLineArguments" method works.
2. For the first time I launch my application without command line arguments. And then I can launch it with a command line argument as many times as I wish. Here "handleEvent" method works.
The problem is the third case, when I launch my application with the command line argument for the first time and do it again for the second time. After the default timeout (60 sec) Eclipse tries to create a new instance of my application instead of opening the file in the running instance. What am I doing wrong?
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.03410 seconds