KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > ui > internal > ide > dialogs > WelcomeEditorInput


1 /*******************************************************************************
2  * Copyright (c) 2000, 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.ide.dialogs;
12
13 import org.eclipse.jface.resource.ImageDescriptor;
14 import org.eclipse.osgi.util.NLS;
15 import org.eclipse.ui.IEditorInput;
16 import org.eclipse.ui.IMemento;
17 import org.eclipse.ui.IPersistableElement;
18 import org.eclipse.ui.internal.ide.AboutInfo;
19 import org.eclipse.ui.internal.ide.IDEWorkbenchMessages;
20
21 /**
22  * A simple editor input for the welcome editor
23  */

24 public class WelcomeEditorInput implements IEditorInput {
25     private AboutInfo aboutInfo;
26
27     private final static String JavaDoc FACTORY_ID = "org.eclipse.ui.internal.dialogs.WelcomeEditorInputFactory"; //$NON-NLS-1$
28

29     public final static String JavaDoc FEATURE_ID = "featureId"; //$NON-NLS-1$
30

31     /**
32      * WelcomeEditorInput constructor comment.
33      */

34     public WelcomeEditorInput(AboutInfo info) {
35         super();
36         if (info == null) {
37             throw new IllegalArgumentException JavaDoc();
38         }
39         aboutInfo = info;
40     }
41
42     public boolean exists() {
43         return false;
44     }
45
46     public Object JavaDoc getAdapter(Class JavaDoc adapter) {
47         return null;
48     }
49
50     public ImageDescriptor getImageDescriptor() {
51         return null;
52     }
53
54     public String JavaDoc getName() {
55         return IDEWorkbenchMessages.WelcomeEditor_title;
56     }
57
58     public IPersistableElement getPersistable() {
59         return new IPersistableElement() {
60             public String JavaDoc getFactoryId() {
61                 return FACTORY_ID;
62             }
63
64             public void saveState(IMemento memento) {
65                 memento.putString(FEATURE_ID, aboutInfo.getFeatureId() + ':'
66                         + aboutInfo.getVersionId());
67             }
68         };
69     }
70
71     public AboutInfo getAboutInfo() {
72         return aboutInfo;
73     }
74
75     public boolean equals(Object JavaDoc o) {
76         if ((o != null) && (o instanceof WelcomeEditorInput)) {
77             if (((WelcomeEditorInput) o).aboutInfo.getFeatureId().equals(
78                     aboutInfo.getFeatureId())) {
79                 return true;
80             }
81         }
82         return false;
83     }
84
85     public String JavaDoc getToolTipText() {
86         return NLS.bind(IDEWorkbenchMessages.WelcomeEditor_toolTip, aboutInfo.getFeatureLabel());
87     }
88 }
89
Popular Tags