1 /*******************************************************************************
\r
2 * Copyright (c) 2007, 2010 Association for Decentralized Information Management
\r
3 * in Industry THTH ry.
\r
4 * All rights reserved. This program and the accompanying materials
\r
5 * are made available under the terms of the Eclipse Public License v1.0
\r
6 * which accompanies this distribution, and is available at
\r
7 * http://www.eclipse.org/legal/epl-v10.html
\r
10 * VTT Technical Research Centre of Finland - initial API and implementation
\r
11 *******************************************************************************/
\r
12 package org.simantics.project.management;
\r
14 import java.io.File;
\r
15 import java.io.FileReader;
\r
16 import java.io.FileWriter;
\r
17 import java.io.IOException;
\r
18 import java.util.Properties;
\r
21 * Workspace management utils
\r
23 * @author Toni Kalajainen <toni.kalajainen@vtt.fi>
\r
25 public class WorkspaceUtil {
\r
28 * Write project properties
\r
30 * Project URI is in a text file simantics.cfg
\r
32 * @param propertyFile
\r
34 * @throws IOException
\r
36 public static void writeProperties(File propertyFile, Properties props) throws IOException {
\r
37 FileWriter fw = null;
\r
39 fw = new FileWriter( propertyFile );
\r
40 props.store(fw, "Project configuration");
\r
42 if (fw!=null) fw.close();
\r
47 * Read project properties in a workspace
\r
51 * @throws IOException
\r
53 public static Properties readProperties(File propertyFile) throws IOException {
\r
54 FileReader fr = null;
\r
56 fr = new FileReader(propertyFile);
\r
57 Properties props = new Properties();
\r
61 if (fr!=null) fr.close();
\r