I need to be able to double click on a file on the desktop and have Eclipse (or more specifically Lotus Notes) kick off my custom action, to process and display it. I've found
which describes how to setup a content type in eclipse and bind it to an editor. This is not quite what I need. We have emails stored as DXL (Domino XML), and while I can open them internally (through my custom functions), I can't find information on how to accomplish launching them externally. I'm hoping someone has done this before.
I havn't done it before but ... with the help of
EclipseEnvironmentInfo.getDefault().getCommandLineArgs()
you can get at the command line arguments eclipse is started with ("org.eclipse.core.runtime.internal.adaptor.EclipseEnvironmentInfo" is an internal class but you can access it anyhow ... at your own risk ;) ). A quick test shows that if you start a file with eclipse, the last argument is the path to that file.
Normal startup:
-os, win32, -ws, win32, -arch, x86, -product, org.eclipse.epp.package.rcp.product
With file:
-os, win32, -ws, win32, -arch, x86, -product, org.eclipse.epp.package.rcp.product, D:\Programme\Eclipse3.5-RCP\readme\readme_eclipse.html
You can extend the extension point "org.eclipse.ui.startup" and implement "org.eclipse.ui.IStartup" to check the command line Arguments and invoke your own command.
Heres my test class:
import java.util.Arrays;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
import org.eclipse.core.runtime.internal.adaptor.EclipseEnvironmentInfo;
import org.eclipse.ui.IStartup;
import test.Activator;
public class Test implements IStartup {
@Override
public void earlyStartup() {
String message = "Arguments: " + Arrays.toString(EclipseEnvironmentInfo.getDefault().getCommandLineArgs());
Activator.getDefault().getLog().log(new Status(IStatus.INFO, "Test", message));
}
}