X-Git-Url: http://secure.phpeclipse.com diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/text/java/hover/AbstractJavaEditorTextHover.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/text/java/hover/AbstractJavaEditorTextHover.java index ce9fe79..1fc50ad 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/text/java/hover/AbstractJavaEditorTextHover.java +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/text/java/hover/AbstractJavaEditorTextHover.java @@ -36,46 +36,50 @@ import org.eclipse.ui.keys.KeySequence; /** * Abstract class for providing hover information for Java elements. - * + * * @since 2.1 */ -public abstract class AbstractJavaEditorTextHover implements IJavaEditorTextHover { - +public abstract class AbstractJavaEditorTextHover implements + IJavaEditorTextHover { private IEditorPart fEditor; + private ICommand fCommand; { - ICommandManager commandManager= PlatformUI.getWorkbench().getCommandSupport().getCommandManager(); -// fCommand= commandManager.getCommand(PHPEditorActionDefinitionIds.SHOW_JAVADOC); -// if (!fCommand.isDefined()) - fCommand= null; + ICommandManager commandManager = PlatformUI.getWorkbench() + .getCommandSupport().getCommandManager(); + // fCommand= + // commandManager.getCommand(PHPEditorActionDefinitionIds.SHOW_JAVADOC); + // if (!fCommand.isDefined()) + fCommand = null; } /* * @see IJavaEditorTextHover#setEditor(IEditorPart) */ public void setEditor(IEditorPart editor) { - fEditor= 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; -// } + // 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) @@ -89,40 +93,42 @@ public abstract class AbstractJavaEditorTextHover implements IJavaEditorTextHove */ 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()); -// } -// } + // 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; } + /* * @see ITextHoverExtension#getHoverControlCreator() * @since 3.0 @@ -130,44 +136,50 @@ public abstract class AbstractJavaEditorTextHover implements IJavaEditorTextHove public IInformationControlCreator getHoverControlCreator() { return new IInformationControlCreator() { public IInformationControl createInformationControl(Shell parent) { - return new DefaultInformationControl(parent, SWT.NONE, new HTMLTextPresenter(true), getTooltipAffordanceString()); + return new DefaultInformationControl(parent, SWT.NONE, + new HTMLTextPresenter(true), + getTooltipAffordanceString()); } }; } /** * Returns the tool tip affordance string. - * - * @return the affordance string or null if disabled or no key binding is defined + * + * @return the affordance string or null if disabled or no + * key binding is defined * @since 3.0 */ protected String getTooltipAffordanceString() { - if (!PHPeclipsePlugin.getDefault().getPreferenceStore().getBoolean(PreferenceConstants.EDITOR_SHOW_TEXT_HOVER_AFFORDANCE)) + if (!PHPeclipsePlugin.getDefault().getPreferenceStore().getBoolean( + PreferenceConstants.EDITOR_SHOW_TEXT_HOVER_AFFORDANCE)) return null; - KeySequence[] sequences= getKeySequences(); + KeySequence[] sequences = getKeySequences(); if (sequences == null) return null; - String keySequence= sequences[0].format(); - return JavaHoverMessages.getFormattedString("JavaTextHover.makeStickyHint", keySequence); //$NON-NLS-1$ + String keySequence = sequences[0].format(); + return JavaHoverMessages.getFormattedString( + "JavaTextHover.makeStickyHint", keySequence); //$NON-NLS-1$ } /** - * Returns the array of valid key sequence bindings for the - * show tool tip description command. - * + * Returns the array of valid key sequence bindings for the show tool tip + * description command. + * * @return the array with the {@link KeySequence}s - * + * * @since 3.0 */ private KeySequence[] getKeySequences() { if (fCommand != null) { - List list= fCommand.getKeySequenceBindings(); + List list = fCommand.getKeySequenceBindings(); if (!list.isEmpty()) { - KeySequence[] keySequences= new KeySequence[list.size()]; - for (int i= 0; i < keySequences.length; i++) { - keySequences[i]= ((IKeySequenceBinding) list.get(i)).getKeySequence(); + KeySequence[] keySequences = new KeySequence[list.size()]; + for (int i = 0; i < keySequences.length; i++) { + keySequences[i] = ((IKeySequenceBinding) list.get(i)) + .getKeySequence(); } return keySequences; }