Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
View | Details | Raw Unified | Return to bug 355228
Collapse All | Expand All

(-)src/org/eclipse/e4/ui/internal/workbench/ModelServiceImpl.java (-9 / +3 lines)
Lines 247-264 Link Here
247
	 * @see org.eclipse.e4.ui.workbench.modeling.EModelService#cloneElement(org.eclipse.e4.ui.model.
247
	 * @see org.eclipse.e4.ui.workbench.modeling.EModelService#cloneElement(org.eclipse.e4.ui.model.
248
	 * application.ui.MUIElement, java.lang.String)
248
	 * application.ui.MUIElement, java.lang.String)
249
	 */
249
	 */
250
	public MUIElement cloneElement(MUIElement element, String cloneId, boolean saveAsSnippet) {
250
	public MUIElement cloneElement(MUIElement element, MUIElement snippetContainer) {
251
		EObject eObj = (EObject) element;
251
		EObject eObj = (EObject) element;
252
		MUIElement clone = (MUIElement) EcoreUtil.copy(eObj);
252
		MUIElement clone = (MUIElement) EcoreUtil.copy(eObj);
253
		clone.setElementId(cloneId);
254
253
255
		if (saveAsSnippet) {
254
		if (snippetContainer != null) {
256
			MUIElement topWin = getTopLevelWindowFor(element);
255
			snippetContainer.getClonableSnippets().add(clone);
257
			if (topWin != null) {
258
				MUIElement appElement = topWin.getParent();
259
				MApplication app = (MApplication) appElement;
260
				app.getClonableSnippets().add(clone);
261
			}
262
		}
256
		}
263
257
264
		return clone;
258
		return clone;
(-)src/org/eclipse/e4/ui/workbench/modeling/EModelService.java (-6 / +4 lines)
Lines 162-175 Link Here
162
	 * 
162
	 * 
163
	 * @param element
163
	 * @param element
164
	 *            The element to clone
164
	 *            The element to clone
165
	 * @param cloneId
165
	 * @param snippetContainer
166
	 *            The id to give the newly coned element
166
	 *            An optional MUIElement where the cloned snippet is to be saved. null if the clone
167
	 * @param saveAsSnippet
167
	 *            need not be saved
168
	 *            iff <code>true</code> saves the newly created clone into the app's
169
	 *            'clonableSnippets' list
170
	 * @return The newly cloned element
168
	 * @return The newly cloned element
171
	 */
169
	 */
172
	public MUIElement cloneElement(MUIElement element, String cloneId, boolean saveAsSnippet);
170
	public MUIElement cloneElement(MUIElement element, MUIElement snippetContainer);
173
171
174
	/**
172
	/**
175
	 * If a snippet with the given id exists a clone is created and returned. returns
173
	 * If a snippet with the given id exists a clone is created and returned. returns

Return to bug 355228