Community
Participate
Working Groups
* @see org.eclipse.e4.ui.workbench.modeling.EModelService#cloneElement(org.eclipse.e4.ui.model.
* application.ui.MUIElement, java.lang.String)
*/
public MUIElement cloneElement(MUIElement element, String cloneId, boolean saveAsSnippet) {
public MUIElement cloneElement(MUIElement element, MUIElement snippetContainer) {
EObject eObj = (EObject) element;
MUIElement clone = (MUIElement) EcoreUtil.copy(eObj);
clone.setElementId(cloneId);
if (saveAsSnippet) {
if (snippetContainer != null) {
MUIElement topWin = getTopLevelWindowFor(element);
snippetContainer.getClonableSnippets().add(clone);
if (topWin != null) {
MUIElement appElement = topWin.getParent();
MApplication app = (MApplication) appElement;
app.getClonableSnippets().add(clone);
}
return clone;
*
* @param element
* The element to clone
* @param cloneId
* @param snippetContainer
* The id to give the newly coned element
* An optional MUIElement where the cloned snippet is to be saved. null if the clone
* @param saveAsSnippet
* need not be saved
* iff <code>true</code> saves the newly created clone into the app's
* 'clonableSnippets' list
* @return The newly cloned element
public MUIElement cloneElement(MUIElement element, String cloneId, boolean saveAsSnippet);
public MUIElement cloneElement(MUIElement element, MUIElement snippetContainer);
/**
* If a snippet with the given id exists a clone is created and returned. returns