mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-06-08 18:26:01 +02:00
Cosmetics.
This commit is contained in:
parent
60214efa55
commit
0d4d66ec6e
12 changed files with 67 additions and 125 deletions
|
@ -63,13 +63,13 @@ public abstract class ChangeGeneratorTest extends BaseTestFramework {
|
|||
assertTrue("The indexing operation of the test CProject has not finished jet. This should not happen...", joined);
|
||||
|
||||
IASTTranslationUnit unit = CoreModelUtil.findTranslationUnit(testFile).getAST();
|
||||
final ChangeGenerator changegenartor = new ChangeGenerator(modStore,
|
||||
final ChangeGenerator changeGenerator = new ChangeGenerator(modStore,
|
||||
ASTCommenter.getCommentedNodeMap(unit));
|
||||
unit.accept(visitor);
|
||||
|
||||
changegenartor.generateChange(unit);
|
||||
changeGenerator.generateChange(unit);
|
||||
Document doc = new Document(source);
|
||||
for (Change curChange : ((CompositeChange) changegenartor.getChange()).getChildren()) {
|
||||
for (Change curChange : ((CompositeChange) changeGenerator.getChange()).getChildren()) {
|
||||
if (curChange instanceof TextFileChange) {
|
||||
TextFileChange textChange = (TextFileChange) curChange;
|
||||
textChange.getEdit().apply(doc);
|
||||
|
|
|
@ -24,7 +24,7 @@ public interface IName {
|
|||
/**
|
||||
* @since 5.2
|
||||
*/
|
||||
IName[] EMPTY_ARRAY= {};
|
||||
public static final IName[] EMPTY_ARRAY= {};
|
||||
|
||||
/**
|
||||
* Returns the name without qualification and without template arguments.
|
||||
|
|
|
@ -26,7 +26,7 @@ public interface IASTName extends IASTNode, IName {
|
|||
/**
|
||||
* Constant sentinel.
|
||||
*/
|
||||
public static final IASTName[] EMPTY_NAME_ARRAY = new IASTName[0];
|
||||
public static final IASTName[] EMPTY_NAME_ARRAY = {};
|
||||
|
||||
/**
|
||||
* Returns the name including qualification and template arguments.
|
||||
|
|
|
@ -24,7 +24,6 @@ import org.eclipse.cdt.core.parser.IToken;
|
|||
* @noextend This interface is not intended to be extended by clients.
|
||||
*/
|
||||
public interface IASTNode {
|
||||
|
||||
/**
|
||||
* @since 5.3
|
||||
*/
|
||||
|
@ -42,7 +41,7 @@ public interface IASTNode {
|
|||
withLocations
|
||||
}
|
||||
|
||||
public static final IASTNode[] EMPTY_NODE_ARRAY = new IASTNode[0];
|
||||
public static final IASTNode[] EMPTY_NODE_ARRAY = {};
|
||||
|
||||
/**
|
||||
* Get the translation unit (master) node that is the ancestor of all nodes
|
||||
|
|
|
@ -1207,14 +1207,15 @@ public class CVisitor extends ASTQueries {
|
|||
node = node.getParent();
|
||||
}
|
||||
|
||||
if (node instanceof IASTParameterDeclaration)
|
||||
declSpec = ((IASTParameterDeclaration) node).getDeclSpecifier();
|
||||
else if (node instanceof IASTSimpleDeclaration)
|
||||
if (node instanceof IASTSimpleDeclaration) {
|
||||
declSpec = ((IASTSimpleDeclaration) node).getDeclSpecifier();
|
||||
else if (node instanceof IASTFunctionDefinition)
|
||||
} else if (node instanceof IASTParameterDeclaration) {
|
||||
declSpec = ((IASTParameterDeclaration) node).getDeclSpecifier();
|
||||
} else if (node instanceof IASTFunctionDefinition) {
|
||||
declSpec = ((IASTFunctionDefinition) node).getDeclSpecifier();
|
||||
else if (node instanceof IASTTypeId)
|
||||
} else if (node instanceof IASTTypeId) {
|
||||
declSpec = ((IASTTypeId) node).getDeclSpecifier();
|
||||
}
|
||||
|
||||
boolean isParameter = (node instanceof IASTParameterDeclaration || node.getParent() instanceof ICASTKnRFunctionDeclarator);
|
||||
|
||||
|
|
|
@ -18,10 +18,8 @@ import org.eclipse.ltk.core.refactoring.RefactoringChangeDescriptor;
|
|||
|
||||
/**
|
||||
* @author Emanuel Graf IFS
|
||||
*
|
||||
*/
|
||||
public class CCompositeChange extends CompositeChange {
|
||||
|
||||
private RefactoringChangeDescriptor desc;
|
||||
|
||||
public CCompositeChange(String name, Change[] children) {
|
||||
|
@ -38,12 +36,9 @@ public class CCompositeChange extends CompositeChange {
|
|||
|
||||
@Override
|
||||
public ChangeDescriptor getDescriptor() {
|
||||
if(desc == null) {
|
||||
return super.getDescriptor();
|
||||
}else {
|
||||
if (desc != null) {
|
||||
return desc;
|
||||
}
|
||||
return super.getDescriptor();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -22,14 +22,12 @@ import org.eclipse.swt.widgets.Group;
|
|||
import org.eclipse.cdt.internal.ui.refactoring.utils.VisibilityEnum;
|
||||
|
||||
/**
|
||||
* 3 radio buttons in a group, labeled according to the corresponding visibility name (public, private, protected).
|
||||
* Three radio buttons in a group, labeled according to the corresponding visibility name
|
||||
* (public, private, protected).
|
||||
*
|
||||
* @author Thomas Corbat
|
||||
*
|
||||
*/
|
||||
public class VisibilitySelectionPanel extends Composite {
|
||||
|
||||
|
||||
private Button publicAccessRadioButton;
|
||||
private Button protectedAccessRadioButton;
|
||||
private Button privateAccessRadioButton;
|
||||
|
@ -46,11 +44,9 @@ public class VisibilitySelectionPanel extends Composite {
|
|||
|
||||
createAccessModifierComposite(this);
|
||||
setSelected(defaultVisibility);
|
||||
|
||||
}
|
||||
|
||||
private void createAccessModifierComposite(Composite control) {
|
||||
|
||||
accessModifierGroup = new Group(this, SWT.SHADOW_NONE);
|
||||
RowLayout groupLayout = new RowLayout(SWT.HORIZONTAL);
|
||||
groupLayout.fill = true;
|
||||
|
@ -65,7 +61,6 @@ public class VisibilitySelectionPanel extends Composite {
|
|||
|
||||
privateAccessRadioButton = new Button(accessModifierGroup, SWT.RADIO | SWT.LEFT);
|
||||
privateAccessRadioButton.setText(VisibilityEnum.v_private.toString());
|
||||
|
||||
}
|
||||
|
||||
private void setSelected(VisibilityEnum defaultVisibility) {
|
||||
|
@ -94,5 +89,4 @@ public class VisibilitySelectionPanel extends Composite {
|
|||
privateAccessRadioButton.setEnabled(enabled);
|
||||
super.setEnabled(enabled);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -21,16 +21,15 @@ import org.eclipse.cdt.internal.ui.refactoring.utils.NameHelper;
|
|||
|
||||
/**
|
||||
* @author Lukas Felber
|
||||
*
|
||||
*/
|
||||
public class ParameterInfo {
|
||||
private IASTParameterDeclaration parameter;
|
||||
private boolean hasNewName;
|
||||
private String parameterName;
|
||||
|
||||
public ParameterInfo(IASTParameterDeclaration parameter, String parameterName, boolean HasNewName) {
|
||||
public ParameterInfo(IASTParameterDeclaration parameter, String parameterName, boolean hasNewName) {
|
||||
this.parameter = parameter;
|
||||
this.hasNewName = HasNewName;
|
||||
this.hasNewName = hasNewName;
|
||||
this.parameterName = parameterName;
|
||||
}
|
||||
|
||||
|
|
|
@ -78,7 +78,8 @@ public class ASTHelper {
|
|||
return null;
|
||||
}
|
||||
|
||||
public static boolean samePointers(IASTPointerOperator[] pointerOperators1, IASTPointerOperator[] pointerOperators2, TrailNodeEqualityChecker checker) {
|
||||
public static boolean samePointers(IASTPointerOperator[] pointerOperators1,
|
||||
IASTPointerOperator[] pointerOperators2, TrailNodeEqualityChecker checker) {
|
||||
if (pointerOperators2.length == pointerOperators1.length) {
|
||||
for (int i = 0; i < pointerOperators2.length; i++) {
|
||||
IASTPointerOperator operator1 = pointerOperators1[i];
|
||||
|
@ -146,7 +147,8 @@ public class ASTHelper {
|
|||
return specifiers;
|
||||
}
|
||||
|
||||
public static Collection<IASTPreprocessorStatement> getAllInFilePreprocessorStatements(IASTTranslationUnit unit, String aktFileName) {
|
||||
public static Collection<IASTPreprocessorStatement> getAllInFilePreprocessorStatements(
|
||||
IASTTranslationUnit unit, String aktFileName) {
|
||||
Collection<IASTPreprocessorStatement> statements = new ArrayList<IASTPreprocessorStatement>();
|
||||
for (IASTPreprocessorStatement aktStatement : unit.getAllPreprocessorStatements()) {
|
||||
if (aktStatement.getFileLocation() == null) {
|
||||
|
@ -193,29 +195,6 @@ public class ASTHelper {
|
|||
return usingDecls;
|
||||
}
|
||||
|
||||
public static boolean isClassDefinitionName(IASTName name) {
|
||||
try {
|
||||
if(!(name.getParent().getParent().getParent() instanceof IASTFunctionDefinition)) {
|
||||
return false;
|
||||
}
|
||||
ICPPASTQualifiedName qName = (ICPPASTQualifiedName) name.getParent();
|
||||
IASTName secondLastName = qName.getNames()[qName.getNames().length-2];
|
||||
if(!(name.equals(secondLastName))) {
|
||||
return false;
|
||||
}
|
||||
IBinding binding = name.resolveBinding();
|
||||
for(IASTName aktName : name.getTranslationUnit().getDeclarationsInAST(binding)) {
|
||||
if(!isClassDeclarationName(aktName)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
} catch (NullPointerException e) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public static IASTCompositeTypeSpecifier getCompositeTypeSpecifierForName(IASTName name) {
|
||||
IBinding binding = name.resolveBinding();
|
||||
for (IASTName aktName : name.getTranslationUnit().getDefinitionsInAST(binding)) {
|
||||
|
|
|
@ -10,15 +10,14 @@
|
|||
*******************************************************************************/
|
||||
package org.eclipse.cdt.internal.ui.wizards.classwizard;
|
||||
|
||||
import org.eclipse.cdt.core.parser.ast.ASTAccessVisibility;
|
||||
import org.eclipse.cdt.ui.browser.typeinfo.TypeInfoLabelProvider;
|
||||
import org.eclipse.jface.viewers.ILabelProviderListener;
|
||||
import org.eclipse.jface.viewers.ITableLabelProvider;
|
||||
import org.eclipse.swt.graphics.Image;
|
||||
|
||||
import org.eclipse.cdt.core.parser.ast.ASTAccessVisibility;
|
||||
import org.eclipse.cdt.ui.browser.typeinfo.TypeInfoLabelProvider;
|
||||
|
||||
public final class BaseClassesLabelProvider implements ITableLabelProvider {
|
||||
|
||||
private static final String YES_VALUE = NewClassWizardMessages.BaseClassesLabelProvider_boolean_yes_label;
|
||||
private static final String NO_VALUE = NewClassWizardMessages.BaseClassesLabelProvider_boolean_no_label;
|
||||
private static final String ACCESS_PUBLIC = NewClassWizardMessages.BaseClassesLabelProvider_access_public_label;
|
||||
|
@ -70,31 +69,19 @@ public final class BaseClassesLabelProvider implements ITableLabelProvider {
|
|||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* @see IBaseLabelProvider#addListener(ILabelProviderListener)
|
||||
*/
|
||||
@Override
|
||||
public void addListener(ILabelProviderListener listener) {
|
||||
}
|
||||
|
||||
/*
|
||||
* @see IBaseLabelProvider#dispose()
|
||||
*/
|
||||
@Override
|
||||
public void dispose() {
|
||||
}
|
||||
|
||||
/*
|
||||
* @see IBaseLabelProvider#isLabelProperty(Object, String)
|
||||
*/
|
||||
@Override
|
||||
public boolean isLabelProperty(Object element, String property) {
|
||||
return false;
|
||||
}
|
||||
|
||||
/*
|
||||
* @see IBaseLabelProvider#removeListener(ILabelProviderListener)
|
||||
*/
|
||||
@Override
|
||||
public void removeListener(ILabelProviderListener listener) {
|
||||
}
|
||||
|
|
|
@ -33,7 +33,6 @@ import org.eclipse.cdt.internal.ui.wizards.dialogfields.IListAdapter;
|
|||
import org.eclipse.cdt.internal.ui.wizards.dialogfields.ListDialogField;
|
||||
|
||||
public class MethodStubsListDialogField extends CheckedListDialogField<IMethodStub> {
|
||||
|
||||
// column properties
|
||||
private static final String CP_NAME = "name"; //$NON-NLS-1$
|
||||
private static final String CP_ACCESS = "access"; //$NON-NLS-1$
|
||||
|
|
|
@ -65,10 +65,6 @@ public class CheckedListDialogField<T> extends ListDialogField<T> {
|
|||
fUncheckAllButtonIndex= uncheckButtonIndex;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* @see ListDialogField#createTableViewer
|
||||
*/
|
||||
@Override
|
||||
protected TableViewer createTableViewer(Composite parent) {
|
||||
Table table= new Table(parent, SWT.CHECK + getListStyle());
|
||||
|
@ -82,10 +78,6 @@ public class CheckedListDialogField<T> extends ListDialogField<T> {
|
|||
return tableViewer;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* @see ListDialogField#getListControl
|
||||
*/
|
||||
@Override
|
||||
public Control getListControl(Composite parent) {
|
||||
Control control= super.getListControl(parent);
|
||||
|
@ -110,7 +102,7 @@ public class CheckedListDialogField<T> extends ListDialogField<T> {
|
|||
}
|
||||
|
||||
private void checkStateChanged() {
|
||||
//call super and do not update check model
|
||||
// Call super and do not update check model
|
||||
super.dialogFieldChanged();
|
||||
}
|
||||
|
||||
|
@ -196,9 +188,6 @@ public class CheckedListDialogField<T> extends ListDialogField<T> {
|
|||
checkStateChanged();
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.jdt.internal.ui.wizards.dialogfields.ListDialogField#replaceElement(java.lang.Object, java.lang.Object)
|
||||
*/
|
||||
@Override
|
||||
public void replaceElement(T oldElement, T newElement) throws IllegalArgumentException {
|
||||
boolean wasChecked= isChecked(oldElement);
|
||||
|
|
Loading…
Add table
Reference in a new issue