blob: f9168360144389d579856e95f0e250bfd6d762d5 [file] [log] [blame]
/*=============================================================================#
# Copyright (c) 2012, 2021 Stephan Wahlbrink and others.
#
# This program and the accompanying materials are made available under the
# terms of the Eclipse Public License 2.0 which is available at
# https://www.eclipse.org/legal/epl-2.0, or the Apache License, Version 2.0
# which is available at https://www.apache.org/licenses/LICENSE-2.0.
#
# SPDX-License-Identifier: EPL-2.0 OR Apache-2.0
#
# Contributors:
# Stephan Wahlbrink <sw@wahlbrink.eu> - initial API and implementation
#=============================================================================*/
package org.eclipse.statet.internal.rtm.base.ui.editors;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.ui.IPersistableElement;
import org.eclipse.statet.ltk.core.input.SourceFragment;
import org.eclipse.statet.ltk.ui.sourceediting.ISourceFragmentEditorInput;
import org.eclipse.statet.r.ui.RUI;
public class RCodeGenEditorInput implements ISourceFragmentEditorInput {
private final SourceFragment fragment;
public RCodeGenEditorInput(final SourceFragment fragment) {
if (fragment == null) {
throw new NullPointerException("fragment"); //$NON-NLS-1$
}
this.fragment= fragment;
}
@Override
public SourceFragment getSourceFragment() {
return this.fragment;
}
@Override
public ImageDescriptor getImageDescriptor() {
return RUI.getImageDescriptor(RUI.IMG_OBJ_R_SCRIPT);
}
@Override
public String getName() {
return this.fragment.getName();
}
@Override
public boolean exists() {
return false;
}
@Override
public String getToolTipText() {
return this.fragment.getFullName();
}
@Override
public IPersistableElement getPersistable() {
return null;
}
@Override
public <T> T getAdapter(final Class<T> adapterType) {
return null;
}
@Override
public int hashCode() {
return this.fragment.hashCode();
}
@Override
public boolean equals(final Object obj) {
if (this == obj) {
return true;
}
if (!(obj instanceof RCodeGenEditorInput)) {
return false;
}
final RCodeGenEditorInput other= (RCodeGenEditorInput) obj;
return this.fragment.equals(other.fragment);
}
@Override
public String toString() {
return this.fragment.getFullName();
}
}