Is it possible to arrange two static and one dynamically created parts in Eclipse e4 application?

StackOverflow https://stackoverflow.com/questions/21712768

  •  10-10-2022
  •  | 
  •  

Question

I am creating a view in which there are two static part PartSashContainer. I am creating a dynamic part which is called from the menu handler. Whenever the dynamic part is called from the handler the dynamic part is arranged at the end of the two static part. I should create in such way that dynamic part should come in the first place followed by two static part.

Can anyone please provide me the solution for arranging the parts?

Was it helpful?

Solution

If you get the MPartStack containing the three parts you can rearrange the order of the children.

MPartStack stack;
// TODO inject the stack or find in the model

List<MStackElement> children = stack.getChildren();

// Copy the list - don't try and update the original list

List<MStackElement> sorted = new ArrayList<>(children);

// TODO order the list

// Update the stack children

children.clear();
children.addAll(sorted);
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top