1 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 24 public class WelcomeEditorInput implements IEditorInput { 25 private AboutInfo aboutInfo; 26 27 private final static String FACTORY_ID = "org.eclipse.ui.internal.dialogs.WelcomeEditorInputFactory"; 29 public final static String FEATURE_ID = "featureId"; 31 34 public WelcomeEditorInput(AboutInfo info) { 35 super(); 36 if (info == null) { 37 throw new IllegalArgumentException (); 38 } 39 aboutInfo = info; 40 } 41 42 public boolean exists() { 43 return false; 44 } 45 46 public Object getAdapter(Class adapter) { 47 return null; 48 } 49 50 public ImageDescriptor getImageDescriptor() { 51 return null; 52 } 53 54 public String getName() { 55 return IDEWorkbenchMessages.WelcomeEditor_title; 56 } 57 58 public IPersistableElement getPersistable() { 59 return new IPersistableElement() { 60 public String 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 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 getToolTipText() { 86 return NLS.bind(IDEWorkbenchMessages.WelcomeEditor_toolTip, aboutInfo.getFeatureLabel()); 87 } 88 } 89 | Popular Tags |