/** * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * * See the NOTICE file distributed with this work for additional * information regarding copyright ownership. */ package org.sintef.thingml.resource.thingml.ui; /** * Provides input for the <code>TextHover</code>. The most is copied from * <code>org.eclipse.jdt.internal.ui.text.java.hover.JavadocBrowserInformationContr * olInput</code>. */ public class ThingmlDocBrowserInformationControlInput { private final ThingmlDocBrowserInformationControlInput fPrevious; private ThingmlDocBrowserInformationControlInput fNext; private final org.eclipse.emf.ecore.EObject element; private final String htmlContent; private final String tokenText; private final org.eclipse.emf.ecore.resource.Resource resource; /** * Creates a new browser information control input. * * @param previous previous input, or <code>null</code> if none available * @param element the element, or <code>null</code> if none available * @param htmlContent HTML contents, must not be null */ public ThingmlDocBrowserInformationControlInput(ThingmlDocBrowserInformationControlInput previous, org.eclipse.emf.ecore.EObject element, org.eclipse.emf.ecore.resource.Resource resource, String htmlContent, String tokenText) { fPrevious= previous; if (previous != null) { previous.fNext= this; } assert htmlContent != null; this.element = element; this.htmlContent = htmlContent; this.tokenText = tokenText; this.resource = resource; } /** * Returns the previous input or <code>null</code> if this is the first. * * @return the previous input or <code>null</code> */ public ThingmlDocBrowserInformationControlInput getPrevious() { return fPrevious; } /** * Returns the next input or <code>null</code> if this is the last. * * @return the next input or <code>null</code> */ public ThingmlDocBrowserInformationControlInput getNext() { return fNext; } /** * * @return the resource */ public org.eclipse.emf.ecore.resource.Resource getResource() { return resource; } public String getHtml() { return htmlContent; } public String toString() { return getHtml(); } /** * * @return the token text, it is needed for a hyperlink where the caret has to * jump to */ public String getTokenText() { return tokenText; } public Object getInputElement() { return element == null ? (Object) htmlContent : element; } public String getInputName() { return element == null ? "" : element.toString(); } public int getLeadingImageWidth() { return 0; } }