Recall of IEntryPoint.createUI() after saving editor [message #118516] |
Fri, 16 January 2009 05:48  |
Eclipse User |
|
|
|
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 #118672 is a reply to message #118603] |
Mon, 19 January 2009 07:52   |
Eclipse User |
|
|
|
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 #119216 is a reply to message #118672] |
Thu, 22 January 2009 07:35  |
Eclipse User |
|
|
|
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?
>
>
>
>
>
|
|
|
Powered by
FUDForum. Page generated in 0.04867 seconds