1436190 - Test additions & refactoring
[phpeclipse.git] / net.sourceforge.phpeclipse.phphelp / src / net / sourceforge / phpdt / httpquery / config / 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.phpdt.httpquery.config;
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                         configuration.setInternal(this);
68                         mm.configurationChanged(configuration);
69                 } else {
70                         configuration = new Configuration();
71                         configuration.setInternal(this);
72                         mm.addConfiguration(configuration);
73                 }
74                 return configuration;
75         }
76 }