Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Rich Client Platform (RCP) » User Rightmanagement for Parts(Show and Hide Parts for special user rights)
User Rightmanagement for Parts [message #1769501] Tue, 01 August 2017 06:43 Go to next message
Patrick Sowada is currently offline Patrick SowadaFriend
Messages: 3
Registered: June 2017
Junior Member
Hi,

I implemented an e4 RCP application and i have user with differned rights. For these rights i want to hide parts for the user. Now is the question how can i do that in e4?

In e3 i know that i can do that with a perspective class that implements the IPerspectiveFactory.

For my e4 application i search for a solution and find that i can define a handler for the part that execute this code below:

 @Execute
   public void execute(MApplication application, EPartService partService,
            EModelService modelService) {
       final MPart part = partService.findPart("partID");
       partService.hidePart(part);
   }


The only problem what i have is that my handle will not be executed, so how can i combine the part with the handler?

I also try to hide the parts in the lifecylcemanager, but i get the execption that the window is not ready and the part cannot be found.

Regards,
Patrick
Re: User Rightmanagement for Parts [message #1769504 is a reply to message #1769501] Tue, 01 August 2017 07:14 Go to previous messageGo to next message
Patrick Sowada is currently offline Patrick SowadaFriend
Messages: 3
Registered: June 2017
Junior Member
I found a way to hide the part but i get InjectionException.

I do the hide in the init() method:
@PostConstruct
	private void init(EPartService partService) {
		MPart part = partService.findPart("part.id.activity");
		partService.hidePart(part, true);
	}


Quote:

!ENTRY org.eclipse.e4.ui.workbench 4 0 2017-08-01 09:08:06.139
!MESSAGE Unable to create class 'application.parts.activityPart.ActivityPart' from bundle '135'
!STACK 0
org.eclipse.e4.core.di.InjectionException: Unable to process "ActivityPart#createComposite()": no actual value was found for the argument "Composite".
at org.eclipse.e4.core.internal.di.InjectorImpl.reportUnresolvedArgument(InjectorImpl.java:476)
at org.eclipse.e4.core.internal.di.InjectorImpl.processAnnotated(InjectorImpl.java:987)
at org.eclipse.e4.core.internal.di.InjectorImpl.inject(InjectorImpl.java:124)
at org.eclipse.e4.core.internal.di.InjectorImpl.internalMake(InjectorImpl.java:399)
at org.eclipse.e4.core.internal.di.InjectorImpl.make(InjectorImpl.java:318)
at org.eclipse.e4.core.contexts.ContextInjectionFactory.make(ContextInjectionFactory.java:162)
at org.eclipse.e4.ui.internal.workbench.ReflectionContributionFactory.createFromBundle(ReflectionContributionFactory.java:105)
at org.eclipse.e4.ui.internal.workbench.ReflectionContributionFactory.doCreate(ReflectionContributionFactory.java:74)
at org.eclipse.e4.ui.internal.workbench.ReflectionContributionFactory.create(ReflectionContributionFactory.java:56)
at org.eclipse.e4.ui.workbench.renderers.swt.ContributedPartRenderer.createWidget(ContributedPartRenderer.java:129)
at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.createWidget(PartRenderingEngine.java:997)
at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.safeCreateGui(PartRenderingEngine.java:666)
at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.safeCreateGui(PartRenderingEngine.java:772)
at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.access$0(PartRenderingEngine.java:743)
at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$2.run(PartRenderingEngine.java:737)
at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.createGui(PartRenderingEngine.java:721)
at org.eclipse.e4.ui.workbench.renderers.swt.StackRenderer.showTab(StackRenderer.java:1289)
at org.eclipse.e4.ui.workbench.renderers.swt.LazyStackRenderer.lambda$0(LazyStackRenderer.java:68)
at org.eclipse.e4.ui.services.internal.events.UIEventHandler$1.run(UIEventHandler.java:40)
at org.eclipse.swt.widgets.Synchronizer.syncExec(Synchronizer.java:233)
at org.eclipse.swt.widgets.Display.syncExec(Display.java:4889)
...
Re: User Rightmanagement for Parts [message #1770135 is a reply to message #1769504] Tue, 08 August 2017 14:50 Go to previous message
Brian de Alwis is currently offline Brian de AlwisFriend
Messages: 786
Registered: January 2012
Senior Member

Quote:
The only problem what i have is that my handle will not be executed, so how can i combine the part with the handler?


Typically you perform these hide/show as part of a login-user / switch-user flow. You would trigger that with a command handler.


Eclipse Platform committer. Ask me about Eclipse support, training, and consulting.
Previous Topic:Could not resolve module: org.eclipse.equinox.security.ui
Next Topic:equinox launcher VS ini file
Goto Forum:
  


Current Time: Mon Nov 12 18:33:43 GMT 2018

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

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

Back to the top