Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Remote Application Platform (RAP) » Recall of IEntryPoint.createUI() after saving editor
Recall of IEntryPoint.createUI() after saving editor [message #118516] Fri, 16 January 2009 10:48 Go to next message
Bogdan B. is currently offline Bogdan B.Friend
Messages: 50
Registered: July 2009
Member
Hi,

I added the ActionFactory.SAVE action to the toolbar in my RAP_1.2M4
application using my extension of ActionBarAdvisor (exactly how it is done
in the demo application that comes with RAP). The icon is shown, the
enabling works fine, but when I save, then the .createUI() method of my
extension of IEntryPoint (MyEntryPoint in the stack trace) is called again
although it shouldn't. This call produces the NPE shown below.

My question is: why is it called again?
Shouldn't it be called only once when the application starts? I checked
the demo and it is indeed only called once and not on every saving the
changes from an editor.
So what am I doing wrong? Is there something I still should configure?


java.lang.NullPointerException
at
org.eclipse.jface.action.StatusLineManager$1.setCanceled(Sta tusLineManager.java:188)
at org.eclipse.jface.operation.ModalContext.run(ModalContext.ja va:354)
at
org.eclipse.jface.window.ApplicationWindow$1.run(Application Window.java:758)
at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator .java:66)
at
org.eclipse.jface.window.ApplicationWindow.run(ApplicationWi ndow.java:755)
at org.eclipse.ui.internal.WorkbenchWindow.run(WorkbenchWindow. java:2445)
at
org.eclipse.ui.internal.SaveableHelper.runProgressMonitorOpe ration(SaveableHelper.java:273)
at
org.eclipse.ui.internal.SaveableHelper.runProgressMonitorOpe ration(SaveableHelper.java:252)
at
org.eclipse.ui.internal.SaveableHelper.savePart(SaveableHelp er.java:147)
at org.eclipse.ui.internal.EditorManager.savePart(EditorManager .java:1354)
at org.eclipse.ui.internal.WorkbenchPage.savePart(WorkbenchPage .java:3185)
at
org.eclipse.ui.internal.WorkbenchPage.saveEditor(WorkbenchPa ge.java:3198)
at org.eclipse.ui.internal.SaveAction.run(SaveAction.java:75)
at org.eclipse.jface.action.Action.runWithEvent(Action.java:500 )
at
org.eclipse.jface.action.ActionContributionItem.handleWidget Selection(ActionContributionItem.java:580)
at
org.eclipse.jface.action.ActionContributionItem.access$2(Act ionContributionItem.java:497)
at
org.eclipse.jface.action.ActionContributionItem$6.handleEven t(ActionContributionItem.java:449)
at
org.eclipse.swt.internal.widgets.UntypedEventAdapter.dispatc hEvent(UntypedEventAdapter.java:365)
at
org.eclipse.swt.internal.widgets.UntypedEventAdapter.widgetS elected(UntypedEventAdapter.java:82)
at
org.eclipse.swt.events.SelectionEvent.dispatchToObserver(Sel ectionEvent.java:176)
at org.eclipse.rwt.internal.events.Event.processEvent(Event.jav a:44)
at org.eclipse.swt.events.TypedEvent.processEvent(TypedEvent.ja va:117)
at org.eclipse.swt.events.TypedEvent.executeNext(TypedEvent.jav a:157)
at
org.eclipse.rwt.internal.lifecycle.RWTLifeCycle.readAndDispa tch(RWTLifeCycle.java:241)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java :685)
at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.jav a:2388)
at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2347)
at org.eclipse.ui.internal.Workbench.access$5(Workbench.java:22 00)
at org.eclipse.ui.internal.Workbench$4.run(Workbench.java:425)
at
org.eclipse.core.databinding.observable.Realm.runWithDefault (Realm.java:333)
at
org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Work bench.java:408)
at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.j ava:157)
at com.centrasite.workbench.MyEntryPoint.createUI(MyEntryPoint. java:17)
at
org.eclipse.rwt.internal.lifecycle.EntryPointManager.createU I(EntryPointManager.java:92)
at
org.eclipse.rwt.internal.lifecycle.RWTLifeCycle.createUI(RWT LifeCycle.java:228)
at
org.eclipse.rwt.internal.lifecycle.RWTLifeCycle$UIThreadCont roller.run(RWTLifeCycle.java:116)
at java.lang.Thread.run(Thread.java:595)
Re: Recall of IEntryPoint.createUI() after saving editor [message #118532 is a reply to message #118516] Mon, 19 January 2009 09:56 Go to previous messageGo to next message
Rüdiger Herrmann is currently offline Rüdiger HerrmannFriend
Messages: 581
Registered: July 2009
Senior Member
I can't see where MyEntryPoint is called *again*. Apparently there
is a difference between your code and the demo application code.

Bogdan B. wrote:
> Hi,
>
> I added the ActionFactory.SAVE action to the toolbar in my RAP_1.2M4
> application using my extension of ActionBarAdvisor (exactly how it is
> done in the demo application that comes with RAP). The icon is shown,
> the enabling works fine, but when I save, then the .createUI() method of
> my extension of IEntryPoint (MyEntryPoint in the stack trace) is called
> again although it shouldn't. This call produces the NPE shown below.
>
> My question is: why is it called again? Shouldn't it be called only once
> when the application starts? I checked the demo and it is indeed only
> called once and not on every saving the changes from an editor.
> So what am I doing wrong? Is there something I still should configure?
>
>
> java.lang.NullPointerException
> at
> org.eclipse.jface.action.StatusLineManager$1.setCanceled(Sta tusLineManager.java:188)
>
> at org.eclipse.jface.operation.ModalContext.run(ModalContext.ja va:354)
> at
> org.eclipse.jface.window.ApplicationWindow$1.run(Application Window.java:758)
>
> at
> org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator .java:66)
> at
> org.eclipse.jface.window.ApplicationWindow.run(ApplicationWi ndow.java:755)
> at
> org.eclipse.ui.internal.WorkbenchWindow.run(WorkbenchWindow. java:2445)
> at
> org.eclipse.ui.internal.SaveableHelper.runProgressMonitorOpe ration(SaveableHelper.java:273)
>
> at
> org.eclipse.ui.internal.SaveableHelper.runProgressMonitorOpe ration(SaveableHelper.java:252)
>
> at
> org.eclipse.ui.internal.SaveableHelper.savePart(SaveableHelp er.java:147)
> at
> org.eclipse.ui.internal.EditorManager.savePart(EditorManager .java:1354)
> at
> org.eclipse.ui.internal.WorkbenchPage.savePart(WorkbenchPage .java:3185)
> at
> org.eclipse.ui.internal.WorkbenchPage.saveEditor(WorkbenchPa ge.java:3198)
> at org.eclipse.ui.internal.SaveAction.run(SaveAction.java:75)
> at org.eclipse.jface.action.Action.runWithEvent(Action.java:500 )
> at
> org.eclipse.jface.action.ActionContributionItem.handleWidget Selection(ActionContributionItem.java:580)
>
> at
> org.eclipse.jface.action.ActionContributionItem.access$2(Act ionContributionItem.java:497)
>
> at
> org.eclipse.jface.action.ActionContributionItem$6.handleEven t(ActionContributionItem.java:449)
>
> at
> org.eclipse.swt.internal.widgets.UntypedEventAdapter.dispatc hEvent(UntypedEventAdapter.java:365)
>
> at
> org.eclipse.swt.internal.widgets.UntypedEventAdapter.widgetS elected(UntypedEventAdapter.java:82)
>
> at
> org.eclipse.swt.events.SelectionEvent.dispatchToObserver(Sel ectionEvent.java:176)
>
> at org.eclipse.rwt.internal.events.Event.processEvent(Event.jav a:44)
> at org.eclipse.swt.events.TypedEvent.processEvent(TypedEvent.ja va:117)
> at org.eclipse.swt.events.TypedEvent.executeNext(TypedEvent.jav a:157)
> at
> org.eclipse.rwt.internal.lifecycle.RWTLifeCycle.readAndDispa tch(RWTLifeCycle.java:241)
>
> at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java :685)
> at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.jav a:2388)
> at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2347)
> at org.eclipse.ui.internal.Workbench.access$5(Workbench.java:22 00)
> at org.eclipse.ui.internal.Workbench$4.run(Workbench.java:425)
> at
> org.eclipse.core.databinding.observable.Realm.runWithDefault (Realm.java:333)
>
> at
> org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Work bench.java:408)
> at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.j ava:157)
> at com.centrasite.workbench.MyEntryPoint.createUI(MyEntryPoint. java:17)
> at
> org.eclipse.rwt.internal.lifecycle.EntryPointManager.createU I(EntryPointManager.java:92)
>
> at
> org.eclipse.rwt.internal.lifecycle.RWTLifeCycle.createUI(RWT LifeCycle.java:228)
>
> at
> org.eclipse.rwt.internal.lifecycle.RWTLifeCycle$UIThreadCont roller.run(RWTLifeCycle.java:116)
>
> at java.lang.Thread.run(Thread.java:595)
>
Re: Recall of IEntryPoint.createUI() after saving editor [message #118547 is a reply to message #118532] Mon, 19 January 2009 10:37 Go to previous messageGo to next message
Bogdan B. is currently offline Bogdan B.Friend
Messages: 50
Registered: July 2009
Member
Hi, and thanks for the answer. Maybe I wasn't too clear, I shall explain
it again:

The demo application works fine, its entry point is DemoWorkbench, and its
createUI() is called only once when the demo application starts, and NOT
when I save an editor (as it should be).

The problem occurs only in my application. The NPE corresponding to the
posted stack trace is thrown when I save the changes made in an editor
from my application, not the demo application. MyEntrypoint is the
implementation of IEntryPointin in my application (as DemoWorkbench is the
implementation of IEntryPoint in the demo application). What I am saying
is that .createUI() shouldn't be called here at all, it has been already
called when my application first started (which is the only place it
should be called).

And I was asking whether you have any ideas of what could cause a second
call of recreating the UI when I save an editor.
Re: Recall of IEntryPoint.createUI() after saving editor [message #118603 is a reply to message #118547] Mon, 19 January 2009 11:27 Go to previous messageGo to next message
Rüdiger Herrmann is currently offline Rüdiger HerrmannFriend
Messages: 581
Registered: July 2009
Senior Member
Bogdan B. wrote:
> Hi, and thanks for the answer. Maybe I wasn't too clear, I shall explain
> it again:
>
> The demo application works fine, its entry point is DemoWorkbench, and
> its createUI() is called only once when the demo application starts, and
> NOT when I save an editor (as it should be).
>
> The problem occurs only in my application. The NPE corresponding to the
> posted stack trace is thrown when I save the changes made in an editor
> from my application, not the demo application. MyEntrypoint is the
> implementation of IEntryPointin in my application (as DemoWorkbench is
> the implementation of IEntryPoint in the demo application). What I am
> saying is that .createUI() shouldn't be called here at all, it has been
> already called when my application first started (which is the only
> place it should be called).
I am not sure if I got you.
MyEntryPoint is always contained in the stack trace because it is
one of the first things being called and only ever returned from if
the session terminates. This is why you will see it in each and
every stack trace. It is like the main method of a "normal" Java
application.

>
> And I was asking whether you have any ideas of what could cause a second
> call of recreating the UI when I save an editor.
>
Re: Recall of IEntryPoint.createUI() after saving editor [message #118672 is a reply to message #118603] Mon, 19 January 2009 12:52 Go to previous messageGo to next message
Bogdan B. is currently offline Bogdan B.Friend
Messages: 50
Registered: July 2009
Member
Rüdiger Herrmann wrote:
> I am not sure if I got you.
> MyEntryPoint is always contained in the stack trace because it is
> one of the first things being called and only ever returned from if
> the session terminates. This is why you will see it in each and
> every stack trace. It is like the main method of a "normal" Java
> application.

Yes, you are right, sorry.

Anyway, I found the problem: on saving the changes made in an editor, the
following will be called (first line of my stack trace):
org.eclipse.jface.action.StatusLineManager$1.setCanceled(Sta tusLineManager.java:188)

But in my application I have overriden
WorkbenchWindowAdvisor.createWindowContents() to not create a menu and a
status line (as it would be created by default, and as the demo
application does), because I don't need them.
Which means that StatusLineManager.createControl(Composite, int) will
never be invoked in my application, which leaves
StatusLineManager.statusLine null, which produces the NPE when the saving
reaches the line 188 of StatusLineManager: "if (statusLine.isDisposed())
{".

To sustain this, if I add the following into
WorkbenchWindowAdvisor.createWindowContents():
getWindowConfigurer().getPresentationFactory().createStatusL ineControl(
((WorkbenchWindow)getWindowConfigurer().getWindow()).getStat usLineManager(),
shell);
than it works fine.

But why should I create a status line if I don't need it? Wouldn't be
better if you check if the statusline is not null before you check if it
has been disposed?
Re: Recall of IEntryPoint.createUI() after saving editor [message #118692 is a reply to message #118672] Mon, 19 January 2009 13:34 Go to previous messageGo to next message
Rüdiger Herrmann is currently offline Rüdiger HerrmannFriend
Messages: 581
Registered: July 2009
Senior Member
Bogdan B. wrote:

> But why should I create a status line if I don't need it? Wouldn't be
> better if you check if the statusline is not null before you check if it
> has been disposed?
The code from StatusLineManager originally belongs to JFace and was
adopted for RAP. Feel free to file a bug for Platform / JFace:
https://bugs.eclipse.org/bugs/enter_bug.cgi?product=Platform
Re: Recall of IEntryPoint.createUI() after saving editor [message #118768 is a reply to message #118692] Mon, 19 January 2009 16:24 Go to previous messageGo to next message
Bogdan B. is currently offline Bogdan B.Friend
Messages: 50
Registered: July 2009
Member
Rüdiger Herrmann wrote:
> The code from StatusLineManager originally belongs to JFace and was
> adopted for RAP. Feel free to file a bug for Platform / JFace:
> https://bugs.eclipse.org/bugs/enter_bug.cgi?product=Platform

Thank you again for the trouble, Rüdiger!
Re: Recall of IEntryPoint.createUI() after saving editor [message #119216 is a reply to message #118672] Thu, 22 January 2009 12:35 Go to previous message
Matthias Maar is currently offline Matthias MaarFriend
Messages: 5
Registered: July 2009
Junior Member
Hi Bogdan,

as the JavaDoc for WorkbenchWindowAdvisor.createWindowContents() states,
you can control the visibility of some default workbench items by using
the setShow* methods. So simply adding
getWindowConfigurer().setShowStatusLine(false) in the preWindowOpen()
method of your overridden WorkbenchWindowAdvisor class effectively hides
the status bar. Overriding the createWindowContents() is most often not
necessary and error prone.

Regards,
Matthias


Bogdan B. wrote:
> Rüdiger Herrmann wrote:
>> I am not sure if I got you.
>> MyEntryPoint is always contained in the stack trace because it is one
>> of the first things being called and only ever returned from if the
>> session terminates. This is why you will see it in each and every
>> stack trace. It is like the main method of a "normal" Java application.
>
> Yes, you are right, sorry.
>
> Anyway, I found the problem: on saving the changes made in an editor,
> the following will be called (first line of my stack trace):
> org.eclipse.jface.action.StatusLineManager$1.setCanceled(Sta tusLineManager.java:188)
>
>
> But in my application I have overriden
> WorkbenchWindowAdvisor.createWindowContents() to not create a menu and a
> status line (as it would be created by default, and as the demo
> application does), because I don't need them.
> Which means that StatusLineManager.createControl(Composite, int) will
> never be invoked in my application, which leaves
> StatusLineManager.statusLine null, which produces the NPE when the
> saving reaches the line 188 of StatusLineManager: "if
> (statusLine.isDisposed()) {".
>
> To sustain this, if I add the following into
> WorkbenchWindowAdvisor.createWindowContents():
> getWindowConfigurer().getPresentationFactory().createStatusL ineControl(
>
> ((WorkbenchWindow)getWindowConfigurer().getWindow()).getStat usLineManager(),
> shell);
> than it works fine.
>
> But why should I create a status line if I don't need it? Wouldn't be
> better if you check if the statusline is not null before you check if it
> has been disposed?
>
>
>
>
>
Previous Topic:KeyListener and VerifyText on Text can't co-exist ?
Next Topic:Building on M4
Goto Forum:
  


Current Time: Fri Nov 08 21:59:57 GMT 2024

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

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

Back to the top