Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse 4 » creating input part via part descriptor
creating input part via part descriptor [message #1007776] Thu, 07 February 2013 13:32 Go to next message
Jan Weidauer is currently offline Jan Weidauer
Messages: 47
Registered: July 2009
Member
Hi there!

In my RCP-Application I have defined a PartDescriptor within a
Perspective and want to place an InputPart there.
Because in PartService there is no method createInputPart(String
descriptorID) I created a utility method using the code from
PartService.createPart(MPartDescriptor descriptor).

public static MInputPart createInputPart(String id, String inputURI,
EPartService partService) {
MPart part = partService.createPart(id);
MInputPart inputPart = MBasicFactory.INSTANCE.createInputPart();
inputPart.setInputURI(inputURI);

inputPart.setElementId(part.getElementId());
inputPart.getMenus().addAll(EcoreUtil.copyAll(part.getMenus()));
if (part.getToolbar() != null) {

inputPart.setToolbar((MToolBar)EcoreUtil.copy((EObject)part.getToolbar()));
}
inputPart.setContributorURI(part.getContributorURI());
inputPart.setCloseable(part.isCloseable());
inputPart.setContributionURI(part.getContributionURI());
inputPart.setLabel(part.getLabel());
inputPart.setIconURI(part.getIconURI());
inputPart.setTooltip(part.getTooltip());
inputPart.getHandlers().addAll(EcoreUtil.copyAll(part.getHandlers()));
inputPart.getTags().addAll(part.getTags());
inputPart.getBindingContexts().addAll(part.getBindingContexts());

return inputPart;
}


Using the returned InputPart I get an InjectionException because there
is no MDirtyable found to inject into my PartContribution class.
Using the part via partService.createPart(id) all works well.

partService.showPart(inputPart, PartState.ACTIVATE); -> Exception
partService.showPart(part, PartState.ACTIVATE); -> everything is fine

I debugged the code and can't find a difference. What am I doing wrong?

Regards,

Jan
Re: creating input part via part descriptor [message #1007787 is a reply to message #1007776] Thu, 07 February 2013 13:52 Go to previous messageGo to next message
Thomas Schindl is currently offline Thomas Schindl
Messages: 5316
Registered: July 2009
Senior Member
MInputPart extends MPart so the MDirtyable sounds strange. It might help
us if you are showing the Exception Stacktrace.

Tom

Am 07.02.13 14:32, schrieb Jan Weidauer:
> Hi there!
>
> In my RCP-Application I have defined a PartDescriptor within a
> Perspective and want to place an InputPart there.
> Because in PartService there is no method createInputPart(String
> descriptorID) I created a utility method using the code from
> PartService.createPart(MPartDescriptor descriptor).
>
> public static MInputPart createInputPart(String id, String inputURI,
> EPartService partService) {
> MPart part = partService.createPart(id);
> MInputPart inputPart = MBasicFactory.INSTANCE.createInputPart();
> inputPart.setInputURI(inputURI);
>
> inputPart.setElementId(part.getElementId());
> inputPart.getMenus().addAll(EcoreUtil.copyAll(part.getMenus()));
> if (part.getToolbar() != null) {
>
> inputPart.setToolbar((MToolBar)EcoreUtil.copy((EObject)part.getToolbar()));
> }
> inputPart.setContributorURI(part.getContributorURI());
> inputPart.setCloseable(part.isCloseable());
> inputPart.setContributionURI(part.getContributionURI());
> inputPart.setLabel(part.getLabel());
> inputPart.setIconURI(part.getIconURI());
> inputPart.setTooltip(part.getTooltip());
> inputPart.getHandlers().addAll(EcoreUtil.copyAll(part.getHandlers()));
> inputPart.getTags().addAll(part.getTags());
> inputPart.getBindingContexts().addAll(part.getBindingContexts());
>
> return inputPart;
> }
>
>
> Using the returned InputPart I get an InjectionException because there
> is no MDirtyable found to inject into my PartContribution class.
> Using the part via partService.createPart(id) all works well.
>
> partService.showPart(inputPart, PartState.ACTIVATE); -> Exception
> partService.showPart(part, PartState.ACTIVATE); -> everything is fine
>
> I debugged the code and can't find a difference. What am I doing wrong?
>
> Regards,
>
> Jan
>
Re: creating input part via part descriptor [message #1007797 is a reply to message #1007787] Thu, 07 February 2013 14:07 Go to previous messageGo to next message
Jan Weidauer is currently offline Jan Weidauer
Messages: 47
Registered: July 2009
Member
!ENTRY org.eclipse.e4.ui.workbench 4 0 2013-02-07 15:02:22.056
!MESSAGE Unable to create class
'de.servalse.ebas.rcp.lvr.demo.ui.parts.FachfunktionEditor' from bundle
'459'
!STACK 0
org.eclipse.e4.core.di.InjectionException: Unable to process
"FachfunktionEditor.dirty": no actual value was found for the argument
"MDirtyable".
at
org.eclipse.e4.core.internal.di.InjectorImpl.reportUnresolvedArgument(InjectorImpl.java:394)
at
org.eclipse.e4.core.internal.di.InjectorImpl.resolveRequestorArgs(InjectorImpl.java:385)
at
org.eclipse.e4.core.internal.di.InjectorImpl.inject(InjectorImpl.java:100)
at
org.eclipse.e4.core.internal.di.InjectorImpl.internalMake(InjectorImpl.java:319)
at org.eclipse.e4.core.internal.di.InjectorImpl.make(InjectorImpl.java:240)
at
org.eclipse.e4.core.contexts.ContextInjectionFactory.make(ContextInjectionFactory.java:161)
at
org.eclipse.e4.ui.internal.workbench.ReflectionContributionFactory.createFromBundle(ReflectionContributionFactory.java:102)
at
org.eclipse.e4.ui.internal.workbench.ReflectionContributionFactory.doCreate(ReflectionContributionFactory.java:71)
at
org.eclipse.e4.ui.internal.workbench.ReflectionContributionFactory.create(ReflectionContributionFactory.java:53)
at
org.eclipse.e4.ui.workbench.renderers.swt.ContributedPartRenderer.createWidget(ContributedPartRenderer.java:141)
at
org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.createWidget(PartRenderingEngine.java:896)
at
org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.safeCreateGui(PartRenderingEngine.java:630)
at
org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.safeCreateGui(PartRenderingEngine.java:732)
at
org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.access$2(PartRenderingEngine.java:703)
at
org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$7.run(PartRenderingEngine.java:697)
at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
at
org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.createGui(PartRenderingEngine.java:682)
at
org.eclipse.e4.ui.workbench.renderers.swt.StackRenderer.showTab(StackRenderer.java:1114)
at
org.eclipse.e4.ui.workbench.renderers.swt.LazyStackRenderer$1.handleEvent(LazyStackRenderer.java:67)
at
org.eclipse.e4.ui.services.internal.events.UIEventHandler$1.run(UIEventHandler.java:41)
at org.eclipse.swt.widgets.Synchronizer.syncExec(Synchronizer.java:180)
at org.eclipse.swt.widgets.Display.syncExec(Display.java:4687)
at
org.eclipse.e4.ui.internal.workbench.swt.E4Application$1.syncExec(E4Application.java:187)
at
org.eclipse.e4.ui.services.internal.events.UIEventHandler.handleEvent(UIEventHandler.java:38)
at
org.eclipse.equinox.internal.event.EventHandlerWrapper.handleEvent(EventHandlerWrapper.java:197)
at
org.eclipse.equinox.internal.event.EventHandlerTracker.dispatchEvent(EventHandlerTracker.java:197)
at
org.eclipse.equinox.internal.event.EventHandlerTracker.dispatchEvent(EventHandlerTracker.java:1)
at
org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEvent(EventManager.java:230)
at
org.eclipse.osgi.framework.eventmgr.ListenerQueue.dispatchEventSynchronous(ListenerQueue.java:148)
at
org.eclipse.equinox.internal.event.EventAdminImpl.dispatchEvent(EventAdminImpl.java:135)
at
org.eclipse.equinox.internal.event.EventAdminImpl.sendEvent(EventAdminImpl.java:78)
at
org.eclipse.equinox.internal.event.EventComponent.sendEvent(EventComponent.java:39)
at
org.eclipse.e4.ui.services.internal.events.EventBroker.send(EventBroker.java:81)
at
org.eclipse.e4.ui.internal.workbench.UIEventPublisher.notifyChanged(UIEventPublisher.java:58)
at
org.eclipse.emf.common.notify.impl.BasicNotifierImpl.eNotify(BasicNotifierImpl.java:374)
at
org.eclipse.e4.ui.model.application.ui.impl.ElementContainerImpl.setSelectedElement(ElementContainerImpl.java:171)
at
org.eclipse.e4.ui.internal.workbench.ModelServiceImpl.showElementInWindow(ModelServiceImpl.java:418)
at
org.eclipse.e4.ui.internal.workbench.ModelServiceImpl.bringToTop(ModelServiceImpl.java:385)
at
org.eclipse.e4.ui.internal.workbench.PartServiceImpl.delegateBringToTop(PartServiceImpl.java:579)
at
org.eclipse.e4.ui.internal.workbench.PartServiceImpl.activate(PartServiceImpl.java:558)
at
org.eclipse.e4.ui.internal.workbench.PartServiceImpl.activate(PartServiceImpl.java:532)
at
org.eclipse.e4.ui.internal.workbench.PartServiceImpl.activate(PartServiceImpl.java:521)
at
org.eclipse.e4.ui.internal.workbench.PartServiceImpl.showPart(PartServiceImpl.java:978)
at
de.servalse.ebas.rcp.lvr.demo.handlers.OpenEditorHandler.execute(OpenEditorHandler.java:55)
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.e4.core.internal.di.MethodRequestor.execute(MethodRequestor.java:56)
at
org.eclipse.e4.core.internal.di.InjectorImpl.invokeUsingClass(InjectorImpl.java:229)
at
org.eclipse.e4.core.internal.di.InjectorImpl.invoke(InjectorImpl.java:210)
at
org.eclipse.e4.core.contexts.ContextInjectionFactory.invoke(ContextInjectionFactory.java:131)
at
org.eclipse.e4.core.commands.internal.HandlerServiceImpl.executeHandler(HandlerServiceImpl.java:171)
at
org.eclipse.e4.core.commands.internal.HandlerServiceImpl.executeHandler(HandlerServiceImpl.java:145)
at
de.servalse.ebas.rcp.lvr.demo.ui.parts.MainPart.openEditor(MainPart.java:198)
at
de.servalse.ebas.rcp.lvr.demo.ui.parts.MainPart.access$0(MainPart.java:180)
at
de.servalse.ebas.rcp.lvr.demo.ui.parts.MainPart$2.doubleClick(MainPart.java:142)
at
org.eclipse.jface.viewers.StructuredViewer$1.run(StructuredViewer.java:845)
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.StructuredViewer.fireDoubleClick(StructuredViewer.java:843)
at
org.eclipse.jface.viewers.StructuredViewer.handleDoubleSelect(StructuredViewer.java:1134)
at
org.eclipse.jface.viewers.StructuredViewer$4.widgetDefaultSelected(StructuredViewer.java:1246)
at
org.eclipse.jface.util.OpenStrategy.fireDefaultSelectionEvent(OpenStrategy.java:249)
at org.eclipse.jface.util.OpenStrategy.access$0(OpenStrategy.java:246)
at org.eclipse.jface.util.OpenStrategy$1.handleEvent(OpenStrategy.java:307)
at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1053)
at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:4169)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3758)
at
org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$9.run(PartRenderingEngine.java:1029)
at
org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
at
org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRenderingEngine.java:923)
at
org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(E4Workbench.java:86)
at
org.eclipse.e4.ui.internal.workbench.swt.E4Application.start(E4Application.java:150)
at
de.servalse.ebas.rcp.application.RestartableApplication.start(RestartableApplication.java:16)
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:353)
at
org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:180)
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:629)
at org.eclipse.equinox.launcher.Main.basicRun(Main.java:584)
at org.eclipse.equinox.launcher.Main.run(Main.java:1438)
at org.eclipse.equinox.launcher.Main.main(Main.java:1414)


