* 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
**********************************************************************/
import net.sourceforge.phpeclipse.wiki.editor.WikiEditorPlugin;
-
/**
- *
+ *
*/
public class Configuration implements IConfiguration {
- private static final String MEMENTO_ID = "id";
- private static final String MEMENTO_USER = "user";
- private static final String MEMENTO_URL = "url";
- private static final String MEMENTO_PASSWORD = "password";
- private static final String MEMENTO_TYPE_ID = "type-id";
-
- protected String id;
- protected String fUrl;
- protected String fPassword;
- protected String fUser;
- protected String fType;
-
- public Configuration() {
- this( WikiEditorPlugin.HTTP_QUERY ); // default type
- }
-
- public Configuration(String type) {
- this.fType = type;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.monitor.internal.IConfiguration#getId()
- */
- public String getId() {
- return id;
- }
-
- public String getURL() {
- return fUrl;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.monitor.internal.IConfiguration#getRemotePort()
- */
- public String getPassword() {
- return fPassword;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.monitor.internal.IConfiguration#getLocalPort()
- */
- public String getUser() {
- return fUser;
- }
-
- /**
- */
- public String getType() {
- return fType;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.monitor.internal.IConfiguration#isRunning()
- */
- public boolean isActive() {
- return ConfigurationManager.getInstance().isActive(this);
- }
-
- public void delete() {
- ConfigurationManager.getInstance().removeConfiguration(this);
- }
-
- public boolean isWorkingCopy() {
- return false;
- }
-
- public IConfigurationWorkingCopy getWorkingCopy() {
- return new ConfigurationWorkingCopy(this);
- }
-
- protected void setInternal(IConfiguration monitor) {
- id = monitor.getId();
- fUrl = monitor.getURL();
- fPassword = monitor.getPassword();
- fUser = monitor.getUser();
- fType = monitor.getType();
- }
-
- protected void save(IMemento memento) {
- memento.putString(MEMENTO_ID, id);
- memento.putString(MEMENTO_TYPE_ID, fType);
- memento.putString(MEMENTO_USER, fUser);
- memento.putString(MEMENTO_URL, fUrl);
- memento.putString(MEMENTO_PASSWORD, fPassword);
- }
-
- protected void load(IMemento memento) {
- id = memento.getString(MEMENTO_ID);
- fType = memento.getString(MEMENTO_TYPE_ID);
- fUser = memento.getString(MEMENTO_USER);
- fUrl = memento.getString(MEMENTO_URL);
- fPassword = memento.getString(MEMENTO_PASSWORD);
- }
+ private static final String MEMENTO_ID = "id";
+
+ private static final String MEMENTO_NAME = "name";
+
+ private static final String MEMENTO_USER = "user";
+
+ private static final String MEMENTO_URL = "url";
+
+ private static final String MEMENTO_PASSWORD = "password";
+
+ private static final String MEMENTO_TYPE_ID = "type-id";
+
+ protected String fId = "";
+
+ protected String fName = "";
+
+ protected String fUrl = "";
+
+ protected String fPassword = "";
+
+ protected String fUser = "";
+
+ protected String fType = "";
+
+ public Configuration() {
+ this(WikiEditorPlugin.HTTP_QUERY); // default type
+ }
+
+ public Configuration(String type) {
+ this.fType = type;
+ }
+
+ public String getId() {
+ return fId;
+ }
+
+ public String getName() {
+ return fName;
+ }
+
+ public String getURL() {
+ return fUrl;
+ }
+
+ public String getPassword() {
+ return fPassword;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.monitor.internal.IConfiguration#getLocalPort()
+ */
+ public String getUser() {
+ return fUser;
+ }
+
+ /**
+ */
+ public String getType() {
+ return fType;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.monitor.internal.IConfiguration#isRunning()
+ */
+ public boolean isActive() {
+ return ConfigurationManager.getInstance().isActive(this);
+ }
+
+ public void delete() {
+ ConfigurationManager.getInstance().removeConfiguration(this);
+ }
+
+ public boolean isWorkingCopy() {
+ return false;
+ }
+
+ public IConfigurationWorkingCopy getWorkingCopy() {
+ return new ConfigurationWorkingCopy(this);
+ }
+
+ protected void setInternal(IConfiguration monitor) {
+ fId = monitor.getId();
+ fName = monitor.getName();
+ fUrl = monitor.getURL();
+ fPassword = monitor.getPassword();
+ fUser = monitor.getUser();
+ fType = monitor.getType();
+ }
+
+ protected void save(IMemento memento) {
+ memento.putString(MEMENTO_ID, fId);
+ memento.putString(MEMENTO_NAME, fName);
+ memento.putString(MEMENTO_TYPE_ID, fType);
+ memento.putString(MEMENTO_USER, fUser);
+ memento.putString(MEMENTO_URL, fUrl);
+ memento.putString(MEMENTO_PASSWORD, fPassword);
+ }
+
+ protected void load(IMemento memento) {
+ fId = memento.getString(MEMENTO_ID);
+ if (fId == null) {
+ fId = "";
+ }
+ fName = memento.getString(MEMENTO_NAME);
+ if (fName == null) {
+ fName = "";
+ }
+ fType = memento.getString(MEMENTO_TYPE_ID);
+ if (fType == null) {
+ fType = "";
+ }
+ fUser = memento.getString(MEMENTO_USER);
+ if (fUser == null) {
+ fUser = "";
+ }
+ fUrl = memento.getString(MEMENTO_URL);
+ if (fUrl == null) {
+ fUrl = "";
+ }
+ fPassword = memento.getString(MEMENTO_PASSWORD);
+ if (fPassword == null) {
+ fPassword = "";
+ }
+ }
}
\ No newline at end of file