[Title] native api hover refactoring.
authorTaeyoung Son <taeyoung2.son@samsung.com>
Mon, 4 Feb 2013 01:46:33 +0000 (10:46 +0900)
committerTaeyoung Son <taeyoung2.son@samsung.com>
Tue, 5 Feb 2013 06:43:24 +0000 (15:43 +0900)
[Desc.]

Change-Id: Ief57f45b49ed28528a3bc8be11f0064b86279d77

org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/c/hover/CDocHover.java

index 17d2415..1b2ca19 100644 (file)
@@ -13,6 +13,7 @@ package org.eclipse.cdt.internal.ui.text.c.hover;
 
 import java.io.BufferedReader;
 import java.io.File;
+import java.io.FileNotFoundException;
 import java.io.FileReader;
 import java.io.IOException;
 import java.util.Set;
@@ -22,6 +23,14 @@ import org.eclipse.cdt.core.dom.ast.DOMException;
 import org.eclipse.cdt.core.dom.ast.IASTName;
 import org.eclipse.cdt.core.dom.ast.IASTTranslationUnit;
 import org.eclipse.cdt.core.dom.ast.IBinding;
+import org.eclipse.cdt.core.dom.ast.IEnumeration;
+import org.eclipse.cdt.core.dom.ast.IFunction;
+import org.eclipse.cdt.core.dom.ast.IParameter;
+import org.eclipse.cdt.core.dom.ast.ITypedef;
+import org.eclipse.cdt.core.dom.ast.cpp.ICPPClassType;
+import org.eclipse.cdt.core.dom.ast.cpp.ICPPFunction;
+import org.eclipse.cdt.core.dom.ast.cpp.ICPPMethod;
+import org.eclipse.cdt.core.dom.ast.cpp.ICPPNamespace;
 import org.eclipse.cdt.core.model.CModelException;
 import org.eclipse.cdt.core.model.ILanguage;
 import org.eclipse.cdt.core.model.ITranslationUnit;
