Implemented a simple occurrences finder for Variables ($...) and Identifiers;
[phpeclipse.git] / net.sourceforge.phpeclipse / src / net / sourceforge / phpdt / internal / ui / text / java / hover / AbstractJavaEditorTextHover.java
index 1103c43..ce9fe79 100644 (file)
@@ -1,10 +1,10 @@
 /*******************************************************************************
  * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials 
+ * 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
  *******************************************************************************/
@@ -17,7 +17,6 @@ import net.sourceforge.phpdt.core.IJavaElement;
 import net.sourceforge.phpdt.internal.ui.text.HTMLTextPresenter;
 import net.sourceforge.phpdt.internal.ui.text.JavaWordFinder;
 import net.sourceforge.phpdt.ui.PreferenceConstants;
-import net.sourceforge.phpdt.ui.actions.PHPEditorActionDefinitionIds;
 import net.sourceforge.phpdt.ui.text.java.hover.IJavaEditorTextHover;
 import net.sourceforge.phpeclipse.PHPeclipsePlugin;
 
@@ -37,7 +36,7 @@ import org.eclipse.ui.keys.KeySequence;
 
 /**
  * Abstract class for providing hover information for Java elements.
- * 
+ *
  * @since 2.1
  */
 public abstract class AbstractJavaEditorTextHover implements IJavaEditorTextHover {
@@ -47,8 +46,8 @@ public abstract class AbstractJavaEditorTextHover implements IJavaEditorTextHove
        private ICommand fCommand;
        {
                ICommandManager commandManager= PlatformUI.getWorkbench().getCommandSupport().getCommandManager();
-               fCommand= commandManager.getCommand(PHPEditorActionDefinitionIds.SHOW_JAVADOC);
-               if (!fCommand.isDefined())
+//             fCommand= commandManager.getCommand(PHPEditorActionDefinitionIds.SHOW_JAVADOC);
+//             if (!fCommand.isDefined())
                        fCommand= null;
        }
 
@@ -70,44 +69,44 @@ public abstract class AbstractJavaEditorTextHover implements IJavaEditorTextHove
 //                             IClassFileEditorInput cfeInput= (IClassFileEditorInput) input;
 //                             return cfeInput.getClassFile();
 //                     }
-//                     
-//                     IWorkingCopyManager manager= PHPeclipsePlugin.getDefault().getWorkingCopyManager();                             
+//
+//                     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;    
+//
+//                             int nResults= result.length;
 //                             if (nResults == 0)
 //                                     return null;
-//                             
+//
 //                             return getHoverInfo(result);
-//                             
+//
 //                     } catch (JavaModelException x) {
 //                             PHPeclipsePlugin.log(x.getStatus());
 //                     }
@@ -117,7 +116,7 @@ public abstract class AbstractJavaEditorTextHover implements IJavaEditorTextHove
 
        /**
         * Provides hover information for the given Java elements.
-        * 
+        *
         * @return the hover information string
         * @since 2.1
         */
@@ -135,21 +134,21 @@ public abstract class AbstractJavaEditorTextHover implements IJavaEditorTextHove
                        }
                };
        }
-       
+
        /**
         * Returns the tool tip affordance string.
-        * 
+        *
         * @return the affordance string or <code>null</code> 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))
                        return null;
-               
+
                KeySequence[] sequences= getKeySequences();
                if (sequences == null)
                        return null;
-               
+
                String keySequence= sequences[0].format();
                return JavaHoverMessages.getFormattedString("JavaTextHover.makeStickyHint", keySequence); //$NON-NLS-1$
        }
@@ -157,9 +156,9 @@ public abstract class AbstractJavaEditorTextHover implements IJavaEditorTextHove
        /**
         * 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() {
@@ -171,7 +170,7 @@ public abstract class AbstractJavaEditorTextHover implements IJavaEditorTextHove
                                        keySequences[i]= ((IKeySequenceBinding) list.get(i)).getKeySequence();
                                }
                                return keySequences;
-                       }               
+                       }
                }
                return null;
        }