Show Part in specific PartStack

If a part is statically added to the application model the parent container containing the part is set because the part model element is placed directly under the part container in the hierarchy.

For adding a part dynamically the parent of the part is not set and by default refers to the part stack of the current view (afaik).

For setting the parent (part stack) of a dynamically created part the specific part needs to be retrieved from the application model. Then the new part needs to be added to the part stack.

// create a new Part based on a PartDescriptor
// in the application model
// assume the ID is used for the PartDescriptor
MPart part = partService.createPart(Constants.EDITOR_PART_ID);

// configure part

// add part to partstack
MPartStack editorPartStack = (MPartStack) modelService.find("miworkplace.middle", application);

// If multiple parts of this type are now allowed
// in the application model,
// then the provided part will be shown
// and returned
partService.showPart(part, PartState.ACTIVATE);