Eclipse Neon 和 Oxygen setExtended GridLayout 无法转换为 FillLayout
Eclipse Neon and Oxygen setExtended GridLayout can't cast to FillLayout
我有一个大插件eclipse Indigo RCP 程序。
尝试迁移到 Oxygen 和 Java 8(从 7)我的 setExpanded(false) 关于 GridLayouts 的所有问题都出现了问题。
我收到类似于...GridLayout 无法转换为 FillLayout 的响应。
奇怪的是这在 Indigo 中有效。两个版本之间的代码库没有变化。除此之外 Compact/Extend 该程序似乎可以正常工作。
有什么想法吗??
当然我可以添加错误消息,但我的问题是靛蓝和氧气之间是否存在变化,甚至霓虹灯和氧气之间是否存在与 setExtend 有关的变化?
有一份 2014 年的错误报告,但似乎从未被解决。
堆栈跟踪:
!ENTRY org.eclipse.ui 4 0 2017-09-15 08:44:54.915
!MESSAGE Unhandled event loop exception
!STACK 0
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:173)
at org.eclipse.swt.widgets.Composite.layout(Composite.java:831)
at org.eclipse.swt.widgets.Control.requestLayout(Control.java:2427)
at org.eclipse.ui.forms.widgets.ExpandableComposite.reflow(ExpandableComposite.java:1139)
at org.eclipse.ui.forms.widgets.Section.reflow(Section.java:122)
at org.eclipse.ui.forms.widgets.ExpandableComposite.internalSetExpanded(ExpandableComposite.java:893)
at org.eclipse.ui.forms.widgets.Section.internalSetExpanded(Section.java:108)
at org.eclipse.ui.forms.widgets.ExpandableComposite.toggleState(ExpandableComposite.java:1068)
at org.eclipse.ui.forms.widgets.ExpandableComposite.access(ExpandableComposite.java:1065)
at org.eclipse.ui.forms.widgets.ExpandableComposite.linkActivated(ExpandableComposite.java:576)
at org.eclipse.ui.forms.widgets.AbstractHyperlink.handleActivate(AbstractHyperlink.java:213)
at org.eclipse.ui.forms.widgets.AbstractHyperlink.handleMouseUp(AbstractHyperlink.java:307)
at org.eclipse.ui.forms.widgets.AbstractHyperlink.lambda(AbstractHyperlink.java:115)
at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:86)
at org.eclipse.swt.widgets.Display.sendEvent(Display.java:4428)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1079)
at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:4238)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3817)
at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRenderingEngine.java:1155)
at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:336)
at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRenderingEngine.java:1044)
at org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(E4Workbench.java:153)
at org.eclipse.ui.internal.Workbench.lambda(Workbench.java:680)
at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:336)
at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:594)
at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:148)
at com.myCompany.rcp.console.product.Application.start(Application.java:167)
at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:134)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:104)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:388)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:243)
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:653)
at org.eclipse.equinox.launcher.Main.basicRun(Main.java:590)
at org.eclipse.equinox.launcher.Main.run(Main.java:1499)
at org.eclipse.equinox.launcher.Main.main(Main.java:1472)
代码:
@Override
public void createPartControl(Composite parent)
{
// Toolkit
FormToolkit toolkit = new FormToolkit(parent.getDisplay());
toolkit.setBorderStyle(SWT.NO);
// Base component
baseComp = toolkit.createComposite(parent);
GridLayout layout = new GridLayout();
layout.horizontalSpacing = 0;
layout.verticalSpacing = 0;
layout.marginHeight=0;
layout.marginWidth=0;
baseComp.setLayout(layout);
baseComp.setLayoutData(new GridData(GridData.FILL_BOTH));
m_searchRoiSection = toolkit.createSection(baseComp, Section.DESCRIPTION | Section.TWISTIE | Section.EXPANDED);
m_searchRoiSection.setActiveToggleColor(toolkit.getHyperlinkGroup().getActiveForeground());
m_searchRoiSection.setToggleColor(toolkit.getColors().getColor(IFormColors.SEPARATOR));
toolkit.createCompositeSeparator(m_searchRoiSection);
layout = new GridLayout();
layout.horizontalSpacing = 0;
layout.verticalSpacing = 10;
layout.marginHeight = 0;
layout.marginWidth = 0;
m_searchRoiSection.setLayout(layout);
m_searchRoiSection.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
m_searchRoiSection.addExpansionListener(new ExpansionAdapter()
{
public void expansionStateChanged(ExpansionEvent e)
{
updateRoiSection();
}
});
m_searchRoiSection.setText("ROI");
m_searchRoiSection.setDescription("Select region of interest. Leave blank for any area.");
Composite searchRoiComp = toolkit.createComposite(m_searchRoiSection);
layout = new GridLayout();
layout.horizontalSpacing = 3;
layout.verticalSpacing = 3;
layout.marginHeight = 5;
layout.marginWidth = 5;
layout.numColumns = 3;
searchRoiComp.setLayout(layout);
// Create ROI search section contents
createRoiSearch(searchRoiComp);
m_searchRoiSection.setClient(searchRoiComp);
m_searchRoiSection.setExpanded(false);
}
行:
baseComp.setLayoutData(new GridData(GridData.FILL_BOTH));
正在基础合成上设置布局数据。此数据由 parent
控件布局使用。父控件正在使用 FillLayout
,因此 GridData
不正确。您应该只删除此行,因为您不需要 FillLayout
.
的任何布局数据
setExpanded
导致 reflow
重做所有控件的布局,因此您在调用 setExpanded
.
时会遇到此问题
另请注意:
layout = new GridLayout();
layout.horizontalSpacing = 0;
layout.verticalSpacing = 10;
layout.marginHeight = 0;
layout.marginWidth = 0;
m_searchRoiSection.setLayout(layout);
Section
不支持 setLayout
,只是忽略了这个调用。
我有一个大插件eclipse Indigo RCP 程序。 尝试迁移到 Oxygen 和 Java 8(从 7)我的 setExpanded(false) 关于 GridLayouts 的所有问题都出现了问题。
我收到类似于...GridLayout 无法转换为 FillLayout 的响应。 奇怪的是这在 Indigo 中有效。两个版本之间的代码库没有变化。除此之外 Compact/Extend 该程序似乎可以正常工作。
有什么想法吗??
当然我可以添加错误消息,但我的问题是靛蓝和氧气之间是否存在变化,甚至霓虹灯和氧气之间是否存在与 setExtend 有关的变化?
有一份 2014 年的错误报告,但似乎从未被解决。
堆栈跟踪:
!ENTRY org.eclipse.ui 4 0 2017-09-15 08:44:54.915
!MESSAGE Unhandled event loop exception
!STACK 0
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:173)
at org.eclipse.swt.widgets.Composite.layout(Composite.java:831)
at org.eclipse.swt.widgets.Control.requestLayout(Control.java:2427)
at org.eclipse.ui.forms.widgets.ExpandableComposite.reflow(ExpandableComposite.java:1139)
at org.eclipse.ui.forms.widgets.Section.reflow(Section.java:122)
at org.eclipse.ui.forms.widgets.ExpandableComposite.internalSetExpanded(ExpandableComposite.java:893)
at org.eclipse.ui.forms.widgets.Section.internalSetExpanded(Section.java:108)
at org.eclipse.ui.forms.widgets.ExpandableComposite.toggleState(ExpandableComposite.java:1068)
at org.eclipse.ui.forms.widgets.ExpandableComposite.access(ExpandableComposite.java:1065)
at org.eclipse.ui.forms.widgets.ExpandableComposite.linkActivated(ExpandableComposite.java:576)
at org.eclipse.ui.forms.widgets.AbstractHyperlink.handleActivate(AbstractHyperlink.java:213)
at org.eclipse.ui.forms.widgets.AbstractHyperlink.handleMouseUp(AbstractHyperlink.java:307)
at org.eclipse.ui.forms.widgets.AbstractHyperlink.lambda(AbstractHyperlink.java:115)
at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:86)
at org.eclipse.swt.widgets.Display.sendEvent(Display.java:4428)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1079)
at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:4238)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3817)
at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRenderingEngine.java:1155)
at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:336)
at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRenderingEngine.java:1044)
at org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(E4Workbench.java:153)
at org.eclipse.ui.internal.Workbench.lambda(Workbench.java:680)
at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:336)
at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:594)
at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:148)
at com.myCompany.rcp.console.product.Application.start(Application.java:167)
at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:134)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:104)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:388)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:243)
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:653)
at org.eclipse.equinox.launcher.Main.basicRun(Main.java:590)
at org.eclipse.equinox.launcher.Main.run(Main.java:1499)
at org.eclipse.equinox.launcher.Main.main(Main.java:1472)
代码:
@Override
public void createPartControl(Composite parent)
{
// Toolkit
FormToolkit toolkit = new FormToolkit(parent.getDisplay());
toolkit.setBorderStyle(SWT.NO);
// Base component
baseComp = toolkit.createComposite(parent);
GridLayout layout = new GridLayout();
layout.horizontalSpacing = 0;
layout.verticalSpacing = 0;
layout.marginHeight=0;
layout.marginWidth=0;
baseComp.setLayout(layout);
baseComp.setLayoutData(new GridData(GridData.FILL_BOTH));
m_searchRoiSection = toolkit.createSection(baseComp, Section.DESCRIPTION | Section.TWISTIE | Section.EXPANDED);
m_searchRoiSection.setActiveToggleColor(toolkit.getHyperlinkGroup().getActiveForeground());
m_searchRoiSection.setToggleColor(toolkit.getColors().getColor(IFormColors.SEPARATOR));
toolkit.createCompositeSeparator(m_searchRoiSection);
layout = new GridLayout();
layout.horizontalSpacing = 0;
layout.verticalSpacing = 10;
layout.marginHeight = 0;
layout.marginWidth = 0;
m_searchRoiSection.setLayout(layout);
m_searchRoiSection.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
m_searchRoiSection.addExpansionListener(new ExpansionAdapter()
{
public void expansionStateChanged(ExpansionEvent e)
{
updateRoiSection();
}
});
m_searchRoiSection.setText("ROI");
m_searchRoiSection.setDescription("Select region of interest. Leave blank for any area.");
Composite searchRoiComp = toolkit.createComposite(m_searchRoiSection);
layout = new GridLayout();
layout.horizontalSpacing = 3;
layout.verticalSpacing = 3;
layout.marginHeight = 5;
layout.marginWidth = 5;
layout.numColumns = 3;
searchRoiComp.setLayout(layout);
// Create ROI search section contents
createRoiSearch(searchRoiComp);
m_searchRoiSection.setClient(searchRoiComp);
m_searchRoiSection.setExpanded(false);
}
行:
baseComp.setLayoutData(new GridData(GridData.FILL_BOTH));
正在基础合成上设置布局数据。此数据由 parent
控件布局使用。父控件正在使用 FillLayout
,因此 GridData
不正确。您应该只删除此行,因为您不需要 FillLayout
.
setExpanded
导致 reflow
重做所有控件的布局,因此您在调用 setExpanded
.
另请注意:
layout = new GridLayout();
layout.horizontalSpacing = 0;
layout.verticalSpacing = 10;
layout.marginHeight = 0;
layout.marginWidth = 0;
m_searchRoiSection.setLayout(layout);
Section
不支持 setLayout
,只是忽略了这个调用。