|
Re: E4 Switch Views [message #898879 is a reply to message #898878] |
Sat, 28 July 2012 19:04 |
Eclipse User |
|
|
|
Yes in fact, they are called parts. All (most) of things in e4 are done through services and also what you want to do is done through the EPartService. To obtain the EPS you have to inject in the class which holds the buttons like this :
@Inject
privat EPartService partService;
then in your button's listener you can show (or hide) a part like this:
partService.showPart(chosenPart,PartState.VISIBLE);
to find the chosenPart you have to search it like this:
partService.findPart("this.is.the.part.id");
So pretty much all you need is the EPartService.
|
|
|
Re: E4 Switch Views [message #898885 is a reply to message #898879] |
Sat, 28 July 2012 19:40 |
Alex W Messages: 3 Registered: July 2012 |
Junior Member |
|
|
Sadly it works not very well.
Case 1) the rigth parts is invisible. If i use showPart then it will not correctly shown. Only the Tabname is shown but the content is missing. Do i click on Tabname i get this exception: java.lang.IllegalArgumentException: Widget has the wrong parent
Case 2) in the right section is one part visible. after pressing button this part disapear completly and the left part occupies the complete window. Never again will a second part be shown.
Do you have any idears?
Maybe the order of the parts is wrong?
Edit: I have some strange warnings: Discouraged access: The method showPart(String, EPartService.PartState) from the type EPartService is not accessible due to restriction on required library ...eclipse\plugins\org.eclipse.e4.ui.workbench_0.10.2.v20120531-1742.jar
Could this be the problem?
[Updated on: Sat, 28 July 2012 19:45] Report message to a moderator
|
|
|
|
Re: E4 Switch Views [message #898895 is a reply to message #898890] |
Sat, 28 July 2012 21:34 |
Eclipse User |
|
|
|
Hi,
If the tab name is shown and the content is missing the problem has nothing to do with the handler but with how you implement your part's composite content. Make sure you put a method with the @Focus annotation in your part class and delegate the focus to the right control. This will save you some strange behavior.
For the refactoring thing I'm not sure what you mean but you can use handlers and commands if you want to encapsulate commanding code.
I am not aware of a way to hide the tab title (other than leaving an empty label).
You can find other resources on e4 app development here: http://www.vogella.com/eclipse.html
|
|
|
Re: E4 Switch Views [message #899089 is a reply to message #898890] |
Mon, 30 July 2012 14:18 |
|
Have you looked into PartSashContainer's and PartStack's? You shouldn't need to have anything visible (or not) at runtime. IIRC, you are able to control the sizing of each element by setting the "Container Data" attribute for the individual part.
JD
|
|
|
Re: E4 Switch Views [message #899488 is a reply to message #899089] |
Wed, 01 August 2012 07:16 |
|
You might have been hit by Bug 372211. If a part is initial not visible you also need to use the model service to set it to visible. Please feel free to complain in the bug, I think the current behavior is not as expected by most users.
|
|
|
Powered by
FUDForum. Page generated in 0.03188 seconds