/******************************************************************************* * 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 net.sourceforge.phpdt.internal.ui.text.java.hover; import net.sourceforge.phpdt.core.IJavaElement; import net.sourceforge.phpdt.internal.ui.text.JavaWordFinder; import net.sourceforge.phpdt.ui.text.java.hover.IJavaEditorTextHover; import org.eclipse.jface.text.IRegion; import org.eclipse.jface.text.ITextViewer; import org.eclipse.ui.IEditorPart; /** * Abstract class for providing hover information for Java elements. * * @since 2.1 */ public abstract class AbstractJavaEditorTextHover implements IJavaEditorTextHover { private IEditorPart fEditor; /* * @see IJavaEditorTextHover#setEditor(IEditorPart) */ public void setEditor(IEditorPart editor) { fEditor= editor; } protected IEditorPart getEditor() { return fEditor; } // protected ICodeAssist getCodeAssist() { // if (fEditor != null) { // IEditorInput input= fEditor.getEditorInput(); // if (input instanceof IClassFileEditorInput) { // IClassFileEditorInput cfeInput= (IClassFileEditorInput) input; // return cfeInput.getClassFile(); // } // // IWorkingCopyManager manager= PHPeclipsePlugin.getDefault().getWorkingCopyManager(); // return manager.getWorkingCopy(input); // } // // return null; // } /* * @see ITextHover#getHoverRegion(ITextViewer, int) */ public IRegion getHoverRegion(ITextViewer textViewer, int offset) { return JavaWordFinder.findWord(textViewer.getDocument(), offset); } /* * @see ITextHover#getHoverInfo(ITextViewer, IRegion) */ public String getHoverInfo(ITextViewer textViewer, IRegion hoverRegion) { // ICodeAssist resolve= getCodeAssist(); // if (resolve != null) { // try { // IJavaElement[] result= null; // // synchronized (resolve) { // result= resolve.codeSelect(hoverRegion.getOffset(), hoverRegion.getLength()); // } // // if (result == null) // return null; // // int nResults= result.length; // if (nResults == 0) // return null; // // return getHoverInfo(result); // // } catch (JavaModelException x) { // PHPeclipsePlugin.log(x.getStatus()); // } // } return null; } /** * Provides hover information for the given Java elements. * * @return the hover information string * @since 2.1 */ protected String getHoverInfo(IJavaElement[] javaElements) { return null; } }