b0cafc5952e4485be87ff6648bbab2f489304a33
[phpeclipse.git] / archive / net.sourceforge.phpeclipse.wiki / src / net / sourceforge / phpeclipse / wiki / internal / ConfigurationWorkingCopy.java
1 /**********************************************************************
2  * Copyright (c) 2003 IBM Corporation and others.
3  * All rights reserved. This program and the accompanying materials
4  * are made available under the terms of the Common Public License v1.0
5  * which accompanies this distribution, and is available at
6  * http://www.eclipse.org/legal/cpl-v10.html
7  *
8  * Contributors:
9  *    IBM - Initial API and implementation
10  **********************************************************************/
11 package net.sourceforge.phpeclipse.wiki.internal;
12
13 /**
14  * 
15  */
16 public class ConfigurationWorkingCopy extends Configuration implements IConfigurationWorkingCopy {
17         protected Configuration configuration;
18         
19         // creation
20         public ConfigurationWorkingCopy() { }
21
22         // working copy
23         public ConfigurationWorkingCopy(Configuration configuration) {
24                 this.configuration = configuration;
25                 setInternal(configuration);
26         }
27         
28         public void setId(String newId) {
29                 fId = newId;
30         }
31         
32         public void setName(String name) {
33                 fName = name;
34         }
35
36         
37         public void setURL(String url) {
38                 fUrl = url;
39         }
40
41         
42         public void setPassword(String password) {
43                 fPassword = password;
44         }
45
46         
47         public void setUser(String user) {
48                 fUser = user;
49         }
50
51         
52         public void setType(String t) {
53                 fType = t;
54         }
55         
56         public boolean isWorkingCopy() {
57                 return true;
58         }
59         
60         public IConfigurationWorkingCopy getWorkingCopy() {
61                 return this;
62         }
63         
64         public IConfiguration save() {
65                 ConfigurationManager mm = ConfigurationManager.getInstance();
66                 if (configuration != null) {
67                         //boolean restart = false;
68 //                      if (monitor.isRunning()) {
69 //                              //restart = true;
70 //                              mm.stopMonitor(monitor);
71 //                      }
72                         configuration.setInternal(this);
73                         mm.configurationChanged(configuration);
74                         //if (restart)
75                         //      mm.startMonitor(monitor);
76                 } else {
77                         configuration = new Configuration();
78                         configuration.setInternal(this);
79                         mm.addConfiguration(configuration);
80                 }
81                 return configuration;
82         }
83 }