alvinalexander.com | career | drupal | java | mac | mysql | perl | scala | uml | unix  

What this is

This file is included in the DevDaily.com "Java Source Code Warehouse" project. The intent of this project is to help you "Learn Java by Example" TM.

Other links

The source code

/*******************************************************************************
 * Copyright (c) 2000, 2003 IBM Corporation and others.
 * All rights reserved. This program and the accompanying materials 
 * are made available under the terms of the Common Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/cpl-v10.html
 * 
 * Contributors:
 *     IBM Corporation - initial API and implementation
 *******************************************************************************/
package org.eclipse.welcome.internal.webbrowser;

import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.ui.*;
/**
 * A simple editor input for the welcome editor
 */
public class WebBrowserEditorInput implements IEditorInput {
	private final static String FACTORY_ID = "org.eclipse.welcome.internal.webbrowser.WebBrowserEditorInputFactory"; //$NON-NLS-1$
	private String url;
	private String name;
	/**
	 * WelcomeEditorInput constructor comment.
	 */
	public WebBrowserEditorInput(String name, String url) {
		this.name = name;
		this.url = url;
	}
	public boolean exists() {
		return false;
	}
	public Object getAdapter(Class adapter) {
		return null;
	}
	public ImageDescriptor getImageDescriptor() {
		return null;
	}
	public String getName() {
		return name;
	}
	public String getURL() {
		return url;
	}
	public boolean equals(Object obj) {
		if (obj==null) return false;
		if (obj == this) return true;
		if (obj instanceof WebBrowserEditorInput) {
			WebBrowserEditorInput wobj = (WebBrowserEditorInput)obj;
			return wobj.getURL().equals(getURL());
		}
		return false;
	}
	public IPersistableElement getPersistable() {
		return new IPersistableElement() {
			public String getFactoryId() {
				return FACTORY_ID;
			}
			public void saveState(IMemento memento) {
				memento.putString("name", name);
				memento.putString("url", url);
			}
		};
	}
	public String getToolTipText() {
		return name;
	}
}
... this post is sponsored by my books ...

#1 New Release!

FP Best Seller

 

new blog posts

 

Copyright 1998-2021 Alvin Alexander, alvinalexander.com
All Rights Reserved.

A percentage of advertising revenue from
pages under the /java/jwarehouse URI on this website is
paid back to open source projects.