Layout exception when opening editor [message #119409] |
Fri, 23 January 2009 16:55 ![Go to next message Go to next message](theme/Solstice/images/down.png) |
|
Hi all,
I have the following simple editor:
public class MyEditor extends EditorPart
{
@Override
public void doSave(IProgressMonitor monitor){}
@Override
public void doSaveAs(){}
@Override
public boolean isDirty(){return false;}
@Override
public boolean isSaveAsAllowed(){return false;}
@Override
public void init(IEditorSite site, IEditorInput input) throws
PartInitException
{
setSite(site);
setInput(input);
}
@Override
public void createPartControl(final Composite parent)
{
Composite container = new Composite(parent,SWT.NONE);
container.setLayoutData(GridDataFactory.fillDefaults().grab( true,true).create());
}
@Override
public void setFocus(){}
}
When I open the editor the following exception is thrown:
Jan 23, 2009 11:44:07 PM org.eclipse.rwt.internal.lifecycle.RWTLifeCycle
afterPhaseExecution
SEVERE: Could not execute PhaseListener after phase 'PROCESS_ACTION'.
java.lang.ClassCastException: org.eclipse.swt.layout.GridData cannot be
cast to org.eclipse.swt.layout.FillData
at org.eclipse.swt.layout.FillLayout.flushCache(FillLayout.java :180)
at org.eclipse.swt.widgets.Composite.changed(Composite.java:493 )
at
org.eclipse.swt.internal.graphics.TextSizeDeterminationHandl er$1.doVisit(TextSizeDeterminationHandler.java:79)
at
org.eclipse.swt.internal.widgets.WidgetTreeVisitor$AllWidget TreeVisitor.visit(WidgetTreeVisitor.java:32)
at
org.eclipse.swt.internal.widgets.WidgetTreeVisitor.accept(Wi dgetTreeVisitor.java:46)
at
org.eclipse.swt.internal.widgets.WidgetTreeVisitor.accept(Wi dgetTreeVisitor.java:51)
at
org.eclipse.swt.internal.widgets.WidgetTreeVisitor.accept(Wi dgetTreeVisitor.java:51)
at
org.eclipse.swt.internal.widgets.WidgetTreeVisitor.accept(Wi dgetTreeVisitor.java:51)
at
org.eclipse.swt.internal.widgets.WidgetTreeVisitor.accept(Wi dgetTreeVisitor.java:51)
at
org.eclipse.swt.internal.widgets.WidgetTreeVisitor.accept(Wi dgetTreeVisitor.java:51)
at
org.eclipse.swt.internal.graphics.TextSizeDeterminationHandl er.afterPhase(TextSizeDeterminationHandler.java:126)
at
org.eclipse.rwt.internal.lifecycle.RWTLifeCycle.afterPhaseEx ecution(RWTLifeCycle.java:390)
at
org.eclipse.rwt.internal.lifecycle.RWTLifeCycle.continueLife Cycle(RWTLifeCycle.java:191)
at
org.eclipse.rwt.internal.lifecycle.RWTLifeCycle.sleep(RWTLif eCycle.java:297)
at org.eclipse.swt.widgets.Display.sleep(Display.java:706)
at
org.eclipse.ui.application.WorkbenchAdvisor.eventLoopIdle(Wo rkbenchAdvisor.java:361)
at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.jav a:2389)
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:288)
at
org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Work bench.java:408)
at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.j ava:157)
at
com.farbeyond.input.ui.application.DemoEntryPoint.createUI(D emoEntryPoint.java:12)
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:619)
What's wrong ?
Regards,
Setya
|
|
|
|
|
|
Re: Layout exception when opening editor [message #119461 is a reply to message #119448] |
Fri, 23 January 2009 18:15 ![Go to previous message Go to previous message](theme/Solstice/images/up.png) ![Go to next message Go to next message](theme/Solstice/images/down.png) |
Eclipse User![Friend of Eclipse Friend](/donate/web-api/friends_decorator.php?email=) |
|
|
|
Originally posted by: benjamin.wolff.web.de
Hi,
the exception is only thrown once because the layout is only created once, when starting the editor for the first time.
regarding the layouting, setting a LayoutData on a composite is also connected to the Layout of its parent composite! the LayoutDate defines how the composite, 'container' in this case, behaves inside
the parent composite. FillLayout is the default Layout when nothing else is set, therefore the parent comp, which is contributed by the method call, has a FillLayout and can't use the GridData of the
container comp. adding the Line
parent.setLayout(GridLayoutFactory.swtDefaults().create());
should avoid the exception if i'm not mistaken.
greetings,
ben
Setya schrieb:
> Hi,
>
> Besides, the exception only thrown when I open the editor for the 1st time.
>
>
> Setya
>
|
|
|
Re: Layout exception when opening editor [message #119474 is a reply to message #119461] |
Fri, 23 January 2009 18:30 ![Go to previous message Go to previous message](theme/Solstice/images/up.png) ![Go to next message Go to next message](theme/Solstice/images/down.png) |
Eclipse User![Friend of Eclipse Friend](/donate/web-api/friends_decorator.php?email=) |
|
|
|
Originally posted by: benjamin.wolff.web.de
i have to correct my last posting, since it is not a good idea to modify the Layout of the parent comp it would be best if you don't set a LayoutData on the container comp. Simply add a GridLayout to
the container comp and use the container to layout the children (buttons etc.) using Grid Layouting. that's how do it.
greetings,
ben
Ben W. schrieb:
> Hi,
>
> the exception is only thrown once because the layout is only created
> once, when starting the editor for the first time.
>
> regarding the layouting, setting a LayoutData on a composite is also
> connected to the Layout of its parent composite! the LayoutDate defines
> how the composite, 'container' in this case, behaves inside the parent
> composite. FillLayout is the default Layout when nothing else is set,
> therefore the parent comp, which is contributed by the method call, has
> a FillLayout and can't use the GridData of the container comp. adding
> the Line
>
> parent.setLayout(GridLayoutFactory.swtDefaults().create());
>
> should avoid the exception if i'm not mistaken.
>
>
> greetings,
> ben
>
>
>
> Setya schrieb:
>> Hi,
>>
>> Besides, the exception only thrown when I open the editor for the 1st
>> time.
>>
>>
>> Setya
>>
|
|
|
Re: Layout exception when opening editor [message #119546 is a reply to message #119474] |
Sun, 25 January 2009 06:48 ![Go to previous message Go to previous message](theme/Solstice/images/up.png) ![Go to next message Go to next message](theme/Solstice/images/down.png) |
|
Hi,
Thanks for your advice. Actually removing the GridLayoutData assignment
makes no difference.
But, I've put the same editor part in my RCP app to test, no exception was
thrown, should I expected incompatibility here ?
Regards,
Setya
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.03740 seconds