01: /*******************************************************************************
02: * Copyright (c) 2000, 2006 IBM Corporation and others.
03: * All rights reserved. This program and the accompanying materials
04: * are made available under the terms of the Eclipse Public License v1.0
05: * which accompanies this distribution, and is available at
06: * http://www.eclipse.org/legal/epl-v10.html
07: *
08: * Contributors:
09: * IBM Corporation - initial API and implementation
10: *******************************************************************************/package org.eclipse.ui.internal.ide.dialogs;
11:
12: import org.eclipse.jface.resource.ImageDescriptor;
13: import org.eclipse.osgi.util.NLS;
14: import org.eclipse.ui.IEditorInput;
15: import org.eclipse.ui.IMemento;
16: import org.eclipse.ui.IPersistableElement;
17: import org.eclipse.ui.internal.ide.AboutInfo;
18: import org.eclipse.ui.internal.ide.IDEWorkbenchMessages;
19:
20: /**
21: * A simple editor input for the welcome editor
22: */
23: public class WelcomeEditorInput implements IEditorInput {
24: private AboutInfo aboutInfo;
25:
26: private final static String FACTORY_ID = "org.eclipse.ui.internal.dialogs.WelcomeEditorInputFactory"; //$NON-NLS-1$
27:
28: public final static String FEATURE_ID = "featureId"; //$NON-NLS-1$
29:
30: /**
31: * WelcomeEditorInput constructor comment.
32: */
33: public WelcomeEditorInput(AboutInfo info) {
34: super ();
35: if (info == null) {
36: throw new IllegalArgumentException();
37: }
38: aboutInfo = info;
39: }
40:
41: public boolean exists() {
42: return false;
43: }
44:
45: public Object getAdapter(Class adapter) {
46: return null;
47: }
48:
49: public ImageDescriptor getImageDescriptor() {
50: return null;
51: }
52:
53: public String getName() {
54: return IDEWorkbenchMessages.WelcomeEditor_title;
55: }
56:
57: public IPersistableElement getPersistable() {
58: return new IPersistableElement() {
59: public String getFactoryId() {
60: return FACTORY_ID;
61: }
62:
63: public void saveState(IMemento memento) {
64: memento.putString(FEATURE_ID, aboutInfo.getFeatureId()
65: + ':' + aboutInfo.getVersionId());
66: }
67: };
68: }
69:
70: public AboutInfo getAboutInfo() {
71: return aboutInfo;
72: }
73:
74: public boolean equals(Object o) {
75: if ((o != null) && (o instanceof WelcomeEditorInput)) {
76: if (((WelcomeEditorInput) o).aboutInfo.getFeatureId()
77: .equals(aboutInfo.getFeatureId())) {
78: return true;
79: }
80: }
81: return false;
82: }
83:
84: public String getToolTipText() {
85: return NLS.bind(IDEWorkbenchMessages.WelcomeEditor_toolTip,
86: aboutInfo.getFeatureLabel());
87: }
88: }
|