KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > ui > internal > browser > BrowserDescriptor


1 /*******************************************************************************
2  * Copyright (c) 2004, 2006 IBM Corporation and others.
3  * All rights reserved. This program and the accompanying materials
4  * are made available under the terms of the Eclipse Public License v1.0
5  * which accompanies this distribution, and is available at
6  * http://www.eclipse.org/legal/epl-v10.html
7  *
8  * Contributors:
9  * IBM Corporation - Initial API and implementation
10  *******************************************************************************/

11 package org.eclipse.ui.internal.browser;
12
13 import org.eclipse.ui.IMemento;
14 /**
15  *
16  */

17 public class BrowserDescriptor implements IBrowserDescriptor {
18     private static final String JavaDoc MEMENTO_NAME = "name"; //$NON-NLS-1$
19
private static final String JavaDoc MEMENTO_LOCATION = "location"; //$NON-NLS-1$
20
private static final String JavaDoc MEMENTO_PARAMETERS = "parameters"; //$NON-NLS-1$
21

22     protected String JavaDoc name;
23     protected String JavaDoc location;
24     protected String JavaDoc parameters;
25     
26     /* (non-Javadoc)
27      * @see org.eclipse.ui.internal.browser.IWebBrowser#getName()
28      */

29     public String JavaDoc getName() {
30         return name;
31     }
32
33     /* (non-Javadoc)
34      * @see org.eclipse.ui.internal.browser.IBrowserDescriptor#getLocation()
35      */

36     public String JavaDoc getLocation() {
37         return location;
38     }
39
40     /* (non-Javadoc)
41      * @see org.eclipse.ui.internal.browser.IBrowserDescriptor#getParameters()
42      */

43     public String JavaDoc getParameters() {
44         return parameters;
45     }
46     
47     public void delete() {
48         BrowserManager.getInstance().removeWebBrowser(this);
49     }
50
51     public boolean isWorkingCopy() {
52         return false;
53     }
54
55     public IBrowserDescriptorWorkingCopy getWorkingCopy() {
56         return new BrowserDescriptorWorkingCopy(this);
57     }
58
59     protected void setInternal(IBrowserDescriptor browser) {
60         name = browser.getName();
61         location = browser.getLocation();
62         parameters = browser.getParameters();
63     }
64
65     protected void save(IMemento memento) {
66         memento.putString(MEMENTO_NAME, name);
67         memento.putString(MEMENTO_LOCATION, location);
68         memento.putString(MEMENTO_PARAMETERS, parameters);
69     }
70
71     protected void load(IMemento memento) {
72         name = memento.getString(MEMENTO_NAME);
73         location = memento.getString(MEMENTO_LOCATION);
74         parameters = memento.getString(MEMENTO_PARAMETERS);
75     }
76
77     public String JavaDoc toString() {
78         return "External Web browser: " + getName() + " / " + getLocation() + " / " + getParameters(); //$NON-NLS-1$//$NON-NLS-2$//$NON-NLS-3$
79
}
80 }
81
Popular Tags