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);
|
assertTrue("The indexing operation of the test CProject has not finished jet. This should not happen...", joined);
|
||||||
|
|
||||||
IASTTranslationUnit unit = CoreModelUtil.findTranslationUnit(testFile).getAST();
|
IASTTranslationUnit unit = CoreModelUtil.findTranslationUnit(testFile).getAST();
|
||||||
final ChangeGenerator changegenartor = new ChangeGenerator(modStore,
|
final ChangeGenerator changeGenerator = new ChangeGenerator(modStore,
|
||||||
ASTCommenter.getCommentedNodeMap(unit));
|
ASTCommenter.getCommentedNodeMap(unit));
|
||||||
unit.accept(visitor);
|
unit.accept(visitor);
|
||||||
|
|
||||||
changegenartor.generateChange(unit);
|
changeGenerator.generateChange(unit);
|
||||||
Document doc = new Document(source);
|
Document doc = new Document(source);
|
||||||
for (Change curChange : ((CompositeChange) changegenartor.getChange()).getChildren()) {
|
for (Change curChange : ((CompositeChange) changeGenerator.getChange()).getChildren()) {
|
||||||
if (curChange instanceof TextFileChange) {
|
if (curChange instanceof TextFileChange) {
|
||||||
TextFileChange textChange = (TextFileChange) curChange;
|
TextFileChange textChange = (TextFileChange) curChange;
|
||||||
textChange.getEdit().apply(doc);
|
textChange.getEdit().apply(doc);
|
||||||
|
|
|
@ -24,7 +24,7 @@ public interface IName {
|
||||||
/**
|
/**
|
||||||
* @since 5.2
|
* @since 5.2
|
||||||
*/
|
*/
|
||||||
IName[] EMPTY_ARRAY= {};
|
public static final IName[] EMPTY_ARRAY= {};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the name without qualification and without template arguments.
|
* Returns the name without qualification and without template arguments.
|
||||||
|
|
|
@ -26,7 +26,7 @@ public interface IASTName extends IASTNode, IName {
|
||||||
/**
|
/**
|
||||||
* Constant sentinel.
|
* 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.
|
* 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.
|
* @noextend This interface is not intended to be extended by clients.
|
||||||
*/
|
*/
|
||||||
public interface IASTNode {
|
public interface IASTNode {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @since 5.3
|
* @since 5.3
|
||||||
*/
|
*/
|
||||||
|
@ -42,7 +41,7 @@ public interface IASTNode {
|
||||||
withLocations
|
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
|
* 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();
|
node = node.getParent();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (node instanceof IASTParameterDeclaration)
|
if (node instanceof IASTSimpleDeclaration) {
|
||||||
declSpec = ((IASTParameterDeclaration) node).getDeclSpecifier();
|
|
||||||
else if (node instanceof IASTSimpleDeclaration)
|
|
||||||
declSpec = ((IASTSimpleDeclaration) node).getDeclSpecifier();
|
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();
|
declSpec = ((IASTFunctionDefinition) node).getDeclSpecifier();
|
||||||
else if (node instanceof IASTTypeId)
|
} else if (node instanceof IASTTypeId) {
|
||||||
declSpec = ((IASTTypeId) node).getDeclSpecifier();
|
declSpec = ((IASTTypeId) node).getDeclSpecifier();
|
||||||
|
}
|
||||||
|
|
||||||
boolean isParameter = (node instanceof IASTParameterDeclaration || node.getParent() instanceof ICASTKnRFunctionDeclarator);
|
boolean isParameter = (node instanceof IASTParameterDeclaration || node.getParent() instanceof ICASTKnRFunctionDeclarator);
|
||||||
|
|
||||||
|
|
|
@ -18,10 +18,8 @@ import org.eclipse.ltk.core.refactoring.RefactoringChangeDescriptor;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Emanuel Graf IFS
|
* @author Emanuel Graf IFS
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
public class CCompositeChange extends CompositeChange {
|
public class CCompositeChange extends CompositeChange {
|
||||||
|
|
||||||
private RefactoringChangeDescriptor desc;
|
private RefactoringChangeDescriptor desc;
|
||||||
|
|
||||||
public CCompositeChange(String name, Change[] children) {
|
public CCompositeChange(String name, Change[] children) {
|
||||||
|
@ -38,12 +36,9 @@ public class CCompositeChange extends CompositeChange {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ChangeDescriptor getDescriptor() {
|
public ChangeDescriptor getDescriptor() {
|
||||||
if(desc == null) {
|
if (desc != null) {
|
||||||
return super.getDescriptor();
|
|
||||||
}else {
|
|
||||||
return desc;
|
return desc;
|
||||||
}
|
}
|
||||||
|
return super.getDescriptor();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,14 +22,12 @@ import org.eclipse.swt.widgets.Group;
|
||||||
import org.eclipse.cdt.internal.ui.refactoring.utils.VisibilityEnum;
|
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
|
* @author Thomas Corbat
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
public class VisibilitySelectionPanel extends Composite {
|
public class VisibilitySelectionPanel extends Composite {
|
||||||
|
|
||||||
|
|
||||||
private Button publicAccessRadioButton;
|
private Button publicAccessRadioButton;
|
||||||
private Button protectedAccessRadioButton;
|
private Button protectedAccessRadioButton;
|
||||||
private Button privateAccessRadioButton;
|
private Button privateAccessRadioButton;
|
||||||
|
@ -46,11 +44,9 @@ public class VisibilitySelectionPanel extends Composite {
|
||||||
|
|
||||||
createAccessModifierComposite(this);
|
createAccessModifierComposite(this);
|
||||||
setSelected(defaultVisibility);
|
setSelected(defaultVisibility);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void createAccessModifierComposite(Composite control) {
|
private void createAccessModifierComposite(Composite control) {
|
||||||
|
|
||||||
accessModifierGroup = new Group(this, SWT.SHADOW_NONE);
|
accessModifierGroup = new Group(this, SWT.SHADOW_NONE);
|
||||||
RowLayout groupLayout = new RowLayout(SWT.HORIZONTAL);
|
RowLayout groupLayout = new RowLayout(SWT.HORIZONTAL);
|
||||||
groupLayout.fill = true;
|
groupLayout.fill = true;
|
||||||
|
@ -65,7 +61,6 @@ public class VisibilitySelectionPanel extends Composite {
|
||||||
|
|
||||||
privateAccessRadioButton = new Button(accessModifierGroup, SWT.RADIO | SWT.LEFT);
|
privateAccessRadioButton = new Button(accessModifierGroup, SWT.RADIO | SWT.LEFT);
|
||||||
privateAccessRadioButton.setText(VisibilityEnum.v_private.toString());
|
privateAccessRadioButton.setText(VisibilityEnum.v_private.toString());
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setSelected(VisibilityEnum defaultVisibility) {
|
private void setSelected(VisibilityEnum defaultVisibility) {
|
||||||
|
@ -94,5 +89,4 @@ public class VisibilitySelectionPanel extends Composite {
|
||||||
privateAccessRadioButton.setEnabled(enabled);
|
privateAccessRadioButton.setEnabled(enabled);
|
||||||
super.setEnabled(enabled);
|
super.setEnabled(enabled);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,16 +21,15 @@ import org.eclipse.cdt.internal.ui.refactoring.utils.NameHelper;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Lukas Felber
|
* @author Lukas Felber
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
public class ParameterInfo {
|
public class ParameterInfo {
|
||||||
private IASTParameterDeclaration parameter;
|
private IASTParameterDeclaration parameter;
|
||||||
private boolean hasNewName;
|
private boolean hasNewName;
|
||||||
private String parameterName;
|
private String parameterName;
|
||||||
|
|
||||||
public ParameterInfo(IASTParameterDeclaration parameter, String parameterName, boolean HasNewName) {
|
public ParameterInfo(IASTParameterDeclaration parameter, String parameterName, boolean hasNewName) {
|
||||||
this.parameter = parameter;
|
this.parameter = parameter;
|
||||||
this.hasNewName = HasNewName;
|
this.hasNewName = hasNewName;
|
||||||
this.parameterName = parameterName;
|
this.parameterName = parameterName;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -78,7 +78,8 @@ public class ASTHelper {
|
||||||
return null;
|
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) {
|
if (pointerOperators2.length == pointerOperators1.length) {
|
||||||
for (int i = 0; i < pointerOperators2.length; i++) {
|
for (int i = 0; i < pointerOperators2.length; i++) {
|
||||||
IASTPointerOperator operator1 = pointerOperators1[i];
|
IASTPointerOperator operator1 = pointerOperators1[i];
|
||||||
|
@ -146,7 +147,8 @@ public class ASTHelper {
|
||||||
return specifiers;
|
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>();
|
Collection<IASTPreprocessorStatement> statements = new ArrayList<IASTPreprocessorStatement>();
|
||||||
for (IASTPreprocessorStatement aktStatement : unit.getAllPreprocessorStatements()) {
|
for (IASTPreprocessorStatement aktStatement : unit.getAllPreprocessorStatements()) {
|
||||||
if (aktStatement.getFileLocation() == null) {
|
if (aktStatement.getFileLocation() == null) {
|
||||||
|
@ -193,29 +195,6 @@ public class ASTHelper {
|
||||||
return usingDecls;
|
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) {
|
public static IASTCompositeTypeSpecifier getCompositeTypeSpecifierForName(IASTName name) {
|
||||||
IBinding binding = name.resolveBinding();
|
IBinding binding = name.resolveBinding();
|
||||||
for (IASTName aktName : name.getTranslationUnit().getDefinitionsInAST(binding)) {
|
for (IASTName aktName : name.getTranslationUnit().getDefinitionsInAST(binding)) {
|
||||||
|
|
|
@ -10,15 +10,14 @@
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.cdt.internal.ui.wizards.classwizard;
|
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.ILabelProviderListener;
|
||||||
import org.eclipse.jface.viewers.ITableLabelProvider;
|
import org.eclipse.jface.viewers.ITableLabelProvider;
|
||||||
import org.eclipse.swt.graphics.Image;
|
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 {
|
public final class BaseClassesLabelProvider implements ITableLabelProvider {
|
||||||
|
|
||||||
private static final String YES_VALUE = NewClassWizardMessages.BaseClassesLabelProvider_boolean_yes_label;
|
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 NO_VALUE = NewClassWizardMessages.BaseClassesLabelProvider_boolean_no_label;
|
||||||
private static final String ACCESS_PUBLIC = NewClassWizardMessages.BaseClassesLabelProvider_access_public_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
|
@Override
|
||||||
public void addListener(ILabelProviderListener listener) {
|
public void addListener(ILabelProviderListener listener) {
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* @see IBaseLabelProvider#dispose()
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public void dispose() {
|
public void dispose() {
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* @see IBaseLabelProvider#isLabelProperty(Object, String)
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isLabelProperty(Object element, String property) {
|
public boolean isLabelProperty(Object element, String property) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* @see IBaseLabelProvider#removeListener(ILabelProviderListener)
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public void removeListener(ILabelProviderListener listener) {
|
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;
|
import org.eclipse.cdt.internal.ui.wizards.dialogfields.ListDialogField;
|
||||||
|
|
||||||
public class MethodStubsListDialogField extends CheckedListDialogField<IMethodStub> {
|
public class MethodStubsListDialogField extends CheckedListDialogField<IMethodStub> {
|
||||||
|
|
||||||
// column properties
|
// column properties
|
||||||
private static final String CP_NAME = "name"; //$NON-NLS-1$
|
private static final String CP_NAME = "name"; //$NON-NLS-1$
|
||||||
private static final String CP_ACCESS = "access"; //$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;
|
fUncheckAllButtonIndex= uncheckButtonIndex;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
* @see ListDialogField#createTableViewer
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
protected TableViewer createTableViewer(Composite parent) {
|
protected TableViewer createTableViewer(Composite parent) {
|
||||||
Table table= new Table(parent, SWT.CHECK + getListStyle());
|
Table table= new Table(parent, SWT.CHECK + getListStyle());
|
||||||
|
@ -82,10 +78,6 @@ public class CheckedListDialogField<T> extends ListDialogField<T> {
|
||||||
return tableViewer;
|
return tableViewer;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
* @see ListDialogField#getListControl
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public Control getListControl(Composite parent) {
|
public Control getListControl(Composite parent) {
|
||||||
Control control= super.getListControl(parent);
|
Control control= super.getListControl(parent);
|
||||||
|
@ -110,7 +102,7 @@ public class CheckedListDialogField<T> extends ListDialogField<T> {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void checkStateChanged() {
|
private void checkStateChanged() {
|
||||||
//call super and do not update check model
|
// Call super and do not update check model
|
||||||
super.dialogFieldChanged();
|
super.dialogFieldChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -196,9 +188,6 @@ public class CheckedListDialogField<T> extends ListDialogField<T> {
|
||||||
checkStateChanged();
|
checkStateChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.jdt.internal.ui.wizards.dialogfields.ListDialogField#replaceElement(java.lang.Object, java.lang.Object)
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public void replaceElement(T oldElement, T newElement) throws IllegalArgumentException {
|
public void replaceElement(T oldElement, T newElement) throws IllegalArgumentException {
|
||||||
boolean wasChecked= isChecked(oldElement);
|
boolean wasChecked= isChecked(oldElement);
|
||||||
|
|
Loading…
Add table
Reference in a new issue