|
|
|
Re: MCompositePart creation with EPartService.createPart()? [message #1759888 is a reply to message #1759141] |
Wed, 19 April 2017 06:53 |
Jay Norwood Messages: 155 Registered: July 2009 |
Senior Member |
|
|
I experimented some more with the snippet cloning.
A single call to the snippet cloning handler below was able to replicate a copy of the whole window.main model, placed under the Snippets ... menus, parts, perspectives, sash and stack containers ... everything. Pretty amazing capability.
I couldn't find a document of what to give as the element ID for the node shown as 'Windows and Dialogs' in the editor, so I passed in a the window.main id as a sibling command parameter, and looked up the parent.
I was also left with a question about replication of the ID strings of the application model elements. Apparently the application model doesn't require these to be unique. At least, I didn't do anything explicit to change the IDs after cloning multiple times. Is that right?
public class CloneSnippetHandler {
@Execute
public void cloneSnippet(@Named("snippetID") String snippetID,@Named("siblingID") String siblingID, EModelService modelService, MApplication application) {
MUIElement el = modelService.findSnippet(application,snippetID);
MUIElement sibling = modelService.find(siblingID, application);
MUIElement cloned = modelService.cloneSnippet(application, snippetID, null);
MElementContainer<MUIElement> cont = sibling.getParent();
cont.getChildren().add(cloned);
}
}
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.03268 seconds