initial contribution
[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 monitor;
18         
19         // creation
20         public ConfigurationWorkingCopy() { }
21
22         // working copy
23         public ConfigurationWorkingCopy(Configuration monitor) {
24                 this.monitor = monitor;
25                 setInternal(monitor);
26         }
27         
28         public void setId(String newId) {
29                 id = newId;
30         }
31
32         
33         public void setURL(String url) {
34                 fUrl = url;
35         }
36
37         
38         public void setPassword(String password) {
39                 fPassword = password;
40         }
41
42         
43         public void setUser(String user) {
44                 fUser = user;
45         }
46
47         
48         public void setType(String t) {
49                 fType = t;
50         }
51         
52         public boolean isWorkingCopy() {
53                 return true;
54         }
55         
56         public IConfigurationWorkingCopy getWorkingCopy() {
57                 return this;
58         }
59         
60         public IConfiguration save() {
61                 ConfigurationManager mm = ConfigurationManager.getInstance();
62                 if (monitor != null) {
63                         //boolean restart = false;
64 //                      if (monitor.isRunning()) {
65 //                              //restart = true;
66 //                              mm.stopMonitor(monitor);
67 //                      }
68                         monitor.setInternal(this);
69                         mm.configurationChanged(monitor);
70                         //if (restart)
71                         //      mm.startMonitor(monitor);
72                 } else {
73                         monitor = new Configuration();
74                         monitor.setInternal(this);
75                         mm.addConfiguration(monitor);
76                 }
77                 return monitor;
78         }
79 }