Skip to main content
aboutsummaryrefslogtreecommitdiffstats
blob: 65f86bdd577a687455b7ffa5e699415de9562909 (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
/*******************************************************************************
 * Copyright (c) 2007 Intel Corporation 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:
 * Intel Corporation - Initial API and implementation
 *******************************************************************************/
package org.eclipse.cdt.managedbuilder.internal.core;

import org.eclipse.cdt.core.settings.model.ICStorageElement;
import org.eclipse.cdt.managedbuilder.core.IManagedConfigElement;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.Path;

class SourcePath {
	static final String ELEMENT_NAME = "sourcePath"; //$NON-NLS-1$
	private static final String ATTRIBUTE_PATH = "path"; //$NON-NLS-1$
	private IPath path;
	
	SourcePath(IPath path) {
		this.path = path;
	}
	
	SourcePath(ICStorageElement el) {
		String pathStr = el.getAttribute(ATTRIBUTE_PATH);
		if(pathStr != null)
			path = new Path(pathStr);
	}

	SourcePath(IManagedConfigElement el) {
		String pathStr = el.getAttribute(ATTRIBUTE_PATH);
		if(pathStr != null)
			path = new Path(pathStr);
	}

	public IPath getPath(){
		return path;
	}
	
	void serialize(ICStorageElement el){
		if(path != null){
			String strPath = path.toString();
			el.setAttribute(ATTRIBUTE_PATH, strPath);
		}
	}
}

Back to the top