blob: 626eb4231c22cf63ad2a85f7fe075ae40312c198 [file] [log] [blame]
/*******************************************************************************
* Copyright (c) 2007, 2016 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
* which accompanies this distribution, and is available at
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* IBM Corporation - initial API and implementation
******************************************************************************/
package org.eclipse.ui.examples.contributions.model;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.ui.IEditorInput;
import org.eclipse.ui.IPersistableElement;
/**
* The editor input for looking up a person.
*
* @since 3.3
*/
public class PersonInput implements IEditorInput {
private int index;
public PersonInput(int i) {
index = i;
}
public int getIndex() {
return index;
}
@Override
public boolean exists() {
return true;
}
@Override
public ImageDescriptor getImageDescriptor() {
return null;
}
@Override
public String getName() {
return "" + index; //$NON-NLS-1$
}
@Override
public IPersistableElement getPersistable() {
return null;
}
@Override
public String getToolTipText() {
return getName();
}
@Override
public <T> T getAdapter(Class<T> adapter) {
return null;
}
@Override
public int hashCode() {
return index;
}
@Override
public boolean equals(Object o) {
if (o instanceof PersonInput) {
return index == ((PersonInput)o).index;
}
return false;
}
}