1) Added missing strings for italic, underline and strike through.
[phpeclipse.git] / archive / net.sourceforge.phpeclipse.monitor.core / src / net / sourceforge / phpdt / monitor / core / internal / MonitorWorkingCopy.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.monitor.core.internal;
12
13 import net.sourceforge.phpdt.monitor.core.IMonitor;
14 import net.sourceforge.phpdt.monitor.core.IMonitorWorkingCopy;
15 import net.sourceforge.phpdt.monitor.core.IProtocolAdapter;
16 /**
17  * 
18  */
19 public class MonitorWorkingCopy extends Monitor implements IMonitorWorkingCopy {
20         protected Monitor monitor;
21         
22         // creation
23         public MonitorWorkingCopy() { }
24
25         // working copy
26         public MonitorWorkingCopy(Monitor monitor) {
27                 this.monitor = monitor;
28                 setInternal(monitor);
29         }
30         
31         /* (non-Javadoc)
32          * @see org.eclipse.monitor.internal.IMonitorWorkingCopy#setRemoteHost(java.lang.String)
33          */
34         public void setId(String newId) {
35                 id = newId;
36         }
37
38         /* (non-Javadoc)
39          * @see org.eclipse.monitor.internal.IMonitorWorkingCopy#setRemoteHost(java.lang.String)
40          */
41         public void setRemoteHost(String host) {
42                 remoteHost = host;
43         }
44
45         /* (non-Javadoc)
46          * @see org.eclipse.monitor.internal.IMonitorWorkingCopy#setRemotePort(int)
47          */
48         public void setRemotePort(int port) {
49                 remotePort = port;
50         }
51
52         /* (non-Javadoc)
53          * @see org.eclipse.monitor.internal.IMonitorWorkingCopy#setLocalPort(int)
54          */
55         public void setLocalPort(int port) {
56                 localPort = port;
57         }
58
59         /* (non-Javadoc)
60          * @see org.eclipse.monitor.internal.IMonitorWorkingCopy#setType(IType)
61          */
62         public void setProtocolAdapter(IProtocolAdapter t) {
63                 type = t;
64         }
65         
66         public boolean isWorkingCopy() {
67                 return true;
68         }
69         
70         public IMonitorWorkingCopy getWorkingCopy() {
71                 return this;
72         }
73         
74         public IMonitor save() {
75                 MonitorManager mm = MonitorManager.getInstance();
76                 if (monitor != null) {
77                         //boolean restart = false;
78                         if (monitor.isRunning()) {
79                                 //restart = true;
80                                 mm.stopMonitor(monitor);
81                         }
82                         monitor.setInternal(this);
83                         mm.monitorChanged(monitor);
84                         //if (restart)
85                         //      mm.startMonitor(monitor);
86                 } else {
87                         monitor = new Monitor();
88                         monitor.setInternal(this);
89                         mm.addMonitor(monitor);
90                 }
91                 return monitor;
92         }
93 }