KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > debug > internal > ui > viewers > model > ElementMementoRequest


1 /*******************************************************************************
2  * Copyright (c) 2006 IBM Corporation and others.
3  * All rights reserved. This program and the accompanying materials
4  * are made available under the terms of the Eclipse Public License v1.0
5  * which accompanies this distribution, and is available at
6  * http://www.eclipse.org/legal/epl-v10.html
7  *
8  * Contributors:
9  * IBM Corporation - initial API and implementation
10  *******************************************************************************/

11 package org.eclipse.debug.internal.ui.viewers.model;
12
13 import org.eclipse.debug.internal.ui.viewers.model.provisional.IElementMementoRequest;
14 import org.eclipse.debug.internal.ui.viewers.model.provisional.IPresentationContext;
15 import org.eclipse.debug.internal.ui.viewers.model.provisional.ModelDelta;
16 import org.eclipse.jface.viewers.TreePath;
17 import org.eclipse.ui.IMemento;
18
19 /**
20  * @since 3.3
21  */

22 class ElementMementoRequest extends MementoUpdate implements IElementMementoRequest {
23     
24     private IMementoManager fManager;
25     private ModelDelta fDelta;
26
27     /**
28      * @param context
29      * @param element
30      * @param memento
31      */

32     public ElementMementoRequest(ModelContentProvider provider, IMementoManager manager, IPresentationContext context, Object JavaDoc element, TreePath elementPath, IMemento memento, ModelDelta delta) {
33         super(provider, context, element, elementPath, memento);
34         fManager = manager;
35         fDelta = delta;
36     }
37
38     /* (non-Javadoc)
39      * @see org.eclipse.core.runtime.IProgressMonitor#done()
40      */

41     public void done() {
42         if (!isCanceled() && (getStatus() == null || getStatus().isOK())) {
43             // replace the element with a memento
44
fDelta.setElement(getMemento());
45         }
46         fManager.requestComplete(this);
47     }
48
49 }
50
Popular Tags