Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse 4 » how to pass arguments to a Part
how to pass arguments to a Part [message #648536] Thu, 13 January 2011 12:52 Go to next message
sev! is currently offline sev!Friend
Messages: 2
Registered: January 2011
Junior Member
hi

I'm new to eclipse e4.

I Have a stack to which I'm dinamically adding parts like this:

	public void openProgram(String prog) {
	    MPart part = MBasicFactory.INSTANCE.createPart();
	    
	    part.setLabel(prog);
	    
	    part.setCloseable(true);
	    part.setContributionURI("platform:/plugin/ch.inteco.wegas/ch.inteco.wegas.app.ProgramView");
	    
	    List<MPartStack> stacks = modelService.findElements(application, null, MPartStack.class, null);
	    stacks.get(1).getChildren().add(part);
	    partService.showPart(part, PartState.ACTIVATE);
    
	}


Is there a possibility to pass a parameter to the ProgramView class, or maybe injection of a context? It should be available upon creation of the ProgramView part.

Regards and Thank you

Severin
Re: how to pass arguments to a Part [message #648543 is a reply to message #648536] Thu, 13 January 2011 13:22 Go to previous messageGo to next message
Paul Webster is currently offline Paul WebsterFriend
Messages: 6859
Registered: July 2009
Location: Ottawa
Senior Member

On 01/13/2011 07:52 AM, severin.laeuppi@inteco.ch wrote:
> Is there a possibility to pass a parameter to the ProgramView class, or
> maybe injection of a context? It should be available upon creation of
> the ProgramView part.


Depends on the kind of parameter. If you have string parameters, you
can use MPart.getProperties().put("key", "value")

They'll get populated into your IEclipseContext, and can even be
retrieved by:

@Inject
public void setUid(@Named("key") String uid);

Or is it something else?

PW


--
Paul Webster
http://wiki.eclipse.org/Platform_Command_Framework
http://wiki.eclipse.org/Command_Core_Expressions
http://wiki.eclipse.org/Platform_Expression_Framework
http://wiki.eclipse.org/Menu_Contributions
http://wiki.eclipse.org/Menus_Extension_Mapping
http://help.eclipse.org/galileo/index.jsp?topic=/org.eclipse .platform.doc.isv/guide/workbench.htm


Re: how to pass arguments to a Part [message #648583 is a reply to message #648536] Thu, 13 January 2011 15:14 Go to previous message
sev! is currently offline sev!Friend
Messages: 2
Registered: January 2011
Junior Member
Thanks! Exactly what I needed!
Previous Topic:Download is not happeining through git server
Next Topic:XWT and ListViewer
Goto Forum:
  


Current Time: Thu Mar 28 11:54:51 GMT 2024

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

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

Back to the top