Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » WindowBuilder » Unexpected internal error
Unexpected internal error [message #666812] Fri, 22 April 2011 18:15 Go to next message
Oleg Danilov is currently offline Oleg DanilovFriend
Messages: 1
Registered: July 2009
Junior Member
WindowBuilder reports about unexpected internal error on Test1
import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Composite;

public class Test2 extends Composite {

	public Test2(Composite parent, int style) {
		super(parent, style);
		setLayout(new GridLayout());
		new Test1(this, SWT.NONE).setL(true);
	}

}
---------------------------
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 Test1 extends Composite {

	private Label lbl;

	public Test1(Composite parent, int style) {
		super(parent, SWT.BORDER);
		setLayout(new GridLayout());
		lbl = new Label(this, SWT.NONE);
		lbl.setLayoutData(new GridData(SWT.FILL, SWT.FILL));
	}

	public void setL(boolean b) {
		lbl.setVisible(!b);
		((GridData) lbl.getLayoutData()).exclude = b;
	}

}


StackTrace:
java.lang.NullPointerException
at org.eclipse.wb.internal.swt.model.layout.grid.GridLayoutInfo.getImplicitControlCells(GridLayoutInfo.java:856)
at org.eclipse.wb.internal.swt.model.layout.grid.GridLayoutInfo.getImplicitGridSize(GridLayoutInfo.java:842)
at org.eclipse.wb.internal.swt.model.layout.grid.GridLayoutInfo.getControlsGridSize(GridLayoutInfo.java:821)
at org.eclipse.wb.internal.swt.model.layout.grid.GridLayoutInfo.getControlsGrid(GridLayoutInfo.java:864)
at org.eclipse.wb.internal.swt.model.layout.grid.GridLayoutInfo.fixEmptyColumns(GridLayoutInfo.java:200)
at org.eclipse.wb.internal.swt.model.layout.grid.GridLayoutInfo.refresh_afterCreate(GridLayoutInfo.java:170)
at org.eclipse.wb.internal.rcp.model.layout.grid.GridLayoutInfo.refresh_afterCreate(GridLayoutInfo.java:52)
at org.eclipse.wb.core.model.ObjectInfo.refresh_afterCreate(ObjectInfo.java:611)
Re: Unexpected internal error [message #1070140 is a reply to message #666812] Wed, 17 July 2013 10:00 Go to previous messageGo to next message
Rico Scholz is currently offline Rico ScholzFriend
Messages: 9
Registered: March 2013
Junior Member
I get a similar error in the same region of code. The stacktrace is:
java.lang.ArrayIndexOutOfBoundsException: 1
	at org.eclipse.wb.internal.swt.model.layout.grid.GridLayoutInfo.fixEmptyColumns(GridLayoutInfo.java:204)
	at org.eclipse.wb.internal.swt.model.layout.grid.GridLayoutInfo.refresh_afterCreate(GridLayoutInfo.java:169)
	at org.eclipse.wb.internal.rcp.model.layout.grid.GridLayoutInfo.refresh_afterCreate(GridLayoutInfo.java:52)
	at org.eclipse.wb.core.model.ObjectInfo.refresh_afterCreate(ObjectInfo.java:621)
	at org.eclipse.wb.core.model.JavaInfo.refresh_afterCreate(JavaInfo.java:1246)
	at org.eclipse.wb.core.model.AbstractComponentInfo.refresh_afterCreate(AbstractComponentInfo.java:238)
	at org.eclipse.wb.internal.swt.model.widgets.ControlInfo.refresh_afterCreate(ControlInfo.java:119)
	at org.eclipse.wb.core.model.ObjectInfo.refresh_afterCreate(ObjectInfo.java:621)
	at org.eclipse.wb.core.model.JavaInfo.refresh_afterCreate(JavaInfo.java:1246)
	at org.eclipse.wb.core.model.AbstractComponentInfo.refresh_afterCreate(AbstractComponentInfo.java:238)
	at org.eclipse.wb.internal.swt.model.widgets.ControlInfo.refresh_afterCreate(ControlInfo.java:119)
	at org.eclipse.wb.core.model.ObjectInfo.refresh_afterCreate(ObjectInfo.java:621)
	at org.eclipse.wb.core.model.JavaInfo.refresh_afterCreate(JavaInfo.java:1246)
	at org.eclipse.wb.core.model.AbstractComponentInfo.refresh_afterCreate(AbstractComponentInfo.java:238)
	at org.eclipse.wb.internal.swt.model.widgets.ControlInfo.refresh_afterCreate(ControlInfo.java:119)
	at org.eclipse.wb.internal.rcp.model.widgets.CTabFolderInfo.refresh_afterCreate(CTabFolderInfo.java:65)
	at org.eclipse.wb.core.model.ObjectInfo.refresh_afterCreate(ObjectInfo.java:621)
	at org.eclipse.wb.core.model.JavaInfo.refresh_afterCreate(JavaInfo.java:1246)
	at org.eclipse.wb.core.model.AbstractComponentInfo.refresh_afterCreate(AbstractComponentInfo.java:238)
	at org.eclipse.wb.internal.swt.model.widgets.ControlInfo.refresh_afterCreate(ControlInfo.java:119)
	at org.eclipse.wb.core.model.ObjectInfo.refreshCreate0(ObjectInfo.java:552)
	at org.eclipse.wb.core.model.ObjectInfo.access$0(ObjectInfo.java:546)
	at org.eclipse.wb.core.model.ObjectInfo$5$1.run(ObjectInfo.java:486)
	at org.eclipse.wb.internal.core.utils.execution.ExecutionUtils.runDesignTime(ExecutionUtils.java:145)
	at org.eclipse.wb.core.model.ObjectInfo$5.run(ObjectInfo.java:484)
	at org.eclipse.wb.core.model.ObjectInfo.execRefreshOperation(ObjectInfo.java:514)
	at org.eclipse.wb.core.model.ObjectInfo.refresh(ObjectInfo.java:482)
	at org.eclipse.wb.internal.core.editor.DesignPage.internal_refreshGEF(DesignPage.java:580)
	at org.eclipse.wb.internal.core.editor.DesignPage.access$9(DesignPage.java:522)
	at org.eclipse.wb.internal.core.editor.DesignPage$8$1.run(DesignPage.java:449)
	at org.eclipse.swt.widgets.Synchronizer.syncExec(Synchronizer.java:180)
	at org.eclipse.ui.internal.UISynchronizer.syncExec(UISynchronizer.java:150)
	at org.eclipse.swt.widgets.Display.syncExec(Display.java:4688)
	at org.eclipse.wb.internal.core.editor.DesignPage$8.run(DesignPage.java:446)
	at org.eclipse.jface.operation.ModalContext.runInCurrentThread(ModalContext.java:464)
	at org.eclipse.jface.operation.ModalContext.run(ModalContext.java:372)
	at org.eclipse.jface.dialogs.ProgressMonitorDialog.run(ProgressMonitorDialog.java:507)
	at org.eclipse.wb.internal.core.editor.DesignPage.internal_refreshGEF_withProgress(DesignPage.java:465)
	at org.eclipse.wb.internal.core.editor.DesignPage.internal_refreshGEF(DesignPage.java:415)
	at org.eclipse.wb.internal.core.editor.UndoManager.refreshDesignerEditor(UndoManager.java:381)
	at org.eclipse.wb.internal.core.editor.UndoManager.activate(UndoManager.java:90)
	at org.eclipse.wb.internal.core.editor.DesignPage.handleActiveState_True(DesignPage.java:263)
	at org.eclipse.wb.internal.core.editor.DesignPage.handleActiveState(DesignPage.java:241)
	at org.eclipse.wb.internal.core.editor.multi.DefaultMultiMode.showPage(DefaultMultiMode.java:125)
	at org.eclipse.wb.internal.core.editor.multi.DefaultMultiMode$1.widgetSelected(DefaultMultiMode.java:63)
	at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:248)
	at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1057)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1081)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1066)
	at org.eclipse.swt.widgets.Widget.notifyListeners(Widget.java:778)
	at org.eclipse.swt.custom.CTabFolder.setSelection(CTabFolder.java:3061)
	at org.eclipse.swt.custom.CTabFolder.onMouse(CTabFolder.java:1753)
	at org.eclipse.swt.custom.CTabFolder$1.handleEvent(CTabFolder.java:278)
	at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1057)
	at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:4170)
	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3759)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$9.run(PartRenderingEngine.java:1113)
	at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRenderingEngine.java:997)
	at org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(E4Workbench.java:138)
	at org.eclipse.ui.internal.Workbench$5.run(Workbench.java:610)
	at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
	at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:567)
	at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:150)
	at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:124)
	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(NativeMethodAccessorImpl.java:39)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:597)
	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)

