e4 app based on Contact demo has problem with IEclipseContext [message #524501] |
Thu, 01 April 2010 04:02  |
Eclipse User |
|
|
|
Hi,
I cloned the Contacts demo for my own app. I get an error with the IEclipseContext on selecting from the ListView as follows:
Exception occurred
java.lang.IllegalArgumentException: Variable selection is not modifiable in the context Anonymous Context
at org.eclipse.e4.core.services.internal.context.EclipseContext.internalModify(EclipseContext.java:499)
at org.eclipse.e4.core.services.internal.context.EclipseContext.modify(EclipseContext.java:489)
at com.hsbcib.grds.testui.views.ListViewer$1.selectionChanged(ListViewer.java:51)
at org.eclipse.jface.viewers.Viewer$2.run(Viewer.java:162)
at org.eclipse.jface.util.SafeRunnable$1.run(SafeRunnable.java:128)
at org.eclipse.jface.util.SafeRunnable.run(SafeRunnable.java:175)
at org.eclipse.jface.viewers.Viewer.fireSelectionChanged(Viewer.java:160)
at org.eclipse.jface.viewers.StructuredViewer.updateSelection(StructuredViewer.java:2132)
at org.eclipse.jface.viewers.StructuredViewer.handleSelect(StructuredViewer.java:1160)
at org.eclipse.jface.viewers.StructuredViewer$4.widgetSelected(StructuredViewer.java:1190)
at org.eclipse.jface.util.OpenStrategy.fireSelectionEvent(OpenStrategy.java:228)
at org.eclipse.jface.util.OpenStrategy.access$4(OpenStrategy.java:222)
at org.eclipse.jface.util.OpenStrategy$1.handleEvent(OpenStrategy.java:389)
at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1050)
at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:4037)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3628)
at org.eclipse.e4.ui.workbench.swt.internal.PartRenderingEngine$5.run(PartRenderingEngine.java:554)
at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
at org.eclipse.e4.ui.workbench.swt.internal.PartRenderingEngine.run(PartRenderingEngine.java:478)
at org.eclipse.e4.workbench.ui.internal.E4Workbench.createAndRunUI(E4Workbench.java:100)
at org.eclipse.e4.ui.workbench.swt.internal.E4Application.start(E4Application.java:84)
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:369)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:179)
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:619)
at org.eclipse.equinox.launcher.Main.basicRun(Main.java:574)
at org.eclipse.equinox.launcher.Main.run(Main.java:1406)
at org.eclipse.equinox.launcher.Main.main(Main.java:1382)
the method looks like this
@Inject
public ListViewer(Composite parent) {
// Table composite (because of TableColumnLayout)
final Composite tableComposite = new Composite(parent, SWT.NONE);
tableComposite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
final TableColumnLayout tableColumnLayout = new TableColumnLayout();
tableComposite.setLayout(tableColumnLayout);
// Table viewer
testCaseViewer = new TableViewer(tableComposite, SWT.FULL_SELECTION);
testCaseViewer.getTable().setHeaderVisible(true);
// contactsViewer.getTable().setLinesVisible(true);
testCaseViewer.setComparator(new TestCaseViewerComparator());
testCaseViewer.addSelectionChangedListener(
new ISelectionChangedListener() {
public void selectionChanged(SelectionChangedEvent event) {
IStructuredSelection selection = (IStructuredSelection)event.getSelection();
context.modify(IServiceConstants.SELECTION, selection.getFirstElement());
}
});
The exception only occurs on the 2nd or later seelction of an item in the list. Unlike the Contacts demo the List only has one column. The difficulty with an @Inject is it is hard to see the larger context for a problem like this. Any suggestions?
Thx.
David
|
|
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.04536 seconds