The contribution class:
public class FachfunktionEditor {
@Inject private MDirtyable dirty;
@Inject private Logger log;

private Label label;

@PostConstruct
public void postConstruct(Composite parent) {
label = new Label(parent, SWT.NONE);
label.setText("testing dirty");
this.dirty.setDirty(true);
}

@Focus
public void setFocus() {
this.label.setFocus();
}

}
Re: creating input part via part descriptor [message #1007965 is a reply to message #1007797] Thu, 07 February 2013 15:20 Go to previous messageGo to next message
Thomas Schindl is currently offline Thomas Schindl
Messages: 5316
Registered: July 2009
Senior Member
Ok - that looks very strange. Can you please set a breakpoint in
PartRenderingEngine.populateModelInterfaces() and see which context-keys
are pushed there please.

It would be good to have a small standalone sample to debug the problem
and a bugzilla because this looks like a bug to me.

What if you use "@Inject MInputPart dirty" instead of MDirtyable?

Tom

Am 07.02.13 15:07, schrieb Jan Weidauer:
> !ENTRY org.eclipse.e4.ui.workbench 4 0 2013-02-07 15:02:22.056
> !MESSAGE Unable to create class
> 'de.servalse.ebas.rcp.lvr.demo.ui.parts.FachfunktionEditor' from bundle
> '459'
> !STACK 0
> org.eclipse.e4.core.di.InjectionException: Unable to process
> "FachfunktionEditor.dirty": no actual value was found for the argument
> "MDirtyable".
> at
> org.eclipse.e4.core.internal.di.InjectorImpl.reportUnresolvedArgument(InjectorImpl.java:394)
> at
> org.eclipse.e4.core.internal.di.InjectorImpl.resolveRequestorArgs(InjectorImpl.java:385)
> at
> org.eclipse.e4.core.internal.di.InjectorImpl.inject(InjectorImpl.java:100)
> at
> org.eclipse.e4.core.internal.di.InjectorImpl.internalMake(InjectorImpl.java:319)
> at org.eclipse.e4.core.internal.di.InjectorImpl.make(InjectorImpl.java:240)
> at
> org.eclipse.e4.core.contexts.ContextInjectionFactory.make(ContextInjectionFactory.java:161)
> at
> org.eclipse.e4.ui.internal.workbench.ReflectionContributionFactory.createFromBundle(ReflectionContributionFactory.java:102)
> at
> org.eclipse.e4.ui.internal.workbench.ReflectionContributionFactory.doCreate(ReflectionContributionFactory.java:71)
> at
> org.eclipse.e4.ui.internal.workbench.ReflectionContributionFactory.create(ReflectionContributionFactory.java:53)
> at
> org.eclipse.e4.ui.workbench.renderers.swt.ContributedPartRenderer.createWidget(ContributedPartRenderer.java:141)
> at
> org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.createWidget(PartRenderingEngine.java:896)
> at
> org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.safeCreateGui(PartRenderingEngine.java:630)
> at
> org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.safeCreateGui(PartRenderingEngine.java:732)
> at
> org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.access$2(PartRenderingEngine.java:703)
> at
> org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$7.run(PartRenderingEngine.java:697)
> at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
> at
> org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.createGui(PartRenderingEngine.java:682)
> at
> org.eclipse.e4.ui.workbench.renderers.swt.StackRenderer.showTab(StackRenderer.java:1114)
> at
> org.eclipse.e4.ui.workbench.renderers.swt.LazyStackRenderer$1.handleEvent(LazyStackRenderer.java:67)
> at
> org.eclipse.e4.ui.services.internal.events.UIEventHandler$1.run(UIEventHandler.java:41)
> at org.eclipse.swt.widgets.Synchronizer.syncExec(Synchronizer.java:180)
> at org.eclipse.swt.widgets.Display.syncExec(Display.java:4687)
> at
> org.eclipse.e4.ui.internal.workbench.swt.E4Application$1.syncExec(E4Application.java:187)
> at
> org.eclipse.e4.ui.services.internal.events.UIEventHandler.handleEvent(UIEventHandler.java:38)
> at
> org.eclipse.equinox.internal.event.EventHandlerWrapper.handleEvent(EventHandlerWrapper.java:197)
> at
> org.eclipse.equinox.internal.event.EventHandlerTracker.dispatchEvent(EventHandlerTracker.java:197)
> at
> org.eclipse.equinox.internal.event.EventHandlerTracker.dispatchEvent(EventHandlerTracker.java:1)
> at
> org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEvent(EventManager.java:230)
> at
> org.eclipse.osgi.framework.eventmgr.ListenerQueue.dispatchEventSynchronous(ListenerQueue.java:148)
> at
> org.eclipse.equinox.internal.event.EventAdminImpl.dispatchEvent(EventAdminImpl.java:135)
> at
> org.eclipse.equinox.internal.event.EventAdminImpl.sendEvent(EventAdminImpl.java:78)
> at
> org.eclipse.equinox.internal.event.EventComponent.sendEvent(EventComponent.java:39)
> at
> org.eclipse.e4.ui.services.internal.events.EventBroker.send(EventBroker.java:81)
> at
> org.eclipse.e4.ui.internal.workbench.UIEventPublisher.notifyChanged(UIEventPublisher.java:58)
> at
> org.eclipse.emf.common.notify.impl.BasicNotifierImpl.eNotify(BasicNotifierImpl.java:374)
> at
> org.eclipse.e4.ui.model.application.ui.impl.ElementContainerImpl.setSelectedElement(ElementContainerImpl.java:171)
> at
> org.eclipse.e4.ui.internal.workbench.ModelServiceImpl.showElementInWindow(ModelServiceImpl.java:418)
> at
> org.eclipse.e4.ui.internal.workbench.ModelServiceImpl.bringToTop(ModelServiceImpl.java:385)
> at
> org.eclipse.e4.ui.internal.workbench.PartServiceImpl.delegateBringToTop(PartServiceImpl.java:579)
> at
> org.eclipse.e4.ui.internal.workbench.PartServiceImpl.activate(PartServiceImpl.java:558)
> at
> org.eclipse.e4.ui.internal.workbench.PartServiceImpl.activate(PartServiceImpl.java:532)
> at
> org.eclipse.e4.ui.internal.workbench.PartServiceImpl.activate(PartServiceImpl.java:521)
> at
> org.eclipse.e4.ui.internal.workbench.PartServiceImpl.showPart(PartServiceImpl.java:978)
> at
> de.servalse.ebas.rcp.lvr.demo.handlers.OpenEditorHandler.execute(OpenEditorHandler.java:55)
> 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.e4.core.internal.di.MethodRequestor.execute(MethodRequestor.java:56)
> at
> org.eclipse.e4.core.internal.di.InjectorImpl.invokeUsingClass(InjectorImpl.java:229)
> at
> org.eclipse.e4.core.internal.di.InjectorImpl.invoke(InjectorImpl.java:210)
> at
> org.eclipse.e4.core.contexts.ContextInjectionFactory.invoke(ContextInjectionFactory.java:131)
> at
> org.eclipse.e4.core.commands.internal.HandlerServiceImpl.executeHandler(HandlerServiceImpl.java:171)
> at
> org.eclipse.e4.core.commands.internal.HandlerServiceImpl.executeHandler(HandlerServiceImpl.java:145)
> at
> de.servalse.ebas.rcp.lvr.demo.ui.parts.MainPart.openEditor(MainPart.java:198)
> at
> de.servalse.ebas.rcp.lvr.demo.ui.parts.MainPart.access$0(MainPart.java:180)
> at
> de.servalse.ebas.rcp.lvr.demo.ui.parts.MainPart$2.doubleClick(MainPart.java:142)
> at
> org.eclipse.jface.viewers.StructuredViewer$1.run(StructuredViewer.java:845)
> 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.StructuredViewer.fireDoubleClick(StructuredViewer.java:843)
> at
> org.eclipse.jface.viewers.StructuredViewer.handleDoubleSelect(StructuredViewer.java:1134)
> at
> org.eclipse.jface.viewers.StructuredViewer$4.widgetDefaultSelected(StructuredViewer.java:1246)
> at
> org.eclipse.jface.util.OpenStrategy.fireDefaultSelectionEvent(OpenStrategy.java:249)
> at org.eclipse.jface.util.OpenStrategy.access$0(OpenStrategy.java:246)
> at org.eclipse.jface.util.OpenStrategy$1.handleEvent(OpenStrategy.java:307)
> at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
> at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1053)
> at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:4169)
> at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3758)
> at
> org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$9.run(PartRenderingEngine.java:1029)
> at
> org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
> at
> org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRenderingEngine.java:923)
> at
> org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(E4Workbench.java:86)
> at
> org.eclipse.e4.ui.internal.workbench.swt.E4Application.start(E4Application.java:150)
> at
> de.servalse.ebas.rcp.application.RestartableApplication.start(RestartableApplication.java:16)
> 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:353)
> at
> org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:180)
> 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:629)
> at org.eclipse.equinox.launcher.Main.basicRun(Main.java:584)
> at org.eclipse.equinox.launcher.Main.run(Main.java:1438)
> at org.eclipse.equinox.launcher.Main.main(Main.java:1414)
>
>
> The contribution class:
> public class FachfunktionEditor {
> @Inject private MDirtyable dirty;
> @Inject private Logger log;
>
> private Label label;
>
> @PostConstruct
> public void postConstruct(Composite parent) {
> label = new Label(parent, SWT.NONE);
> label.setText("testing dirty");
> this.dirty.setDirty(true);
> }
>
> @Focus
> public void setFocus() {
> this.label.setFocus();
> }
>
> }
>
Re: creating input part via part descriptor [message #1007966 is a reply to message #1007965] Thu, 07 February 2013 16:18 Go to previous messageGo to next message
Jan Weidauer is currently offline Jan Weidauer
Messages: 47
Registered: July 2009
Member
Ok, while reimplementing the stuff for a small example I found the
failure: I messed up with the context, overwriting the part context with
a newly created.

Anyway, thanks for help Tom!

Greetings,

Jan
Re: creating input part via part descriptor [message #1007967 is a reply to message #1007966] Thu, 07 February 2013 18:19 Go to previous messageGo to next message
Thomas Schindl is currently offline Thomas Schindl
Messages: 5316
Registered: July 2009
Senior Member
Now you know why we always force you to strap down your problem, at
least 50% of the time people find the problem in their code ;-) Good
news for us we don't have a major bug in our system.

Tom

Am 07.02.13 17:18, schrieb Jan Weidauer:
> Ok, while reimplementing the stuff for a small example I found the
> failure: I messed up with the context, overwriting the part context with
> a newly created.
>
> Anyway, thanks for help Tom!
>
> Greetings,
>
> Jan
>
>
Re: creating input part via part descriptor [message #1008259 is a reply to message #1007967] Mon, 11 February 2013 14:57 Go to previous messageGo to next message
Jan Weidauer is currently offline Jan Weidauer
Messages: 47
Registered: July 2009
Member
I noticed that I was partly wrong. I did not overwrite an existing
context because the part I created has no context.
I investigated this a little further and found that a part gets his own
context when rendered. There is a comment in the PartRenderingEngine
source code that the context should be null before rendering. So when I
create a context to put own information in it, the partrenderer fails to
create the proper context.
This means I can't use the context to deliver information to my part. Or
do I miss something?

Jan
Re: creating input part via part descriptor [message #1008260 is a reply to message #1008259] Mon, 11 February 2013 15:10 Go to previous messageGo to next message
Thomas Schindl is currently offline Thomas Schindl
Messages: 5316
Registered: July 2009
Senior Member
Well you can pass on informations through the MPart#properties but those
are only String values. What values do you want to pass?

Tom

Am 11.02.13 15:57, schrieb Jan Weidauer:
> I noticed that I was partly wrong. I did not overwrite an existing
> context because the part I created has no context.
> I investigated this a little further and found that a part gets his own
> context when rendered. There is a comment in the PartRenderingEngine
> source code that the context should be null before rendering. So when I
> create a context to put own information in it, the partrenderer fails to
> create the proper context.
> This means I can't use the context to deliver information to my part. Or
> do I miss something?
>
> Jan
>
Re: creating input part via part descriptor [message #1008261 is a reply to message #1008260] Mon, 11 February 2013 15:22 Go to previous messageGo to next message
Jan Weidauer is currently offline Jan Weidauer
Messages: 47
Registered: July 2009
Member
I want to pass a data object as input for an editor.

Jan
Re: creating input part via part descriptor [message #1008262 is a reply to message #1008261] Mon, 11 February 2013 15:54 Go to previous messageGo to next message
Thomas Schindl is currently offline Thomas Schindl
Messages: 5316
Registered: July 2009
Senior Member
Hi,

Well the original idea with InputPart was to one would use something
like an URI and then pass on this URI to a factory get the real input
object - similar to IEditorInput in 3.x.

What are you using the URI for.

If I would have the time to implement it. I'd envision it working
something like this:

MInpuPart p = ....
p.setInputURI("my-protocol://MyObject@[id=1]");

Then would provide a ResourceFactoryService which looks something like this:

interface ResourceFactory {
public <O> O loadResource(String resourceURI) {
// ....
}
}

which can be registered for a protocol e.g. "my-protocol" and finally an
annotation like e.g. @InputResource.

class MyInputView {
@PostConstruct
void init(@InputResource MyObject myObject) {
// ...
}
}

Tom

Am 11.02.13 16:22, schrieb Jan Weidauer:
> I want to pass a data object as input for an editor.
>
> Jan
>
Re: creating input part via part descriptor [message #1008301 is a reply to message #1008262] Mon, 11 February 2013 19:55 Go to previous messageGo to next message
Jan Weidauer is currently offline Jan Weidauer
Messages: 47
Registered: July 2009
Member
Hi,

the data is loaded from a database and then presented for selection for
further work. This selection can be done in an overview or in a dialog
or something like this. That means the data object exists already at the
time of selection. In 3.x I created my own EditorInput as container for
the data object and passed it to the editor.
In e4 I wanted to avoid implementing the mechanism you described using
the InputURI, because following this way I have to create, pass and
parse an URI to an resource I already have in my hands. That is a little
too much in my thoughts. But in the end it seems the only correct way...

Thanks for help again :)

Jan
Re: creating input part via part descriptor [message #1008318 is a reply to message #1008301] Mon, 11 February 2013 21:42 Go to previous messageGo to next message
Thomas Schindl is currently offline Thomas Schindl
Messages: 5316
Registered: July 2009
Senior Member
Well you can naturally push stuff in an upper context e.g. the one of
the perspective or window. The context created is a child of this context.

Tom

Am 11.02.13 20:55, schrieb Jan Weidauer:
> Hi,
>
> the data is loaded from a database and then presented for selection for
> further work. This selection can be done in an overview or in a dialog
> or something like this. That means the data object exists already at the
> time of selection. In 3.x I created my own EditorInput as container for
> the data object and passed it to the editor.
> In e4 I wanted to avoid implementing the mechanism you described using
> the InputURI, because following this way I have to create, pass and
> parse an URI to an resource I already have in my hands. That is a little
> too much in my thoughts. But in the end it seems the only correct way...
>
> Thanks for help again :)
>
> Jan
>
Re: creating input part via part descriptor [message #1008431 is a reply to message #1008318] Tue, 12 February 2013 12:53 Go to previous message
Jan Weidauer is currently offline Jan Weidauer
Messages: 47
Registered: July 2009
Member
Am 11.02.2013 16:54, schrieb Tom Schindl:> Hi,
....
>
> Then would provide a ResourceFactoryService which looks something like
this:

....

>
> which can be registered for a protocol e.g. "my-protocol"
....


Would you mind giving me a hint how to register a service for a
protocol, please?


Jan
Previous Topic:How to get view part from Handler
Next Topic:Clearing model data without clearing preferences
Goto Forum:
  


Current Time: Tue Sep 16 11:39:37 GMT 2014

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

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