Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse 4 » Can't add MInputPart(Getting a NullPointerException since Eclipse update)
Can't add MInputPart [message #1802048] Thu, 31 January 2019 11:06 Go to next message
Peter Treitler is currently offline Peter TreitlerFriend
Messages: 2
Registered: October 2012
Junior Member
Hello,

I'm maintaining an old Eclipse E4/RCP project and I've been running into trouble since installing the latest version of Eclipse for RCP and RAP developers (Version: 2018-12 (4.10.0)).

I get the following stack trace when adding an InputPart in the application:

!ENTRY org.eclipse.jface 4 0 2019-01-31 11:40:49.044
!MESSAGE An error has occurred. See error log for more details.
!STACK 0
java.lang.NullPointerException
	at org.eclipse.emf.ecore.util.EContentsEList.createEContentsEList(EContentsEList.java:51)
	at org.eclipse.emf.ecore.impl.MinimalEObjectImpl.eContents(MinimalEObjectImpl.java:758)
	at org.eclipse.emf.ecore.util.EcoreUtil$ProperContentIterator.<init>(EcoreUtil.java:1354)
	at org.eclipse.emf.ecore.util.EcoreUtil$4.getChildren(EcoreUtil.java:1265)
	at org.eclipse.emf.ecore.util.EcoreUtil$ContentTreeIterator.hasNext(EcoreUtil.java:1516)
	at org.eclipse.emf.ecore.resource.impl.ResourceImpl.attached(ResourceImpl.java:889)
	at org.eclipse.emf.ecore.impl.BasicEObjectImpl.eBasicSetContainer(BasicEObjectImpl.java:1336)
	at org.eclipse.e4.ui.model.application.ui.impl.UIElementImpl.basicSetParent(UIElementImpl.java:369)
	at org.eclipse.e4.ui.model.application.ui.impl.UIElementImpl.eInverseAdd(UIElementImpl.java:548)
	at org.eclipse.emf.ecore.impl.BasicEObjectImpl.eInverseAdd(BasicEObjectImpl.java:1409)
	at org.eclipse.emf.ecore.util.EcoreEList.inverseAdd(EcoreEList.java:276)
	at org.eclipse.emf.common.notify.impl.NotifyingListImpl.addUnique(NotifyingListImpl.java:286)
	at org.eclipse.emf.common.util.AbstractEList.add(AbstractEList.java:304)
	at com.mypackage.editor.profiles.ProfileRegistry.createProfileEditor(ProfileRegistry.java:186)
	at com.mypackage.editor.profiles.ProfileRegistry.getOrCreateProfileEditor(ProfileRegistry.java:155)
	at com.mypackage.editor.profiles.ProfileRegistry.openEditor(ProfileRegistry.java:149)
	at com.mypackage.editor.parts.InfoPart$1.doubleClick(InfoPart.java:229)
	at org.eclipse.jface.viewers.StructuredViewer$1.run(StructuredViewer.java:833)
	at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:45)
	at org.eclipse.ui.internal.JFaceUtil.lambda$0(JFaceUtil.java:47)
	at org.eclipse.jface.util.SafeRunnable.run(SafeRunnable.java:176)
	at org.eclipse.jface.viewers.StructuredViewer.fireDoubleClick(StructuredViewer.java:830)
	at org.eclipse.jface.viewers.StructuredViewer.handleDoubleSelect(StructuredViewer.java:1147)
	at org.eclipse.jface.viewers.StructuredViewer$4.widgetDefaultSelected(StructuredViewer.java:1260)
	at org.eclipse.jface.util.OpenStrategy.fireDefaultSelectionEvent(OpenStrategy.java:252)
	at org.eclipse.jface.util.OpenStrategy.access$0(OpenStrategy.java:250)
	at org.eclipse.jface.util.OpenStrategy$1.handleEvent(OpenStrategy.java:309)
	at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:89)
	at org.eclipse.swt.widgets.Display.sendEvent(Display.java:4131)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1055)
	at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:3944)
	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3547)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$5.run(PartRenderingEngine.java:1173)
	at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:339)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRenderingEngine.java:1062)
	at org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(E4Workbench.java:156)
	at org.eclipse.e4.ui.internal.workbench.swt.E4Application.start(E4Application.java:166)
	at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:203)
	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:137)
	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:107)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:400)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:255)
	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:659)
	at org.eclipse.equinox.launcher.Main.basicRun(Main.java:595)
	at org.eclipse.equinox.launcher.Main.run(Main.java:1501)
	at org.eclipse.equinox.launcher.Main.main(Main.java:1474)

(the error log has no additional information)

Relevant code:
	private MInputPart createProfileEditor(ProfileInfo profileInfo) {

		String editorInputUri = UUID.randomUUID().toString();

		MInputPart editor = MBasicFactory.INSTANCE.createInputPart();

		editor.getTags().add(EPartService.REMOVE_ON_HIDE_TAG);

		editor.setInputURI(editorInputUri);
		editor.setLabel(profileInfo.getShortName());
		editor.setTooltip(profileInfo.getToolTip());

		editor.setContributionURI(Uris.forClass(ProfileEditorPart.class));
		editor.setCloseable(true);
		editor.setIconURI(Images.getUrl(Images.ICON_PROFILE));

		editorPartStack.getChildren().add(editor); // exception happens here
		profileEditors.add(editor);
		profileInfos.put(editorInputUri, profileInfo);

		return editor;
	}


I have verified that there are no null values in the affected line. I get "source code not found" for the top bunch of entries in the stack trace, so I'm having a hard time tracing the source of the issue.
I have seen that MInputPart is deprecated. Could this be related to my issue?

I'm afraid I'm completely stumped and would be grateful for any hints on how to fix this.
Re: Can't add MInputPart [message #1802065 is a reply to message #1802048] Thu, 31 January 2019 15:00 Go to previous message
Brian de Alwis is currently offline Brian de AlwisFriend
Messages: 865
Registered: January 2012
Senior Member

Has that MPartStack actually been added to the model -- that is, does it have a parent?

You should have source available if you install the Eclipse SDK (org.eclipse.sdk) feature.


Eclipse Platform committer. Ask me about Eclipse support, training, and consulting.
Previous Topic:What is the best way to remove a MToolControl from main toolbar if part is deactivated?
Next Topic:Problem with combination of restoring state + processing fragments with placeholders
Goto Forum:
  


Current Time: Mon Dec 16 01:50:45 GMT 2019

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

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

Back to the top