/******************************************************************************* * FreeQDA, a software for professional qualitative research data * analysis, such as interviews, manuscripts, journal articles, memos * and field notes. * * Copyright (C) 2011 Dirk Kitscha, Jörg große Schlarmann * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. *******************************************************************************/ package net.sf.freeqda.editor.stylededitor; import net.sf.freeqda.common.projectmanager.TextNode; import org.eclipse.jface.resource.ImageDescriptor; import org.eclipse.ui.IEditorInput; import org.eclipse.ui.IPersistableElement; public class FQDADocumentEditorInput implements IEditorInput { private TextNode textNode; public FQDADocumentEditorInput(TextNode textNode) { this.textNode = textNode; } @Override public boolean exists() { return false; } @Override public ImageDescriptor getImageDescriptor() { return null; } @Override public String getName() { return textNode.getName(); } @Override public IPersistableElement getPersistable() { return null; } @Override public String getToolTipText() { return textNode.getName(); } @SuppressWarnings("rawtypes") @Override public Object getAdapter(Class adapter) { return null; } public TextNode getTextNode() { return textNode; } @Override public boolean equals(Object obj) { if (super.equals(obj)) { return true; } if (obj instanceof FQDADocumentEditorInput) { return textNode.equals(((FQDADocumentEditorInput) obj).getTextNode()); } return false; } @Override public int hashCode() { return textNode.hashCode(); } }