Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse 4 » Launching from PDE with -console
Launching from PDE with -console [message #1010912] Mon, 18 February 2013 13:22 Go to next message
Christian Eugster is currently offline Christian EugsterFriend
Messages: 203
Registered: July 2009
Location: St. Gallen Switzerland
Senior Member
Hi,
I have created an e4 application project using the respective template. Starting the application from pde is ok. When I try to start with -console as program argument (added the felix gogo bundles an the equinox.console bundle) the osgi prompt shows up but the application window does get visible until I fired one or several ss commands in the console. Am I missing something?
Re: Launching from PDE with -console [message #1011353 is a reply to message #1010912] Tue, 19 February 2013 11:39 Go to previous messageGo to next message
Eclipse UserFriend
Christian Eugster wrote on Mon, 18 February 2013 08:22
Hi,
Am I missing something?


Probably Wink. What bundles o you have marked for autostart? See:

http://wiki.eclipse.org/Eclipse4/RCP/FAQ#Why_won.27t_my_application_start.3F

Brian.
Re: Launching from PDE with -console [message #1011366 is a reply to message #1011353] Tue, 19 February 2013 12:22 Go to previous messageGo to next message
Christian Eugster is currently offline Christian EugsterFriend
Messages: 203
Registered: July 2009
Location: St. Gallen Switzerland
Senior Member
Hi,

I did not have any auto-starts and run-levels set. After setting them as described in the target of the link nothing changed: I have to write "ss" to let pop up the main window. Are there other bundles that have to be set in configuration? Without -console set, the application starts normally.

Re: Launching from PDE with -console [message #1011377 is a reply to message #1011366] Tue, 19 February 2013 12:51 Go to previous messageGo to next message
Christoph Keimel is currently offline Christoph KeimelFriend
Messages: 482
Registered: December 2010
Location: Germany
Senior Member
Hi Christian

I don't know if this is what you want, but with the VM Argument -Dosgi.console.enable.builtin=true you do not need the equinox.console and felix bundles. This is the way I use it, but I just use it to question the bundle states (ss) during runtime, so I don't need the new fancy features.

Greetings
Christoph
Re: Launching from PDE with -console [message #1011384 is a reply to message #1011377] Tue, 19 February 2013 13:04 Go to previous messageGo to next message
Christian Eugster is currently offline Christian EugsterFriend
Messages: 203
Registered: July 2009
Location: St. Gallen Switzerland
Senior Member
Hi Christoph,

I have now removed the dependencies to the felix.gogo and the equinox.console bundles and added the -Dosgi.console.enable.builtin=true argument. There is no osgi-prompt in the console and calling e.g. "help" from it does nothing.

Also I have a perspective-stack with a selected perspective, that contains a (also selected) partsashcontainer, containing a (selected) part-stack, containing a (selected) part with an injected composite containing a label with text Hello (with focus set to it. The whole application window is empty. There are the template menues but the components are not shown... The whole is on a Windows XP machine running jre7 runtime and eclipse 4 m5a.

Re: Launching from PDE with -console [message #1011390 is a reply to message #1011384] Tue, 19 February 2013 13:21 Go to previous messageGo to next message
Christoph Keimel is currently offline Christoph KeimelFriend
Messages: 482
Registered: December 2010
Location: Germany
Senior Member
Hi Christian

this is what my Arguments look like in the .product file I use to start the (pure E4) application from the IDE:
<launcherArgs>
      <programArgs>
-console
-debug</programArgs>
      <vmArgs>-Dosgi.console.enable.builtin=true</vmArgs>
</launcherArgs>

Concerning your other problem: This could be an issue with the saved model state. Do you have "Clear workspace" activated in your Run Configuration? Alternativly you could add -clearPersistedState to your programm arguments to make sure, that the model is recalculated on startup.

Another way to debug is to add *.e4.tools.emf.liveditor (and required bundles) to your configuration. You can then check your model at runtime with Alt+Shift+F9.

Greetings
Christoph
Re: Launching from PDE with -console [message #1011391 is a reply to message #1011390] Tue, 19 February 2013 13:22 Go to previous messageGo to next message
Christoph Keimel is currently offline Christoph KeimelFriend
Messages: 482
Registered: December 2010
Location: Germany
Senior Member
BTW: I also don't see an osgi prompt at first, but when you put the focus in the console and just type the command it will work and show the prompt afterwards.
Re: Launching from PDE with -console [message #1012023 is a reply to message #1011391] Wed, 20 February 2013 18:08 Go to previous messageGo to next message
Christian Eugster is currently offline Christian EugsterFriend
Messages: 203
Registered: July 2009
Location: St. Gallen Switzerland
Senior Member
Hi Christoph,

sorry for the late answer. I have been in Holidays and I am back now. Thanks to your help I can now start the example. But I have another issue now: The method of @PostConstruct is not called, so I get an NullPointerException in the method annotated with @Focus. I am not sure, if I were a bit thumb. The tutorials seem not to have those problems at all. Sorry for that!

Thank you very much!

Christian
Re: Launching from PDE with -console [message #1012051 is a reply to message #1012023] Wed, 20 February 2013 19:41 Go to previous messageGo to next message
Christoph Keimel is currently offline Christoph KeimelFriend
Messages: 482
Registered: December 2010
Location: Germany
Senior Member
Hi Christian

that happens when DI can not find all the parameters in the context that are needed to call the method. To try if that is the case you can annotate every parameter with @Optional and then see which one is null.

Hope that helps.
Christoph
Re: Launching from PDE with -console [message #1012068 is a reply to message #1012023] Wed, 20 February 2013 20:26 Go to previous messageGo to next message
Eclipse UserFriend
I thought objects whose @PostConstruct fails (because of unsatisfied parameters) leads to an InjectionException and the object creation fails. But I may be wrong.

This problem can happen if your bundle is resolving to a different version of @PostConstruct than that used by the injector. Be sure to import package javax.inject 1.0.0.

Brian.
Re: Launching from PDE with -console [message #1012363 is a reply to message #1012068] Thu, 21 February 2013 12:15 Go to previous messageGo to next message
Christoph Keimel is currently offline Christoph KeimelFriend
Messages: 482
Registered: December 2010
Location: Germany
Senior Member
Brian de Alwis wrote on Wed, 20 February 2013 21:26
I thought objects whose @PostConstruct fails (because of unsatisfied parameters) leads to an InjectionException and the object creation fails. But I may be wrong.

You are correct. Thanks for the correction! This does lead to an InjectionException. I confused this with Handlers: If a parameter in @Execute or @CanExecute can't be resolved, there is no exception ... it just doesn't happen.

Greetings
Christoph
Re: Launching from PDE with -console [message #1016950 is a reply to message #1012363] Fri, 08 March 2013 10:14 Go to previous messageGo to next message
Christian Eugster is currently offline Christian EugsterFriend
Messages: 203
Registered: July 2009
Location: St. Gallen Switzerland
Senior Member
Hi Christoph,

I have no parameters in the code. The code of the part is:


package ch.eugster.colibri.parts;

import javax.annotation.PostConstruct;
import javax.inject.Inject;

import org.eclipse.e4.ui.di.Focus;
import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Label;

public class Part 
{
	@Inject
	private Composite composite;
	
	private Label label;
	
	@Inject
	public Part() 
	{
	}
	
	@PostConstruct
	public void postConstruct() 
	{
		composite.setLayout(new GridLayout());
		label = new Label(composite, SWT.None);
		label.setLayoutData(new GridData(GridData.FILL_BOTH));
		label.setText("Hallo");
	}
	
	
	
	@Focus
	public void onFocus() 
	{
		label.setFocus();
	}
	
	
}



and the exceptions thrown are:


osgi> !SESSION 2013-03-08 11:06:44.460 -----------------------------------------------
eclipse.buildId=unknown
java.version=1.7.0_09
java.vendor=Oracle Corporation
BootLoader constants: OS=win32, ARCH=x86, WS=win32, NL=de_CH
Framework arguments:  -product ch.eugster.colibri.product -clearPersistedState
Command-line arguments:  -product ch.eugster.colibri.product -data U:\Projekte\ColibriTS2G\Workspace/../runtime-ch.eugster.colibri.product -dev file:U:/Projekte/ColibriTS2G/Workspace/.metadata/.plugins/org.eclipse.pde.core/ch.eugster.colibri.product/dev.properties -os win32 -ws win32 -arch x86 -consoleLog -clearPersistedState -console

!ENTRY org.eclipse.e4.ui.workbench 4 0 2013-03-08 11:06:57.409
!MESSAGE Failed to grant focus to part (ch.eugster.colibri.part.0)
!STACK 0
org.eclipse.e4.core.di.InjectionException: java.lang.NullPointerException
	at org.eclipse.e4.core.internal.di.MethodRequestor.execute(MethodRequestor.java:63)
	at org.eclipse.e4.core.internal.di.InjectorImpl.invokeUsingClass(InjectorImpl.java:231)
	at org.eclipse.e4.core.internal.di.InjectorImpl.invoke(InjectorImpl.java:208)
	at org.eclipse.e4.core.contexts.ContextInjectionFactory.invoke(ContextInjectionFactory.java:106)
	at org.eclipse.e4.ui.internal.workbench.PartServiceImpl.activate(PartServiceImpl.java:587)
	at org.eclipse.e4.ui.internal.workbench.PartServiceImpl.switchPerspective(PartServiceImpl.java:515)
	at org.eclipse.e4.ui.workbench.renderers.swt.PerspectiveStackRenderer.showTab(PerspectiveStackRenderer.java:124)
	at org.eclipse.e4.ui.workbench.renderers.swt.LazyStackRenderer.postProcess(LazyStackRenderer.java:97)
	at org.eclipse.e4.ui.workbench.renderers.swt.PerspectiveStackRenderer.postProcess(PerspectiveStackRenderer.java:77)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.safeCreateGui(PartRenderingEngine.java:643)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.safeCreateGui(PartRenderingEngine.java:729)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.access$2(PartRenderingEngine.java:700)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$7.run(PartRenderingEngine.java:694)
	at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.createGui(PartRenderingEngine.java:679)
	at org.eclipse.e4.ui.workbench.renderers.swt.SWTPartRenderer.processContents(SWTPartRenderer.java:59)
	at org.eclipse.e4.ui.workbench.renderers.swt.WBWRenderer.processContents(WBWRenderer.java:644)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.safeCreateGui(PartRenderingEngine.java:639)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.safeCreateGui(PartRenderingEngine.java:729)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.access$2(PartRenderingEngine.java:700)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$7.run(PartRenderingEngine.java:694)
	at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.createGui(PartRenderingEngine.java:679)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$9.run(PartRenderingEngine.java:982)
	at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRenderingEngine.java:941)
	at org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(E4Workbench.java:79)
	at org.eclipse.e4.ui.internal.workbench.swt.E4Application.start(E4Application.java:150)
	at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110)
	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:354)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:181)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
	at java.lang.reflect.Method.invoke(Unknown Source)
	at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:636)
	at org.eclipse.equinox.launcher.Main.basicRun(Main.java:591)
	at org.eclipse.equinox.launcher.Main.run(Main.java:1450)
	at org.eclipse.equinox.launcher.Main.main(Main.java:1426)
Caused by: java.lang.NullPointerException
	at ch.eugster.colibri.parts.Part.onFocus(Part.java:40)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
	at java.lang.reflect.Method.invoke(Unknown Source)
	at org.eclipse.e4.core.internal.di.MethodRequestor.execute(MethodRequestor.java:56)
	... 40 more



May be that helps you to help me Very Happy

Christian
Re: Launching from PDE with -console [message #1016954 is a reply to message #1016950] Fri, 08 March 2013 10:34 Go to previous messageGo to next message
Christoph Keimel is currently offline Christoph KeimelFriend
Messages: 482
Registered: December 2010
Location: Germany
Senior Member
Hi Christian,

I don't know why postConstruct is not called on your part. I think you should open a new topic, so that others will read it and might have tipps on where to look.

Greetings
Christoph
Re: Launching from PDE with -console [message #1016956 is a reply to message #1016950] Fri, 08 March 2013 10:43 Go to previous message
Eclipse UserFriend
Christian -- sounds suspiciosly like you're missing versions on your import-packages. See the following for details (recently updated):

http://wiki.eclipse.org/Eclipse4/RCP/FAQ#Why_isn.27t_my_.40Inject-able.2F.40PostConstruct_methods_being_injected.3F
Previous Topic:Trying to get E4 services
Next Topic:Access to SWT Widgets in Parts at runtime
Goto Forum:
  


Current Time: Tue Apr 23 16:48:11 GMT 2024

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

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

Back to the top