Skip to main content
summaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
authorSergey Prigogin2012-06-01 01:47:49 +0000
committerSergey Prigogin2012-06-01 02:12:23 +0000
commit31e3729d82024b8564621cae3950030aa5587446 (patch)
treec5ee56d4970b53abc3770ac7a56adb31d28fcbf8 /core
parent07f9700ccde9fdb2ced735c13f66cbcaba5f843c (diff)
downloadorg.eclipse.cdt-31e3729d82024b8564621cae3950030aa5587446.tar.gz
org.eclipse.cdt-31e3729d82024b8564621cae3950030aa5587446.tar.xz
org.eclipse.cdt-31e3729d82024b8564621cae3950030aa5587446.zip
Cosmetics.
Diffstat (limited to 'core')
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/ASTTypeUtil.java29
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/IASTTypeId.java8
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/IProblemType.java3
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/cpp/ICPPASTTypeId.java2
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTTypeId.java6
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/CPPVisitor.java3
-rw-r--r--core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/search/CSearchMessages.properties2
-rw-r--r--core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/c/hover/AbstractCEditorTextHover.java11
-rw-r--r--core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/c/hover/BestMatchHover.java28
-rw-r--r--core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/c/hover/CDocHover.java24
-rw-r--r--core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/c/hover/CEditorTextHoverProxy.java3
-rw-r--r--core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/c/hover/CMacroExpansionHover.java6
-rw-r--r--core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/c/hover/CSourceHover.java95
13 files changed, 95 insertions, 125 deletions
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/ASTTypeUtil.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/ASTTypeUtil.java
index 6bceaa29dca..ee0d6e2fb11 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/ASTTypeUtil.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/ASTTypeUtil.java
@@ -45,8 +45,8 @@ import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.CPPVisitor;
import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.SemanticUtil;
/**
- * This is a utility class to help convert AST elements to Strings corresponding to the
- * AST element's type.
+ * This is a utility class to help convert AST elements to Strings corresponding to
+ * the AST element's type.
*
* @noextend This class is not intended to be subclassed by clients.
* @noinstantiate This class is not intended to be instantiated by clients.
@@ -58,9 +58,9 @@ public class ASTTypeUtil {
private static final int DEAULT_ITYPE_SIZE = 2;
/**
- * Returns a string representation for the parameters of the given function type. The
- * representation contains the comma-separated list of the normalized parameter type
- * representations wrapped in parentheses.
+ * Returns a string representation for the parameters of the given function type.
+ * The representation contains the comma-separated list of the normalized parameter
+ * type representations wrapped in parentheses.
*/
public static String getParameterTypeString(IFunctionType type) {
StringBuilder result = new StringBuilder();
@@ -493,7 +493,7 @@ public class ASTTypeUtil {
} else {
if (type instanceof ICPPReferenceType) {
// reference types ignore cv-qualifiers
- cvq=null;
+ cvq= null;
// lvalue references win over rvalue references
if (ref == null || ref.isRValueReference()) {
// delay reference to see if there are more
@@ -599,23 +599,24 @@ public class ASTTypeUtil {
*
* @noreference This method is not intended to be referenced by clients.
*/
- public static String getType(IASTDeclarator decltor) {
+ public static String getType(IASTDeclarator declarator) {
// get the most nested declarator
- while (decltor.getNestedDeclarator() != null)
- decltor = decltor.getNestedDeclarator();
+ while (declarator.getNestedDeclarator() != null) {
+ declarator = declarator.getNestedDeclarator();
+ }
- IBinding binding = decltor.getName().resolveBinding();
+ IBinding binding = declarator.getName().resolveBinding();
IType type = null;
try {
if (binding instanceof IEnumerator) {
- type = ((IEnumerator)binding).getType();
+ type = ((IEnumerator) binding).getType();
} else if (binding instanceof IFunction) {
- type = ((IFunction)binding).getType();
+ type = ((IFunction) binding).getType();
} else if (binding instanceof ITypedef) {
- type = ((ITypedef)binding).getType();
+ type = ((ITypedef) binding).getType();
} else if (binding instanceof IVariable) {
- type = ((IVariable)binding).getType();
+ type = ((IVariable) binding).getType();
}
} catch (DOMException e) {
return EMPTY_STRING;
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/IASTTypeId.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/IASTTypeId.java
index 767b376941d..13fc8a000c9 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/IASTTypeId.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/IASTTypeId.java
@@ -21,15 +21,15 @@ public interface IASTTypeId extends IASTNode {
public static final IASTTypeId[] EMPTY_TYPEID_ARRAY = new IASTTypeId[0];
/**
- * <code>DECL_SPECIFIER</code> represents the relationship between an <code>IASTTypeId</code> and
- * it's nested <code>IASTDeclSpecifier</code>.
+ * <code>DECL_SPECIFIER</code> represents the relationship between an <code>IASTTypeId</code>
+ * and it's nested <code>IASTDeclSpecifier</code>.
*/
public static final ASTNodeProperty DECL_SPECIFIER = new ASTNodeProperty(
"IASTTypeId.DECL_SPECIFIER - IASTDeclSpecifier for IASTTypeId"); //$NON-NLS-1$
/**
- * <code>ABSTRACT_DECLARATOR</code> represents the relationship between an <code>IASTTypeId</code> and
- * it's nested <code>IASTDeclarator</code>.
+ * <code>ABSTRACT_DECLARATOR</code> represents the relationship between an <code>IASTTypeId</code>
+ * and it's nested <code>IASTDeclarator</code>.
*/
public static final ASTNodeProperty ABSTRACT_DECLARATOR = new ASTNodeProperty(
"IASTTypeId.ABSTRACT_DECLARATOR - IASTDeclarator for IASTTypeId"); //$NON-NLS-1$
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/IProblemType.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/IProblemType.java
index facc9fa48c8..abc92782df0 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/IProblemType.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/IProblemType.java
@@ -6,7 +6,7 @@
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
- * Markus Schorn - initial API and implementation
+ * Markus Schorn - initial API and implementation
*******************************************************************************/
package org.eclipse.cdt.core.dom.ast;
@@ -22,5 +22,4 @@ package org.eclipse.cdt.core.dom.ast;
* @noimplement This interface is not intended to be implemented by clients.
*/
public interface IProblemType extends IType, ISemanticProblem {
-
}
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/cpp/ICPPASTTypeId.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/cpp/ICPPASTTypeId.java
index 5f7dad418f4..cab1df9c5ef 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/cpp/ICPPASTTypeId.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/cpp/ICPPASTTypeId.java
@@ -6,7 +6,7 @@
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
- * Markus Schorn - initial API and implementation
+ * Markus Schorn - initial API and implementation
*******************************************************************************/
package org.eclipse.cdt.core.dom.ast.cpp;
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTTypeId.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTTypeId.java
index 0e0c4f67f92..ebbca66cef9 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTTypeId.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTTypeId.java
@@ -43,12 +43,8 @@ public class CPPASTTypeId extends ASTNode implements ICPPASTTypeId {
CPPASTTypeId copy = new CPPASTTypeId();
copy.setDeclSpecifier(declSpec == null ? null : declSpec.copy(style));
copy.setAbstractDeclarator(absDecl == null ? null : absDecl.copy(style));
- copy.setOffsetAndLength(this);
copy.isPackExpansion = isPackExpansion;
- if (style == CopyStyle.withLocations) {
- copy.setCopyLocation(this);
- }
- return copy;
+ return copy(copy, style);
}
@Override
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/CPPVisitor.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/CPPVisitor.java
index 62279584e4b..2d1347274a9 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/CPPVisitor.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/CPPVisitor.java
@@ -1762,10 +1762,9 @@ public class CPPVisitor extends ASTQueries {
* Creates the type for a parameter declaration.
*/
public static IType createType(final ICPPASTParameterDeclaration pdecl, boolean forFuncType) {
- IType pt;
IASTDeclSpecifier pDeclSpec = pdecl.getDeclSpecifier();
ICPPASTDeclarator pDtor = pdecl.getDeclarator();
- pt = createType(pDeclSpec);
+ IType pt = createType(pDeclSpec);
if (pDtor != null) {
pt = createType(pt, pDtor);
}
diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/search/CSearchMessages.properties b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/search/CSearchMessages.properties
index 4deb6dd58e0..86d85b60e80 100644
--- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/search/CSearchMessages.properties
+++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/search/CSearchMessages.properties
@@ -110,4 +110,4 @@ OccurrencesFinder_label_singular=''{0}'' - 1 occurrence in ''{1}''
# The first argument will be replaced by the element name, the second by the count and the last by the file name
OccurrencesFinder_label_plural=''{0}'' - {1} occurrences in ''{2}''
OccurrencesFinder_occurrence_description=Occurrence of ''{0}''
-OccurrencesFinder_occurrence_write_description=Write Occurrence of ''{0}'' \ No newline at end of file
+OccurrencesFinder_occurrence_write_description=Write occurrence of ''{0}'' \ No newline at end of file
diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/c/hover/AbstractCEditorTextHover.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/c/hover/AbstractCEditorTextHover.java
index 81696fb5953..016f663fb95 100644
--- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/c/hover/AbstractCEditorTextHover.java
+++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/c/hover/AbstractCEditorTextHover.java
@@ -10,7 +10,6 @@
* IBM Corporation
* Anton Leherbauer (Wind River Systems)
*******************************************************************************/
-
package org.eclipse.cdt.internal.ui.text.c.hover;
import org.eclipse.jface.text.DefaultInformationControl;
@@ -32,12 +31,10 @@ import org.eclipse.cdt.ui.text.c.hover.ICEditorTextHover;
import org.eclipse.cdt.internal.ui.text.CWordFinder;
/**
- * Abstract class for providing hover information for C
- * elements.
- *
+ * Abstract class for providing hover information for C elements.
*/
-public abstract class AbstractCEditorTextHover implements ICEditorTextHover, ITextHoverExtension, ITextHoverExtension2, IInformationProviderExtension2 {
-
+public abstract class AbstractCEditorTextHover implements ICEditorTextHover, ITextHoverExtension,
+ ITextHoverExtension2, IInformationProviderExtension2 {
private IEditorPart fEditor;
/*
@@ -102,7 +99,7 @@ public abstract class AbstractCEditorTextHover implements ICEditorTextHover, ITe
}
/*
- * @see org.eclipse.jface.text.ITextHoverExtension2#getInformationPresenterControlCreator()
+ * @see ITextHoverExtension2#getInformationPresenterControlCreator()
* @since 5.0
*/
@Override
diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/c/hover/BestMatchHover.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/c/hover/BestMatchHover.java
index e2722749571..98a3ffb5bab 100644
--- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/c/hover/BestMatchHover.java
+++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/c/hover/BestMatchHover.java
@@ -10,7 +10,6 @@
* Anton Leherbauer (Wind River Systems)
* Ericsson - Fix improper hover order (Bug 294812)
*******************************************************************************/
-
package org.eclipse.cdt.internal.ui.text.c.hover;
import java.util.ArrayList;
@@ -39,10 +38,8 @@ import org.eclipse.cdt.ui.text.c.hover.ICEditorTextHover;
* hovers being placed before less specific ones.
*/
public class BestMatchHover extends AbstractCEditorTextHover {
-
/*
- * Note that hover ordering is very important to be preserved by this
- * class. (Bug 294812)
+ * Note that hover ordering is very important to be preserved by this class (bug 294812).
*/
private List<CEditorTextHoverDescriptor> fTextHoverSpecifications;
private List<ITextHover> fInstantiatedTextHovers;
@@ -63,16 +60,16 @@ public class BestMatchHover extends AbstractCEditorTextHover {
private void installTextHovers() {
CEditorTextHoverDescriptor[] hoverDescs= CUIPlugin.getDefault().getCEditorTextHoverDescriptors();
- // initialize lists - indicates that the initialization happened
+ // Initialize lists - indicates that the initialization happened
fTextHoverSpecifications= new ArrayList<CEditorTextHoverDescriptor>(hoverDescs.length-1);
fInstantiatedTextHovers= new ArrayList<ITextHover>(hoverDescs.length-1);
- // populate list
+ // Populate list
for (int i= 0; i < hoverDescs.length; i++) {
- // ensure that we don't add ourselves to the list
+ // Ensure that we don't add ourselves to the list
if (!PreferenceConstants.ID_BESTMATCH_HOVER.equals(hoverDescs[i].getId())) {
fTextHoverSpecifications.add(hoverDescs[i]);
- // add place-holder for hover instance
+ // Add place-holder for hover instance
fInstantiatedTextHovers.add(null);
}
}
@@ -90,7 +87,7 @@ public class BestMatchHover extends AbstractCEditorTextHover {
ICEditorTextHover hover= spec.createTextHover();
if (hover != null) {
hover.setEditor(getEditor());
- // remember instance and mark as created
+ // Remember instance and mark as created
fInstantiatedTextHovers.set(i, hover);
fTextHoverSpecifications.set(i, null);
} else {
@@ -109,7 +106,6 @@ public class BestMatchHover extends AbstractCEditorTextHover {
@SuppressWarnings("deprecation")
@Override
public String getHoverInfo(ITextViewer textViewer, IRegion hoverRegion) {
-
checkTextHovers();
fBestHover= null;
@@ -130,12 +126,11 @@ public class BestMatchHover extends AbstractCEditorTextHover {
}
/*
- * @see org.eclipse.jface.text.ITextHoverExtension2#getHoverInfo2(org.eclipse.jface.text.ITextViewer, org.eclipse.jface.text.IRegion)
+ * @see ITextHoverExtension2#getHoverInfo2(ITextViewer, IRegion)
*/
@SuppressWarnings("deprecation")
@Override
public Object getHoverInfo2(ITextViewer textViewer, IRegion hoverRegion) {
-
checkTextHovers();
fBestHover= null;
@@ -164,7 +159,7 @@ public class BestMatchHover extends AbstractCEditorTextHover {
}
/*
- * @see org.eclipse.jface.text.ITextHoverExtension#getHoverControlCreator()
+ * @see ITextHoverExtension#getHoverControlCreator()
* @since 3.0
*/
@Override
@@ -176,16 +171,15 @@ public class BestMatchHover extends AbstractCEditorTextHover {
}
/*
- * @see org.eclipse.jface.text.information.IInformationProviderExtension2#getInformationPresenterControlCreator()
+ * @see IInformationProviderExtension2#getInformationPresenterControlCreator()
* @since 3.0
*/
@Override
public IInformationControlCreator getInformationPresenterControlCreator() {
- // this is wrong, but left here for backwards compatibility
+ // This is wrong, but left here for backwards compatibility
if (fBestHover instanceof IInformationProviderExtension2)
- return ((IInformationProviderExtension2)fBestHover).getInformationPresenterControlCreator();
+ return ((IInformationProviderExtension2) fBestHover).getInformationPresenterControlCreator();
return null;
}
-
}
diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/c/hover/CDocHover.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/c/hover/CDocHover.java
index f0a89dee4f2..2361fb9ea21 100644
--- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/c/hover/CDocHover.java
+++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/c/hover/CDocHover.java
@@ -11,7 +11,6 @@
*******************************************************************************/
package org.eclipse.cdt.internal.ui.text.c.hover;
-
import org.eclipse.core.resources.IProject;
import org.eclipse.jface.text.IRegion;
import org.eclipse.jface.text.ITextViewer;
@@ -22,8 +21,8 @@ import org.eclipse.ui.IEditorInput;
import org.eclipse.cdt.core.model.ITranslationUnit;
import org.eclipse.cdt.ui.CUIPlugin;
import org.eclipse.cdt.ui.IFunctionSummary;
-import org.eclipse.cdt.ui.IRequiredInclude;
import org.eclipse.cdt.ui.IFunctionSummary.IFunctionPrototypeSummary;
+import org.eclipse.cdt.ui.IRequiredInclude;
import org.eclipse.cdt.ui.text.ICHelpInvocationContext;
import org.eclipse.cdt.ui.text.IHoverHelpInvocationContext;
@@ -33,15 +32,12 @@ import org.eclipse.cdt.internal.ui.text.CWordFinder;
import org.eclipse.cdt.internal.ui.text.HTMLPrinter;
public class CDocHover extends AbstractCEditorTextHover {
-
- /**
- * Constructor for DefaultCEditorTextHover
- */
+
public CDocHover() {
}
/* (non-Javadoc)
- * @see org.eclipse.jface.text.ITextHover#getHoverInfo(org.eclipse.jface.text.ITextViewer, org.eclipse.jface.text.IRegion)
+ * @see ITextHover#getHoverInfo(ITextViewer, IRegion)
*/
@Override
public String getHoverInfo(ITextViewer viewer, IRegion region) {
@@ -61,7 +57,6 @@ public class CDocHover extends AbstractCEditorTextHover {
// call the Help to get info
ICHelpInvocationContext context = new IHoverHelpInvocationContext() {
-
@Override
public IProject getProject() {
ITranslationUnit unit = getTranslationUnit();
@@ -81,7 +76,6 @@ public class CDocHover extends AbstractCEditorTextHover {
public IRegion getHoverRegion() {
return hoverRegion;
}
-
};
IFunctionSummary fs = CHelpProviderManager.getDefault().getFunctionInfo(context, expression);
@@ -93,7 +87,7 @@ public class CDocHover extends AbstractCEditorTextHover {
buffer.append(CEditorMessages.DefaultCEditorTextHover_html_prototype);
buffer.append(HTMLPrinter.convertToHTMLContent(prototype.getPrototypeString(false)));
}
- if(fs.getDescription() != null) {
+ if (fs.getDescription() != null) {
buffer.append(CEditorMessages.DefaultCEditorTextHover_html_description);
//Don't convert this description since it could already be formatted
buffer.append(fs.getDescription());
@@ -117,7 +111,7 @@ public class CDocHover extends AbstractCEditorTextHover {
HTMLPrinter.addPageEpilog(buffer);
return buffer.toString();
}
- } catch(Exception ex) {
+ } catch (Exception e) {
/* Ignore */
}
@@ -125,7 +119,7 @@ public class CDocHover extends AbstractCEditorTextHover {
}
/* (non-Javadoc)
- * @see org.eclipse.jface.text.ITextHover#getHoverRegion(org.eclipse.jface.text.ITextViewer, int)
+ * @see ITextHover#getHoverRegion(ITextViewer, int)
*/
@Override
public IRegion getHoverRegion(ITextViewer viewer, int offset) {
@@ -134,12 +128,12 @@ public class CDocHover extends AbstractCEditorTextHover {
if (selectedRange.x >= 0 &&
selectedRange.y > 0 &&
offset >= selectedRange.x &&
- offset <= selectedRange.x + selectedRange.y)
- return new Region( selectedRange.x, selectedRange.y );
+ offset <= selectedRange.x + selectedRange.y) {
+ return new Region(selectedRange.x, selectedRange.y);
+ }
return CWordFinder.findWord(viewer.getDocument(), offset);
}
return null;
}
-
}
diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/c/hover/CEditorTextHoverProxy.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/c/hover/CEditorTextHoverProxy.java
index b76604737b9..e899b216e64 100644
--- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/c/hover/CEditorTextHoverProxy.java
+++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/c/hover/CEditorTextHoverProxy.java
@@ -9,7 +9,6 @@
* QNX Software Systems - Initial API and implementation
* Anton Leherbauer (Wind River Systems)
*******************************************************************************/
-
package org.eclipse.cdt.internal.ui.text.c.hover;
import org.eclipse.jface.text.IInformationControlCreator;
@@ -26,7 +25,6 @@ import org.eclipse.cdt.ui.text.c.hover.ICEditorTextHover;
* CEditorTexHoverProxy
*/
public class CEditorTextHoverProxy extends AbstractCEditorTextHover {
-
private CEditorTextHoverDescriptor fHoverDescriptor;
private ICEditorTextHover fHover;
@@ -132,5 +130,4 @@ public class CEditorTextHoverProxy extends AbstractCEditorTextHover {
}
return null;
}
-
}
diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/c/hover/CMacroExpansionHover.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/c/hover/CMacroExpansionHover.java
index ea67639e15f..a2497c22726 100644
--- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/c/hover/CMacroExpansionHover.java
+++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/c/hover/CMacroExpansionHover.java
@@ -25,7 +25,6 @@ import org.eclipse.ui.part.IWorkbenchPartOrientation;
* @since 5.0
*/
public class CMacroExpansionHover extends AbstractCEditorTextHover {
-
@Override
public String getHoverInfo(ITextViewer textViewer, IRegion hoverRegion) {
Object hoverInfo= getHoverInfo2(textViewer, hoverRegion);
@@ -33,7 +32,7 @@ public class CMacroExpansionHover extends AbstractCEditorTextHover {
}
/*
- * @see org.eclipse.cdt.internal.ui.text.c.hover.AbstractCEditorTextHover#getHoverInfo2(org.eclipse.jface.text.ITextViewer, org.eclipse.jface.text.IRegion)
+ * @see AbstractCEditorTextHover#getHoverInfo2(ITextViewer, IRegion)
*/
@Override
public Object getHoverInfo2(ITextViewer textViewer, IRegion hoverRegion) {
@@ -55,7 +54,7 @@ public class CMacroExpansionHover extends AbstractCEditorTextHover {
}
/*
- * @see org.eclipse.cdt.internal.ui.text.c.hover.AbstractCEditorTextHover#getInformationPresenterControlCreator()
+ * @see AbstractCEditorTextHover#getInformationPresenterControlCreator()
*/
@Override
public IInformationControlCreator getInformationPresenterControlCreator() {
@@ -70,5 +69,4 @@ public class CMacroExpansionHover extends AbstractCEditorTextHover {
}
};
}
-
}
diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/c/hover/CSourceHover.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/c/hover/CSourceHover.java
index 5e59cd00407..29d2d9ef515 100644
--- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/c/hover/CSourceHover.java
+++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/c/hover/CSourceHover.java
@@ -6,8 +6,8 @@
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
- * QNX Software Systems - Initial API and implementation
- * Anton Leherbauer (Wind River Systems)
+ * QNX Software Systems - Initial API and implementation
+ * Anton Leherbauer (Wind River Systems)
*******************************************************************************/
package org.eclipse.cdt.internal.ui.text.c.hover;
@@ -95,15 +95,16 @@ import org.eclipse.cdt.internal.ui.util.EditorUtility;
* A text hover presenting the source of the element under the cursor.
*/
public class CSourceHover extends AbstractCEditorTextHover {
-
private static final boolean DEBUG = false;
protected static class SingletonRule implements ISchedulingRule {
public static final ISchedulingRule INSTANCE = new SingletonRule();
+
@Override
public boolean contains(ISchedulingRule rule) {
return rule == this;
}
+
@Override
public boolean isConflicting(ISchedulingRule rule) {
return rule == this;
@@ -114,7 +115,6 @@ public class CSourceHover extends AbstractCEditorTextHover {
* Computes the source location for a given identifier.
*/
protected static class ComputeSourceRunnable implements ASTRunnable {
-
private final ITranslationUnit fTU;
private final IRegion fTextRegion;
private final IProgressMonitor fMonitor;
@@ -132,7 +132,7 @@ public class CSourceHover extends AbstractCEditorTextHover {
}
/*
- * @see org.eclipse.cdt.internal.core.model.ASTCache.ASTRunnable#runOnAST(org.eclipse.cdt.core.dom.ast.IASTTranslationUnit)
+ * @see org.eclipse.cdt.internal.core.model.ASTCache.ASTRunnable#runOnAST(IASTTranslationUnit)
*/
@Override
public IStatus runOnAST(ILanguage lang, IASTTranslationUnit ast) {
@@ -142,21 +142,20 @@ public class CSourceHover extends AbstractCEditorTextHover {
if (name != null) {
IBinding binding= name.resolveBinding();
if (binding != null) {
-
// Check for implicit names first, could be an implicit constructor call
- if(name.getParent() instanceof IASTImplicitNameOwner) {
+ if (name.getParent() instanceof IASTImplicitNameOwner) {
IASTImplicitNameOwner iastImplicitNameOwner = (IASTImplicitNameOwner) name.getParent();
IASTName [] implicitNames = iastImplicitNameOwner.getImplicitNames();
- if(implicitNames.length == 1) {
+ if (implicitNames.length == 1) {
IBinding implicitNameBinding = implicitNames[0].resolveBinding();
- if(implicitNameBinding instanceof ICPPConstructor) {
+ if (implicitNameBinding instanceof ICPPConstructor) {
binding = implicitNameBinding;
}
}
}
if (binding instanceof IProblemBinding) {
- // report problem as source comment
+ // Report problem as source comment
if (DEBUG) {
IProblemBinding problem= (IProblemBinding) binding;
fSource= "/* Indexer Problem!\n" + //$NON-NLS-1$
@@ -173,10 +172,10 @@ public class CSourceHover extends AbstractCEditorTextHover {
}
}
}
- } catch (CoreException exc) {
- return exc.getStatus();
- } catch (DOMException exc) {
- return new Status(IStatus.ERROR, CUIPlugin.PLUGIN_ID, "Internal Error", exc); //$NON-NLS-1$
+ } catch (CoreException e) {
+ return e.getStatus();
+ } catch (DOMException e) {
+ return new Status(IStatus.ERROR, CUIPlugin.PLUGIN_ID, "Internal Error", e); //$NON-NLS-1$
}
}
return Status.CANCEL_STATUS;
@@ -219,8 +218,8 @@ public class CSourceHover extends AbstractCEditorTextHover {
private String computeSourceForBinding(IASTTranslationUnit ast, IBinding binding) throws CoreException, DOMException {
IName[] names = findDefsOrDecls(ast, binding);
- // in case the binding is a non-explicit specialization we need
- // to consider the original binding (bug 281396)
+ // In case the binding is a non-explicit specialization we need
+ // to consider the original binding (bug 281396).
while (names.length == 0 && binding instanceof ICPPSpecialization) {
IBinding specializedBinding = ((ICPPSpecialization) binding).getSpecializedBinding();
if (specializedBinding == null || specializedBinding instanceof IProblemBinding) {
@@ -275,24 +274,24 @@ public class CSourceHover extends AbstractCEditorTextHover {
int hoverOffset = fTextRegion.getOffset();
if (hoverOffset <= nodeOffset && nodeOffset < hoverOffset + fTextRegion.getLength() ||
hoverOffset >= nodeOffset && hoverOffset < nodeOffset + nodeLength) {
- // bug 359352 - don't show source if its the same we are hovering on
+ // Bug 359352 - don't show source if its the same we are hovering on.
return null;
}
if (fTU.getResource() != null) {
- // reuse editor buffer for names local to the translation unit
+ // Reuse editor buffer for names local to the translation unit
location= fTU.getResource().getFullPath();
locationKind= LocationKind.IFILE;
}
}
} else {
- // try to resolve path to a resource for proper encoding (bug 221029)
+ // Try to resolve path to a resource for proper encoding (bug 221029)
IFile file= EditorUtility.getWorkspaceFileAtLocation(location, fTU);
if (file != null) {
location= file.getFullPath();
locationKind= LocationKind.IFILE;
if (name instanceof IIndexName) {
- // need to adjust index offsets to current offsets
- // in case file has been modified since last index time
+ // Need to adjust index offsets to current offsets
+ // in case file has been modified since last index time.
IIndexName indexName= (IIndexName) name;
long timestamp= indexName.getFile().getTimestamp();
IPositionConverter converter= CCorePlugin.getPositionTrackerManager().findPositionConverter(file, timestamp);
@@ -331,7 +330,7 @@ public class CSourceHover extends AbstractCEditorTextHover {
return null;
}
} else {
- // expand source range to include preceding comment, if any
+ // Expand source range to include preceding comment, if any
boolean isKnR= isKnRSource(name);
sourceStart= computeSourceStart(doc, nameOffset, binding, isKnR);
if (sourceStart == CHeuristicScanner.NOT_FOUND) {
@@ -342,9 +341,9 @@ public class CSourceHover extends AbstractCEditorTextHover {
String source= buffer.getDocument().get(sourceStart, sourceEnd - sourceStart);
return source;
- } catch (BadLocationException exc) {
- // ignore - should not happen anyway
- if (DEBUG) exc.printStackTrace();
+ } catch (BadLocationException e) {
+ // Ignore - should not happen anyway
+ if (DEBUG) e.printStackTrace();
} finally {
mgr.disconnect(location, LocationKind.LOCATION, fMonitor);
}
@@ -455,7 +454,7 @@ public class CSourceHover extends AbstractCEditorTextHover {
if (nextNonWS != CHeuristicScanner.NOT_FOUND) {
int nextNonWSLine= doc.getLineOfOffset(nextNonWS);
int lineOffset= doc.getLineOffset(nextNonWSLine);
- if (doc.get(lineOffset, nextNonWS - lineOffset).trim().length() == 0) {
+ if (doc.get(lineOffset, nextNonWS - lineOffset).trim().isEmpty()) {
sourceStart= doc.getLineOffset(nextNonWSLine);
}
}
@@ -467,7 +466,7 @@ public class CSourceHover extends AbstractCEditorTextHover {
private int computeSourceEnd(IDocument doc, int start, IBinding binding, boolean isDefinition, boolean isKnR) throws BadLocationException {
int sourceEnd= start;
CHeuristicScanner scanner= new CHeuristicScanner(doc);
- // expand forward to the end of the definition/declaration
+ // Expand forward to the end of the definition/declaration
boolean searchBrace= false;
boolean searchSemi= false;
boolean searchComma= false;
@@ -498,7 +497,7 @@ public class CSourceHover extends AbstractCEditorTextHover {
sourceEnd= doc.getLength();
}
}
- // expand region to include whole line
+ // Expand region to include whole line
IRegion lineRegion= doc.getLineInformationOfOffset(sourceEnd);
sourceEnd= lineRegion.getOffset() + lineRegion.getLength();
} else if (searchSemi) {
@@ -506,7 +505,7 @@ public class CSourceHover extends AbstractCEditorTextHover {
if (semi != CHeuristicScanner.NOT_FOUND) {
sourceEnd= semi+1;
}
- // expand region to include whole line
+ // Expand region to include whole line
IRegion lineRegion= doc.getLineInformationOfOffset(sourceEnd);
sourceEnd= lineRegion.getOffset() + lineRegion.getLength();
} else if (searchComma) {
@@ -552,8 +551,7 @@ public class CSourceHover extends AbstractCEditorTextHover {
* @return an array of definitions, never <code>null</code>
* @throws CoreException
*/
- private IName[] findDefinitions(IASTTranslationUnit ast,
- IBinding binding) throws CoreException {
+ private IName[] findDefinitions(IASTTranslationUnit ast, IBinding binding) throws CoreException {
IName[] declNames= ast.getDefinitionsInAST(binding);
if (declNames.length == 0 && ast.getIndex() != null) {
// search definitions in index
@@ -570,8 +568,7 @@ public class CSourceHover extends AbstractCEditorTextHover {
* @return an array of declarations, never <code>null</code>
* @throws CoreException
*/
- private IName[] findDeclarations(IASTTranslationUnit ast,
- IBinding binding) throws CoreException {
+ private IName[] findDeclarations(IASTTranslationUnit ast, IBinding binding) throws CoreException {
IName[] declNames= ast.getDeclarationsInAST(binding);
if (declNames.length == 0 && ast.getIndex() != null) {
// search declarations in index
@@ -586,7 +583,6 @@ public class CSourceHover extends AbstractCEditorTextHover {
public String getSource() {
return fSource;
}
-
}
/**
@@ -618,10 +614,10 @@ public class CSourceHover extends AbstractCEditorTextHover {
try {
expression = textViewer.getDocument().get(hoverRegion.getOffset(), hoverRegion.getLength());
expression = expression.trim();
- if (expression.length() == 0)
+ if (expression.isEmpty())
return null;
- //Before trying a search lets make sure that the user is not hovering over a keyword
+ // Before trying a search lets make sure that the user is not hovering over a keyword
if (selectionIsKeyword(expression))
return null;
@@ -630,10 +626,10 @@ public class CSourceHover extends AbstractCEditorTextHover {
// Try with the indexer
source= searchInIndex(copy, hoverRegion);
- if (source == null || source.trim().length() == 0)
+ if (source == null || source.trim().isEmpty())
return null;
- // we are actually interested in the comments, too.
+ // We are actually interested in the comments, too.
// source= removeLeadingComments(source);
String delim= System.getProperty("line.separator", "\n"); //$NON-NLS-1$ //$NON-NLS-2$
@@ -645,7 +641,6 @@ public class CSourceHover extends AbstractCEditorTextHover {
source = Strings.concatenate(sourceLines, delim);
return source;
-
} catch (BadLocationException e) {
}
}
@@ -680,7 +675,7 @@ public class CSourceHover extends AbstractCEditorTextHover {
final int startLine= doc.getLineOfOffset(partitionOffset);
final int lineOffset= doc.getLineOffset(startLine);
if (partitionOffset == lineOffset ||
- doc.get(lineOffset, partitionOffset - lineOffset).trim().length() == 0) {
+ doc.get(lineOffset, partitionOffset - lineOffset).trim().isEmpty()) {
return lineOffset;
}
return commentOffset;
@@ -690,13 +685,13 @@ public class CSourceHover extends AbstractCEditorTextHover {
final int startLine= doc.getLineOfOffset(partitionOffset);
final int lineOffset= doc.getLineOffset(startLine);
if (partitionOffset == lineOffset ||
- doc.get(lineOffset, partitionOffset - lineOffset).trim().length() == 0) {
+ doc.get(lineOffset, partitionOffset - lineOffset).trim().isEmpty()) {
commentOffset= lineOffset;
continue;
}
return commentOffset;
} else if (IDocument.DEFAULT_CONTENT_TYPE.equals(partition.getType())) {
- if (doc.get(partition.getOffset(), partition.getLength()).trim().length() == 0) {
+ if (doc.get(partition.getOffset(), partition.getLength()).trim().isEmpty()) {
continue;
}
if (commentOffset >= 0) {
@@ -713,7 +708,6 @@ public class CSourceHover extends AbstractCEditorTextHover {
return 4;
}
-
/**
* Strip the leading comment from the given source string.
*
@@ -732,13 +726,13 @@ public class CSourceHover extends AbstractCEditorTextHover {
}
i= reader.getOffset();
reader.close();
- } catch (IOException ex) {
+ } catch (IOException e) {
i= 0;
} finally {
try {
reader.close();
- } catch (IOException ex) {
- CUIPlugin.log(ex);
+ } catch (IOException e) {
+ CUIPlugin.log(e);
}
}
@@ -753,7 +747,8 @@ public class CSourceHover extends AbstractCEditorTextHover {
@Override
protected IStatus run(IProgressMonitor monitor) {
try {
- return ASTProvider.getASTProvider().runOnAST(tUnit, ASTProvider.WAIT_ACTIVE_ONLY, monitor, computer);
+ return ASTProvider.getASTProvider().runOnAST(tUnit, ASTProvider.WAIT_ACTIVE_ONLY,
+ monitor, computer);
} catch (Throwable t) {
CUIPlugin.log(t);
}
@@ -776,9 +771,8 @@ public class CSourceHover extends AbstractCEditorTextHover {
return computer.getSource();
}
-
/**
- * Test whether the given name is a known keyword.
+ * Checks whether the given name is a known keyword.
*
* @param name
* @return <code>true</code> if the name is a known keyword or <code>false</code> if the
@@ -802,7 +796,8 @@ public class CSourceHover extends AbstractCEditorTextHover {
int orientation= SWT.NONE;
if (editor instanceof IWorkbenchPartOrientation)
orientation= ((IWorkbenchPartOrientation) editor).getOrientation();
- return new SourceViewerInformationControl(parent, false, orientation, getTooltipAffordanceString());
+ return new SourceViewerInformationControl(parent, false, orientation,
+ getTooltipAffordanceString());
}
};
}

Back to the top