I can't show a source file where this error occures. My tries to create a small example doesn't show the error. So I wanted to ask, what are possibilities to raise the error?
The method where the ArrayIndexOutOfBounds occures is:
  /**
   * Ensures that empty columns (only with fillers) have reasonable width.
   */
  private void fixEmptyColumns() throws Exception {
    fetchGridDataValues();
    ControlInfo[][] grid = getControlsGrid();
    int columnCount = grid.length != 0 ? grid[0].length : 0;
    m_columnWidths = GridLayoutSupport.getColumnWidths(getObject());
    // set empty text for fillers in empty column
    for (int column = 0; column < columnCount; column++) {
      int width = m_columnWidths[column]; // <--- here comes the Exception
      if (width == 0) {
        for (int row = 0; row < grid.length; row++) {
          ControlInfo control = grid[row][column];
          if (control != null && isFiller(control)) {
            LabelSupport.setText(control.getObject(), "      ");
          }
        }
      }
    }
  }

It seems that grid and GridLayoutSupport.getColumnWidths() has not the same size, but why?

I hope you can tell me, to what I can look for in the code.
Re: Unexpected internal error [message #1070354 is a reply to message #1070140] Wed, 17 July 2013 19:57 Go to previous messageGo to next message
Eric Clayberg is currently offline Eric ClaybergFriend
Messages: 979
Registered: July 2009
Location: Boston, MA
Senior Member
I tried your Test1 and Test2 example code and it worked fine on my end.

What exact version of WindowBuilder are you using?

I need to see a test case that triggers the problem in order to help you.
Re: Unexpected internal error [message #1070520 is a reply to message #1070354] Thu, 18 July 2013 06:28 Go to previous messageGo to next message
Rico Scholz is currently offline Rico ScholzFriend
Messages: 9
Registered: March 2013
Junior Member
The two test classes are not from me and reproduce not my error. I replied on this topic, because it is a similar error and it occures in the same region of code like the original.
As I mentioned in my post, I have no small test case. I have 2 UI-classes that are very complex and huge. In one, the error occures and in the second not. In the not working class, I use also the griddata.exlude command, like in the original post, but this seems not be the cause of the error. Both UI's uses similar widgets, Composite, Sash-Form, Text, Label, NatTable, CCombo... mostly with GridLayout.
Eclipse-Version is 4.3 Kepler (3.9.0.v20130326-1255) and WB-Version is 1.6.0.r43x201305212024[201307171427]

I will try to build a test-case.
Re: Unexpected internal error [message #1070653 is a reply to message #1070520] Thu, 18 July 2013 11:56 Go to previous messageGo to next message
Rico Scholz is currently offline Rico ScholzFriend
Messages: 9
Registered: March 2013
Junior Member
I found the piece of code that causes the error. It was a third-party lib, that takes a Composite, sets a layout to it and creates an AWT-Frame to use Swing. I think somewhere there is the problem.
My solution is, to let the window builder not parse this code by Beans.isDesignTime() and show a dummy object.
Re: Unexpected internal error [message #1070718 is a reply to message #1070653] Thu, 18 July 2013 14:28 Go to previous messageGo to next message
Eric Clayberg is currently offline Eric ClaybergFriend
Messages: 979
Registered: July 2009
Location: Boston, MA
Senior Member
It is generally not a good idea to piggyback off of an existing thread unless you are experiencing the exact same error and can reproduce it using the same test case. I didn't notice the user name change on the thread so assumed that the two were related when they weren't.

Code that takes an incoming composite and changes its layout downstream can be very tricky.
Re: Unexpected internal error [message #1173389 is a reply to message #1070718] Wed, 06 November 2013 13:41 Go to previous message
Piotr Kołodziej is currently offline Piotr KołodziejFriend
Messages: 1
Registered: November 2013
Junior Member
This is my first post here, I wouldn't like to interrupt discussion but I had the same problem with I was able to fix, perhaps it will help you to find the real problem.

Part of my exception log:
java.lang.ArrayIndexOutOfBoundsException: 2
at org.eclipse.wb.internal.swt.model.layout.grid.GridLayoutInfo.fixEmptyColumns(GridLayoutInfo.java:204)
at org.eclipse.wb.internal.swt.model.layout.grid.GridLayoutInfo.refresh_afterCreate(GridLayoutInfo.java:169)

Solution was to change 3->2, which is 'horizontalSpan':
myGrid.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, false, 3->2, 1));

Crash happened for parent controls/classes, not for the control/class where the 'myGrid' was implemented. Child control/class works fine, it is visualized correctly by WindowBuilder Design mode.

P.S. Sorry for my bad English.
Previous Topic:Binding SWT text widget to an Integer
Next Topic:Using Automatic Data Binding wizard
Goto Forum:
  


Current Time: Fri Mar 29 13:42:36 GMT 2024

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

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

Back to the top