score:0

you could also check swt plugin's state:

bundle swtbunble = platform.getbundle("org.eclipse.swt");
boolean isheadless = (swtbunble==null || swtbunble.getstate() != bundle.active);

score:1

update: this code works properly only if a corresponding system property is set.

boolean isheadless = system.getproperty("eclipse.application")
            .equals("org.eclipse.cdt.managedbuilder.core.headlessbuild");

this code checks an argument passed as an "application", it is "org.eclipse.cdt.managedbuilder.core.headlessbuild" in case of a headless eclipse launch.


Related Query

More Query from same tag