Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Platform » EclipseApplication Launcher Variant
EclipseApplication Launcher Variant [message #333751] Thu, 01 January 2009 22:12
Bill Winspur is currently offline Bill WinspurFriend
Messages: 180
Registered: July 2009
Senior Member
I am trying to develop a launcher to allow testing of a finished plug-in
jar file in a new Eclipse (3.1.1) instance, instead of the standard
EclipseApplication launcher, than compiles, builds and launches (in a new
Eclipse instance) plug-ins/fragments contributed by the subset of
currently open PDE projects in the workspace. Google revealed the
following two articles:



a. "We Have Lift-off: The Launching Framework in Eclipse" and

b. "Launching Java Applications Programmatically"



Both articles deal with launching a java application, not an
EclipseApplication, and I have not yet found the code that implements a
launch-config, and launch-config-type, for Eclipse applications, as shown
in the launch configurations dialog. However, in the PDE, I found source
code for launching a junit test app as an Eclipse app.



org.eclipse.pde.internal.junit.runtime.UITestApplication



which does not use ILaunchConfiguration, ILaunchConfigurationType, and
other components of the Eclipse launching framework. This suggests to me
that launch of an EclipseApplication is actually implemented
independently of the launching framework, which is perhaps limited to
launching apps that run outside Eclipse. Am I right about this?



Inching forward anyway, I cloned the UITestApplication source, modified
it to only launch the workbench extension (org.eclipse.ui.ide.workbench),
and called it from the action of a template plug-in (see source code,
below). I use the IDE export function to directly install the plugin's
jar directly into the eclipse/plugins directly of my Eclipse
installation, and re-boot eclipse to test it. The test aborts with an
error message:



"Could not launch the product because the associated workspace is
currently in use by another Eclipse application."

I suspect that is because I specified a null context for the start
method, not knowing how to create a context for the test instance.
However, I am concerned that this is not the proper approach to adding a
launch variant for EclipseApplications, and I remain confused about the
scope of the launching framework.



Question

--------



Can anybody direct me to articles or code that show how one should one
extend Eclipse to add a variant of the EclipseApplication launch
capability?



---------



Thanks



Bill.



========== Snippet ==================================



This is my current, as yet buggy method for launching a separate instance
of Eclipse (based on UITestApplication), with no attempt to configure the
new instance with a plugin.jar to be tested (later for that).



public void startEclipseInstance(){


// locate the workbench extension

IExtension extension = Platform.getExtensionRegistry().getExtension(

Platform.PI_RUNTIME, // "org.eclipse.core.runtime"

Platform.PT_APPLICATIONS, // "applications"

Workbench_APP_3_0); // "org.eclipse.ui.ide.workbench"



// create and execute a runnable for the workbench extension

IConfigurationElement[] elements =
extension.getConfigurationElements();

if (elements.length > 0) {
IConfigurationElement[] runs = elements[0].getChildren("run");
if (runs.length > 0) {
Object runnable;

try {

runnable = runs[0].createExecutableExtension("class");

} catch (CoreException e) {
throw new IllegalStateException(
"can not create runnable for wbench, due: " + e);

}

if (runnable instanceof IApplication) {
Object[] args = new Object[0];

try {

((IApplication)runnable).start(null);

} catch (Exception e) {

throw new IllegalStateException(
"can not start runnable for wbench, due: " + e);

}

} else {

throw new IllegalStateException(
"expected an IApplication, not a "
+ runnable.getClass().getName());

}
} else {
throw new IllegalStateException("
startEclipseInstance() zero run config elements found");

}

} else {
throw new IllegalStateException(
"startEclipseInstance() zero config elements found");

}

}

=================================
Previous Topic:Eclipse Proxy Settings Issue
Next Topic:problem in --> IFile org.eclipse.core.resources.IProject.getFile(String name)
Goto Forum:
  


Current Time: Sun Jun 30 13:47:47 GMT 2024

Powered by FUDForum. Page generated in 0.01936 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top