@@ -80,6 +89,7 @@ import org.eclipse.ui.editors.text.EditorsUI;
  */
 public class CDocHover extends AbstractCEditorTextHover {
     private static String TIZEN_API_ROOT_NAMESPACE = "Tizen";
+    private static String TIZEN_API_NAMSPACE_DELIMITER = "::";
        private static String doxygenDirectoryPath;
 
        /**
@@ -678,39 +688,151 @@ public class CDocHover extends AbstractCEditorTextHover {
                        return htmlFileName;
                }
 
+        private IBinding getBinding(IASTTranslationUnit ast) {
+            if (ast == null) {
+                return null;
+            }
+
+            IASTName name = ast.getNodeSelector(null).findEnclosingName(
+                    fTextRegion.getOffset(), fTextRegion.getLength());
+            if (name == null) {
+                return null;
+            }
+
+            IBinding binding = name.resolveBinding();
+            return binding;
+        }
+
+        /**
+         * This method return full name
+         * @param binding
+         * @return It returns name including namespace of parents and class(when binding is method).
+         *         If binding is namespace, it returns namespace including namespace of parents.
+         *              (ex. Tizen::App::UiApp)
+         *         If binding is class, it returns class including namespace of parents.
+         *              (ex. Tizen::App::UiApp::Execute)
+         */
+        private String getFullName(IBinding binding) {
+            String owner = "";
+            
+            if (binding.getOwner() != null) {
+                owner = tokenizeString(binding.getOwner().toString())[0]
+                        + TIZEN_API_NAMSPACE_DELIMITER + binding.getName();
+            } else {
+                owner = binding.getName();
+            }
+            return owner;
+        }
+
+        private String getHoverLinkInternal(ICPPClassType binding) {
+            // String indexingFile = doxygenDirectoryPath+"annotated.html";
+            // return getHoverLink(indexingFile, hoverText);
+            
+            String hoverText = getFullName(binding);
+            return "class"
+            + hoverText
+                    .replaceAll(TIZEN_API_NAMSPACE_DELIMITER, "_1_1")
+            + ".html";
+        }
+
+        private String getHoverLinkInternal(ICPPNamespace binding) {
+            // String indexingFile = doxygenDirectoryPath+"namespaces.html";
+            // return getHoverLink(indexingFile, hoverText);
+
+            String hoverText = getFullName(binding);
+            
+            return "namespace"
+                    + hoverText
+                            .replaceAll(TIZEN_API_NAMSPACE_DELIMITER, "_1_1")
+                    + ".html";
+        }
+
+        private String getHoverLink(IBinding binding) throws FileNotFoundException, IOException, DOMException {
+            if (binding == null) {
+                return null;
+            }
+
+            String referenceLink = null;
+
+            if (binding instanceof IFunction) { //method, function
+                //TODO: implement
+            } else if (binding instanceof IParameter) { //parameter
+                //TODO: implement
+            } else if (binding instanceof ITypedef) { //typedef
+                //TODO: implement
+            } else if (binding instanceof IEnumeration) {
+                //TODO: implement
+            } else if (binding instanceof ICPPNamespace) {
+                referenceLink = getHoverLinkInternal((ICPPNamespace) binding);
+            } else if (binding instanceof ICPPClassType) {
+                referenceLink = getHoverLinkInternal((ICPPClassType) binding);
+            } 
+            return referenceLink;
+               }
+
+        protected String getHoverLink(IASTTranslationUnit ast) throws FileNotFoundException, IOException, DOMException {
+            if ( ast == null ) {
+                return null;
+            }
+            IASTName name = ast.getNodeSelector(null).findEnclosingName(
+                    fTextRegion.getOffset(), fTextRegion.getLength());  //ASTPreprocessorName(header file) || ASTMacroReferenceName(typedef) || CPPASTName(method, parameter,,,) || ASTPreprocessorDefinition(define)
+            if (name == null) {
+                return null;
+            }
+
+            return getHoverLink(name.resolveBinding());
+        }
+               
                /*
                 * @see org.eclipse.cdt.internal.core.model.ASTCache.ASTRunnable#runOnAST(org.eclipse.cdt.core.dom.ast.IASTTranslationUnit)
                 */
                public IStatus runOnAST(ILanguage lang, IASTTranslationUnit ast) {
-                       if (ast != null) {
-                               try {
-                                       IASTName name= ast.getNodeSelector(null).findEnclosingName(fTextRegion.getOffset(), fTextRegion.getLength());
-                                       if (name != null) {
-                                               IBinding binding= name.resolveBinding();
-
-                                               if (binding != null) {
-                                                       String htmlFileName = null;
-                                                       boolean isExist = false;
-
-                                                       if (binding.getOwner() == null) {
-                                                               String stringOfBinding[] = tokenizeString(binding.toString());
-                                                               if (stringOfBinding.length == 2) { /* Case 1-1. using root namespace in source file */
-                                                                       if (stringOfBinding[0].equals(TIZEN_API_ROOT_NAMESPACE) && stringOfBinding[1].equals("CPPNAMESPACE")) {
-                                                                               htmlFileName = "namespaceTizen.html";
-                                                                               isExist = checkHTMLFileExistence(htmlFileName);
-                                                                       }
-                                                               } else if (stringOfBinding.length == 1) {  /* Case 1-2. declaration root namespace in header or source file */
-                                                                       if (stringOfBinding[0].equals(TIZEN_API_ROOT_NAMESPACE)) {
-                                                                               htmlFileName = "namespaceTizen.html";
-                                                                               isExist = checkHTMLFileExistence(htmlFileName);
+                       try {
+                               String htmlFileName = null;
+                               boolean isExist = false;
+
+                               htmlFileName = getHoverLink(ast);
+                               if ( (htmlFileName != null) && checkHTMLFileExistence(htmlFileName) ) {
+                                       fSource = htmlFileName;
+                                       return Status.OK_STATUS;
+                               }
+
+                               IBinding binding = getBinding(ast); //must remove.
+                               if (binding==null) {
+                                   return Status.CANCEL_STATUS;
+                               }
+
+                               if (binding.getOwner() != null) {
+                                       String stringOfOwner[] = tokenizeString(binding.getOwner().toString());
+                                       if (stringOfOwner.length == 3) {
+                                               if (stringOfOwner[2].equals("CPPENUMERATION")) {
+                                                       String stringOfBinding[] = tokenizeString(binding.toString());
+                                                       if (stringOfBinding[1].equals("CPPENUMERATOR")) { /* Case 2-0. enumerator in source file */
+                                                               char firstChar = stringOfBinding[0].charAt(0);
+                                                               if (firstChar == 'A') {
+                                                                       htmlFileName = "namespacemembers_eval.html";
+                                                               } else {
+                                                                       for (int i = 66; i < 91; i++) {
+                                                                               if ((int)firstChar == i) {
+                                                                                       htmlFileName = "namespacemembers_eval_0x" + Integer.toHexString(i + 32) + ".html";
+                                                                               }
                                                                        }
                                                                }
-                                                       } else if (binding.getOwner() != null) {
-                                                               String stringOfOwner[] = tokenizeString(binding.getOwner().toString());
-                                                               if (stringOfOwner.length == 3) {
-                                                                       if (stringOfOwner[2].equals("CPPENUMERATION")) {
-                                                                               String stringOfBinding[] = tokenizeString(binding.toString());
-                                                                               if (stringOfBinding[1].equals("CPPENUMERATOR")) { /* Case 2-0. enumerator in source file */
+
+                                                               String htmlFileName2 = null;
+                                                               if ( (htmlFileName2 = searchEnumerator(htmlFileName, binding, methodInSource)) != null) {
+                                                                       isExist = true;
+                                                                       htmlFileName = htmlFileName2;
+                                                               }
+                                                       }
+                                               }
+                                       } else if (stringOfOwner.length == 2) {
+                                               if (stringOfOwner[1].equals("CPPNAMESPACE")) {
+                                                       String stringOfBinding[] = tokenizeString(binding.toString());
+                                                       if (stringOfBinding[1].equals("CPP_CLASS_TEMPLATE")) { /* Case 2-1-3. class template in source file */
+                                                               htmlFileName = "class" + stringOfBinding[0].replaceAll("::", "_1_1") + ".html";
+                                                               isExist = checkHTMLFileExistence(htmlFileName); /* check HTML file existence */
+                                                       } /*else if (stringOfBinding[1].equals("CPPENUMERATOR")) { Case 2-1-4. enumerator in source file
                                                                                        char firstChar = stringOfBinding[0].charAt(0);
                                                                                        if (firstChar == 'A') {
                                                                                                htmlFileName = "namespacemembers_eval.html";
@@ -727,265 +849,226 @@ public class CDocHover extends AbstractCEditorTextHover {
                                                                                                isExist = true;
                                                                                                htmlFileName = htmlFileName2;
                                                                                        }
+                                                       }*/ else if (stringOfBinding.length == 3 && stringOfBinding[2].equals("CPPENUMERATION")) { /* Case 2-1-5. enumeration used as parameter variable in header file */
+                                                               char firstChar = stringOfBinding[1].charAt(0);
+                                                               if (firstChar == 'A') {
+                                                                       htmlFileName = "namespacemembers_enum.html";
+                                                               } else {
+                                                                       for (int i = 66; i < 91; i++) {
+                                                                               if ((int)firstChar == i) {
+                                                                                       htmlFileName = "namespacemembers_enum_0x" + Integer.toHexString(i + 32) + ".html";
                                                                                }
                                                                        }
-                                                               } else if (stringOfOwner.length == 2) {
-                                                                       if (stringOfOwner[1].equals("CPPNAMESPACE")) {
-                                                                               String stringOfBinding[] = tokenizeString(binding.toString());
-                                                                               if (stringOfBinding[1].equals("CPPNAMESPACE")) { /* Case 2-1-1. using namespace in source file */
-                                                                                       htmlFileName = "namespace" + tokenizeString(binding.toString())[0].replaceAll("::", "_1_1") + ".html";
-                                                                                       isExist = checkHTMLFileExistence(htmlFileName);
-                                                                               } else if (stringOfBinding[1].equals("CPPCLASSTYPE")) { /* Case 2-1-2. class in source file */
-                                                                                       htmlFileName = "class" + stringOfBinding[0].replaceAll("::", "_1_1") + ".html";
-                                                                                       isExist = checkHTMLFileExistence(htmlFileName); /* check HTML file existence */
-                                                                               } else if (stringOfBinding[1].equals("CPP_CLASS_TEMPLATE")) { /* Case 2-1-3. class template in source file */
-                                                                                       htmlFileName = "class" + stringOfBinding[0].replaceAll("::", "_1_1") + ".html";
-                                                                                       isExist = checkHTMLFileExistence(htmlFileName); /* check HTML file existence */
-                                                                               } /*else if (stringOfBinding[1].equals("CPPENUMERATOR")) { Case 2-1-4. enumerator in source file
-                                                                                       char firstChar = stringOfBinding[0].charAt(0);
-                                                                                       if (firstChar == 'A') {
-                                                                                               htmlFileName = "namespacemembers_eval.html";
-                                                                                       } else {
-                                                                                               for (int i = 66; i < 91; i++) {
-                                                                                                       if ((int)firstChar == i) {
-                                                                                                               htmlFileName = "namespacemembers_eval_0x" + Integer.toHexString(i + 32) + ".html";
-                                                                                                       }
-                                                                                               }
-                                                                                       }
-
-                                                                                       String htmlFileName2 = null;
-                                                                                       if ( (htmlFileName2 = searchEnumerator(htmlFileName, binding, methodInSource)) != null) {
-                                                                                               isExist = true;
-                                                                                               htmlFileName = htmlFileName2;
-                                                                                       }
-                                                                               }*/ else if (stringOfBinding.length == 3 && stringOfBinding[2].equals("CPPENUMERATION")) { /* Case 2-1-5. enumeration used as parameter variable in header file */
-                                                                                       char firstChar = stringOfBinding[1].charAt(0);
-                                                                                       if (firstChar == 'A') {
-                                                                                               htmlFileName = "namespacemembers_enum.html";
-                                                                                       } else {
-                                                                                               for (int i = 66; i < 91; i++) {
-                                                                                                       if ((int)firstChar == i) {
-                                                                                                               htmlFileName = "namespacemembers_enum_0x" + Integer.toHexString(i + 32) + ".html";
-                                                                                                       }
-                                                                                               }
-                                                                                       }
-
-                                                                                       String htmlFileName2 = null;
-                                                                                       if ( (htmlFileName2 = searchEnumeration(htmlFileName, binding)) != null) {
-                                                                                               isExist = true;
-                                                                                               htmlFileName = htmlFileName2;
-                                                                                       }
-                                                                               } else if (binding.toString().contains("CPPTYPEDEF") && binding.toString().contains("enum")) { /* Case 2-1-6. typedef enumeration used as parameter variable in header file */
-                                                                                       char firstChar = stringOfBinding[0].charAt(0);
-                                                                                       if (firstChar == 'A') {
-                                                                                               htmlFileName = "namespacemembers_enum.html";
-                                                                                       } else {
-                                                                                               for (int i = 66; i < 91; i++) {
-                                                                                                       if ((int)firstChar == i) {
-                                                                                                               htmlFileName = "namespacemembers_enum_0x" + Integer.toHexString(i + 32) + ".html";
-                                                                                                       }
-                                                                                               }
-                                                                                       }
+                                                               }
 
-                                                                                       String htmlFileName2 = null;
-                                                                                       if ( (htmlFileName2 = searchEnumeration(htmlFileName, binding)) != null) {
-                                                                                               isExist = true;
-                                                                                               htmlFileName = htmlFileName2;
-                                                                                       }
-                                                                               }
-                                                                       } else if (stringOfOwner[1].equals("CPPCLASSTYPE")) { /* Case 2-2. constructor or member method in source file */
-                                                                               String tokenOfStringOfOwner[] = tokenizeStringWithDelimiter(stringOfOwner[0], "::");
-                                                                               if ( checkIsInterface(tokenOfStringOfOwner) == false ) { /* Case 2-2-1. constructor or member method of class in source file */
-                                                                                       htmlFileName = "class" + stringOfOwner[0].replaceAll("::", "_1_1") + "-members.html";
-
-                                                                                       isExist = checkHTMLFileExistence(htmlFileName); /* check HTML file existence */
-
-                                                                                       if (isExist == true) {
-                                                                                               BufferedReader reader = new BufferedReader(new FileReader(doxygenDirectoryPath + "/" + htmlFileName));
-                                                                                               String tempString = null;
-                                                                                               String htmlFileName2 = null;
-                                                                                               while ( (tempString = reader.readLine()) != null) {
-                                                                                                       if ( (htmlFileName2 = searchMethodLocationOfClass(tempString, binding, methodInSource, true)) != null) {
-                                                                                                               break;
-                                                                                                       }
-                                                                                               }
-                                                                                               reader.close();
-                                                                                               htmlFileName = htmlFileName2;
-                                                                                       }
-                                                                               } else if ( checkIsInterface(tokenOfStringOfOwner) == true ) { /* Case 2-2-2. constructor or member method of interface in source file */
-                                                                                       htmlFileName = "interface" + stringOfOwner[0].replaceAll("::", "_1_1") + "-members.html";
-
-                                                                                       isExist = checkHTMLFileExistence(htmlFileName); /* check HTML file existence */
-
-                                                                                       if (isExist == true) {
-                                                                                               BufferedReader reader = new BufferedReader(new FileReader(doxygenDirectoryPath + "/" + htmlFileName));
-                                                                                               String tempString = null;
-                                                                                               String htmlFileName2 = null;
-                                                                                               while ( (tempString = reader.readLine()) != null) {
-                                                                                                       if ( (htmlFileName2 = searchMethodLocationOfClass(tempString, binding, methodInSource, false)) != null) {
-                                                                                                               break;
-                                                                                                       }
-                                                                                               }
-                                                                                               reader.close();
-                                                                                               htmlFileName = htmlFileName2;
-                                                                                       }
-                                                                               }
-                                                                       } else if (stringOfOwner[1].equals("CPP_CLASS_INSTANCE")) { /* Case 2-3. member method with <type> in source file */
-                                                                               String tokenOfStringOfOwner[] = tokenizeStringWithDelimiter(stringOfOwner[0], "::");
-                                                                               if ( checkIsInterface(tokenOfStringOfOwner) == false ) { /* Case 2-3-1. member method with <type> of class in source file */
-                                                                                       String owner = stringOfOwner[0].substring(0, stringOfOwner[0].indexOf("<"));
-                                                                                       htmlFileName = "class" + owner.replaceAll("::", "_1_1") + "-members.html";
-
-                                                                                       isExist = checkHTMLFileExistence(htmlFileName); /* check HTML file existence */
-
-                                                                                       if (isExist == true) {
-                                                                                               BufferedReader reader = new BufferedReader(new FileReader(doxygenDirectoryPath + "/" + htmlFileName));
-                                                                                               String tempString = null;
-                                                                                               String htmlFileName2 = null;
-                                                                                               while ( (tempString = reader.readLine()) != null) {
-                                                                                                       if ( (htmlFileName2 = searchMethodLocationOfClass(tempString, binding, methodInSource, true)) != null) {
-                                                                                                               break;
-                                                                                                       }
-                                                                                               }
-                                                                                               reader.close();
-                                                                                               htmlFileName = htmlFileName2;
-                                                                                       }
-                                                                               } else if ( checkIsInterface(tokenOfStringOfOwner) == true ) { /* Case 2-3-2. member method with <type> of interface in source file */
-                                                                                       String owner = stringOfOwner[0].substring(0, stringOfOwner[0].indexOf("<"));
-                                                                                       htmlFileName = "interface" + owner.replaceAll("::", "_1_1") + "-members.html";
-
-                                                                                       isExist = checkHTMLFileExistence(htmlFileName); /* check HTML file existence */
-
-                                                                                       if (isExist == true) {
-                                                                                               BufferedReader reader = new BufferedReader(new FileReader(doxygenDirectoryPath + "/" + htmlFileName));
-                                                                                               String tempString = null;
-                                                                                               String htmlFileName2 = null;
-                                                                                               while ( (tempString = reader.readLine()) != null) {
-                                                                                                       if ( (htmlFileName2 = searchMethodLocationOfClass(tempString, binding, methodInSource, false)) != null) {
-                                                                                                               break;
-                                                                                                       }
-                                                                                               }
-                                                                                               reader.close();
-                                                                                               htmlFileName = htmlFileName2;
-                                                                                       }
+                                                               String htmlFileName2 = null;
+                                                               if ( (htmlFileName2 = searchEnumeration(htmlFileName, binding)) != null) {
+                                                                       isExist = true;
+                                                                       htmlFileName = htmlFileName2;
+                                                               }
+                                                       } else if (binding.toString().contains("CPPTYPEDEF") && binding.toString().contains("enum")) { /* Case 2-1-6. typedef enumeration used as parameter variable in header file */
+                                                               char firstChar = stringOfBinding[0].charAt(0);
+                                                               if (firstChar == 'A') {
+                                                                       htmlFileName = "namespacemembers_enum.html";
+                                                               } else {
+                                                                       for (int i = 66; i < 91; i++) {
+                                                                               if ((int)firstChar == i) {
+                                                                                       htmlFileName = "namespacemembers_enum_0x" + Integer.toHexString(i + 32) + ".html";
                                                                                }
-
                                                                        }
-                                                               } else if (stringOfOwner.length == 1) {
-                                                                       String stringOfClass[] = tokenizeStringWithDelimiter(binding.getClass().toString(), ".");
-                                                                       if ( stringOfClass[stringOfClass.length - 1].equals("CPPNamespace") ) { /* Case 3-1-1. declaration namespace in header or source file */
-                                                                               htmlFileName = "namespace" + binding.toString().replaceAll("::", "_1_1") + ".html";
-                                                                               isExist = checkHTMLFileExistence(htmlFileName); /* check HTML file existence */
-                                                                       } else if ( stringOfClass[stringOfClass.length - 1].equals("CPPClassType") ) { /* Case 3-1-2. class in header file */
-                                                                               htmlFileName = "class" + binding.getOwner().toString().replaceAll("::", "_1_1") + "_1_1" + binding.toString() + ".html";
-                                                                               isExist = checkHTMLFileExistence(htmlFileName); /* check HTML file existence */
-                                                                       } /*else if ( stringOfClass[stringOfClass.length - 1].equals("CPPEnumerator") ) {  Case 3-1-3. enumerator in header file 
-                                                                               char firstChar = binding.getName().charAt(0);
-                                                                               if (firstChar == 'A') {
-                                                                                       htmlFileName = "namespacemembers_eval.html";
-                                                                               } else {
-                                                                                       for (int i = 66; i < 91; i++) {
-                                                                                               if ((int)firstChar == i) {
-                                                                                                       htmlFileName = "namespacemembers_eval_0x" + Integer.toHexString(i + 32) + ".html";
-                                                                                               }
-                                                                                       }
-                                                                               }
+                                                               }
 
-                                                                               String htmlFileName2 = null;
-                                                                               if ( (htmlFileName2 = searchEnumerator(htmlFileName, binding, methodInHeader)) != null) {
-                                                                                       isExist = true;
-                                                                                       htmlFileName = htmlFileName2;
-                                                                               }
-                                                                       }*/ else if ( stringOfClass[stringOfClass.length - 1].equals("CPPEnumeration") ) { /* Case 3-1-4. declared enumeration in header file */
-                                                                               char firstChar = binding.getName().charAt(0);
-                                                                               if (firstChar == 'A') {
-                                                                                       htmlFileName = "namespacemembers_enum.html";
-                                                                               } else {
-                                                                                       for (int i = 66; i < 91; i++) {
-                                                                                               if ((int)firstChar == i) {
-                                                                                                       htmlFileName = "namespacemembers_enum_0x" + Integer.toHexString(i + 32) + ".html";
-                                                                                               }
-                                                                                       }
+                                                               String htmlFileName2 = null;
+                                                               if ( (htmlFileName2 = searchEnumeration(htmlFileName, binding)) != null) {
+                                                                       isExist = true;
+                                                                       htmlFileName = htmlFileName2;
+                                                               }
+                                                       }
+                                               } else if (stringOfOwner[1].equals("CPPCLASSTYPE")) { /* Case 2-2. constructor or member method in source file */
+                                                       String tokenOfStringOfOwner[] = tokenizeStringWithDelimiter(stringOfOwner[0], "::");
+                                                       if ( checkIsInterface(tokenOfStringOfOwner) == false ) { /* Case 2-2-1. constructor or member method of class in source file */
+                                                               htmlFileName = "class" + stringOfOwner[0].replaceAll("::", "_1_1") + "-members.html";
+
+                                                               isExist = checkHTMLFileExistence(htmlFileName); /* check HTML file existence */
+
+                                                               if (isExist == true) {
+                                                                       BufferedReader reader = new BufferedReader(new FileReader(doxygenDirectoryPath + "/" + htmlFileName));
+                                                                       String tempString = null;
+                                                                       String htmlFileName2 = null;
+                                                                       while ( (tempString = reader.readLine()) != null) {
+                                                                               if ( (htmlFileName2 = searchMethodLocationOfClass(tempString, binding, methodInSource, true)) != null) {
+                                                                                       break;
                                                                                }
-
-                                                                               String htmlFileName2 = null;
-                                                                               if ( (htmlFileName2 = searchEnumeration(htmlFileName, binding)) != null) {
-                                                                                       isExist = true;
-                                                                                       htmlFileName = htmlFileName2;
+                                                                       }
+                                                                       reader.close();
+                                                                       htmlFileName = htmlFileName2;
+                                                               }
+                                                       } else if ( checkIsInterface(tokenOfStringOfOwner) == true ) { /* Case 2-2-2. constructor or member method of interface in source file */
+                                                               htmlFileName = "interface" + stringOfOwner[0].replaceAll("::", "_1_1") + "-members.html";
+
+                                                               isExist = checkHTMLFileExistence(htmlFileName); /* check HTML file existence */
+
+                                                               if (isExist == true) {
+                                                                       BufferedReader reader = new BufferedReader(new FileReader(doxygenDirectoryPath + "/" + htmlFileName));
+                                                                       String tempString = null;
+                                                                       String htmlFileName2 = null;
+                                                                       while ( (tempString = reader.readLine()) != null) {
+                                                                               if ( (htmlFileName2 = searchMethodLocationOfClass(tempString, binding, methodInSource, false)) != null) {
+                                                                                       break;
                                                                                }
-                                                                       } else if ( stringOfClass[stringOfClass.length - 1].equals("CPPTypedef") ) { /* Case 3-1-5. typedef declared enumeration in header file */
-                                                                               char firstChar = binding.getName().charAt(0);
-                                                                               if (firstChar == 'A') {
-                                                                                       htmlFileName = "namespacemembers_enum.html";
-                                                                               } else {
-                                                                                       for (int i = 66; i < 91; i++) {
-                                                                                               if ((int)firstChar == i) {
-                                                                                                       htmlFileName = "namespacemembers_enum_0x" + Integer.toHexString(i + 32) + ".html";
-                                                                                               }
-                                                                                       }
+                                                                       }
+                                                                       reader.close();
+                                                                       htmlFileName = htmlFileName2;
+                                                               }
+                                                       }
+                                               } else if (stringOfOwner[1].equals("CPP_CLASS_INSTANCE")) { /* Case 2-3. member method with <type> in source file */
+                                                       String tokenOfStringOfOwner[] = tokenizeStringWithDelimiter(stringOfOwner[0], "::");
+                                                       if ( checkIsInterface(tokenOfStringOfOwner) == false ) { /* Case 2-3-1. member method with <type> of class in source file */
+                                                               String owner = stringOfOwner[0].substring(0, stringOfOwner[0].indexOf("<"));
+                                                               htmlFileName = "class" + owner.replaceAll("::", "_1_1") + "-members.html";
+
+                                                               isExist = checkHTMLFileExistence(htmlFileName); /* check HTML file existence */
+
+                                                               if (isExist == true) {
+                                                                       BufferedReader reader = new BufferedReader(new FileReader(doxygenDirectoryPath + "/" + htmlFileName));
+                                                                       String tempString = null;
+                                                                       String htmlFileName2 = null;
+                                                                       while ( (tempString = reader.readLine()) != null) {
+                                                                               if ( (htmlFileName2 = searchMethodLocationOfClass(tempString, binding, methodInSource, true)) != null) {
+                                                                                       break;
                                                                                }
-
-                                                                               String htmlFileName2 = null;
-                                                                               if ( (htmlFileName2 = searchEnumeration(htmlFileName, binding)) != null) {
-                                                                                       isExist = true;
-                                                                                       htmlFileName = htmlFileName2;
+                                                                       }
+                                                                       reader.close();
+                                                                       htmlFileName = htmlFileName2;
+                                                               }
+                                                       } else if ( checkIsInterface(tokenOfStringOfOwner) == true ) { /* Case 2-3-2. member method with <type> of interface in source file */
+                                                               String owner = stringOfOwner[0].substring(0, stringOfOwner[0].indexOf("<"));
+                                                               htmlFileName = "interface" + owner.replaceAll("::", "_1_1") + "-members.html";
+
+                                                               isExist = checkHTMLFileExistence(htmlFileName); /* check HTML file existence */
+
+                                                               if (isExist == true) {
+                                                                       BufferedReader reader = new BufferedReader(new FileReader(doxygenDirectoryPath + "/" + htmlFileName));
+                                                                       String tempString = null;
+                                                                       String htmlFileName2 = null;
+                                                                       while ( (tempString = reader.readLine()) != null) {
+                                                                               if ( (htmlFileName2 = searchMethodLocationOfClass(tempString, binding, methodInSource, false)) != null) {
+                                                                                       break;
                                                                                }
-                                                                       } else if ( stringOfClass[stringOfClass.length - 1].equals("CPPClassType") || stringOfClass[stringOfClass.length - 1].equals("CPPMethod") ) { /* Case 3-1-6. constructor or member method in header file */
-                                                                               htmlFileName = "classes.html";
+                                                                       }
+                                                                       reader.close();
+                                                                       htmlFileName = htmlFileName2;
+                                                               }
+                                                       }
 
-                                                                               isExist = checkHTMLFileExistence(htmlFileName); /* check HTML file existence */
+                                               }
+                                       } else if (stringOfOwner.length == 1) {
+                                               String stringOfClass[] = tokenizeStringWithDelimiter(binding.getClass().toString(), ".");
+                                               /*else if ( stringOfClass[stringOfClass.length - 1].equals("CPPEnumerator") ) {  Case 3-1-3. enumerator in header file 
+                                                       char firstChar = binding.getName().charAt(0);
+                                                       if (firstChar == 'A') {
+                                                               htmlFileName = "namespacemembers_eval.html";
+                                                       } else {
+                                                               for (int i = 66; i < 91; i++) {
+                                                                       if ((int)firstChar == i) {
+                                                                               htmlFileName = "namespacemembers_eval_0x" + Integer.toHexString(i + 32) + ".html";
+                                                                       }
+                                                               }
+                                                       }
 
-                                                                               if (isExist == true) {
-                                                                                       BufferedReader reader = new BufferedReader(new FileReader(doxygenDirectoryPath + "/" + htmlFileName));
-                                                                                       String tempString = null;
-                                                                                       String htmlFileName2 = null;
-                                                                                       while ( (tempString = reader.readLine()) != null) {
-                                                                                               if ( (htmlFileName2 = searchMethod(tempString, binding)) != null) {
-                                                                                                       break;
-                                                                                               }
-                                                                                       }
-                                                                                       reader.close();
-                                                                                       htmlFileName = htmlFileName2;
-                                                                               }
+                                                       String htmlFileName2 = null;
+                                                       if ( (htmlFileName2 = searchEnumerator(htmlFileName, binding, methodInHeader)) != null) {
+                                                               isExist = true;
+                                                               htmlFileName = htmlFileName2;
+                                                       }
+                                               }*/ if ( stringOfClass[stringOfClass.length - 1].equals("CPPEnumeration") ) { /* Case 3-1-4. declared enumeration in header file */
+                                                       char firstChar = binding.getName().charAt(0);
+                                                       if (firstChar == 'A') {
+                                                               htmlFileName = "namespacemembers_enum.html";
+                                                       } else {
+                                                               for (int i = 66; i < 91; i++) {
+                                                                       if ((int)firstChar == i) {
+                                                                               htmlFileName = "namespacemembers_enum_0x" + Integer.toHexString(i + 32) + ".html";
                                                                        }
-                                                               } else if (stringOfOwner.length == 0) {
-                                                                       String stringOfClass[] = tokenizeStringWithDelimiter(binding.getClass().toString(), ".");
-                                                                       if ( stringOfClass[stringOfClass.length - 1].equals("CPPEnumerator") ) { /* Case 4-1. enumerator in header file */
-                                                                               char firstChar = binding.getName().charAt(0);
-                                                                               if (firstChar == 'A') {
-                                                                                       htmlFileName = "namespacemembers_eval.html";
-                                                                               } else {
-                                                                                       for (int i = 66; i < 91; i++) {
-                                                                                               if ((int)firstChar == i) {
-                                                                                                       htmlFileName = "namespacemembers_eval_0x" + Integer.toHexString(i + 32) + ".html";
-                                                                                               }
-                                                                                       }
-                                                                               }
+                                                               }
+                                                       }
 
-                                                                               String htmlFileName2 = null;
-                                                                               if ( (htmlFileName2 = searchEnumerator(htmlFileName, binding, methodInHeader)) != null) {
-                                                                                       isExist = true;
-                                                                                       htmlFileName = htmlFileName2;
-                                                                               }
+                                                       String htmlFileName2 = null;
+                                                       if ( (htmlFileName2 = searchEnumeration(htmlFileName, binding)) != null) {
+                                                               isExist = true;
+                                                               htmlFileName = htmlFileName2;
+                                                       }
+                                               } else if ( stringOfClass[stringOfClass.length - 1].equals("CPPTypedef") ) { /* Case 3-1-5. typedef declared enumeration in header file */
+                                                       char firstChar = binding.getName().charAt(0);
+                                                       if (firstChar == 'A') {
+                                                               htmlFileName = "namespacemembers_enum.html";
+                                                       } else {
+                                                               for (int i = 66; i < 91; i++) {
+                                                                       if ((int)firstChar == i) {
+                                                                               htmlFileName = "namespacemembers_enum_0x" + Integer.toHexString(i + 32) + ".html";
                                                                        }
                                                                }
                                                        }
 
+                                                       String htmlFileName2 = null;
+                                                       if ( (htmlFileName2 = searchEnumeration(htmlFileName, binding)) != null) {
+                                                               isExist = true;
+                                                               htmlFileName = htmlFileName2;
+                                                       }
+                                               } else if ( stringOfClass[stringOfClass.length - 1].equals("CPPClassType") || stringOfClass[stringOfClass.length - 1].equals("CPPMethod") ) { /* Case 3-1-6. constructor or member method in header file */
+                                                       htmlFileName = "classes.html";
+
+                                                       isExist = checkHTMLFileExistence(htmlFileName); /* check HTML file existence */
+
                                                        if (isExist == true) {
-                                                               fSource = htmlFileName;
+                                                               BufferedReader reader = new BufferedReader(new FileReader(doxygenDirectoryPath + "/" + htmlFileName));
+                                                               String tempString = null;
+                                                               String htmlFileName2 = null;
+                                                               while ( (tempString = reader.readLine()) != null) {
+                                                                       if ( (htmlFileName2 = searchMethod(tempString, binding)) != null) {
+                                                                               break;
+                                                                       }
+                                                               }
+                                                               reader.close();
+                                                               htmlFileName = htmlFileName2;
+                                                       }
+                                               }
+                                       } else if (stringOfOwner.length == 0) {
+                                               String stringOfClass[] = tokenizeStringWithDelimiter(binding.getClass().toString(), ".");
+                                               if ( stringOfClass[stringOfClass.length - 1].equals("CPPEnumerator") ) { /* Case 4-1. enumerator in header file */
+                                                       char firstChar = binding.getName().charAt(0);
+                                                       if (firstChar == 'A') {
+                                                               htmlFileName = "namespacemembers_eval.html";
+                                                       } else {
+                                                               for (int i = 66; i < 91; i++) {
+                                                                       if ((int)firstChar == i) {
+                                                                               htmlFileName = "namespacemembers_eval_0x" + Integer.toHexString(i + 32) + ".html";
+                                                                       }
+                                                               }
                                                        }
-                                                       /* TODO Modify End */
 
-                                                       if (fSource != null) {
-                                                               return Status.OK_STATUS;
+                                                       String htmlFileName2 = null;
+                                                       if ( (htmlFileName2 = searchEnumerator(htmlFileName, binding, methodInHeader)) != null) {
+                                                               isExist = true;
+                                                               htmlFileName = htmlFileName2;
                                                        }
                                                }
                                        }
-                               } catch (DOMException exc) {
-                                       return new Status(IStatus.ERROR, CUIPlugin.PLUGIN_ID, "Internal Error", exc); //$NON-NLS-1$
-                               } catch (Exception e) {
-                                       //
                                }
+
+                               if (isExist == true) {
+                                       fSource = htmlFileName;
+                               }
+                               /* TODO Modify End */
+
+                               if (fSource != null) {
+                                       return Status.OK_STATUS;
+                               }
+                       } catch (DOMException exc) {
+                               return new Status(IStatus.ERROR, CUIPlugin.PLUGIN_ID, "Internal Error", exc); //$NON-NLS-1$
+                       } catch (Exception e) {
+                               //
+                               return Status.CANCEL_STATUS;
                        }
                        return Status.CANCEL_STATUS;
                }
@@ -996,7 +1079,6 @@ public class CDocHover extends AbstractCEditorTextHover {
                public String getSource() {
                        return fSource;
                }
-
        }
 
        /* (non-Javadoc)