blob: 22aa43cd1b8e79be4e71f568b64fd49112bd1e59 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
|
/*******************************************************************************
* Copyright (c) 2012 Wind River Systems, Inc. and others. All rights reserved.
* This program and the accompanying materials are made available under the terms
* of the Eclipse Public License v1.0 which accompanies this distribution, and is
* available at http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Wind River Systems - initial API and implementation
*******************************************************************************/
package org.eclipse.tcf.te.tcf.filesystem.ui.internal.adapters;
import org.eclipse.tcf.te.tcf.filesystem.core.model.FSTreeNode;
import org.eclipse.ui.IMemento;
import org.eclipse.ui.IPersistableElement;
/**
* The adapter class of FSTreeNode for IPersistableElement, used to
* persist an FSTreeNode.
*/
public class PersistableNode implements IPersistableElement {
// The node to be persisted.
private FSTreeNode node;
/**
* Create an instance.
*
* @param node The node to be persisted.
*/
public PersistableNode(FSTreeNode node) {
this.node = node;
}
/*
* (non-Javadoc)
* @see org.eclipse.ui.IPersistable#saveState(org.eclipse.ui.IMemento)
*/
@Override
public void saveState(IMemento memento) {
memento.putString("peerId", node.peerNode.getPeerId()); //$NON-NLS-1$
String path = null;
if (!node.isSystemRoot()) path = node.getLocation();
if (path != null) memento.putString("path", path); //$NON-NLS-1$
}
/*
* (non-Javadoc)
* @see org.eclipse.ui.IPersistableElement#getFactoryId()
*/
@Override
public String getFactoryId() {
return "org.eclipse.tcf.te.tcf.filesystem.ui.nodeFactory"; //$NON-NLS-1$
}
}
|