Merging code from trunk that fixes #774, this work was done by incastrix
[phpeclipse.git] / net.sourceforge.phpeclipse.webbrowser / src / net / sourceforge / phpeclipse / webbrowser / internal / ExternalWebBrowserWorkingCopy.java
1 package net.sourceforge.phpeclipse.webbrowser.internal;
2
3 import net.sourceforge.phpeclipse.webbrowser.IExternalWebBrowser;
4 import net.sourceforge.phpeclipse.webbrowser.IExternalWebBrowserWorkingCopy;
5
6 /**
7  * 
8  */
9 public class ExternalWebBrowserWorkingCopy extends ExternalWebBrowser implements
10                 IExternalWebBrowserWorkingCopy {
11         protected ExternalWebBrowser browser;
12
13         // creation
14         public ExternalWebBrowserWorkingCopy() {
15         }
16
17         // working copy
18         public ExternalWebBrowserWorkingCopy(ExternalWebBrowser browser) {
19                 this.browser = browser;
20                 setInternal(browser);
21         }
22
23         /*
24          * (non-Javadoc)
25          * 
26          * @see net.sourceforge.phpeclipse.webbrowser.IExternalWebBrowserWorkingCopy#setName(java.lang.String)
27          */
28         public void setName(String name) {
29                 this.name = name;
30         }
31
32         /*
33          * (non-Javadoc)
34          * 
35          * @see net.sourceforge.phpeclipse.webbrowser.IExternalWebBrowserWorkingCopy#setLocation(java.lang.String)
36          */
37         public void setLocation(String location) {
38                 this.location = location;
39         }
40
41         /*
42          * (non-Javadoc)
43          * 
44          * @see net.sourceforge.phpeclipse.webbrowser.IExternalWebBrowserWorkingCopy#setParameters(java.lang.String)
45          */
46         public void setParameters(String params) {
47                 this.parameters = params;
48         }
49
50         public boolean isWorkingCopy() {
51                 return true;
52         }
53
54         public IExternalWebBrowserWorkingCopy getWorkingCopy() {
55                 return this;
56         }
57
58         /*
59          * (non-Javadoc)
60          * 
61          * @see net.sourceforge.phpeclipse.webbrowser.IExternalWebBrowserWorkingCopy#save()
62          */
63         public IExternalWebBrowser save() {
64                 if (browser != null) {
65                         browser.setInternal(this);
66                         BrowserManager.getInstance().browserChanged(browser);
67                 } else {
68                         browser = new ExternalWebBrowser();
69                         browser.setInternal(this);
70                         BrowserManager.getInstance().addBrowser(browser);
71                 }
72                 return browser;
73         }
74 }