initial contribution
[phpeclipse.git] / archive / net.sourceforge.phpeclipse.wiki / src / net / sourceforge / phpeclipse / wiki / internal / ConfigurationWorkingCopy.java
diff --git a/archive/net.sourceforge.phpeclipse.wiki/src/net/sourceforge/phpeclipse/wiki/internal/ConfigurationWorkingCopy.java b/archive/net.sourceforge.phpeclipse.wiki/src/net/sourceforge/phpeclipse/wiki/internal/ConfigurationWorkingCopy.java
new file mode 100644 (file)
index 0000000..c75a2fd
--- /dev/null
@@ -0,0 +1,79 @@
+/**********************************************************************
+ * Copyright (c) 2003 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ *    IBM - Initial API and implementation
+ **********************************************************************/
+package net.sourceforge.phpeclipse.wiki.internal;
+
+/**
+ * 
+ */
+public class ConfigurationWorkingCopy extends Configuration implements IConfigurationWorkingCopy {
+       protected Configuration monitor;
+       
+       // creation
+       public ConfigurationWorkingCopy() { }
+
+       // working copy
+       public ConfigurationWorkingCopy(Configuration monitor) {
+               this.monitor = monitor;
+               setInternal(monitor);
+       }
+       
+       public void setId(String newId) {
+               id = newId;
+       }
+
+       
+       public void setURL(String url) {
+               fUrl = url;
+       }
+
+       
+       public void setPassword(String password) {
+               fPassword = password;
+       }
+
+       
+       public void setUser(String user) {
+               fUser = user;
+       }
+
+       
+       public void setType(String t) {
+               fType = t;
+       }
+       
+       public boolean isWorkingCopy() {
+               return true;
+       }
+       
+       public IConfigurationWorkingCopy getWorkingCopy() {
+               return this;
+       }
+       
+       public IConfiguration save() {
+               ConfigurationManager mm = ConfigurationManager.getInstance();
+               if (monitor != null) {
+                       //boolean restart = false;
+//                     if (monitor.isRunning()) {
+//                             //restart = true;
+//                             mm.stopMonitor(monitor);
+//                     }
+                       monitor.setInternal(this);
+                       mm.configurationChanged(monitor);
+                       //if (restart)
+                       //      mm.startMonitor(monitor);
+               } else {
+                       monitor = new Configuration();
+                       monitor.setInternal(this);
+                       mm.addConfiguration(monitor);
+               }
+               return monitor;
+       }
+}
\ No newline at end of file