diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/IASTBinaryExpression.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/IASTBinaryExpression.java
index 969f7275f22..d9cd509e200 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/IASTBinaryExpression.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/IASTBinaryExpression.java
@@ -11,7 +11,6 @@
*******************************************************************************/
package org.eclipse.cdt.core.dom.ast;
-
/**
* This interface represents a binary expression.
*
@@ -36,15 +35,14 @@ public interface IASTBinaryExpression extends IASTExpression {
"IASTBinaryExpression.OPERAND_TWO - IASTExpression for RHS"); //$NON-NLS-1$
/**
- * Set the operator.
+ * Sets the operator.
*
- * @param op
- * Value to set.
+ * @param op value to set.
*/
public void setOperator(int op);
/**
- * Get the operator.
+ * Returns the operator.
*
* @return int value as operator
*/
@@ -244,7 +242,6 @@ public interface IASTBinaryExpression extends IASTExpression {
* @param expression
* IASTExpression
value.
*/
-
public void setOperand1(IASTExpression expression);
/**
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/IASTBinaryTypeIdExpression.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/IASTBinaryTypeIdExpression.java
index e43f0b4756c..3d5cf6532b2 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/IASTBinaryTypeIdExpression.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/IASTBinaryTypeIdExpression.java
@@ -6,7 +6,7 @@
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
- * Markus Schorn (Wind River Systems) - Initial API and implementation
+ * Markus Schorn (Wind River Systems) - Initial API and implementation
*******************************************************************************/
package org.eclipse.cdt.core.dom.ast;
@@ -25,7 +25,7 @@ public interface IASTBinaryTypeIdExpression extends IASTExpression {
public static enum Operator {__is_base_of}
/**
- * Get the operator for the expression.
+ * Returns the operator for the expression.
*/
public Operator getOperator();
@@ -40,22 +40,23 @@ public interface IASTBinaryTypeIdExpression extends IASTExpression {
public IASTTypeId getOperand2();
/**
- * Set the operator for the expression.
+ * Sets the operator for the expression.
*/
public void setOperator(Operator value);
/**
- * Set the first operand.
+ * Sets the first operand.
*/
public void setOperand1(IASTTypeId typeId);
/**
- * Set the second operand.
+ * Sets the second operand.
*/
public void setOperand2(IASTTypeId typeId);
@Override
public IASTBinaryTypeIdExpression copy();
+
@Override
public IASTBinaryTypeIdExpression copy(CopyStyle style);
}
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/IASTExpression.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/IASTExpression.java
index c5b548b3238..ab5cb7f26fc 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/IASTExpression.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/IASTExpression.java
@@ -11,7 +11,6 @@
*******************************************************************************/
package org.eclipse.cdt.core.dom.ast;
-
/**
* This is the root class of expressions.
*
@@ -28,7 +27,7 @@ public interface IASTExpression extends IASTInitializerClause {
*/
LVALUE,
/**
- * Expiring value as introduced by c++ 0x.
+ * Expiring value as introduced by c++11.
*/
XVALUE,
/**
@@ -42,6 +41,7 @@ public interface IASTExpression extends IASTInitializerClause {
public boolean isRValue() {
return this != LVALUE;
}
+
/**
* A generalized lvalue is either an lvalue or an xvalue.
*/
@@ -53,7 +53,7 @@ public interface IASTExpression extends IASTInitializerClause {
/**
* Empty expression array.
*/
- public static final IASTExpression[] EMPTY_EXPRESSION_ARRAY = new IASTExpression[0];
+ public static final IASTExpression[] EMPTY_EXPRESSION_ARRAY = {};
public IType getExpressionType();
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/IASTUnaryExpression.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/IASTUnaryExpression.java
index 7af56b5f991..2a4cf858a75 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/IASTUnaryExpression.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/IASTUnaryExpression.java
@@ -17,7 +17,6 @@ package org.eclipse.cdt.core.dom.ast;
* @noimplement This interface is not intended to be implemented by clients.
*/
public interface IASTUnaryExpression extends IASTExpression {
-
/**
* Prefix increment.
* op_prefixIncr
++exp
@@ -32,7 +31,7 @@ public interface IASTUnaryExpression extends IASTExpression {
/**
* Operator plus.
- * op_plus
==> + exp
+ * op_plus
==> +exp
*/
public static final int op_plus = 2;
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/cpp/ICPPASTBinaryExpression.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/cpp/ICPPASTBinaryExpression.java
index 6f7e75df787..a447daa91a0 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/cpp/ICPPASTBinaryExpression.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/cpp/ICPPASTBinaryExpression.java
@@ -6,9 +6,9 @@
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
- * John Camelon (IBM) - Initial API and implementation
- * Mike Kucera (IBM)
- * Sergey Prigogin (Google)
+ * John Camelon (IBM) - Initial API and implementation
+ * Mike Kucera (IBM)
+ * Sergey Prigogin (Google)
*******************************************************************************/
package org.eclipse.cdt.core.dom.ast.cpp;
@@ -22,7 +22,6 @@ import org.eclipse.cdt.core.dom.ast.IASTImplicitNameOwner;
* @noimplement This interface is not intended to be implemented by clients.
*/
public interface ICPPASTBinaryExpression extends IASTBinaryExpression, IASTImplicitNameOwner {
-
/**
* op_pmdot
pointer-to-member field dereference.
*/
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/rewrite/ASTRewrite.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/rewrite/ASTRewrite.java
index ee2b2e90f12..a83b0a2e559 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/rewrite/ASTRewrite.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/rewrite/ASTRewrite.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2011 Wind River Systems, Inc. and others.
+ * Copyright (c) 2007, 2012 Wind River Systems, Inc. and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -260,9 +260,10 @@ public final class ASTRewrite {
}
/**
+ * Returns comments for the given node.
*
* @param node the node
- * @param pos the position
+ * @param pos the position of the comments
* @return All comments assigned to the node at this position
* @since 5.3
*/
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/rewrite/ITrackedNodePosition.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/rewrite/ITrackedNodePosition.java
index d9d2a9ff374..197568f9125 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/rewrite/ITrackedNodePosition.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/rewrite/ITrackedNodePosition.java
@@ -20,7 +20,6 @@ package org.eclipse.cdt.core.dom.rewrite;
* @noextend This interface is not intended to be extended by clients.
*/
public interface ITrackedNodePosition {
-
/**
* Returns the original or modified start position of the tracked node depending if called before
* or after the rewrite is applied. -1
is returned for removed nodes.
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/ASTNode.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/ASTNode.java
index 4d45e26519a..89d0b9123db 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/ASTNode.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/ASTNode.java
@@ -259,7 +259,7 @@ public abstract class ASTNode implements IASTNode {
ASTNode astNode= (ASTNode) node;
final int offset = getOffset();
final int nodeOffset= astNode.getOffset();
- return offset <= nodeOffset && nodeOffset+astNode.length <= offset+length;
+ return offset <= nodeOffset && nodeOffset + astNode.length <= offset + length;
}
return false;
}
@@ -267,7 +267,7 @@ public abstract class ASTNode implements IASTNode {
@Override
public IToken getSyntax() throws ExpansionOverlapsBoundaryException {
final int offset = getOffset();
- return getSyntax(offset, offset+length, 0);
+ return getSyntax(offset, offset + length, 0);
}
@Override
@@ -279,7 +279,7 @@ public abstract class ASTNode implements IASTNode {
@Override
public IToken getTrailingSyntax() throws ExpansionOverlapsBoundaryException {
int right= getBoundary(1);
- return getSyntax(getOffset()+length, right, 1);
+ return getSyntax(getOffset() + length, right, 1);
}
/**
@@ -296,15 +296,14 @@ public abstract class ASTNode implements IASTNode {
ASTNode astNode= (ASTNode) sib;
int offset= astNode.getOffset();
if (direction < 0) {
- offset+= astNode.getLength();
+ offset += astNode.getLength();
}
return offset;
}
- // no parent
+ // No parent.
throw new UnsupportedOperationException();
}
-
private IToken getSyntax(int fromSequenceNumber, int nextSequenceNumber, int direction) throws ExpansionOverlapsBoundaryException {
final IASTTranslationUnit tu= getTranslationUnit();
if (!(tu instanceof ASTNode))
@@ -315,7 +314,7 @@ public abstract class ASTNode implements IASTNode {
throw new UnsupportedOperationException();
int endSequenceNumber= lr.convertToSequenceEndNumber(nextSequenceNumber);
- IASTFileLocation total= lr.getMappedFileLocation(fromSequenceNumber, endSequenceNumber-fromSequenceNumber);
+ IASTFileLocation total= lr.getMappedFileLocation(fromSequenceNumber, endSequenceNumber - fromSequenceNumber);
IASTFileLocation myfloc= getFileLocation();
if (total == null || myfloc == null)
throw new UnsupportedOperationException();
@@ -324,13 +323,13 @@ public abstract class ASTNode implements IASTNode {
throw new ExpansionOverlapsBoundaryException();
if (fromSequenceNumber > 0) {
- IASTFileLocation fl= lr.getMappedFileLocation(fromSequenceNumber-1, endSequenceNumber-fromSequenceNumber+1);
+ IASTFileLocation fl= lr.getMappedFileLocation(fromSequenceNumber-1, endSequenceNumber - fromSequenceNumber + 1);
if (fl.getFileName().equals(total.getFileName()) && fl.getNodeOffset() == total.getNodeOffset())
throw new ExpansionOverlapsBoundaryException();
}
if (endSequenceNumber < ((ASTNode) tu).getOffset() + ((ASTNode) tu).getLength()) {
- IASTFileLocation fl= lr.getMappedFileLocation(fromSequenceNumber, nextSequenceNumber-fromSequenceNumber+1);
+ IASTFileLocation fl= lr.getMappedFileLocation(fromSequenceNumber, nextSequenceNumber - fromSequenceNumber + 1);
if (fl.getFileName().equals(total.getFileName()) && fl.getNodeLength() == total.getNodeLength())
throw new ExpansionOverlapsBoundaryException();
}
@@ -345,7 +344,7 @@ public abstract class ASTNode implements IASTNode {
try {
Token result= null;
Token last= null;
- for (;;) {
+ while (true) {
Token t= lex.nextToken();
switch (t.getType()) {
case IToken.tEND_OF_INPUT:
@@ -366,12 +365,12 @@ public abstract class ASTNode implements IASTNode {
}
}
} catch (OffsetLimitReachedException e) {
- // does not happen without using content assist limit
+ // Does not happen without using content assist limit.
}
return null;
}
protected void setCopyLocation(IASTNode originalNode) {
- locations = new IASTNodeLocation[] {new ASTCopyLocation(originalNode)};
+ locations = new IASTNodeLocation[] { new ASTCopyLocation(originalNode) };
}
}
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTLiteralExpression.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTLiteralExpression.java
index 4742eb26e0a..a439bfa8f03 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTLiteralExpression.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTLiteralExpression.java
@@ -51,8 +51,8 @@ public class CPPASTLiteralExpression extends ASTNode implements ICPPASTLiteralEx
@Override
public CPPASTLiteralExpression copy(CopyStyle style) {
- CPPASTLiteralExpression copy = new CPPASTLiteralExpression(kind, value == null ? null
- : value.clone());
+ CPPASTLiteralExpression copy = new CPPASTLiteralExpression(kind,
+ value == null ? null : value.clone());
copy.setOffsetAndLength(this);
if (style == CopyStyle.withLocations) {
copy.setCopyLocation(this);
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/scanner/ASTPreprocessorNode.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/scanner/ASTPreprocessorNode.java
index d438bd47cac..8334909db5f 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/scanner/ASTPreprocessorNode.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/scanner/ASTPreprocessorNode.java
@@ -59,7 +59,7 @@ abstract class ASTPreprocessorNode extends ASTNode {
setParent(parent);
setPropertyInParent(property);
setOffset(startNumber);
- setLength(endNumber-startNumber);
+ setLength(endNumber - startNumber);
}
protected char[] getSource(int offset, int length) {
@@ -597,9 +597,9 @@ class ASTFunctionStyleMacroDefinition extends ASTMacroDefinition implements IAST
}
}
-
class ASTUndef extends ASTPreprocessorNode implements IASTPreprocessorUndefStatement {
private final ASTPreprocessorName fName;
+
public ASTUndef(IASTTranslationUnit parent, char[] name, int startNumber, int nameNumber, int nameEndNumber, IBinding binding, boolean isActive) {
super(parent, IASTTranslationUnit.PREPROCESSOR_STATEMENT, startNumber, nameEndNumber);
fName= new ASTPreprocessorName(this, IASTPreprocessorStatement.MACRO_NAME, nameNumber, nameEndNumber, name, binding);
@@ -686,7 +686,7 @@ class ASTFileLocation implements IASTFileLocation {
@Override
public int getEndingLineNumber() {
- int end= fLength > 0 ? fOffset+fLength-1 : fOffset;
+ int end= fLength > 0 ? fOffset + fLength - 1 : fOffset;
return fLocationCtx.getLineNumber(end);
}
@@ -701,7 +701,7 @@ class ASTFileLocation implements IASTFileLocation {
@Override
public String toString() {
- return getFileName() + "[" + fOffset + "," + (fOffset+fLength) + ")"; //$NON-NLS-1$//$NON-NLS-2$//$NON-NLS-3$
+ return getFileName() + "[" + fOffset + "," + (fOffset + fLength) + "]"; //$NON-NLS-1$//$NON-NLS-2$//$NON-NLS-3$
}
public int getSequenceNumber() {
@@ -709,7 +709,7 @@ class ASTFileLocation implements IASTFileLocation {
}
public int getSequenceEndNumber() {
- return fLocationCtx.getSequenceNumberForOffset(fOffset+fLength, true);
+ return fLocationCtx.getSequenceNumberForOffset(fOffset + fLength, true);
}
public LocationCtxFile getLocationContext() {
@@ -723,7 +723,6 @@ class ASTFileLocation implements IASTFileLocation {
}
class ASTMacroExpansion extends ASTPreprocessorNode implements IASTPreprocessorMacroExpansion {
-
private LocationCtxMacroExpansion fContext;
public ASTMacroExpansion(IASTNode parent, int startNumber, int endNumber) {
@@ -765,7 +764,6 @@ class ASTMacroExpansion extends ASTPreprocessorNode implements IASTPreprocessorM
@SuppressWarnings("deprecation")
class ASTMacroExpansionLocation implements IASTMacroExpansionLocation, org.eclipse.cdt.core.dom.ast.IASTMacroExpansion {
-
private LocationCtxMacroExpansion fContext;
private int fOffset;
private int fLength;
@@ -817,7 +815,7 @@ class ASTMacroExpansionLocation implements IASTMacroExpansionLocation, org.eclip
@Override
public String toString() {
- return fContext.getMacroDefinition().getName().toString() + "[" + fOffset + "," + (fOffset+fLength) + ")"; //$NON-NLS-1$//$NON-NLS-2$//$NON-NLS-3$
+ return fContext.getMacroDefinition().getName().toString() + "[" + fOffset + "," + (fOffset+fLength) + "]"; //$NON-NLS-1$//$NON-NLS-2$//$NON-NLS-3$
}
public IASTImageLocation getImageLocation() {
@@ -872,7 +870,6 @@ class ASTFileLocationForBuiltins implements IASTFileLocation {
}
}
-
class ASTImageLocation extends ASTFileLocationForBuiltins implements IASTImageLocation {
private final int fKind;
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/scanner/LocationCtxMacroExpansion.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/scanner/LocationCtxMacroExpansion.java
index 9e37e56a97f..ad3fe391019 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/scanner/LocationCtxMacroExpansion.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/scanner/LocationCtxMacroExpansion.java
@@ -34,7 +34,7 @@ class LocationCtxMacroExpansion extends LocationCtx {
fLength= length;
fLocationInfos= imageLocations;
fExpansionName= expansionName;
- if (expansionName.getParent() instanceof ASTMacroExpansion == false) {
+ if (!(expansionName.getParent() instanceof ASTMacroExpansion)) {
throw new IllegalArgumentException(expansionName.toString() + " is not a macro expansion name"); //$NON-NLS-1$
}
}
diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/refactoring/extractfunction/ExtractExpression.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/refactoring/extractfunction/ExtractExpression.java
index 0135b5211bb..d7be786dfcf 100644
--- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/refactoring/extractfunction/ExtractExpression.java
+++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/refactoring/extractfunction/ExtractExpression.java
@@ -58,7 +58,7 @@ import org.eclipse.cdt.internal.ui.refactoring.NameInformation;
* @author Mirko Stocker
*/
public class ExtractExpression extends ExtractedFunctionConstructionHelper {
- final static char[] ZERO= { '0' };
+ private final static char[] ZERO= { '0' };
@Override
public void constructMethodBody(IASTCompoundStatement compound, List list,
@@ -74,12 +74,12 @@ public class ExtractExpression extends ExtractedFunctionConstructionHelper {
private IASTExpression getExpression(List list) {
if (list.size() > 1) {
- CPPASTBinaryExpression bExp = new CPPASTBinaryExpression();
- bExp.setParent(list.get(0).getParent());
- bExp.setOperand1((IASTExpression) list.get(0).copy(CopyStyle.withLocations));
- bExp.setOperator(((IASTBinaryExpression) list.get(1).getParent()).getOperator());
- bExp.setOperand2(getExpression(list.subList(1, list.size())));
- return bExp;
+ CPPASTBinaryExpression expression = new CPPASTBinaryExpression();
+ expression.setParent(list.get(0).getParent());
+ expression.setOperand1((IASTExpression) list.get(0).copy(CopyStyle.withLocations));
+ expression.setOperator(((IASTBinaryExpression) list.get(1).getParent()).getOperator());
+ expression.setOperand2(getExpression(list.subList(1, list.size())));
+ return expression;
} else {
return (IASTExpression) list.get(0).copy(CopyStyle.withLocations);
}
diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/refactoring/extractfunction/ExtractStatement.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/refactoring/extractfunction/ExtractStatement.java
index 4839c7379b5..5e3c0fa0cf3 100644
--- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/refactoring/extractfunction/ExtractStatement.java
+++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/refactoring/extractfunction/ExtractStatement.java
@@ -34,9 +34,9 @@ import org.eclipse.cdt.internal.ui.refactoring.utils.ASTHelper;
*/
public class ExtractStatement extends ExtractedFunctionConstructionHelper {
@Override
- public void constructMethodBody(IASTCompoundStatement compound, List list,
+ public void constructMethodBody(IASTCompoundStatement compound, List nodes,
ASTRewrite rewrite, TextEditGroup group) {
- for (IASTNode node : list) {
+ for (IASTNode node : nodes) {
rewrite.insertBefore(compound, null, node, group);
}
}
@@ -48,8 +48,8 @@ public class ExtractStatement extends ExtractedFunctionConstructionHelper {
IASTNode decl = ASTHelper.getDeclarationForNode(returnVariable.getDeclarationName());
return ASTHelper.getDeclarationSpecifier(decl).copy(CopyStyle.withLocations);
}
- IASTDeclSpecifier declSpec = new CPPASTSimpleDeclSpecifier();
- ((IASTSimpleDeclSpecifier) declSpec).setType(IASTSimpleDeclSpecifier.t_void);
+ IASTSimpleDeclSpecifier declSpec = new CPPASTSimpleDeclSpecifier();
+ declSpec.setType(IASTSimpleDeclSpecifier.t_void);
return declSpec.copy(CopyStyle.withLocations);
}
diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/refactoring/togglefunction/ToggleFromInHeaderToImplementationStrategy.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/refactoring/togglefunction/ToggleFromInHeaderToImplementationStrategy.java
index 701396beaaa..ff13a676cd2 100644
--- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/refactoring/togglefunction/ToggleFromInHeaderToImplementationStrategy.java
+++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/refactoring/togglefunction/ToggleFromInHeaderToImplementationStrategy.java
@@ -57,10 +57,10 @@ import org.eclipse.cdt.internal.ui.refactoring.Container;
import org.eclipse.cdt.internal.ui.refactoring.ModificationCollector;
public class ToggleFromInHeaderToImplementationStrategy implements IToggleRefactoringStrategy {
- private IASTTranslationUnit impl_unit;
+ private IASTTranslationUnit implUnit;
private ToggleRefactoringContext context;
private TextEditGroup infoText;
- private ASTLiteralNode includenode;
+ private ASTLiteralNode includeNode;
public ToggleFromInHeaderToImplementationStrategy(final ToggleRefactoringContext context) {
this.infoText = new TextEditGroup(Messages.EditGroupName);
@@ -80,9 +80,9 @@ public class ToggleFromInHeaderToImplementationStrategy implements IToggleRefact
replaceDefinitionWithDeclaration(collector);
}
- ASTRewrite implRewrite = collector.rewriterForTranslationUnit(impl_unit);
- if (includenode != null) {
- implRewrite.insertBefore(impl_unit, null, includenode, infoText);
+ ASTRewrite implRewrite = collector.rewriterForTranslationUnit(implUnit);
+ if (includeNode != null) {
+ implRewrite.insertBefore(implUnit, null, includeNode, infoText);
}
IASTNode insertionParent = null;
@@ -93,11 +93,11 @@ public class ToggleFromInHeaderToImplementationStrategy implements IToggleRefact
insertionParent = searchNamespaceInImplementation(parent.getName());
if (insertionParent == null) {
insertionParent = createNamespace(parent);
- implRewrite = implRewrite.insertBefore(impl_unit.getTranslationUnit(),
+ implRewrite = implRewrite.insertBefore(implUnit.getTranslationUnit(),
null, insertionParent, infoText);
}
} else {
- insertionParent = impl_unit.getTranslationUnit();
+ insertionParent = implUnit.getTranslationUnit();
}
newDefinition.setParent(insertionParent);
@@ -241,13 +241,13 @@ public class ToggleFromInHeaderToImplementationStrategy implements IToggleRefact
}
private boolean newFileCheck() {
- impl_unit = context.getTUForSiblingFile();
- if (impl_unit == null) {
+ implUnit = context.getTUForSiblingFile();
+ if (implUnit == null) {
ToggleFileCreator filecreator = new ToggleFileCreator(context, ".cpp"); //$NON-NLS-1$
if (filecreator.askUserForFileCreation(context)) {
filecreator.createNewFile();
- impl_unit = filecreator.loadTranslationUnit();
- includenode = new ASTLiteralNode(filecreator.getIncludeStatement());
+ implUnit = filecreator.loadTranslationUnit();
+ includeNode = new ASTLiteralNode(filecreator.getIncludeStatement());
return true;
} else {
return false;
@@ -342,7 +342,7 @@ public class ToggleFromInHeaderToImplementationStrategy implements IToggleRefact
private CPPASTNamespaceDefinition createNamespace(ICPPASTNamespaceDefinition parent_namespace) {
CPPASTNamespaceDefinition insertionParent = new CPPASTNamespaceDefinition(
parent_namespace.getName().copy(CopyStyle.withLocations));
- insertionParent.setParent(impl_unit);
+ insertionParent.setParent(implUnit);
return insertionParent;
}
@@ -354,7 +354,7 @@ public class ToggleFromInHeaderToImplementationStrategy implements IToggleRefact
private IASTNode searchNamespaceInImplementation(final IASTName name) {
final Container result = new Container();
- this.impl_unit.accept(new ASTVisitor() {
+ this.implUnit.accept(new ASTVisitor() {
{
shouldVisitNamespaces = true;
}
diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/viewsupport/ProjectTemplateStore.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/viewsupport/ProjectTemplateStore.java
index 393fd8c3600..27b8dac4ee7 100644
--- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/viewsupport/ProjectTemplateStore.java
+++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/viewsupport/ProjectTemplateStore.java
@@ -32,12 +32,11 @@ import org.eclipse.cdt.ui.CUIPlugin;
* @since 5.0
*/
public final class ProjectTemplateStore {
-
private static final String KEY= "org.eclipse.cdt.ui.text.custom_code_templates"; //$NON-NLS-1$
private final TemplateStore fInstanceStore;
private final TemplateStore fProjectStore;
-
+
public ProjectTemplateStore(IProject project) {
fInstanceStore= CUIPlugin.getDefault().getCodeTemplateStore();
if (project == null) {
@@ -57,21 +56,20 @@ public final class ProjectTemplateStore {
internalAdd(data);
}
}
-
+
@Override
public void save() throws IOException {
-
StringWriter output= new StringWriter();
TemplateReaderWriter writer= new TemplateReaderWriter();
writer.save(getTemplateData(false), output);
-
+
projectSettings.setValue(KEY, output.toString());
projectSettings.save();
}
};
}
}
-
+
public static boolean hasProjectSpecificTempates(IProject project) {
String pref= new ProjectScope(project).getNode(CUIPlugin.PLUGIN_ID).get(KEY, null);
if (pref != null && pref.trim().length() > 0) {
@@ -87,29 +85,28 @@ public final class ProjectTemplateStore {
}
return false;
}
-
-
+
public TemplatePersistenceData[] getTemplateData() {
if (fProjectStore != null) {
return fProjectStore.getTemplateData(true);
}
return fInstanceStore.getTemplateData(true);
}
-
+
public Template findTemplateById(String id) {
Template template= null;
if (fProjectStore != null)
template= fProjectStore.findTemplateById(id);
if (template == null)
template= fInstanceStore.findTemplateById(id);
-
+
return template;
}
-
+
public void load() throws IOException {
if (fProjectStore != null) {
fProjectStore.load();
-
+
Set datas= new HashSet();
TemplatePersistenceData[] data= fProjectStore.getTemplateData(false);
for (TemplatePersistenceData element : data) {
@@ -119,7 +116,7 @@ public final class ProjectTemplateStore {
}
datas.add(id);
}
-
+
data= fInstanceStore.getTemplateData(false);
for (TemplatePersistenceData orig : data) {
String origId= orig.getId();
@@ -134,22 +131,21 @@ public final class ProjectTemplateStore {
}
}
}
-
+
public boolean isProjectSpecific(String id) {
if (id == null) {
return false;
}
-
+
if (fProjectStore == null)
return false;
-
+
return fProjectStore.findTemplateById(id) != null;
}
-
-
+
public void setProjectSpecific(String id, boolean projectSpecific) {
Assert.isNotNull(fProjectStore);
-
+
TemplatePersistenceData data= fProjectStore.getTemplateData(id);
if (data == null) {
return; // does not exist
@@ -164,7 +160,7 @@ public final class ProjectTemplateStore {
fProjectStore.restoreDefaults();
}
}
-
+
public void save() throws IOException {
if (fProjectStore == null) {
fInstanceStore.save();
@@ -172,7 +168,7 @@ public final class ProjectTemplateStore {
fProjectStore.save();
}
}
-
+
public void revertChanges() throws IOException {
if (fProjectStore != null) {
// nothing to do